Created
May 6, 2022 08:02
-
-
Save alanef/1b4e1d536d4e18fa43180dfac79f8d1c to your computer and use it in GitHub Desktop.
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
| #!/bin/bash -xv | |
| # parse the current directory name | |
| currentdirectory=${PWD##*/} | |
| # get env variables | |
| export $(grep -v '^#' .env | xargs) | |
| ssh ${LIVE_USER}@${LIVE_DOMAIN} "cd /home/${LIVE_DIR};wp db export --add-drop-table db.sql" | |
| rsync -ar -progress -e 'ssh ' ${LIVE_USER}@${LIVE_DOMAIN}:/home/${LIVE_DIR}/ . --delete --force --exclude wp-config.php --exclude .htaccess --exclude robots.txt --exclude .env --exclude *.zip | |
| docker exec --user 1000:33 -i ${currentdirectory}_php_1 wp db import db.sql | |
| rm db.sql | |
| ssh ${LIVE_USER}@${LIVE_DOMAIN} "cd /home/${LIVE_DIR};rm db.sql" | |
| docker exec --user 1000:33 -i ${currentdirectory}_php_1 wp search-replace --all-tables --precise --report=false "http://${LIVE_DOMAIN}" "https://localhost:${PORT}" | |
| docker exec --user 1000:33 -i ${currentdirectory}_php_1 wp search-replace --all-tables --precise --report=false "http://www.${LIVE_DOMAIN}" "https://localhost:${PORT}" | |
| docker exec --user 1000:33 -i ${currentdirectory}_php_1 wp search-replace --all-tables --precise --report=false "https://${LIVE_DOMAIN}" "http://localhost:${PORT}" | |
| docker exec --user 1000:33 -i ${currentdirectory}_php_1 wp search-replace --all-tables --precise --report=false "https://www.${LIVE_DOMAIN}" "http://localhost:${PORT}" | |
| docker exec --user 1000:33 -i ${currentdirectory}_php_1 wp plugin deactivate wordfence litespeed-cache |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment