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

22 lines
689 B
Bash
Executable File

#!/bin/sh
. ./config
rsync -azP "$local_wp_path/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_protocol://$local_domain" "$remote_protocol://$remote_domain" \
--ssh="$remote_ssh$remote_wp_path" \
--skip-columns=guid
--quiet
wp search-replace "$local_domain" "$remote_domain" \
--ssh="$remote_ssh$remote_wp_path" \
--skip-columns=guid
--quiet