Last active
October 15, 2023 19:16
-
-
Save garvinhicking/4892f6a3f50101b77a66174757d41ab5 to your computer and use it in GitHub Desktop.
ReferenceIndex Post-Patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/typo3/sysext/core/Classes/Database/ReferenceIndex.php b/typo3/sysext/core/Classes/Database/ReferenceIndex.php | |
index a5ea028d9c..39c8998f55 100644 | |
--- a/typo3/sysext/core/Classes/Database/ReferenceIndex.php | |
+++ b/typo3/sysext/core/Classes/Database/ReferenceIndex.php | |
@@ -981,6 +981,11 @@ class ReferenceIndex | |
if ($numberOfDeletedRecordsInTargetTable > 0) { | |
$numberOfHandledRecords += $numberOfDeletedRecordsInTargetTable; | |
// List of deleted=0 records in target table that have records in sys_refindex. | |
+ // Note: $subQueryBuilder actually fills parameter placeholders for the main $queryBuilder | |
+ // That means the subQuery is never meant to be executed on its own, only used to be filled-in | |
+ // via $subQueryBuilder->getSQL(). | |
+ $queryBuilder = $this->connectionPool->getQueryBuilderForTable('sys_refindex'); | |
+ $queryBuilder->getRestrictions()->removeAll(); | |
$subQueryBuilder = $this->connectionPool->getQueryBuilderForTable($tableName); | |
$subQueryBuilder->getRestrictions()->removeAll(); | |
$subQueryBuilder | |
@@ -998,8 +1003,6 @@ class ReferenceIndex | |
$queryBuilder->expr()->eq('sub_' . $tableName . '.' . $tableTca['ctrl']['delete'], 1), | |
); | |
if ($testOnly) { | |
- $queryBuilder = $this->connectionPool->getQueryBuilderForTable('sys_refindex'); | |
- $queryBuilder->getRestrictions()->removeAll(); | |
$numberOfRemovedIndexes = $queryBuilder | |
->count('hash') | |
->from('sys_refindex') | |
@@ -1010,8 +1013,6 @@ class ReferenceIndex | |
->executeQuery() | |
->fetchOne(); | |
} else { | |
- $queryBuilder = $this->connectionPool->getQueryBuilderForTable('sys_refindex'); | |
- $queryBuilder->getRestrictions()->removeAll(); | |
$numberOfRemovedIndexes = $queryBuilder | |
->delete('sys_refindex') | |
->where( |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment