Problem/Motivation

This came up as a review point in #2784921-110: Add Workspaces experimental module.16:

+++ b/core/modules/workspace/src/Plugin/RepositoryHandler/LocalWorkspaceRepositoryHandler.php
@@ -0,0 +1,269 @@
+
+    // Only switch to the target workspace and save entities if there are some
+    // to save.
+    if (!empty($entities)) {
+      // Before saving set the active workspace to the target.
+      $this->workspaceManager->setActiveWorkspace($target_workspace);
+      // Save each revision on the target workspace.
+      foreach ($entities as $entity) {
+        $entity->save();
+      }
+    }

This should happen in a transaction so we can roll back if any of the entity saves fail. Additionally there currently appears to be no protection for saving items in a workspace over more recently updated entities on live - that could happen either via a pre-deploy audit or when saving but seems like we need one or the other?

Note that the second part of the comment was already fixed in #2938626: Do not allow concurrent edits in different workspaces.

Proposed resolution

Do it.

Remaining tasks

User interface changes

API changes

Data model changes

CommentFileSizeAuthor
#2 2940241.patch4.06 KBamateescu
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

amateescu created an issue. See original summary.

amateescu’s picture

Status: Active » Needs review
FileSize
4.06 KB

Nothing that could fail here I think.

amateescu’s picture

Title: Wrap workspace pushes in a transaction » Wrap workspace deployments in a single database transaction

Slightly better title.

  • amateescu committed 427351d on 8.x-2.x
    Issue #2940241 by amateescu: Wrap workspace deployments in a single...
amateescu’s picture

Status: Needs review » Fixed

And committed!

Status: Fixed » Closed (fixed)

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