[BUGFIX] Use DBAL Restrictions for index_config queries 55/52755/3
authorBenni Mack <benni@typo3.org>
Thu, 11 May 2017 06:26:58 +0000 (08:26 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Thu, 11 May 2017 12:00:06 +0000 (14:00 +0200)
The IndexSearch repository calls $TSFE->sys_page->enableFields
for queries on index_config which has very static information
(deleted/hidden) which the default restriction container handles.

Changing this code was simply forgotton to migrate to the
restriction container.

Resolves: #81188
Releases: master, 8.7
Change-Id: I159b4c2cf898e97b0e92fd2a57bcd30de0806146
Reviewed-on: https://review.typo3.org/52755
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Jan Helke <typo3@helke.de>
Tested-by: Jan Helke <typo3@helke.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/indexed_search/Classes/Domain/Repository/IndexSearchRepository.php

index 154ba8f..160597c 100644 (file)
@@ -908,7 +908,6 @@ class IndexSearchRepository
         // First, look if the freeIndexUid is a meta configuration:
         $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
             ->getQueryBuilderForTable('index_config');
-        $queryBuilder->getRestrictions()->removeAll();
         $indexCfgRec = $queryBuilder->select('indexcfgs')
             ->from('index_config')
             ->where(
@@ -916,8 +915,7 @@ class IndexSearchRepository
                 $queryBuilder->expr()->eq(
                     'uid',
                     $queryBuilder->createNamedParameter($freeIndexUid, \PDO::PARAM_INT)
-                ),
-                QueryHelper::stripLogicalOperatorPrefix($this->enableFields('index_config'))
+                )
             )
             ->execute()
             ->fetch();
@@ -931,14 +929,12 @@ class IndexSearchRepository
                 $uid = (int)$uid;
                 $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
                     ->getQueryBuilderForTable('index_config');
-                $queryBuilder->getRestrictions()->removeAll();
                 $queryBuilder->select('uid')
-                    ->from('index_config')
-                    ->where(QueryHelper::stripLogicalOperatorPrefix($this->enableFields('index_config')));
+                    ->from('index_config');
                 switch ($table) {
                     case 'index_config':
                         $idxRec = $queryBuilder
-                            ->andWhere(
+                            ->where(
                                 $queryBuilder->expr()->eq(
                                     'uid',
                                     $queryBuilder->createNamedParameter($uid, \PDO::PARAM_INT)
@@ -952,7 +948,7 @@ class IndexSearchRepository
                         break;
                     case 'pages':
                         $indexCfgRecordsFromPid = $queryBuilder
-                            ->andWhere(
+                            ->where(
                                 $queryBuilder->expr()->eq(
                                     'pid',
                                     $queryBuilder->createNamedParameter($uid, \PDO::PARAM_INT)