Skip to content

Instantly share code, notes, and snippets.

@danielpataki
Last active October 8, 2018 19:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save danielpataki/3b43561f87a3bbb9d33fc8191cc2864f to your computer and use it in GitHub Desktop.
Save danielpataki/3b43561f87a3bbb9d33fc8191cc2864f to your computer and use it in GitHub Desktop.
WP-CLI
wp @all plugin update-all
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
php wp-cli.phar --info
chmod +x wp-cli.phar
sudo mv wp-cli.phar /usr/local/bin/wp
# Read folder from params
folder=$1
# Derive required variables
db=${folder//-/_}
url="http://"$folder
title=${folder//-/ }
# Colors used
cRed="\e[31m"
cWhite="\e[37m"
cYellow="\e[33m"
if [[ ! $folder ]]; then
echo -e $cRed"You must specify a folder to add"$cWhite
exit
fi
# Change to given directrory
cd $folder;
echo -e $cYellow"installing and configuring now..."$cWhite
rm -rf *
wp core download
wp core config --dbuser=vagrant --dbpass=vagrant --dbname=$db --extra-php <<PHP
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'SAVEQUERIES', true );
PHP
wp db drop --yes
wp db create
wp core install --url=$url --title="$title" --admin_user=danielpataki --admin_password=danielpataki --admin_email=me@danielpataki.com --skip-email
wp option get siteurl
wp option update siteurl http://newlocation.com
wp search-replace http://danielpataki.com https://danielpataki.com
# Perform a test run only and show results
wp search-replace --dry-run http://danielpataki.com https://danielpataki.com
@prod:
ssh: danielpataki@123.12.12.123:41341~/public
@dev:
ssh: vagrant@192.168.1.11/srv/www/
mkdir test && cd test
wp core download
# Global parameter defaults
color: false
prompt: true
disabled_commands:
- db drop
core config:
dbuser: root
dbpass:
extra-php: |
define( 'WP_DEBUG', true );
define( 'WP_POST_REVISIONS', false );
define( 'EMPTY_TRASH_DAYS', 0 );
define( 'SAVEQUERIES', true );
define( 'CONCATENATE_SCRIPTS', false );
@tricarte
Copy link

db=${folder//-/}
title=${folder//-/ }
"//-/
" What are they used for?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment