Commit acb8bafd authored by Nikita Hovratov's avatar Nikita Hovratov Committed by Christian Kuhn
Browse files

[TASK] Remove all code occurrences from showRemovedLocalizationRecords

The TCA option showRemovedLocalizationRecords was former used to enable
showing 'dangling' records (localized records without parent). Because
it was subject to a broken db structure, its usage was removed in patch
f6f36d3f. But there was still code mentioning this key without using it.

A TCA migration removes this option and logs a message which pinpoints
the lack of usage.

Resolves: #94441
Releases: master
Change-Id: I8c32bb845512585a6314d92f8fcafffd959279ad
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/69665


Tested-by: core-ci's avatarcore-ci <typo3@b13.com>
Tested-by: Simon Gilli's avatarSimon Gilli <typo3@gilbertsoft.org>
Tested-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Simon Gilli's avatarSimon Gilli <typo3@gilbertsoft.org>
Reviewed-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
parent cf10c68b
......@@ -115,8 +115,6 @@ class TcaInlineConfiguration implements FormDataProviderInterface
}
$config['appearance']['showPossibleLocalizationRecords']
= isset($config['appearance']['showPossibleLocalizationRecords']) && $config['appearance']['showPossibleLocalizationRecords'];
$config['appearance']['showRemovedLocalizationRecords']
= isset($config['appearance']['showRemovedLocalizationRecords']) && $config['appearance']['showRemovedLocalizationRecords'];
// Defines which controls should be shown in header of each record
$enabledControls = [
'info' => true,
......
......@@ -107,7 +107,6 @@ class TcaSiteLanguage extends AbstractDatabaseRecordProvider implements FormData
$config['appearance'] = [];
}
$config['appearance']['showPossibleLocalizationRecords'] = false;
$config['appearance']['showRemovedLocalizationRecords'] = false;
$config['appearance']['collapseAll'] = true;
$config['appearance']['expandSignle'] = false;
$config['appearance']['enabledControls'] = [
......
......@@ -186,7 +186,6 @@ class FormInlineAjaxControllerTest extends FunctionalTestCase
'showSynchronizationLink' => 1,
'showAllLocalizationLink' => 1,
'showPossibleLocalizationRecords' => true,
'showRemovedLocalizationRecords' => true,
'levelLinksPosition' => 'top',
'enabledControls' => [
'info' => true,
......
......@@ -34,7 +34,6 @@ class TcaInlineConfigurationTest extends UnitTestCase
'appearance' => [
'levelLinksPosition' => 'top',
'showPossibleLocalizationRecords' => false,
'showRemovedLocalizationRecords' => false,
'enabledControls' => [
'info' => true,
'new' => true,
......@@ -356,58 +355,6 @@ class TcaInlineConfigurationTest extends UnitTestCase
self::assertEquals($expected, (new TcaInlineConfiguration())->addData($input));
}
/**
* @test
*/
public function addDataKeepshowRemovedLocalizationRecordsButForcesBooleanTrue()
{
$input = [
'processedTca' => [
'columns' => [
'aField' => [
'config' => [
'type' => 'inline',
'foreign_table' => 'aForeignTableName',
'appearance' => [
'showRemovedLocalizationRecords' => 1,
],
],
],
],
],
];
$expected = [];
$expected['processedTca']['columns']['aField']['config'] = $this->defaultConfig;
$expected['processedTca']['columns']['aField']['config']['appearance']['showRemovedLocalizationRecords'] = true;
self::assertEquals($expected, (new TcaInlineConfiguration())->addData($input));
}
/**
* @test
*/
public function addDataKeepsShowRemovedLocalizationRecordsButForcesBooleanFalse()
{
$input = [
'processedTca' => [
'columns' => [
'aField' => [
'config' => [
'type' => 'inline',
'foreign_table' => 'aForeignTableName',
'appearance' => [
'showRemovedLocalizationRecords' => '',
],
],
],
],
],
];
$expected = [];
$expected['processedTca']['columns']['aField']['config'] = $this->defaultConfig;
$expected['processedTca']['columns']['aField']['config']['appearance']['showRemovedLocalizationRecords'] = false;
self::assertEquals($expected, (new TcaInlineConfiguration())->addData($input));
}
/**
* @test
*/
......
......@@ -60,6 +60,7 @@ class TcaMigration
$tca = $this->removeWorkspacePlaceholderShadowColumnsConfiguration($tca);
$tca = $this->migrateLanguageFieldToTcaTypeLanguage($tca);
$tca = $this->migrateSpecialLanguagesToTcaTypeLanguage($tca);
$tca = $this->removeShowRemovedLocalizationRecords($tca);
return $tca;
}
......@@ -413,4 +414,26 @@ class TcaMigration
return $tca;
}
protected function removeShowRemovedLocalizationRecords(array $tca): array
{
foreach ($tca as $table => &$tableDefinition) {
if (!isset($tableDefinition['columns']) || !is_array($tableDefinition['columns'])) {
continue;
}
foreach ($tableDefinition['columns'] as $fieldName => &$fieldConfig) {
if ((string)($fieldConfig['config']['type'] ?? '') != 'inline'
|| !isset($fieldConfig['config']['appearance']['showRemovedLocalizationRecords'])
) {
continue;
}
$this->messages[] = 'The TCA field \'' . $fieldName . '\' of table \'' . $table . '\' is '
. 'defined as type \'inline\' with the \'appearance.showRemovedLocalizationRecords\' option. This is not '
. 'evaluated anymore. There is no replacement and should therefore be removed.';
unset($fieldConfig['config']['appearance']['showRemovedLocalizationRecords']);
}
}
return $tca;
}
}
......@@ -22,7 +22,6 @@
<showSynchronizationLink>1</showSynchronizationLink>
<showAllLocalizationLink>1</showAllLocalizationLink>
<showPossibleLocalizationRecords>1</showPossibleLocalizationRecords>
<showRemovedLocalizationRecords>1</showRemovedLocalizationRecords>
</appearance>
</config>
</TCEforms>
......@@ -46,7 +45,6 @@
<showSynchronizationLink>1</showSynchronizationLink>
<showAllLocalizationLink>1</showAllLocalizationLink>
<showPossibleLocalizationRecords>1</showPossibleLocalizationRecords>
<showRemovedLocalizationRecords>1</showRemovedLocalizationRecords>
</appearance>
</config>
</TCEforms>
......
......@@ -21,7 +21,6 @@ $GLOBALS['TCA']['pages']['ctrl']['hideAtCopy'] = false;
'showSynchronizationLink' => 1,
'showAllLocalizationLink' => 1,
'showPossibleLocalizationRecords' => 1,
'showRemovedLocalizationRecords' => 1,
],
]
],
......@@ -36,7 +35,6 @@ $GLOBALS['TCA']['pages']['ctrl']['hideAtCopy'] = false;
'showSynchronizationLink' => 1,
'showAllLocalizationLink' => 1,
'showPossibleLocalizationRecords' => 1,
'showRemovedLocalizationRecords' => 1,
],
]
],
......
......@@ -23,7 +23,6 @@ $GLOBALS['TCA']['tt_content']['ctrl']['hideAtCopy'] = false;
'showSynchronizationLink' => 1,
'showAllLocalizationLink' => 1,
'showPossibleLocalizationRecords' => 1,
'showRemovedLocalizationRecords' => 1,
],
]
],
......@@ -38,7 +37,6 @@ $GLOBALS['TCA']['tt_content']['ctrl']['hideAtCopy'] = false;
'showSynchronizationLink' => 1,
'showAllLocalizationLink' => 1,
'showPossibleLocalizationRecords' => 1,
'showRemovedLocalizationRecords' => 1,
],
'default' => '',
]
......
......@@ -77,7 +77,6 @@ return [
'showSynchronizationLink' => 1,
'showAllLocalizationLink' => 1,
'showPossibleLocalizationRecords' => 1,
'showRemovedLocalizationRecords' => 1,
],
'default' => ''
]
......
......@@ -77,7 +77,6 @@ return [
'showSynchronizationLink' => 1,
'showAllLocalizationLink' => 1,
'showPossibleLocalizationRecords' => 1,
'showRemovedLocalizationRecords' => 1,
],
'default' => ''
]
......
......@@ -97,7 +97,6 @@ return [
'showSynchronizationLink' => 1,
'showAllLocalizationLink' => 1,
'showPossibleLocalizationRecords' => 1,
'showRemovedLocalizationRecords' => 1,
],
]
],
......
......@@ -97,7 +97,6 @@ return [
'showSynchronizationLink' => 1,
'showAllLocalizationLink' => 1,
'showPossibleLocalizationRecords' => 1,
'showRemovedLocalizationRecords' => 1,
],
]
],
......
......@@ -80,7 +80,6 @@ return [
'showSynchronizationLink' => 1,
'showAllLocalizationLink' => 1,
'showPossibleLocalizationRecords' => 1,
'showRemovedLocalizationRecords' => 1,
],
]
],
......
......@@ -88,7 +88,6 @@ return [
'showSynchronizationLink' => 1,
'showAllLocalizationLink' => 1,
'showPossibleLocalizationRecords' => 1,
'showRemovedLocalizationRecords' => 1,
],
]
],
......
......@@ -80,7 +80,6 @@ return [
'showSynchronizationLink' => 1,
'showAllLocalizationLink' => 1,
'showPossibleLocalizationRecords' => 1,
'showRemovedLocalizationRecords' => 1,
],
]
],
......
......@@ -80,7 +80,6 @@ return [
'showSynchronizationLink' => 1,
'showAllLocalizationLink' => 1,
'showPossibleLocalizationRecords' => 1,
'showRemovedLocalizationRecords' => 1,
],
]
],
......
......@@ -80,7 +80,6 @@ return [
'showSynchronizationLink' => 1,
'showAllLocalizationLink' => 1,
'showPossibleLocalizationRecords' => 1,
'showRemovedLocalizationRecords' => 1,
],
]
],
......
......@@ -79,7 +79,6 @@ return [
'showSynchronizationLink' => 1,
'showAllLocalizationLink' => 1,
'showPossibleLocalizationRecords' => 1,
'showRemovedLocalizationRecords' => 1,
],
]
],
......
......@@ -80,7 +80,6 @@ return [
'showSynchronizationLink' => 1,
'showAllLocalizationLink' => 1,
'showPossibleLocalizationRecords' => 1,
'showRemovedLocalizationRecords' => 1,
],
]
],
......@@ -97,7 +96,6 @@ return [
'showSynchronizationLink' => 1,
'showAllLocalizationLink' => 1,
'showPossibleLocalizationRecords' => 1,
'showRemovedLocalizationRecords' => 1,
],
]
],
......
......@@ -89,7 +89,6 @@ return [
'showSynchronizationLink' => 1,
'showAllLocalizationLink' => 1,
'showPossibleLocalizationRecords' => 1,
'showRemovedLocalizationRecords' => 1,
],
]
],
......
Supports Markdown
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