Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
275 changes: 128 additions & 147 deletions data/mysql/cleandata.sql

Large diffs are not rendered by default.

301 changes: 141 additions & 160 deletions data/postgresql/cleandata.sql

Large diffs are not rendered by default.

192 changes: 0 additions & 192 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -11046,42 +11046,6 @@ parameters:
count: 1
path: src/lib/Persistence/Legacy/Content/Language/Mapper.php

-
message: '#^Call to function is_int\(\) with 2\|int\<4, max\> will always evaluate to true\.$#'
identifier: function.alreadyNarrowedType
count: 1
path: src/lib/Persistence/Legacy/Content/Language/MaskGenerator.php

-
message: '#^Method Ibexa\\Core\\Persistence\\Legacy\\Content\\Language\\MaskGenerator\:\:extractLanguageCodesFromMask\(\) return type has no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
count: 1
path: src/lib/Persistence/Legacy/Content/Language/MaskGenerator.php

-
message: '#^Method Ibexa\\Core\\Persistence\\Legacy\\Content\\Language\\MaskGenerator\:\:extractLanguageIdsFromMask\(\) return type has no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
count: 1
path: src/lib/Persistence/Legacy/Content/Language/MaskGenerator.php

-
message: '#^Method Ibexa\\Core\\Persistence\\Legacy\\Content\\Language\\MaskGenerator\:\:isLanguageAlwaysAvailable\(\) has parameter \$languages with no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
count: 1
path: src/lib/Persistence/Legacy/Content/Language/MaskGenerator.php

-
message: '#^Parameter \#1 \$array of function array_keys expects array, iterable\<Ibexa\\Contracts\\Core\\Persistence\\Content\\Language\> given\.$#'
identifier: argument.type
count: 1
path: src/lib/Persistence/Legacy/Content/Language/MaskGenerator.php

-
message: '#^Property Ibexa\\Core\\Persistence\\Legacy\\Content\\Language\\MaskGenerator\:\:\$languageHandler \(Ibexa\\Core\\Persistence\\Legacy\\Content\\Language\\Handler\) does not accept Ibexa\\Contracts\\Core\\Persistence\\Content\\Language\\Handler\.$#'
identifier: assign.propertyType
count: 1
path: src/lib/Persistence/Legacy/Content/Language/MaskGenerator.php

-
message: '#^Method Ibexa\\Core\\Persistence\\Legacy\\Content\\Location\\Gateway\:\:getBasicNodeData\(\) return type has no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
Expand Down Expand Up @@ -12654,24 +12618,6 @@ parameters:
count: 1
path: src/lib/Persistence/Legacy/Content/UrlAlias/Gateway/DoctrineDatabase.php

-
message: '#^Method Ibexa\\Core\\Persistence\\Legacy\\Content\\UrlAlias\\Gateway\\DoctrineDatabase\:\:updateRow\(\) has parameter \$values with no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
count: 1
path: src/lib/Persistence/Legacy/Content/UrlAlias/Gateway/DoctrineDatabase.php

-
message: '#^Parameter \#2 \$callback of function array_filter expects \(callable\(int\)\: bool\)\|null, Closure\(mixed\)\: int given\.$#'
identifier: argument.type
count: 1
path: src/lib/Persistence/Legacy/Content/UrlAlias/Gateway/DoctrineDatabase.php

-
message: '#^Variable \$connection in PHPDoc tag @var does not match assigned variable \$query\.$#'
identifier: varTag.differentVariable
count: 1
path: src/lib/Persistence/Legacy/Content/UrlAlias/Gateway/DoctrineDatabase.php

-
message: '#^Dead catch \- PDOException is never thrown in the try block\.$#'
identifier: catch.neverThrown
Expand Down Expand Up @@ -17226,12 +17172,6 @@ parameters:
count: 1
path: src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/Field.php

-
message: '#^Cannot call method getBitAndComparisonExpression\(\) on Doctrine\\DBAL\\Platforms\\AbstractPlatform\|null\.$#'
identifier: method.nonObject
count: 8
path: src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/FieldBase.php

-
message: '#^Method Ibexa\\Core\\Search\\Legacy\\Content\\Common\\Gateway\\CriterionHandler\\FieldBase\:\:getFieldCondition\(\) has parameter \$languageSettings with no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
Expand Down Expand Up @@ -17430,24 +17370,12 @@ parameters:
count: 1
path: src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/IsUserEnabled.php

-
message: '#^Cannot call method getBitAndComparisonExpression\(\) on Doctrine\\DBAL\\Platforms\\AbstractPlatform\|null\.$#'
identifier: method.nonObject
count: 1
path: src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/LanguageCode.php

-
message: '#^Method Ibexa\\Core\\Search\\Legacy\\Content\\Common\\Gateway\\CriterionHandler\\LanguageCode\:\:handle\(\) has parameter \$languageSettings with no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
count: 1
path: src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/LanguageCode.php

-
message: '#^Parameter \#1 \$languageCodes of method Ibexa\\Core\\Persistence\\Legacy\\Content\\Language\\MaskGenerator\:\:generateLanguageMaskFromLanguageCodes\(\) expects array\<string\>, array\<bool\|float\|int\|string\>\|bool\|float\|int\|string given\.$#'
identifier: argument.type
count: 1
path: src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/LanguageCode.php

-
message: '#^Method Ibexa\\Core\\Search\\Legacy\\Content\\Common\\Gateway\\CriterionHandler\\LogicalAnd\:\:handle\(\) has parameter \$languageSettings with no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
Expand Down Expand Up @@ -17664,12 +17592,6 @@ parameters:
count: 1
path: src/lib/Search/Legacy/Content/Common/Gateway/SortClauseHandler/Factory/RandomSortClauseHandlerFactory.php

-
message: '#^Cannot call method getBitAndComparisonExpression\(\) on Doctrine\\DBAL\\Platforms\\AbstractPlatform\|null\.$#'
identifier: method.nonObject
count: 8
path: src/lib/Search/Legacy/Content/Common/Gateway/SortClauseHandler/Field.php

-
message: '#^Method Ibexa\\Core\\Search\\Legacy\\Content\\Common\\Gateway\\SortClauseHandler\\Field\:\:applySelect\(\) return type has no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
Expand Down Expand Up @@ -17856,12 +17778,6 @@ parameters:
count: 1
path: src/lib/Search/Legacy/Content/Gateway/DoctrineDatabase.php

-
message: '#^Method Ibexa\\Core\\Search\\Legacy\\Content\\Gateway\\DoctrineDatabase\:\:getLanguageMask\(\) has parameter \$languageSettings with no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
count: 1
path: src/lib/Search/Legacy/Content/Gateway/DoctrineDatabase.php

-
message: '#^Method Ibexa\\Core\\Search\\Legacy\\Content\\Gateway\\DoctrineDatabase\:\:getQueryCondition\(\) has parameter \$languageFilter with no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
Expand Down Expand Up @@ -17922,30 +17838,6 @@ parameters:
count: 1
path: src/lib/Search/Legacy/Content/Handler.php

-
message: '#^Method Ibexa\\Core\\Search\\Legacy\\Content\\Handler\:\:extractMatchedLanguage\(\) has no return type specified\.$#'
identifier: missingType.return
count: 1
path: src/lib/Search/Legacy/Content/Handler.php

-
message: '#^Method Ibexa\\Core\\Search\\Legacy\\Content\\Handler\:\:extractMatchedLanguage\(\) has parameter \$languageMask with no type specified\.$#'
identifier: missingType.parameter
count: 1
path: src/lib/Search/Legacy/Content/Handler.php

-
message: '#^Method Ibexa\\Core\\Search\\Legacy\\Content\\Handler\:\:extractMatchedLanguage\(\) has parameter \$languageSettings with no type specified\.$#'
identifier: missingType.parameter
count: 1
path: src/lib/Search/Legacy/Content/Handler.php

-
message: '#^Method Ibexa\\Core\\Search\\Legacy\\Content\\Handler\:\:extractMatchedLanguage\(\) has parameter \$mainLanguageId with no type specified\.$#'
identifier: missingType.parameter
count: 1
path: src/lib/Search/Legacy/Content/Handler.php

-
message: '#^Method Ibexa\\Core\\Search\\Legacy\\Content\\Handler\:\:indexContent\(\) has no return type specified\.$#'
identifier: missingType.return
Expand Down Expand Up @@ -18138,12 +18030,6 @@ parameters:
count: 1
path: src/lib/Search/Legacy/Content/Location/Gateway/DoctrineDatabase.php

-
message: '#^Method Ibexa\\Core\\Search\\Legacy\\Content\\Location\\Gateway\\DoctrineDatabase\:\:getLanguageMask\(\) has parameter \$languageFilter with no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
count: 1
path: src/lib/Search/Legacy/Content/Location/Gateway/DoctrineDatabase.php

-
message: '#^Method Ibexa\\Core\\Search\\Legacy\\Content\\Location\\Gateway\\DoctrineDatabase\:\:getTotalCount\(\) has parameter \$languageFilter with no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
Expand Down Expand Up @@ -32634,66 +32520,6 @@ parameters:
count: 1
path: tests/lib/Persistence/Legacy/Content/Language/LanguageHandlerTest.php

-
message: '#^Method Ibexa\\Tests\\Core\\Persistence\\Legacy\\Content\\Language\\MaskGeneratorTest\:\:getLanguageHandler\(\) should return Ibexa\\Core\\Persistence\\Legacy\\Content\\Language\\Handler but returns Ibexa\\Contracts\\Core\\Persistence\\Content\\Language\\Handler\.$#'
identifier: return.type
count: 1
path: tests/lib/Persistence/Legacy/Content/Language/MaskGeneratorTest.php

-
message: '#^Method Ibexa\\Tests\\Core\\Persistence\\Legacy\\Content\\Language\\MaskGeneratorTest\:\:getLanguageIndicatorData\(\) return type has no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
count: 1
path: tests/lib/Persistence/Legacy/Content/Language/MaskGeneratorTest.php

-
message: '#^Method Ibexa\\Tests\\Core\\Persistence\\Legacy\\Content\\Language\\MaskGeneratorTest\:\:isAlwaysAvailableProvider\(\) return type has no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
count: 1
path: tests/lib/Persistence/Legacy/Content/Language/MaskGeneratorTest.php

-
message: '#^Method Ibexa\\Tests\\Core\\Persistence\\Legacy\\Content\\Language\\MaskGeneratorTest\:\:languageIdsFromMaskProvider\(\) return type has no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
count: 1
path: tests/lib/Persistence/Legacy/Content/Language/MaskGeneratorTest.php

-
message: '#^Method Ibexa\\Tests\\Core\\Persistence\\Legacy\\Content\\Language\\MaskGeneratorTest\:\:removeAlwaysAvailableFlagProvider\(\) return type has no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
count: 1
path: tests/lib/Persistence/Legacy/Content/Language/MaskGeneratorTest.php

-
message: '#^Method Ibexa\\Tests\\Core\\Persistence\\Legacy\\Content\\Language\\MaskGeneratorTest\:\:testExtractLanguageIdsFromMask\(\) has parameter \$expectedResult with no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
count: 1
path: tests/lib/Persistence/Legacy/Content/Language/MaskGeneratorTest.php

-
message: '#^Method Ibexa\\Tests\\Core\\Persistence\\Legacy\\Content\\Language\\MaskGeneratorTest\:\:testRemoveAlwaysAvailableFlag\(\) has parameter \$expectedResult with no type specified\.$#'
identifier: missingType.parameter
count: 1
path: tests/lib/Persistence/Legacy/Content/Language/MaskGeneratorTest.php

-
message: '#^Method Ibexa\\Tests\\Core\\Persistence\\Legacy\\Content\\Language\\MaskGeneratorTest\:\:testRemoveAlwaysAvailableFlag\(\) has parameter \$langMask with no type specified\.$#'
identifier: missingType.parameter
count: 1
path: tests/lib/Persistence/Legacy/Content/Language/MaskGeneratorTest.php

-
message: '#^Offset string might not exist on array\{\}\|array\{eng\-US\?\: Ibexa\\Contracts\\Core\\Persistence\\Content\\Language, eng\-GB\?\: Ibexa\\Contracts\\Core\\Persistence\\Content\\Language\}\.$#'
identifier: offsetAccess.notFound
count: 1
path: tests/lib/Persistence/Legacy/Content/Language/MaskGeneratorTest.php

-
message: '#^Property Ibexa\\Tests\\Core\\Persistence\\Legacy\\Content\\LanguageAwareTestCase\:\:\$languageHandler \(Ibexa\\Contracts\\Core\\Persistence\\Content\\Language\\Handler\) in isset\(\) is not nullable\.$#'
identifier: isset.property
count: 1
path: tests/lib/Persistence/Legacy/Content/Language/MaskGeneratorTest.php

-
message: '#^Method Ibexa\\Tests\\Core\\Persistence\\Legacy\\Content\\LanguageAwareTestCase\:\:getFullTextSearchConfiguration\(\) has no return type specified\.$#'
identifier: missingType.return
Expand All @@ -32712,12 +32538,6 @@ parameters:
count: 1
path: tests/lib/Persistence/Legacy/Content/LanguageAwareTestCase.php

-
message: '#^Property Ibexa\\Tests\\Core\\Persistence\\Legacy\\Content\\LanguageAwareTestCase\:\:\$languageMaskGenerator \(Ibexa\\Core\\Persistence\\Legacy\\Content\\Language\\MaskGenerator\) in isset\(\) is not nullable\.$#'
identifier: isset.property
count: 1
path: tests/lib/Persistence/Legacy/Content/LanguageAwareTestCase.php

-
message: '#^Method Ibexa\\Tests\\Core\\Persistence\\Legacy\\Content\\LanguageHandlerMock\:\:delete\(\) has no return type specified\.$#'
identifier: missingType.return
Expand Down Expand Up @@ -33582,12 +33402,6 @@ parameters:
count: 1
path: tests/lib/Persistence/Legacy/Content/Type/MapperTest.php

-
message: '#^Method Ibexa\\Tests\\Core\\Persistence\\Legacy\\Content\\Type\\MapperTest\:\:getMaskGeneratorMock\(\) has no return type specified\.$#'
identifier: missingType.return
count: 1
path: tests/lib/Persistence/Legacy/Content/Type/MapperTest.php

-
message: '#^Call to an undefined method Ibexa\\Core\\Persistence\\Legacy\\Content\\Type\\ContentUpdater\:\:expects\(\)\.$#'
identifier: method.notFound
Expand Down Expand Up @@ -34218,12 +34032,6 @@ parameters:
count: 1
path: tests/lib/Persistence/Legacy/Content/UrlAlias/UrlAliasHandlerTest.php

-
message: '#^Property Ibexa\\Tests\\Core\\Persistence\\Legacy\\Content\\UrlAlias\\UrlAliasHandlerTest\:\:\$languageMaskGenerator \(Ibexa\\Core\\Persistence\\Legacy\\Content\\Language\\MaskGenerator\) in isset\(\) is not nullable\.$#'
identifier: isset.property
count: 1
path: tests/lib/Persistence/Legacy/Content/UrlAlias/UrlAliasHandlerTest.php

-
message: '#^Property Ibexa\\Tests\\Core\\Persistence\\Legacy\\Content\\UrlAlias\\UrlAliasHandlerTest\:\:\$locationGateway \(Ibexa\\Core\\Persistence\\Legacy\\Content\\Location\\Gateway\) in isset\(\) is not nullable\.$#'
identifier: isset.property
Expand Down
28 changes: 12 additions & 16 deletions src/bundle/Core/Command/BackfillLanguageTranslationsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
The command <info>%command.name%</info> populates "ibexa_content_translation",
"ibexa_content_version_translation" and "ibexa_url_alias_ml_translation" from the existing
"language_mask"/"lang_mask" bitmask columns, and sets "always_available" on "ibexa_content"
and "ibexa_content_version" from bit 0 of "language_mask". It is idempotent - already-backfilled rows are
and "ibexa_content_version" and "is_always_available" on "ibexa_url_alias_ml" from bit 0 of
the mask. It is idempotent - already-backfilled rows are
skipped - so it is safe to re-run, including after a partial/interrupted run.

Run <info>ibexa:languages:verify-translations</info> afterward to confirm the backfill is complete.
Expand Down Expand Up @@ -122,7 +123,7 @@ private function backfillTable(
SELECT u.parent, u.text_md5, l.id FROM ibexa_url_alias_ml u
JOIN %s l ON (u.lang_mask & l.id) = l.id
WHERE u.id BETWEEN :from AND :to %s',
null,
'is_always_available',
],
default => throw new InvalidArgumentException('table', "unknown table \"{$table}\"."),
};
Expand Down Expand Up @@ -165,27 +166,22 @@ private function backfillTable(
for ($from = $minId; $from <= $maxId; $from += $batchSize) {
$to = min($from + $batchSize - 1, $maxId);

$flagged = 0;
if ($dryRun) {
$inserted = (int)$this->connection->fetchOne(
$this->buildDryRunCountSql($table, $languageTable),
['from' => $from, 'to' => $to]
);
if ($alwaysAvailableColumn !== null) {
$flagged = (int)$this->connection->fetchOne(
"SELECT COUNT(*) FROM {$sourceTable} WHERE {$pkColumn} BETWEEN :from AND :to AND {$alwaysAvailableMismatch}",
['from' => $from, 'to' => $to]
);
}
$flagged = (int)$this->connection->fetchOne(
"SELECT COUNT(*) FROM {$sourceTable} WHERE {$pkColumn} BETWEEN :from AND :to AND {$alwaysAvailableMismatch}",
['from' => $from, 'to' => $to]
);
} else {
$inserted = $this->connection->executeStatement($insertSql, ['from' => $from, 'to' => $to]);
if ($alwaysAvailableColumn !== null) {
$flagged = $this->connection->executeStatement(
"UPDATE {$sourceTable} SET {$alwaysAvailableColumn} = (({$maskColumn} & 1) = 1)
WHERE {$pkColumn} BETWEEN :from AND :to AND {$alwaysAvailableMismatch}",
['from' => $from, 'to' => $to]
);
}
$flagged = $this->connection->executeStatement(
"UPDATE {$sourceTable} SET {$alwaysAvailableColumn} = (({$maskColumn} & 1) = 1)
WHERE {$pkColumn} BETWEEN :from AND :to AND {$alwaysAvailableMismatch}",
['from' => $from, 'to' => $to]
);
}

$totalInserted += $inserted;
Expand Down
Loading
Loading