sync
: Sync data from a remote website
The sync command downloads a database dump and/or uploads from an existing website, overwriting your local copy as a convenient means of updating it.
This is one-way sync so there's no risk of altering the remote website.
The command requires an SSH connection to the remote website.
Usage
The plain command only applies plugin overrides.
wp eighteen73 sync
Database mode downloads a fresh copy of the remote database and applies plugin overrides.
wp eighteen73 sync --database
Downloads a fresh copy of uploads directory and applies plugin overrides.
wp eighteen73 sync --uploads
All of the above.
wp eighteen73 sync --database --uploads
Config
INFO
This same configuration is shared by the first-sync
and sync
so adding it once covers both commands.
Nebula/Bedrock websites
This config does not store any especially sensitive login credentials so it may be beneficial to add configuration to config/environments/development.php
and commit to your repo for the benefit of other developers working on the project.
If you would rather not share your config, or you need to override any committed shared configuration, you can also add it to you personal .env
file.
Config::define( 'EIGHTEEN73_SSH_HOST', 'website.example.com' );
Config::define( 'EIGHTEEN73_SSH_USER', 'username' );
Config::define( 'EIGHTEEN73_SSH_PATH', '/path/to/remote/website' );
// Optional, if the SSH port is not 22
Config::define( 'EIGHTEEN73_SSH_PORT', 123 );
// Optional, to automatically activate/deactivate plugins on sync
Config::define( 'EIGHTEEN73_SYNC_ACTIVATE_PLUGINS', 'plugin1,plugin2' );
Config::define( 'EIGHTEEN73_SYNC_DEACTIVATE_PLUGINS', 'plugin3' );
EIGHTEEN73_SSH_HOST=website.example.com
EIGHTEEN73_SSH_USER=username
EIGHTEEN73_SSH_PATH=/path/to/remote/website
# Optional, if the SSH port is not 22
EIGHTEEN73_SSH_PORT=123
# Optional, to automatically activate/deactivate plugins on sync
EIGHTEEN73_SYNC_ACTIVATE_PLUGINS=plugin1,plugin2
EIGHTEEN73_SYNC_DEACTIVATE_PLUGINS=plugin3
Default WordPress
On websites without the above files, you will need to add config to the website's wp-config.php
file. This is only for use on non-Nebula/Bedrock websites.
define( 'EIGHTEEN73_SSH_HOST', 'website.example.com' );
define( 'EIGHTEEN73_SSH_USER', 'username' );
define( 'EIGHTEEN73_SSH_PATH', '/path/to/remote/website' );
// Optional, if the SSH port is not 22
define( 'EIGHTEEN73_SSH_PORT', '123' );
// Optional, to automatically activate/deactivate plugins on sync
define( 'EIGHTEEN73_SYNC_ACTIVATE_PLUGINS', 'plugin1,plugin2' );
define( 'EIGHTEEN73_SYNC_DEACTIVATE_PLUGINS', 'plugin3' );