[BUGFIX] Remove unused Doctrine restriction 34/57434/2
authorBenni Mack <benni@typo3.org>
Sun, 1 Jul 2018 18:13:56 +0000 (20:13 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Mon, 2 Jul 2018 09:15:55 +0000 (11:15 +0200)
During the Doctrine DBAL refactoring, an
additional check for $TSFE->sys_page->showHiddenRecords
was introduced.

First of all: This check is not needed
as the restriction container is checking for
the REAL value correctly by using
$TSFE->showHiddenRecords.

Additionally, it checks for an invalid
property on PHP object property, which
is never a good idea.

Resolves: #85446
Releases: master, 8.7
Change-Id: Ib9dd0aa0197ee7d8379110a8067c31eba2ff73e8
Reviewed-on: https://review.typo3.org/57434
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Frank Naegler <frank.naegler@typo3.org>
Tested-by: Frank Naegler <frank.naegler@typo3.org>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/core/Classes/Resource/FileRepository.php

index 7a571d1..54947a8 100644 (file)
@@ -17,7 +17,6 @@ namespace TYPO3\CMS\Core\Resource;
 use TYPO3\CMS\Backend\Utility\BackendUtility;
 use TYPO3\CMS\Core\Database\ConnectionPool;
 use TYPO3\CMS\Core\Database\Query\Restriction\FrontendRestrictionContainer;
-use TYPO3\CMS\Core\Database\Query\Restriction\HiddenRestriction;
 use TYPO3\CMS\Core\Database\RelationHandler;
 use TYPO3\CMS\Core\Resource\Exception\ResourceDoesNotExistException;
 use TYPO3\CMS\Core\Resource\Index\FileIndexRepository;
@@ -83,10 +82,6 @@ class FileRepository extends AbstractRepository
                 ->getQueryBuilderForTable('sys_file_reference');
 
             $queryBuilder->setRestrictions(GeneralUtility::makeInstance(FrontendRestrictionContainer::class));
-            if ($GLOBALS['TSFE']->sys_page->showHiddenRecords) {
-                $queryBuilder->getRestrictions()->removeByType(HiddenRestriction::class);
-            }
-
             $res = $queryBuilder
                 ->select('uid')
                 ->from('sys_file_reference')