Created
November 17, 2018 10:10
-
-
Save spicecadet/71d65fab0480812bc66b09b69d056253 to your computer and use it in GitHub Desktop.
WP-CLI Get Production DB
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/bash | |
#get siteurl option from prod and dev | |
PROD_SITEURL=$(wp @prod option get siteurl); | |
DEV_SITEURL=$(wp @dev option get siteurl); | |
#Export database from prod and import to dev | |
wp @prod db export - > prod.sql | |
wp @dev db import /srv/www/edmund/prod.sql | |
#Update siteurl | |
wp @dev search-replace $PROD_SITEURL $DEV_SITEURL | |
#Remove .sql file | |
rm prod.sql |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment