From 5e5d3728c8104e9c3e53a549613debe4ad60f4fa Mon Sep 17 00:00:00 2001 From: Sybille Peters Date: Thu, 30 Nov 2023 16:52:56 +0100 Subject: [PATCH 1/5] [FEATURE] Update l10n_state if translated values do not match In case TCA allowLanguageSynchronization=1 is set the value of a translated record should be the same as the value in the default language, unless l10n_state contains a configuration for the field != "parent" (e.g. "custom"). In this case the value is inconsistent because "Use value from default language" is displayed in the BE, but the value is actually different. For better consistency, we change the configuration in l10n_state for these cases to "custom". Resolves: #97 --- ...slatedWithAllowLanguageSynchronization.php | 187 ++++++++++++++++++ Classes/HealthFactory/HealthFactory.php | 1 + Classes/Helper/TcaHelper.php | 27 +++ ...hAllowLanguageSynchronizationTestFixed.csv | 11 ++ ...AllowLanguageSynchronizationTestImport.csv | 11 ++ ...edWithAllowLanguageSynchronizationTest.php | 44 +++++ 6 files changed, 281 insertions(+) create mode 100644 Classes/HealthCheck/TcaTablesTranslatedWithAllowLanguageSynchronization.php create mode 100644 Tests/Functional/Fixtures/TcaTablesTranslatedWithAllowLanguageSynchronizationTestFixed.csv create mode 100644 Tests/Functional/Fixtures/TcaTablesTranslatedWithAllowLanguageSynchronizationTestImport.csv create mode 100644 Tests/Functional/HealthCheck/TcaTablesTranslatedWithAllowLanguageSynchronizationTest.php diff --git a/Classes/HealthCheck/TcaTablesTranslatedWithAllowLanguageSynchronization.php b/Classes/HealthCheck/TcaTablesTranslatedWithAllowLanguageSynchronization.php new file mode 100644 index 0000000..e2c3f5f --- /dev/null +++ b/Classes/HealthCheck/TcaTablesTranslatedWithAllowLanguageSynchronization.php @@ -0,0 +1,187 @@ +section('Scan for translated records which should have value of default language'); + $this->outputClass($io); + $this->outputTags($io, self::TAG_SOFT_DELETE, self::TAG_REMOVE, self::TAG_WORKSPACE_REMOVE); + $io->text([ + 'If a field has the TCA setting allowLanguageSynchronization=1 it is possible for translated records to use', + 'the value of the default language.', + 'This check finds translated records with different values and l10n_state="parent".', + 'and sets the l10n_state to "custom" for these fields.', + ]); + } + + /** + * @return array + * @throws NoSuchTableException + * @throws \Doctrine\DBAL\DBALException + * @throws \Doctrine\DBAL\Driver\Exception + * @throws \Psr\Container\ContainerExceptionInterface + * @throws \Psr\Container\NotFoundExceptionInterface + */ + protected function getAffectedRecords(): array + { + /** @var TableHelper $tableHelper */ + $tableHelper = $this->container->get(TableHelper::class); + + $affectedRows = []; + foreach ($this->tcaHelper->getNextFieldWithAllowLanguageSynchronization() as $tableFields) { + $table = $tableFields['tableName']; + $field = $tableFields['fieldName']; + if (!$tableHelper->tableExistsInDatabase($table)) { + throw new NoSuchTableException('Table "' . $table . '" does not exist.'); + } + // transOrigPointerField, e.g. l18n_parent + $transOrigPointerField = $this->tcaHelper->getTranslationParentField($table); + if (!$transOrigPointerField) { + continue; + } + // languageField, e.g. sys_language_uid + $languageField = $this->tcaHelper->getLanguageField($table); + if (!$languageField) { + continue; + } + // l10n_state + $translationStateField = 'l10n_state'; + if (!$translationStateField) { + continue; + } + + $selectFields = [ + $table . '.uid AS uid', + $table . '.pid AS pid', + $table . '.l10n_state AS l10n_state', + $table . '.' . $field . ' AS ' . $field, + $table . '.' . $translationStateField . ' AS ' . $translationStateField, + $table . '.' . $languageField, + $table . '.' . $transOrigPointerField, + 'parent.uid AS uid2', + 'parent.' . $field . ' AS ' . $field . '2', + ]; + + $queryBuilder = $this->connectionPool->getQueryBuilderForTable($table); + // Do not consider soft-deleted records + $queryBuilder->getRestrictions()->removeAll() + ->add(GeneralUtility::makeInstance(DeletedRestriction::class)); + // get all translated records with a connected default language record and different value for field $field + $result = $queryBuilder->select(...$selectFields) + ->from($table) + ->innerJoin( + $table, + $table, + 'parent', + $queryBuilder->expr()->eq( + $table . '.' . $transOrigPointerField, + $queryBuilder->quoteIdentifier('parent.uid') + ) + ) + ->where( + $queryBuilder->expr()->neq( + $table . '.' . $languageField, + $queryBuilder->createNamedParameter(0, \PDO::PARAM_INT) + ), + $queryBuilder->expr()->neq( + $table . '.' . $transOrigPointerField, + $queryBuilder->createNamedParameter(0, \PDO::PARAM_INT) + ), + $queryBuilder->expr()->neq( + $table . '.' . $field, + $queryBuilder->quoteIdentifier('parent.' . $field) + ), + ) + ->orderBy($table . '.uid') + ->executeQuery(); + while ($row = $result->fetchAssociative()) { + $state = $this->getL10nStateForField($row[$translationStateField] ?? '', $field, 'parent'); + if ($state === 'parent') { + $affectedRow['_reasonBroken'] = sprintf('Value for field %s differs from language parent', $field); + $affectedRow['uid'] = $row['uid']; + $affectedRow['pid'] = $row['pid']; + $affectedRow['l10n_state'] = $row['l10n_state']; + $affectedRow['_fieldName'] = $field; + $affectedRow['_fieldValue'] = $row[$field] ?? ''; + $affectedRow['_fieldValueOfParent'] = $row[$field . '2'] ?? ''; + $affectedRow['_uidOfParent'] = $row['uid2'] ?? ''; + $affectedRows[$table][] = $affectedRow; + } + } + } + return $affectedRows; + } + + protected function addFieldToL10nState(string $l10nState, string $field, string $value): string + { + $array = \json_decode($l10nState, true) ?: []; + $array[$field] = $value; + return \json_encode($array) ?? $l10nState; + } + + protected function getL10nStateForField(string $l10nState, string $field, string $default): string + { + $array = \json_decode($l10nState, true) ?: []; + return $array[$field] ?? $default; + } + + protected function processRecords(SymfonyStyle $io, bool $simulate, array $affectedRecords): void + { + /** @var RecordsHelper $recordsHelper */ + $recordsHelper = $this->container->get(RecordsHelper::class); + + foreach ($affectedRecords as $table => $rows) { + foreach ($rows as $row) { + $uid = (int)$row['uid']; + $field = $row['_fieldName']; + $newL10nState = $this->addFieldToL10nState($row['l10n_state'] ?? '', $field, 'custom'); + $fields = [ + 'l10n_state' => [ + 'value' => $newL10nState, + 'type' => \PDO::PARAM_STR, + ], + ]; + $this->updateSingleTcaRecord($io, $simulate, $recordsHelper, $table, $uid, $fields); + } + } + } + + protected function recordDetails(SymfonyStyle $io, array $affectedRecords): void + { + foreach ($affectedRecords as $tableName => $rows) { + $extraDbFields = [ + (string)$rows[0]['_fieldName'], + ]; + $this->outputRecordDetails($io, [$tableName => $rows], '_reasonBroken', [], $extraDbFields); + } + } +} diff --git a/Classes/HealthFactory/HealthFactory.php b/Classes/HealthFactory/HealthFactory.php index 1e2115d..45c7d84 100644 --- a/Classes/HealthFactory/HealthFactory.php +++ b/Classes/HealthFactory/HealthFactory.php @@ -77,6 +77,7 @@ final class HealthFactory implements HealthFactoryInterface HealthCheck\InlineForeignFieldChildrenParentDeleted::class, // @todo: Maybe that's not a good position when we start scanning for records translated more than once (issue #9)? HealthCheck\InlineForeignFieldChildrenParentLanguageDifferent::class, + HealthCheck\TcaTablesTranslatedWithAllowLanguageSynchronization::class, ]; private ContainerInterface $container; diff --git a/Classes/Helper/TcaHelper.php b/Classes/Helper/TcaHelper.php index 4305444..2b73d2a 100644 --- a/Classes/Helper/TcaHelper.php +++ b/Classes/Helper/TcaHelper.php @@ -115,6 +115,33 @@ public function getNextLanguageSourceAwareTcaTable(array $ignoreTables = []): it } } + /** + * @param array $ignoreTables + * @return iterable> + */ + public function getNextFieldWithAllowLanguageSynchronization(array $ignoreTables = []): iterable + { + $this->verifyTcaIsArray(); + $tablesFields = []; + foreach ($GLOBALS['TCA'] as $tablename => $config) { + if (in_array($tablename, $ignoreTables)) { + continue; + } + foreach (($config['columns'] ?? []) as $fieldName => $columnConfig) { + $allowLanguageSynchronization = (int)($columnConfig['config']['behaviour']['allowLanguageSynchronization'] ?? 0); + if ($allowLanguageSynchronization) { + $tablesFields[] = [ + 'tableName' => $tablename, + 'fieldName' => $fieldName, + ]; + } + } + } + foreach ($tablesFields as $row) { + yield $row; + } + } + /** * @param array $ignoreTables * @return iterable> diff --git a/Tests/Functional/Fixtures/TcaTablesTranslatedWithAllowLanguageSynchronizationTestFixed.csv b/Tests/Functional/Fixtures/TcaTablesTranslatedWithAllowLanguageSynchronizationTestFixed.csv new file mode 100644 index 0000000..0d755a4 --- /dev/null +++ b/Tests/Functional/Fixtures/TcaTablesTranslatedWithAllowLanguageSynchronizationTestFixed.csv @@ -0,0 +1,11 @@ +"pages" +,"uid","pid","url","sys_language_uid","l10n_parent","l10n_state" +# Test with empty l10n_state +,1,0,"https://example.org",0,0,"" +,2,0,"",1,1,"{""url"":""custom""}" +# Test with l10n_state containing values for other field +,3,0,"https://example.org",0,0,"" +,4,0,"",1,3,"{""author"":""custom"",""url"":""custom""}" +# Test with l10n_state: parent +,5,0,"https://example.org",0,0,"" +,6,0,"",1,5,"{""url"":""custom""}" diff --git a/Tests/Functional/Fixtures/TcaTablesTranslatedWithAllowLanguageSynchronizationTestImport.csv b/Tests/Functional/Fixtures/TcaTablesTranslatedWithAllowLanguageSynchronizationTestImport.csv new file mode 100644 index 0000000..732af3a --- /dev/null +++ b/Tests/Functional/Fixtures/TcaTablesTranslatedWithAllowLanguageSynchronizationTestImport.csv @@ -0,0 +1,11 @@ +"pages" +,"uid","pid","url","sys_language_uid","l10n_parent","l10n_state" +# Test with empty l10n_state and field "url" +,1,0,"https://example.org",0,0,"" +,2,0,"",1,1,"" +# Test with l10n_state containing values for other field +,3,0,"https://example.org",0,0,"" +,4,0,"",1,3,"{""author"":""custom""}" +# Test with l10n_state: parent +,5,0,"https://example.org",0,0,"" +,6,0,"",1,5,"{""url"":""parent""}" diff --git a/Tests/Functional/HealthCheck/TcaTablesTranslatedWithAllowLanguageSynchronizationTest.php b/Tests/Functional/HealthCheck/TcaTablesTranslatedWithAllowLanguageSynchronizationTest.php new file mode 100644 index 0000000..3b530b2 --- /dev/null +++ b/Tests/Functional/HealthCheck/TcaTablesTranslatedWithAllowLanguageSynchronizationTest.php @@ -0,0 +1,44 @@ +importCSVDataSet(__DIR__ . '/../Fixtures/TcaTablesTranslatedWithAllowLanguageSynchronizationTestImport.csv'); + $io = $this->getMockBuilder(SymfonyStyle::class)->disableOriginalConstructor()->getMock(); + $io->expects(self::atLeastOnce())->method('warning'); + /** @var TcaTablesTranslatedWithAllowLanguageSynchronization $subject */ + $subject = $this->get(TcaTablesTranslatedWithAllowLanguageSynchronization::class); + $subject->handle($io, HealthCheckInterface::MODE_EXECUTE, ''); + $this->assertCSVDataSet(__DIR__ . '/../Fixtures/TcaTablesTranslatedWithAllowLanguageSynchronizationTestFixed.csv'); + } +} From 235b3dc6ca11cea357bb7e578df0ea0ac60081e6 Mon Sep 17 00:00:00 2001 From: Sybille Peters Date: Thu, 30 Nov 2023 17:20:50 +0100 Subject: [PATCH 2/5] [TASK] Fix phpstan --- ...slatedWithAllowLanguageSynchronization.php | 33 +++++++------------ 1 file changed, 11 insertions(+), 22 deletions(-) diff --git a/Classes/HealthCheck/TcaTablesTranslatedWithAllowLanguageSynchronization.php b/Classes/HealthCheck/TcaTablesTranslatedWithAllowLanguageSynchronization.php index e2c3f5f..f16e6f1 100644 --- a/Classes/HealthCheck/TcaTablesTranslatedWithAllowLanguageSynchronization.php +++ b/Classes/HealthCheck/TcaTablesTranslatedWithAllowLanguageSynchronization.php @@ -43,14 +43,6 @@ public function header(SymfonyStyle $io): void ]); } - /** - * @return array - * @throws NoSuchTableException - * @throws \Doctrine\DBAL\DBALException - * @throws \Doctrine\DBAL\Driver\Exception - * @throws \Psr\Container\ContainerExceptionInterface - * @throws \Psr\Container\NotFoundExceptionInterface - */ protected function getAffectedRecords(): array { /** @var TableHelper $tableHelper */ @@ -75,9 +67,6 @@ protected function getAffectedRecords(): array } // l10n_state $translationStateField = 'l10n_state'; - if (!$translationStateField) { - continue; - } $selectFields = [ $table . '.uid AS uid', @@ -124,16 +113,14 @@ protected function getAffectedRecords(): array ->orderBy($table . '.uid') ->executeQuery(); while ($row = $result->fetchAssociative()) { - $state = $this->getL10nStateForField($row[$translationStateField] ?? '', $field, 'parent'); + /** @var array $row */ + $state = $this->getL10nStateForField((string)($row[$translationStateField] ?? ''), $field, 'parent'); if ($state === 'parent') { $affectedRow['_reasonBroken'] = sprintf('Value for field %s differs from language parent', $field); - $affectedRow['uid'] = $row['uid']; - $affectedRow['pid'] = $row['pid']; - $affectedRow['l10n_state'] = $row['l10n_state']; + $affectedRow['uid'] = (int)($row['uid']); + $affectedRow['pid'] = (int)($row['pid']); + $affectedRow['l10n_state'] = (string)($row['l10n_state'] ?? ''); $affectedRow['_fieldName'] = $field; - $affectedRow['_fieldValue'] = $row[$field] ?? ''; - $affectedRow['_fieldValueOfParent'] = $row[$field . '2'] ?? ''; - $affectedRow['_uidOfParent'] = $row['uid2'] ?? ''; $affectedRows[$table][] = $affectedRow; } } @@ -143,15 +130,17 @@ protected function getAffectedRecords(): array protected function addFieldToL10nState(string $l10nState, string $field, string $value): string { + /** @var array $array */ $array = \json_decode($l10nState, true) ?: []; $array[$field] = $value; - return \json_encode($array) ?? $l10nState; + return (string)(\json_encode($array) ?: $l10nState); } protected function getL10nStateForField(string $l10nState, string $field, string $default): string { + /** @var array $array */ $array = \json_decode($l10nState, true) ?: []; - return $array[$field] ?? $default; + return (string)($array[$field] ?: $default); } protected function processRecords(SymfonyStyle $io, bool $simulate, array $affectedRecords): void @@ -162,8 +151,8 @@ protected function processRecords(SymfonyStyle $io, bool $simulate, array $affec foreach ($affectedRecords as $table => $rows) { foreach ($rows as $row) { $uid = (int)$row['uid']; - $field = $row['_fieldName']; - $newL10nState = $this->addFieldToL10nState($row['l10n_state'] ?? '', $field, 'custom'); + $field = (string)$row['_fieldName']; + $newL10nState = $this->addFieldToL10nState((string)($row['l10n_state'] ?? ''), $field, 'custom'); $fields = [ 'l10n_state' => [ 'value' => $newL10nState, From 81e7bdaafa5bd9c265db25af846519efd7709a9b Mon Sep 17 00:00:00 2001 From: Sybille Peters Date: Thu, 30 Nov 2023 17:27:44 +0100 Subject: [PATCH 3/5] [TASK] Fix test --- .../TcaTablesTranslatedWithAllowLanguageSynchronization.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Classes/HealthCheck/TcaTablesTranslatedWithAllowLanguageSynchronization.php b/Classes/HealthCheck/TcaTablesTranslatedWithAllowLanguageSynchronization.php index f16e6f1..038252d 100644 --- a/Classes/HealthCheck/TcaTablesTranslatedWithAllowLanguageSynchronization.php +++ b/Classes/HealthCheck/TcaTablesTranslatedWithAllowLanguageSynchronization.php @@ -140,7 +140,7 @@ protected function getL10nStateForField(string $l10nState, string $field, string { /** @var array $array */ $array = \json_decode($l10nState, true) ?: []; - return (string)($array[$field] ?: $default); + return (string)($array[$field] ?? $default); } protected function processRecords(SymfonyStyle $io, bool $simulate, array $affectedRecords): void From 81de623e39051d7f1eca36c46fc6acc1e6b596df Mon Sep 17 00:00:00 2001 From: Sybille Peters Date: Fri, 1 Dec 2023 07:55:12 +0100 Subject: [PATCH 4/5] [TASK] Better handling of several fields If several fields are affected in one records, multiple UPDATEs in the DB would overwrite the previous change in l10n_state again. To fix this, the fields are now all bundled together and written in one UPDATE. --- ...slatedWithAllowLanguageSynchronization.php | 46 ++++++++++++++----- Classes/HealthFactory/HealthFactory.php | 2 + ...hAllowLanguageSynchronizationTestFixed.csv | 20 +++++--- ...AllowLanguageSynchronizationTestImport.csv | 20 +++++--- 4 files changed, 62 insertions(+), 26 deletions(-) diff --git a/Classes/HealthCheck/TcaTablesTranslatedWithAllowLanguageSynchronization.php b/Classes/HealthCheck/TcaTablesTranslatedWithAllowLanguageSynchronization.php index 038252d..57358ee 100644 --- a/Classes/HealthCheck/TcaTablesTranslatedWithAllowLanguageSynchronization.php +++ b/Classes/HealthCheck/TcaTablesTranslatedWithAllowLanguageSynchronization.php @@ -116,23 +116,45 @@ protected function getAffectedRecords(): array /** @var array $row */ $state = $this->getL10nStateForField((string)($row[$translationStateField] ?? ''), $field, 'parent'); if ($state === 'parent') { - $affectedRow['_reasonBroken'] = sprintf('Value for field %s differs from language parent', $field); - $affectedRow['uid'] = (int)($row['uid']); - $affectedRow['pid'] = (int)($row['pid']); - $affectedRow['l10n_state'] = (string)($row['l10n_state'] ?? ''); - $affectedRow['_fieldName'] = $field; - $affectedRows[$table][] = $affectedRow; + $uid = (int)($row['uid']); + // if we are handling several fields in one record, we handle them all in one scoop + // (otherwise subsequent changes would overwrite previous changes in l10n_state) + if (isset($affectedRows[$table][$uid])) { + $affectedRows[$table][$uid]['_fieldNames'] .= ',' . $field; + $affectedRows[$table][$uid]['_reasonBroken'] = sprintf( + 'Value for fields %s differ from language parent', + $affectedRows[$table][$uid]['_fieldNames'] + ); + } else { + $affectedRow = []; + $affectedRow['uid'] = $uid; + $affectedRow['pid'] = (int)($row['pid']); + $affectedRow['l10n_state'] = (string)($row['l10n_state'] ?? ''); + $affectedRow['_fieldNames'] = $field; + $affectedRow['_reasonBroken'] = sprintf( + 'Value for field %s differs from language parent', + $field + ); + $affectedRows[$table][$uid] = $affectedRow; + } } } } return $affectedRows; } - protected function addFieldToL10nState(string $l10nState, string $field, string $value): string + /** + * @param string $l10nState + * @param array $fields + * @return string + */ + protected function addFieldsToL10nState(string $l10nState, array $fields, string $value): string { /** @var array $array */ $array = \json_decode($l10nState, true) ?: []; - $array[$field] = $value; + foreach ($fields as $field) { + $array[$field] = $value; + } return (string)(\json_encode($array) ?: $l10nState); } @@ -151,15 +173,15 @@ protected function processRecords(SymfonyStyle $io, bool $simulate, array $affec foreach ($affectedRecords as $table => $rows) { foreach ($rows as $row) { $uid = (int)$row['uid']; - $field = (string)$row['_fieldName']; - $newL10nState = $this->addFieldToL10nState((string)($row['l10n_state'] ?? ''), $field, 'custom'); - $fields = [ + $fields = explode(',', (string)$row['_fieldNames']); + $newL10nState = $this->addFieldsToL10nState((string)($row['l10n_state'] ?? ''), $fields, 'custom'); + $updateField = [ 'l10n_state' => [ 'value' => $newL10nState, 'type' => \PDO::PARAM_STR, ], ]; - $this->updateSingleTcaRecord($io, $simulate, $recordsHelper, $table, $uid, $fields); + $this->updateSingleTcaRecord($io, $simulate, $recordsHelper, $table, $uid, $updateField); } } } diff --git a/Classes/HealthFactory/HealthFactory.php b/Classes/HealthFactory/HealthFactory.php index 45c7d84..2f4e01b 100644 --- a/Classes/HealthFactory/HealthFactory.php +++ b/Classes/HealthFactory/HealthFactory.php @@ -26,6 +26,7 @@ final class HealthFactory implements HealthFactoryInterface * @var string[] */ private array $healthClasses = [ + /* HealthCheck\WorkspacesNotLoadedRecordsDangling::class, HealthCheck\WorkspacesRecordsOfDeletedWorkspaces::class, HealthCheck\TcaTablesDeleteFlagZeroOrOne::class, @@ -77,6 +78,7 @@ final class HealthFactory implements HealthFactoryInterface HealthCheck\InlineForeignFieldChildrenParentDeleted::class, // @todo: Maybe that's not a good position when we start scanning for records translated more than once (issue #9)? HealthCheck\InlineForeignFieldChildrenParentLanguageDifferent::class, + */ HealthCheck\TcaTablesTranslatedWithAllowLanguageSynchronization::class, ]; diff --git a/Tests/Functional/Fixtures/TcaTablesTranslatedWithAllowLanguageSynchronizationTestFixed.csv b/Tests/Functional/Fixtures/TcaTablesTranslatedWithAllowLanguageSynchronizationTestFixed.csv index 0d755a4..aff7f4a 100644 --- a/Tests/Functional/Fixtures/TcaTablesTranslatedWithAllowLanguageSynchronizationTestFixed.csv +++ b/Tests/Functional/Fixtures/TcaTablesTranslatedWithAllowLanguageSynchronizationTestFixed.csv @@ -1,11 +1,17 @@ "pages" -,"uid","pid","url","sys_language_uid","l10n_parent","l10n_state" +,"uid","pid","url","author","sys_language_uid","l10n_parent","l10n_state" # Test with empty l10n_state -,1,0,"https://example.org",0,0,"" -,2,0,"",1,1,"{""url"":""custom""}" +,1,0,"https://example.org","",0,0,"" +,2,0,"","",1,1,"{""url"":""custom""}" # Test with l10n_state containing values for other field -,3,0,"https://example.org",0,0,"" -,4,0,"",1,3,"{""author"":""custom"",""url"":""custom""}" +,3,0,"https://example.org","",0,0,"" +,4,0,"","",1,3,"{""author"":""custom"",""url"":""custom""}" # Test with l10n_state: parent -,5,0,"https://example.org",0,0,"" -,6,0,"",1,5,"{""url"":""custom""}" +,5,0,"https://example.org","",0,0,"" +,6,0,"","",1,5,"{""url"":""custom""}" +# Test with no changes necessary +,7,0,"https://example.org","",0,0,"" +,8,0,"https://example.org","",1,7,"" +# Test with several fields +,9,0,"https://example.org","Author",0,0,"" +,10,0,"","",1,9,"{""url"":""custom"",""author"":""custom""}" diff --git a/Tests/Functional/Fixtures/TcaTablesTranslatedWithAllowLanguageSynchronizationTestImport.csv b/Tests/Functional/Fixtures/TcaTablesTranslatedWithAllowLanguageSynchronizationTestImport.csv index 732af3a..5e226c1 100644 --- a/Tests/Functional/Fixtures/TcaTablesTranslatedWithAllowLanguageSynchronizationTestImport.csv +++ b/Tests/Functional/Fixtures/TcaTablesTranslatedWithAllowLanguageSynchronizationTestImport.csv @@ -1,11 +1,17 @@ "pages" -,"uid","pid","url","sys_language_uid","l10n_parent","l10n_state" +,"uid","pid","url","author","sys_language_uid","l10n_parent","l10n_state" # Test with empty l10n_state and field "url" -,1,0,"https://example.org",0,0,"" -,2,0,"",1,1,"" +,1,0,"https://example.org","",0,0,"" +,2,0,"","",1,1,"" # Test with l10n_state containing values for other field -,3,0,"https://example.org",0,0,"" -,4,0,"",1,3,"{""author"":""custom""}" +,3,0,"https://example.org","",0,0,"" +,4,0,"","",1,3,"{""author"":""custom""}" # Test with l10n_state: parent -,5,0,"https://example.org",0,0,"" -,6,0,"",1,5,"{""url"":""parent""}" +,5,0,"https://example.org","",0,0,"" +,6,0,"","",1,5,"{""url"":""parent""}" +# Test with no changes necessary +,7,0,"https://example.org","",0,0,"" +,8,0,"https://example.org","",1,7,"" +# Test with several fields +,9,0,"https://example.org","Author",0,0,"" +,10,0,"","",1,9,"" From 0765cd5b60bf7268787c1879f203ddf2e72969eb Mon Sep 17 00:00:00 2001 From: Sybille Peters Date: Sat, 2 Dec 2023 06:52:00 +0100 Subject: [PATCH 5/5] [TASKS] Uncomment checks in factory --- Classes/HealthFactory/HealthFactory.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/Classes/HealthFactory/HealthFactory.php b/Classes/HealthFactory/HealthFactory.php index 2f4e01b..45c7d84 100644 --- a/Classes/HealthFactory/HealthFactory.php +++ b/Classes/HealthFactory/HealthFactory.php @@ -26,7 +26,6 @@ final class HealthFactory implements HealthFactoryInterface * @var string[] */ private array $healthClasses = [ - /* HealthCheck\WorkspacesNotLoadedRecordsDangling::class, HealthCheck\WorkspacesRecordsOfDeletedWorkspaces::class, HealthCheck\TcaTablesDeleteFlagZeroOrOne::class, @@ -78,7 +77,6 @@ final class HealthFactory implements HealthFactoryInterface HealthCheck\InlineForeignFieldChildrenParentDeleted::class, // @todo: Maybe that's not a good position when we start scanning for records translated more than once (issue #9)? HealthCheck\InlineForeignFieldChildrenParentLanguageDifferent::class, - */ HealthCheck\TcaTablesTranslatedWithAllowLanguageSynchronization::class, ];