WP-CLI plugins for syncing WordPress databases, media and plugins.
wp package install firstname.lastname@example.org:thegallagher/wpsyncz.git
Copy wpsyncz.php to your
WPSyncz needs to be installed on any remote servers before it can be used.
You can do this globally on the remote server (once you’ve configured your aliases, see Configuration below):
wp <alias> package install email@example.com:thegallagher/wpsyncz.git # eg: wp @production package install firstname.lastname@example.org:thegallagher/wpsyncz.git
Additionally there is a command built in to do a “local” install on the remote server.
wp syncz install <alias> # eg: wp syncz install @production
WPSyncz works with WP-CLI aliases.
The easiest way to configure this is to add
wp-cli.local.yml to your WordPress root.
@production: ssh: email@example.com/var/www/sites/production @staging: ssh: firstname.lastname@example.org/var/www/sites/staging
Only aliases with the
ssh key set will work at this stage. This means alias groups don’t work.
@local alias is defined, this will be the install you will be “pushing” from and “pulling” to.
@local is also used internally to refer to the local install if it is not defined.
# Pull data from a remote server wp syncz pull <source> [<actions>...] [--yes] # eg: wp syncz pull @production # eg: wp syncz pull @staging db media # Push data to a remote server wp syncz push <destination> [<actions>...] [--yes] # eg: wp syncz push @production # eg: wp syncz push @staging plugins # Sync between 2 remote servers wp syncz remote <source> <destination> [<actions>...] [--yes] #eg: wp syncz remote @production @staging # Install WPSyncz on a remote server wp syncz install [<destination>] [--yes] # Used internaly to get data used for syncing wp syncz data <source> [<actions>...] # eg: wp syncz data @local