Skip to content

Commit 986da3e

Browse files
committed
[TASK] Check for l10n overlays move only when necessary
When moving a sys_language_uid=0 record, existing localization overlay records are usually moved as well. The patch optimizes the code to not check for localization overlays if the moved record is a localized record already. This can save another few DB calls in DataHandler. Resolves: #106523 Releases: main, 13.4 Change-Id: Iea877bfe39d0dc5631fa18b16267e5d084af9941 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/88681 Tested-by: Stefan Bürk <stefan@buerk.tech> Reviewed-by: Stefan Bürk <stefan@buerk.tech> Reviewed-by: Benni Mack <benni@typo3.org> Tested-by: core-ci <typo3@b13.com> Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch> Tested-by: Christian Kuhn <lolli@schwarzbu.ch> Tested-by: Benni Mack <benni@typo3.org>
1 parent 7fa80c1 commit 986da3e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

typo3/sysext/core/Classes/DataHandling/DataHandler.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4324,6 +4324,10 @@ public function moveRecord(string $table, int $uid, int $destination): void
43244324
return;
43254325
}
43264326
$pagesLocalizationParentFieldName = $this->tcaSchemaFactory->get('pages')->getCapability(TcaSchemaCapability::Language)->getTranslationOriginPointerField()->getName();
4327+
$tableLanguageFieldName = null;
4328+
if ($schema->hasCapability(TcaSchemaCapability::Language)) {
4329+
$tableLanguageFieldName = $schema->getCapability(TcaSchemaCapability::Language)->getLanguageField()->getName();
4330+
}
43274331

43284332
// Gather record facts
43294333
$plainRecord = BackendUtility::getRecord($table, $uid, '*', '', false);
@@ -4627,7 +4631,9 @@ public function moveRecord(string $table, int $uid, int $destination): void
46274631

46284632
$this->registerRecordIdForPageCacheClearing($table, $sourceUid, $table === 'pages' ? $workspaceRecord['uid'] ?? $liveRecord['uid'] : $workspaceRecord['pid'] ?? $liveRecord['pid']);
46294633
$this->connectionPool->getConnectionForTable($table)->update($table, $updateFields, ['uid' => $sourceUid]);
4630-
$this->moveL10nOverlayRecords($table, $sourceUid, $updateFields['pid'], $destination);
4634+
if ($tableLanguageFieldName && (int)($workspaceRecord[$tableLanguageFieldName] ?? $liveRecord[$tableLanguageFieldName]) === 0) {
4635+
$this->moveL10nOverlayRecords($table, $sourceUid, $updateFields['pid'], $destination);
4636+
}
46314637
if ($destination >= 0) {
46324638
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['moveRecordClass'] ?? [] as $className) {
46334639
$hook = GeneralUtility::makeInstance($className);

0 commit comments

Comments
 (0)