Last active
October 8, 2015 23:48
-
-
Save DArcMattr/3406732 to your computer and use it in GitHub Desktop.
WordPress development install sync script
This file contains 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
#!/bin/sh | |
# Assumptions: | |
# 1) The machine environment variable is set, WEB_ENVIRONMENT, either 'test' or 'demo' | |
# 2) The development site URL is $WEB_ENVIRONMENT.$SITE | |
# 3) The following 3 lines are in wp-config.php | |
# if ( isset( $_GET[ 'relocate' ] ) && ( $_GET[ 'relocate' ] === $_ENV[ 'WEB_ENVIRONMENT' ] ) ): | |
# define( 'RELOCATE', TRUE ); | |
# endif; | |
# 4) https://github.com/interconnectit/Search-Replace-DB is installed, with `replace_db` symlinked to `searchreplacedb2cli.php` | |
SITE="AAAA" | |
DB="BBBB" | |
ssh XXXX@YYYY.ZZZ "mysqldump -C --database $DB" | mysql | |
replace_db -h localhost -u {wp db user} -d $db -p {wp db user password} -c {db character set} -s "http://$site" -r "http://$WEB_ENVIRONMENT.$site" | |
curl http://$WEB_ENVIRONMENT.$SITE/wp-login.php?relocate=$WEB_ENVIRONMENT | |
rsync -rv cor:/var/www/vhosts/$SITE/wp-content/uploads/* /var/www/vhosts/$SITE/wp-content/uploads/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment