Configuration

MigrateWP has one config file. Describe each site once, and you never type a path again.

Where the config lives

migratewp.conf sits in the same folder as migratewp.sh, and the script sources it at the start of a run. It is a Bash file containing a single case statement keyed on the site name you type on the command line.

Settings

SettingScopeWhat it is
logUserName Global Your name, used to label entries in the migration changelog so a team can see who moved what.
sshUser Per site The SSH user and host for the remote server, in user@host form, e.g. username@8.8.8.8. The user needs permissions over the folder holding the WordPress installation. On Plesk this is the system user for the webspace.
remoteURL Per site The live site's domain, e.g. example.com. Used as one half of the WP-CLI search and replace.
remotePath Per site Absolute path to wp-content on the server, e.g. /var/www/vhosts/example.com/httpdocs/wp-content/.
localURL Per site The domain your Local site answers on, e.g. example.local.
localPath Per site Absolute path to wp-content on your Mac, e.g. /Users/Scott/Local Sites/example/app/public/wp-content/.

Trailing slashes are handled for you. If remotePath or localPath is missing its trailing slash, MigrateWP adds one before running rsync.

Adding a site

Copy an existing block, change the name and the six values, and keep it above the *) fallback:

    clientsite)
        sshUser="clientsite@203.0.113.10"

        remoteURL="clientsite.co.uk"
        remotePath="/var/www/vhosts/clientsite.co.uk/httpdocs/wp-content/"
        localURL="clientsite.local"
        localPath="/Users/Scott/Local Sites/clientsite/app/public/wp-content/"

    ;;

From then on the site is addressed by that name:

$ mwp push clientsite
$ mwp pull clientsite
$ mwp report clientsite

Paths with spaces

Local's default site folder lives under ~/Local Sites/, which contains a space. Keep the value in double quotes exactly as the sample config does and MigrateWP handles it correctly.

Keeping the config out of version control

migratewp.conf holds server addresses and usernames for every site you manage. If you keep your copy of MigrateWP in a repository, add the config to .gitignore and keep the sample file as the thing that gets committed.

# .gitignore
migratewp.conf
mwp.log