Issue Bug Closed

#83940L10nModeUpdater breaks if parent of translations is deleted

Joerg Kummer 02/16/18, 18:55 updated 10/02/18, 10:52

Description

Referring to #79853, and as Bert Hiddink mentioned: installtool upgrade wizard ‘Execute database migrations on single rows’ with ‘L10nModeUpdater’ returns error, if for example translated tt_content entries have deleted parent entries.

Argument 3 passed to TYPO3\CMS\Core\DataHandling\Localization\DataMapProcessor::synchronizeFieldValues() must be of the type array, null given …

To find such entries in table tt_content

SELECT child.uid, child.pid, child.header, child.sys_language_uid, child.l18n_parent
FROM tt_content AS parent
INNER JOIN tt_content AS child ON (child.l18n_parent = parent.uid)
WHERE parent.deleted = 1 AND child.deleted = 0
To reproduce:
  • create tt_content element plus translation
  • set field ‘deleted’ of parent language element to 1
  • mark upgrade wizard ‘Execute database migrations on single rows’ as undone (installtool)
  • run upgrade wizard ‘Execute database migrations on single rows’

Hint: Upgrade wizard ’Execute database migrations on single rows’ has three different tasks (L10nModeUpdater, ImageCropUpdater,RteLinkSyntaxUpdater)
where in this case only L10nModeUpdater is affected. In DB:sys_registry.entry_key = rowUpdatersDone AND entry_namespace = installUpdateRows
the serialized values can be manipulated to force only L10nModeUpdater.
Set DB:sys_registry.entry_value for this row to

a:2:{i:0;s:53:"TYPO3\CMS\Install\Updates\RowUpdater\ImageCropUpdater";i:1;s: 57:"TYPO3\CMS\Install\Updates\RowUpdater\RteLinkSyntaxUpdater";}

A workaround is to set such parent entries temporarly to not being deleted, during upgrade wizard:

Befor running upgrade wizard ’Execute database migrations on single rows’ set field ‘deleted’ for such entries to 0:

# Add temporary field for deletion
ALTER TABLE tt_content ADD deleted_temp smallint(5) UNSIGNED NOT NULL DEFAULT '0';
# Copy deletion to temporary field and set deletion to 0
UPDATE tt_content AS parent INNER JOIN (SELECT uid, l18n_parent, deleted FROM tt_content) AS child ON parent.uid=child.l18n_parent
SET parent.deleted_temp = 1, parent.deleted = 0
WHERE parent.deleted=1 AND child.deleted=0

Then run upgrade wizard ’Execute database migrations on single rows’.

After running the upgrade wizard rollback and reset ‘deleted’ field to origin values:

# Reset deletion to origin value
UPDATE tt_content SET deleted = deleted_temp WHERE deleted_temp = 1;
# Drop temporary field
ALTER TABLE tt_content DROP deleted_temp;

Kurt Gusbeth wrote a solution in #79853, which should be included, cause method DataMapProcessor->synchronizeFieldValues requires third and forth argument to be of kind array. I will apply a patch for this.

Reviews 2