function drush_replication_start in Replication 8.2
Same name and namespace in other branches
- 8 replication.drush.inc \drush_replication_start()
Implements drush_hook_COMMAND().
File
- ./
replication.drush.inc, line 144 - Drush integration for the replication module.
Code
function drush_replication_start($source, $target) {
try {
$source_client = replication_client_factory($source);
$target_client = replication_client_factory($target);
// Create the replication task.
$task = new ReplicationTask();
// Create the replication.
$replication = new Replication($source_client, $target_client, $task);
// Generate and set a replication ID.
$replication->task
->setRepId($replication
->generateReplicationId());
// Start the replication.
$replicationResult = $replication
->start();
return $replicationResult;
} catch (\Exception $e) {
drush_set_error($e
->getMessage());
}
}