Revert "[TASK] Avoid slow array functions in loops"
[Packages/TYPO3.CMS.git] / typo3 / sysext / backend / Classes / Controller / Page / TreeController.php
index 8a7b2c8..79f8c53 100644 (file)
@@ -21,13 +21,13 @@ use TYPO3\CMS\Backend\Configuration\BackendUserConfiguration;
 use TYPO3\CMS\Backend\Tree\Repository\PageTreeRepository;
 use TYPO3\CMS\Backend\Utility\BackendUtility;
 use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
+use TYPO3\CMS\Core\Database\Query\Restriction\DocumentTypeExclusionRestriction;
 use TYPO3\CMS\Core\Exception\Page\RootLineException;
 use TYPO3\CMS\Core\Exception\SiteNotFoundException;
 use TYPO3\CMS\Core\Http\JsonResponse;
 use TYPO3\CMS\Core\Imaging\Icon;
 use TYPO3\CMS\Core\Imaging\IconFactory;
 use TYPO3\CMS\Core\Localization\LanguageService;
-use TYPO3\CMS\Core\Site\PseudoSiteFinder;
 use TYPO3\CMS\Core\Site\SiteFinder;
 use TYPO3\CMS\Core\Type\Bitmask\JsConfirmation;
 use TYPO3\CMS\Core\Type\Bitmask\Permission;
@@ -266,7 +266,6 @@ class TreeController
         if (trim($visibleText) === '') {
             $visibleText = htmlspecialchars('[' . $this->getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.no_title') . ']');
         }
-        $visibleText = GeneralUtility::fixed_lgd_cs($visibleText, (int)$this->getBackendUser()->uc['titleLen'] ?: 40);
 
         if ($this->addDomainName && $page['is_siteroot']) {
             $domain = $this->getDomainNameForPage($pageId);
@@ -323,7 +322,18 @@ class TreeController
     protected function getAllEntryPointPageTrees(): array
     {
         $backendUser = $this->getBackendUser();
-        $repository = GeneralUtility::makeInstance(PageTreeRepository::class, (int)$backendUser->workspace);
+
+        $userTsConfig = $this->getBackendUser()->getTSConfig();
+        $excludedDocumentTypes = GeneralUtility::intExplode(',', $userTsConfig['options.']['pageTree.']['excludeDoktypes'] ?? '', true);
+
+        $additionalPageTreeQueryRestrictions = [];
+        if (!empty($excludedDocumentTypes)) {
+            foreach ($excludedDocumentTypes as $excludedDocumentType) {
+                $additionalPageTreeQueryRestrictions[] = new DocumentTypeExclusionRestriction((int)$excludedDocumentType);
+            }
+        }
+
+        $repository = GeneralUtility::makeInstance(PageTreeRepository::class, (int)$backendUser->workspace, [], $additionalPageTreeQueryRestrictions);
 
         $entryPoints = (int)($backendUser->uc['pageTree_temporaryMountPoint'] ?? 0);
         if ($entryPoints > 0) {
@@ -388,14 +398,7 @@ class TreeController
             $site = $siteFinder->getSiteByRootPageId($pageId);
             $domain = (string)$site->getBase();
         } catch (SiteNotFoundException $e) {
-            // No site found, let's see if it is a legacy-pseudo-site
-            $pseudoSiteFinder = GeneralUtility::makeInstance(PseudoSiteFinder::class);
-            try {
-                $site = $pseudoSiteFinder->getSiteByRootPageId($pageId);
-                $domain = trim((string)$site->getBase(), '/');
-            } catch (SiteNotFoundException $e) {
-                // No pseudo-site found either
-            }
+            // No site found
         }
 
         return $domain;