[BUGFIX] Only fetch default language page for tree lists 67/58967/4
authorBenni Mack <benni@typo3.org>
Wed, 28 Nov 2018 07:03:05 +0000 (08:03 +0100)
committerAnja Leichsenring <aleichsenring@ab-softlab.de>
Wed, 28 Nov 2018 09:57:47 +0000 (10:57 +0100)
Due to the removal of pages_language_overlay the queries
for fetching trees have to work as before - mainly because the
concept of the "pid" (= storagePid) works the same - records on a
page have the pid of the default language, not of any translation.

Therefore, the used queries have to be built to check for
sys_language_uid=0.

Resolves: #87020
Related: #86961
Releases: master
Change-Id: Ie7740b6a32618a213d569362a58b9f8e5ed7824d
Reviewed-on: https://review.typo3.org/58967
Reviewed-by: Richard Haeser <richard@maxserv.com>
Tested-by: Richard Haeser <richard@maxserv.com>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
typo3/sysext/backend/Classes/FrontendBackendUserAuthentication.php
typo3/sysext/core/Classes/Database/QueryGenerator.php
typo3/sysext/core/Classes/Database/QueryView.php
typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php

index dd267e3..891a3a1 100644 (file)
@@ -272,6 +272,7 @@ class FrontendBackendUserAuthentication extends BackendUserAuthentication
                 ->from('pages')
                 ->where(
                     $queryBuilder->expr()->eq('pid', $queryBuilder->createNamedParameter($id, \PDO::PARAM_INT)),
+                    $queryBuilder->expr()->eq('sys_language_uid', 0),
                     QueryHelper::stripLogicalOperatorPrefix($perms_clause)
                 )
                 ->execute();
index 9dedcf5..69f7804 100644 (file)
@@ -1586,7 +1586,10 @@ class QueryGenerator
             $queryBuilder->getRestrictions()->removeAll()->add(GeneralUtility::makeInstance(DeletedRestriction::class));
             $queryBuilder->select('uid')
                 ->from('pages')
-                ->where($queryBuilder->expr()->eq('pid', $queryBuilder->createNamedParameter($id, \PDO::PARAM_INT)))
+                ->where(
+                    $queryBuilder->expr()->eq('pid', $queryBuilder->createNamedParameter($id, \PDO::PARAM_INT)),
+                    $queryBuilder->expr()->eq('sys_language_uid', 0)
+                )
                 ->orderBy('uid');
             if ($permClause !== '') {
                 $queryBuilder->andWhere(QueryHelper::stripLogicalOperatorPrefix($permClause));
index 2e81f3a..0244492 100644 (file)
@@ -908,6 +908,7 @@ class QueryView
                 ->from('pages')
                 ->where(
                     $queryBuilder->expr()->eq('pid', $queryBuilder->createNamedParameter($id, \PDO::PARAM_INT)),
+                    $queryBuilder->expr()->eq('sys_language_uid', 0),
                     QueryHelper::stripLogicalOperatorPrefix($permsClause)
                 )
                 ->execute();
index 337f890..3b1342e 100644 (file)
@@ -6307,7 +6307,9 @@ class ContentObjectRenderer implements LoggerAwareInterface
                     $queryBuilder->expr()->eq(
                         'pid',
                         $queryBuilder->createNamedParameter($id, \PDO::PARAM_INT)
-                    )
+                    ),
+                    // tree is only built by language=0 pages
+                    $queryBuilder->expr()->eq('sys_language_uid', 0)
                 )
                 ->orderBy('sorting');