[TASK] Detect page routes based on deleted+workspace restriction 84/58084/2
authorBenni Mack <benni@typo3.org>
Thu, 30 Aug 2018 11:35:34 +0000 (13:35 +0200)
committerSusanne Moog <susanne.moog@typo3.org>
Thu, 30 Aug 2018 17:04:31 +0000 (19:04 +0200)
The Page Router checks for all pages that are available by using
the FrontendRestrictionContainer for database queries.

This leads to side-effects in the future.

Instead, - because all page slugs in one site are unique per
language+workspace - the Page Router should only check
for deleted+current workspace, not wondering about any other
restriction, as this is done when all pages in the rootline are
checked later-on anyway.

This way, frontend previews should be available again.

Resolves: #86037
Releases: master
Change-Id: Ic11a66a958f9391de9084fad86b5d59109bd21c3
Reviewed-on: https://review.typo3.org/58084
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Daniel Sattler <sattler@b13.de>
Tested-by: Daniel Sattler <sattler@b13.de>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Susanne Moog <susanne.moog@typo3.org>
Tested-by: Susanne Moog <susanne.moog@typo3.org>
typo3/sysext/core/Classes/Routing/PageRouter.php

index b43e99a..3a634ef 100644 (file)
@@ -24,7 +24,8 @@ use Symfony\Component\Routing\RequestContext;
 use Symfony\Component\Routing\Route;
 use Symfony\Component\Routing\RouteCollection;
 use TYPO3\CMS\Core\Database\ConnectionPool;
-use TYPO3\CMS\Core\Database\Query\Restriction\FrontendRestrictionContainer;
+use TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction;
+use TYPO3\CMS\Core\Database\Query\Restriction\FrontendWorkspaceRestriction;
 use TYPO3\CMS\Core\Site\Entity\SiteInterface;
 use TYPO3\CMS\Core\Site\Entity\SiteLanguage;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
@@ -113,7 +114,10 @@ class PageRouter
         $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
             ->getQueryBuilderForTable('pages');
         $queryBuilder
-            ->setRestrictions(GeneralUtility::makeInstance(FrontendRestrictionContainer::class));
+            ->getRestrictions()
+            ->removeAll()
+            ->add(GeneralUtility::makeInstance(DeletedRestriction::class))
+            ->add(GeneralUtility::makeInstance(FrontendWorkspaceRestriction::class));
 
         $statement = $queryBuilder
             ->select('uid', 'l10n_parent', 'pid', 'slug')