dev-scripts/tools/wordpress/export-wp-content-db.sh

21 lines
684 B
Bash
Raw Normal View History

2020-09-09 09:33:51 +00:00
#!/bin/sh
remote_domain='some.cloudwaysapps.com'
remote_ssh='user@some.cloudwaysapps.com'
remote_wp_path='/home/some.cloudwaysapps.com/aabbccddee/public_html'
local_domain='example.local'
local_wp_path='/var/www/html/wordpress'
rsync -azP wp-content/ "$remote_ssh:$remote_wp_path/wp-content" --delete-before
echo "DB size before:"
wp db size --ssh="$remote_ssh$remote_wp_path"
wp db export --path="$local_wp_path" --add-drop-table - | wp db import --ssh="$remote_ssh$remote_wp_path" -
echo "DB size after:"
wp db size --ssh="$remote_ssh$remote_wp_path"
wp search-replace "$local_domain" "$remote_domain" \
--ssh="$remote_ssh$remote_wp_path" \
--skip-columns=guid