Commit fbdfea58 authored by Christian Kuhn's avatar Christian Kuhn Committed by Richard Haeser

[BUGFIX] Do not turn workspace delete records into move records

Scenario: A live page has a page localization. In workspaces,
the page localization is deleted, creating a delete placeholder.
After that, the page is moved to a different parent page in
workspaces. The delete placeholder of the localization is then
turned into a move placeholder.
This is wrong since the delete information is lost.
The patch suppresses the change of delete placeholders to move
placeholders when moving records.
This issue is much harder to solve in v10 since v10 has to deal
with two move overlay records and v11 with one. The patch is
thus slated for v11 only.

Change-Id: I233b944b030bba0de6c22d4ec1b6cb862184ddb6
Resolves: #93268
Releases: master
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/67400Tested-by: default avatarTYPO3com <noreply@typo3.com>
Tested-by: Oliver Bartsch's avatarOliver Bartsch <bo@cedev.de>
Tested-by: default avatarRichard Haeser <richard@richardhaeser.com>
Reviewed-by: Oliver Bartsch's avatarOliver Bartsch <bo@cedev.de>
Reviewed-by: default avatarRichard Haeser <richard@richardhaeser.com>
parent 37b7a893
......@@ -1426,18 +1426,31 @@ class DataHandlerHook
$destPid = -$movedTargetRecordInWorkspace['uid'];
}
$dataHandler->moveRecord_raw($table, $versionedRecordUid, $destPid);
// Update the state of this record now
GeneralUtility::makeInstance(ConnectionPool::class)
->getConnectionForTable($table)
->update(
$table,
[
't3ver_state' => (string)new VersionState(VersionState::MOVE_POINTER)
],
[
'uid' => (int)$versionedRecordUid
]
);
$versionedRecord = BackendUtility::getRecord($table, $versionedRecordUid, 'uid,t3ver_state');
if (!VersionState::cast($versionedRecord['t3ver_state'])->equals(VersionState::DELETE_PLACEHOLDER)) {
// Update the state of this record to a move placeholder. This is allowed if the
// record is a 'changed' (t3ver_state=0) record: Changing a record and moving it
// around later, should switch it from 'changed' to 'moved'. Deleted placeholders
// however are an 'end-state', they should not be switched to a move placeholder.
// Scenario: For a live page that has a localization, the localization is first
// marked as to-delete in workspace, creating a delete placeholder for that
// localization. Later, the page is moved around, moving the localization along
// with the default language record. The localization should then NOT be switched
// from 'to-delete' to 'moved', this would loose the 'to-delete' information.
GeneralUtility::makeInstance(ConnectionPool::class)
->getConnectionForTable($table)
->update(
$table,
[
't3ver_state' => (string)new VersionState(VersionState::MOVE_POINTER)
],
[
'uid' => (int)$versionedRecordUid
]
);
}
// Check for the localizations of that element and move them as well
$dataHandler->moveL10nOverlayRecords($table, $liveUid, $destPid, $originalRecordDestinationPid);
}
......
......@@ -5,8 +5,7 @@
,89,88,256,0,0,0,0,0,0,0,0,0,0,"Relations","/data-handler/relations",,
,90,88,512,0,0,0,0,0,0,0,0,0,0,"Target","/data-handler/target",,
,91,88,256,0,0,1,89,89,0,0,0,0,0,"[Translate to Dansk:] Relations","/data-handler/translate-to-dansk-relations",,
# @todo: The delete placeholder information is lost - see Modify version of this test
,92,1,128,0,0,1,89,89,91,1,4,0,91,"[Translate to Dansk:] Relations","/data-handler/translate-to-dansk-relations",,
,92,1,128,0,0,1,89,89,91,1,2,0,91,"[Translate to Dansk:] Relations","/data-handler/translate-to-dansk-relations",,
"sys_workspace",,,,,,,,,,,,,,,,,
,"uid","pid","deleted","title","adminusers","members","db_mountpoints","file_mountpoints","freeze","live_edit","publish_access","custom_stages","stagechg_notification","edit_notification_defaults","edit_allow_notificaton_settings","publish_notification_defaults","publish_allow_notificaton_settings"
,1,0,0,"Workspace #1",,,,,0,0,0,0,0,0,0,0,0
......
......@@ -5,8 +5,7 @@
,89,88,256,0,0,0,0,0,0,0,0,0,0,"Relations","/data-handler/relations",,
,90,88,512,0,0,0,0,0,0,0,0,0,0,"Target","/data-handler/target",,
,91,88,256,0,0,1,89,89,0,0,0,0,0,"[Translate to Dansk:] Relations","/data-handler/translate-to-dansk-relations",,
# @todo: The delete placeholder information is lost here since the record is turned into a move placeholder!
,92,1,128,0,0,1,89,89,91,1,4,0,91,"[Translate to Dansk:] Relations","/data-handler/translate-to-dansk-relations",,
,92,1,128,0,0,1,89,89,91,1,2,0,91,"[Translate to Dansk:] Relations","/data-handler/translate-to-dansk-relations",,
,93,1,128,0,0,0,0,0,89,1,4,0,89,"Relations","/data-handler/relations",,
"sys_workspace",,,,,,,,,,,,,,,,,
,"uid","pid","deleted","title","adminusers","members","db_mountpoints","file_mountpoints","freeze","live_edit","publish_access","custom_stages","stagechg_notification","edit_notification_defaults","edit_allow_notificaton_settings","publish_notification_defaults","publish_allow_notificaton_settings"
......
......@@ -4,9 +4,8 @@
,88,1,256,0,0,0,0,0,0,0,0,0,0,"DataHandlerTest","/data-handler",,
,89,1,128,0,0,0,0,0,89,0,0,0,0,"Relations","/data-handler/relations",,
,90,88,512,0,0,0,0,0,0,0,0,0,0,"Target","/data-handler/target",,
# @todo: The delete placeholder information is lost - see Modify test version
,91,88,256,0,0,1,89,89,0,0,0,0,0,"[Translate to Dansk:] Relations","/data-handler/translate-to-dansk-relations",,
,92,1,128,0,0,1,89,89,91,1,4,0,91,"[Translate to Dansk:] Relations","/data-handler/translate-to-dansk-relations",,
,92,1,128,0,0,1,89,89,91,1,2,0,91,"[Translate to Dansk:] Relations","/data-handler/translate-to-dansk-relations",,
"sys_workspace",,,,,,,,,,,,,,,,,
,"uid","pid","deleted","title","adminusers","members","db_mountpoints","file_mountpoints","freeze","live_edit","publish_access","custom_stages","stagechg_notification","edit_notification_defaults","edit_allow_notificaton_settings","publish_notification_defaults","publish_allow_notificaton_settings"
,1,0,0,"Workspace #1",,,,,0,0,0,0,0,0,0,0,0
......
......@@ -4,8 +4,8 @@
,88,1,256,0,0,0,0,0,0,0,0,0,0,"DataHandlerTest","/data-handler",,
,89,1,128,0,0,0,0,0,89,0,0,0,0,"Relations","/data-handler/relations",,
,90,88,512,0,0,0,0,0,0,0,0,0,0,"Target","/data-handler/target",,
# @todo: The delete placeholder information is lost - see Modify test version
,91,1,128,0,0,1,89,89,91,0,0,0,0,"[Translate to Dansk:] Relations","/data-handler/translate-to-dansk-relations",,
# @todo Note 89 is changed to new pid 1 and 91 is set to deleted at the old pid position - odd but ok for now
,91,88,256,0,1,1,89,89,91,0,0,0,0,"[Translate to Dansk:] Relations","/data-handler/translate-to-dansk-relations",,
"sys_workspace",,,,,,,,,,,,,,,,,
,"uid","pid","deleted","title","adminusers","members","db_mountpoints","file_mountpoints","freeze","live_edit","publish_access","custom_stages","stagechg_notification","edit_notification_defaults","edit_allow_notificaton_settings","publish_notification_defaults","publish_allow_notificaton_settings"
,1,0,0,"Workspace #1",,,,,0,0,0,0,0,0,0,0,0
......@@ -23,8 +23,8 @@
,297,89,256,0,0,0,0,0,0,0,0,0,0,"Regular Element #1",,,
,298,89,512,0,0,0,0,0,0,0,0,0,0,"Regular Element #2",,,
,299,89,768,0,0,0,0,0,0,0,0,0,0,"Regular Element #3",,,
,300,89,1024,0,0,1,299,299,299,0,0,0,0,"[Translate to Dansk:] Regular Element #3",,,
,301,89,384,0,0,1,297,297,297,0,0,0,0,"[Translate to Dansk:] Regular Element #1",,,
,300,89,1024,0,1,1,299,299,299,0,0,0,0,"[Translate to Dansk:] Regular Element #3",,,
,301,89,384,0,1,1,297,297,297,0,0,0,0,"[Translate to Dansk:] Regular Element #1",,,
,302,89,448,0,0,2,297,301,301,0,0,0,0,"[Translate to Deutsch:] [Translate to Dansk:] Regular Element #1",,,
,310,90,256,0,0,0,0,0,0,0,0,0,0,"Regular Element #10",,,
,311,90,512,0,0,1,0,310,310,0,0,0,0,"[Translate to Dansk:] Regular Element #10",,,
......@@ -33,9 +33,5 @@
"sys_refindex",,,,,,,,,,,,,,,,,
,"hash","tablename","recuid","field","flexpointer","softref_key","softref_id","sorting","workspace","ref_table","ref_uid","ref_string",,,,,
,"01a3ce8c4e3b2bb1aa439dc29081f996","sys_workspace_stage",1,"responsible_persons",,,,0,0,"be_users",3,,,,,,
,"1130084e4038e95f2d5806b731cd416a","tt_content",300,"l18n_parent",,,,0,0,"tt_content",299,,,,,,
,"25426f92d44dd2ccf416108462b446e3","sys_workspace",1,"custom_stages",,,,0,0,"sys_workspace_stage",1,,,,,,
,"25f3b71b67f29fa33fbfd4fa2d930b70","tt_content",302,"l18n_parent",,,,0,0,"tt_content",297,,,,,,
,"4a1e04a83a4a17882682d86f6cd61f3d","tt_content",301,"l18n_parent",,,,0,0,"tt_content",297,,,,,,
,"583b9974d1df1d9efb695cdabfe53a73","pages",91,"l10n_parent",,,,0,0,"pages",89,,,,,,
,"8d96507cabb44e003ba3015a13265f03","pages",91,"sys_language_uid",,,,0,0,"sys_language",1,,,,,,
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment