diff --git a/src/ReplicatorManager.php b/src/ReplicatorManager.php index 2adbeef..273407b 100644 --- a/src/ReplicatorManager.php +++ b/src/ReplicatorManager.php @@ -64,7 +64,7 @@ class ReplicatorManager implements ReplicatorInterface { $initial_conflicts = $this->conflictTracker->getAll(); // Derive a replication task from the target Workspace for pulling. - $pull_task = $this->getTask($source->getWorkspace(), 'pull_replication_settings'); + $pull_task = $this->getTask($target->getWorkspace(), 'pull_replication_settings'); // Pull in changes from $target to $source to ensure a merge will complete. $this->update($target, $source, $pull_task); @@ -72,9 +72,12 @@ class ReplicatorManager implements ReplicatorInterface { // @todo use $post_conflicts in a conflict management workflow $post_conflicts = $this->conflictTracker->getAll(); + // Automatically derive settings from the workspace if no task sent. + // @todo Refactor to eliminate obscurity of having an optional parameter + // and automatically setting the parameter's value. if ($task === NULL) { - // Derive a replication task from the source Workspace for pushing. - $task = $this->getTask($source->getWorkspace(), 'push_replication_settings'); + // Derive a replication task from the target Workspace for pushing. + $task = $this->getTask($target->getWorkspace(), 'push_replication_settings'); } // Push changes from $source to $target. @@ -120,6 +123,9 @@ class ReplicatorManager implements ReplicatorInterface { /** * Update the target using the source before doing a replication. * + * This is used primarily as a public facing method by the UpdateForm. It + * avoids the additional logic found in the replicate method. + * * @param \Drupal\workspace\WorkspacePointerInterface $target * The workspace to replicate to. * @param \Drupal\workspace\WorkspacePointerInterface $source