2017 © Pedro Peláez
 

wp-cli-package wp-cli-migrate-command

WP-CLI command to transfer a database or uploads from one connection to another.

image

dword-design/wp-cli-migrate-command

WP-CLI command to transfer a database or uploads from one connection to another.

  • Monday, June 5, 2017
  • by Dword
  • Repository
  • 1 Watchers
  • 0 Stars
  • 2 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

WP-CLI Migrate Command

This command allows to migrate databases and upload directories across wordpress installations. URL replacements can be configured., (*1)

Installation

Since the package index of WP-CLI is currently on hold, the package has to be installed by hand:, (*2)

$ cd ~/.wp-cli/packages/
$ composer require dword-design/wp-cli-migrate-command

Usage

Configure your database connections in wp-cli.yml:, (*3)

databases:
  @local:
    host: localhost
    database: local_db_name
    user: local_db_user
    password: local_db_password
    domain-prefix: '//webiste.dev'

  @live:
    host: myserver.de
    database: live_db_name
    user: live_db_user
    password: live_db_password
    domain-prefix: '//www.website.de'

  ...

For upload migration, configure your SSH aliases in wp-cli.yml:, (*4)

@live:
  ssh: user@myserver.de
  path: www

Note that no entry is needed for local connections. In this case, the current directory is taken., (*5)

Lastly, if the upload directories differ from wp-content/uploads, configure them for each SSH alias:, (*6)

uploads:
  @local: 'some/special/dir'
  @live: 'another/special/dir'

If there is no corresponding SSH alias, the uploads folder is assumbed to be relative to the current directory., (*7)

Execute the migrate command:, (*8)

$ wp migrate <db|up> @sourceAlias @targetAlias

wp migrate db @sourceAlias @targetAlias migrates the database from a source database to a target database. Occurrence of the domain-prefix are replaced. Beware that the database is dropped and recreated on the target system., (*9)

wp migrate up @sourceAlias @targetAlias migrates the uploads folder via rsync. Beware that files are deleted on the target system that do not exist on the source system., (*10)

wp migrate @sourceAlias @targetAlias executes both tasks., (*11)

The Versions

05/06 2017

dev-master

9999999-dev https://github.com/dword-design/wp-cli-migrate-command

WP-CLI command to transfer a database or uploads from one connection to another.

  Sources   Download

MIT