Last active
October 8, 2018 19:20
-
-
Save danielpataki/3b43561f87a3bbb9d33fc8191cc2864f to your computer and use it in GitHub Desktop.
WP-CLI
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wp @all plugin update-all |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 [email protected] --skip-email |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wp option get siteurl | |
wp option update siteurl http://newlocation.com |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@prod: | |
ssh: [email protected]:41341~/public | |
@dev: | |
ssh: [email protected]/srv/www/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mkdir test && cd test | |
wp core download |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 ); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
db=${folder//-/}
title=${folder//-/ }
"//-/" What are they used for?