It would be amazing if Replication provided base classes for replicators to fire events before, during, and after a replication. Because replications are potentially heavily stateful, I think this use the Symfony event dispatcher system. At the very least, there should be pre- and post-replication events, and a single class to store the source and target workspaces, plus the current status of the replication.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

phenaproxima created an issue. See original summary.

phenaproxima’s picture

Here's a patch that implements the things I described in the IS.

josephdpurcell’s picture

Status: Needs review » Needs work

This looks good! Do you think a ReplicationEvent subscriber would want to know if any filters were used or what filter parameters were sent?

For this reason, I think the ReplicationTask should be added as well. Also consider that if we were more closely following the CouchDB pattern the ReplicationTask would even include the source and target Workspaces, so the task object should be considered as important as the source/target workspace.

timmillwood’s picture

Even though this event has not been committed to Replication module it's already being fired in Workspace module in \Drupal\workspace\ReplicatorManager::doReplication.

I'm wondering if this is the best place to fire the event.

At the end of a replication a ReplicationLog entity should be created / updated, I wonder if this would be a better place to fire the event?

timmillwood’s picture

@phenaproxima - Do you still have a need for this?

If not, maybe we can close and remove all the related code from Workspace module.

phenaproxima’s picture

I do not, as Lightning will not support preview/workspace functionality until it's in core :) Let's close this.

timmillwood’s picture

Status: Needs work » Reviewed & tested by the community

We've got to the position where we need events, therefore I'm going to commit this "as is" then open a follow up if we need to iterate.

timmillwood’s picture

Status: Reviewed & tested by the community » Fixed

  • timmillwood committed 1126e2b on 8.x-1.x
    Revert "Issue #2814055 by phenaproxima: Allow modules to react to...
timmillwood’s picture

I've actually decided to revert this because I think the event should handle workspace pointers, which aren't added until the workspace module. So will move it there with #2971926: Better dispatch events.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.