Last active
February 7, 2017 11:07
-
-
Save woraperth/3d2a4b4849dd6e4d2c7c 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
# ---- DB Search-Replace and Backup Script ---- | |
# Note: This requires WP-CLI to be installed http://wp-cli.org/ | |
# | |
# This will generate new SQL file for import to new URL | |
# 1. Old DB - for Backup purpose (old URL): backup-yymm.sql | |
# 2. Replaced DB - ready for deploy (new URL): replaced-yymm.sql | |
# | |
# Replace aaa.com to bbb.com in the script below | |
# | |
# Note: Sometimes you need to change permission with | |
# chmod 755 searchreplace.sh | |
# before running this file | |
# | |
# How to run: ./searchreplace.sh | |
# | |
wp db export "backup-$(date +%d%m).sql" | |
wp search-replace aaa.com bbb.com | |
wp db export "replaced-$(date +%d%m).sql" | |
echo y | wp db reset | |
wp db import "backup-$(date +%d%m).sql" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment