Last active
June 12, 2017 03:10
-
-
Save davemac/8194c0ce358b01b3f93bee7b2d3fd13c to your computer and use it in GitHub Desktop.
WP Engine bash migration script https://anchor.host/2017/06/06/migrating-from-wp-engine-to-kinsta/
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
function anchor_prep { | |
mkdir ~/scripts | |
read -p $'\e[31mDatabase name\e[0m: ' dbname | |
read -p $'\e[31mDatabase password\e[0m: ' dbpw | |
echo -e "dbpw=$dbpw\ndbuser=$dbname\ndbname=$dbname\nmysqldump --user=\$dbuser --password=\$dbpw --no-create-db --databases \$dbname > ~/public/wp-content/mysql.sql" > ~/scripts/db_backup.sh | |
chmod +x ~/scripts/db_backup.sh | |
mkdir ~/downloads | |
cd ~/downloads | |
read -p $'\e[31mWP Engine download link\e[0m: ' downloadlink | |
wget $downloadlink | |
filename=`ls site-*` | |
unzip $filename | |
rm -f $filename | |
rm -rf ~/public/wp-content/ # Removes current wp-content | |
mv ~/downloads/wp-content/ ~/public/wp-content/ # Restore wp-content from snapshot | |
rm -rf ~/public/wp-content/mu-plugins | |
rm -f ~/public/wp-content/advanced-cache.php | |
rm -f ~/public/wp-content/object-cache.php | |
cd ~/public/ | |
find . -type d -exec chmod 755 {} \; | |
find . -type f -exec chmod 644 {} \; | |
~/scripts/db_backup.sh | |
chmod 600 ~/public/wp-content/mysql.sql | |
} | |
anchor_prep |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment