Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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

This comment has been minimized.

Copy link

tricarte commented May 29, 2018

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
You can’t perform that action at this time.