Download the PHP package cullylarson/wp-deploy-database-sync without Composer

On this page you can find all versions of the php package cullylarson/wp-deploy-database-sync. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package wp-deploy-database-sync

Wordpress Deploy DatabaseSync

A library for syncing Wordpress databases. Supports syncs to and from local and remote machines, and even remote to remote syncs. Useful as part of a deployment system.

This project is meant to be a composable component. It does one thing, sync Wordpress databases. If you want to do more, as part of a deployment strategy, then check out the other projects in the Wordpress\Deploy namespace.

Sync's are performed using an SSH connection, not via a remote mysql command connection. So, the connection remains secure, and you don't have to open up the database port to the world.

Dependencies

Install

Usage

You'll do everything using the Wordpress\Deploy\DatabaseSync::sync function.

Constructor Options

The Wordpress\Deploy\DatabaseSync constructor takes an array of options. The options you provide will depend on the type of sync you want to perform (i.e. local to local, local to remote, remote to local, or remote to remote). If you were to provide all of the options, it would look like this:

The definition of these options is as follows:

Sync

The sync itself is performed by the Wordpress\Deploy\DatabaseSync::sync function. When this function is called, the following will happen:

  1. The database is dumped to a file in the tmp folder on the source machine.
  2. The dump file is copied to the tmp folder on the destination. If this is a remote to remote sync, then the following extra steps are taken:
    1. The dump file is copied from the source machine to the local machine's local_tmp folder.
    2. The dump file is copied from the local machine to the destination machine.
    3. The dump file is removed from the local machine.
  3. The dump file is removed from the source, unless the keep_dump option is set to true in the source machine options.
  4. The dump file is imported into the destination machine's database. NOTE: This will completely overwrite the destination database.
  5. The dump file is removed from the destination machine, unless the keep_dump option is set to true on the dest machine options.
  6. If the search_replace option is provided, then the text from each key in this array will be replaced with the text from the corresponding value in the array. E.g.:

Since the transfer is done using the mysqldump and mysql commands on the source and dest machines, no remote mysql command connection is made. Everything is done over SSH.

The Wordpress\Deploy\DatabaseSync::sync function can optionally accept a callback function. This callback will be called whenever the sync function wants to post a status update (e.g. "I'm running", "Here's the output of the rsync command", "Something went wrong", etc.). It allows you to have some control over whether and how messages are handled.

The callback must take one parameter, an instance of Wordpress\Deploy\DatabaseSync\Status. An example is below.

Examples

Create SSH Connections

The following code could be used to create SSH connections for some of the examples below:

NOTE: If you're using RSA for the examples below, and you get an auth error, you might need to run this command:

$ eval `ssh-agent -s` && ssh-add

Local to Local Sync

Local to Remote Sync

Remote to Local

Remote to Remote

Status Callback

You can provide a callback function to sync and get status messsages (e.g "Dumping the database", "Transferring the file", etc.). Here's an example:


All versions of wp-deploy-database-sync with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
cullylarson/ssh-commands Version ~1.0
cullylarson/local-commands Version ~1.0
cullylarson/ssh-copy Version ~1.0
interconnectit/search-replace-db Version ~3.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package cullylarson/wp-deploy-database-sync contains the following files

Loading the files please wait ....