[BUGFIX] Only show pages of current language in XML sitemap 42/58942/7
authorRichard Haeser <richard@maxserv.com>
Fri, 23 Nov 2018 20:48:58 +0000 (21:48 +0100)
committerGeorg Ringer <georg.ringer@gmail.com>
Mon, 3 Dec 2018 19:57:57 +0000 (20:57 +0100)
Because pages of other languages have the page id of the default language
as the parent id, we need to search for the default language only pages
to show up in the initial pagetree.

Resolves: #86961
Related: #87020
Releases: master
Change-Id: I631f900de3f11499568d4f33eec7eabfe760cb1c
Reviewed-on: https://review.typo3.org/58942
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Richard Haeser <richard@maxserv.com>
Tested-by: Richard Haeser <richard@maxserv.com>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
typo3/sysext/seo/Classes/XmlSitemap/PagesXmlSitemapDataProvider.php

index 9d85ac6..c4f48c4 100644 (file)
@@ -21,7 +21,6 @@ use TYPO3\CMS\Core\Context\Context;
 use TYPO3\CMS\Core\Context\LanguageAspect;
 use TYPO3\CMS\Core\Database\ConnectionPool;
 use TYPO3\CMS\Core\Database\Query\QueryHelper;
-use TYPO3\CMS\Core\Database\QueryGenerator;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
 use TYPO3\CMS\Frontend\Page\PageRepository;
@@ -85,14 +84,15 @@ class PagesXmlSitemapDataProvider extends AbstractXmlSitemapDataProvider
             $rootPageId = $site->getRootPageId();
         }
 
-        $queryGenerator = GeneralUtility::makeInstance(QueryGenerator::class);
-        $treeList = $queryGenerator->getTreeList($rootPageId, 99);
+        $cObj = GeneralUtility::makeInstance(ContentObjectRenderer::class);
+        $treeList = $cObj->getTreeList(-$rootPageId, 99);
+        $treeListArray = GeneralUtility::intExplode(',', $treeList);
 
         $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
             ->getQueryBuilderForTable('pages');
 
         $constraints = [
-            $queryBuilder->expr()->in('uid', $treeList)
+            $queryBuilder->expr()->in('uid', $treeListArray)
         ];
 
         if (!empty($this->config['additionalWhere'])) {