Problem/Motivation
If a sub-workspaces gets merged into parent workspace and the content gets published, one would assume that removing the workspaces does not delete the content
Steps to reproduce
Create a page in a subworkspaces of stage
Merge the workspaces into stage
Publish content from stage
Remove the subworkspace
Observe the page being deleted
Proposed resolution
Not sure what the fix would be.
I've tracked down and the issue started appearing after this change:
https://www.drupal.org/project/wse/issues/3494770
But digging into the DB, I see some weird thing that maybe it is a bug in workspace?
After publishing, you get in DB 2 revision_default. One for original workspaces and one for NULL.
select * from node_revision;
+-----+-----+----------+--------------+--------------------+--------------+------------------+---------------+
| nid | vid | langcode | revision_uid | revision_timestamp | revision_log | revision_default | workspace |
+-----+-----+----------+--------------+--------------------+--------------+------------------+---------------+
| 1 | 1 | en | 1 | 1753956167 | NULL | 1 | sub_sub_stage |
| 1 | 2 | en | 1 | 1753956167 | NULL | 1 | NULL |
+-----+-----+----------+--------------+--------------------+--------------+------------------+---------------+
This is causing the WSE getAssociatedInitialRevisions function to return a revision when this is called in WorkspaceManager::purgeDeletedWorkspacesBatch
where in a comment it says:
// If the workspace is tracking the entity's default revision (i.e. the
// entity was created inside that workspace), we need to delete the
// whole entity after all of its pending revisions are gone.
OR am I missing the point and one should never remove a workspaces, even if content is merged and publihsed?
Issue fork wse-3539055
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
amateescu commentedThis was recently fixed in #3538305: Deleting a workspace may lead to live data deletion, you'll need to update to the latest dev version :)
Comment #3
dragos-dumi commentedChecked that fix already, but that refers only to closed workspaces deletion. a workspaces that is merged to parent, does not get closed, so the content loss still happens.
Comment #4
amateescu commentedThat's right.. I'll see what we can do about it.
Comment #7
amateescu commentedThis should be fixed properly after some upcoming changes in Drupal 11.3, but in the meantime the quickest fix is to not purge any data when deleting sub-workspaces. Thanks for reporting this!