[BUGFIX] Remove wrong usage of PageRepository->error_getRootLine_failPid 21/52621/4
authorBenni Mack <benni@typo3.org>
Wed, 26 Apr 2017 19:38:35 +0000 (21:38 +0200)
committerGeorg Ringer <georg.ringer@gmail.com>
Thu, 27 Apr 2017 11:34:17 +0000 (13:34 +0200)
The TypoScript frontend calls TSFE->sys_page->getRootline() which fills
the public property "error_getRootLine_failPid" when the third parameter
is set. Otherwise it throws an exception.

Setting this option was actually removed in TYPO3 when the RootlineUtility
was introduced, making the third parameter very non-useful, as it does not
throw exceptions but instead writing some weird values in the error_getRootLine
property.

It also goes back to the case where branch versioning was still supported.

In case of regular frontend requests there is a lot of dead code now because
of always-false checks on $TSFE->sys_page->error_getRootLine_failPid == -1.

Resolves: #81027
Releases: master, 8.7
Change-Id: I141f145c1855f09c33f003422c8e34653bf7f951
Reviewed-on: https://review.typo3.org/52621
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php

index a27dc71..15112cc 100644 (file)
@@ -1185,27 +1185,10 @@ class TypoScriptFrontendController
                     }
                 }
             }
-            if ($this->id) {
-                if ($this->determineIdIsHiddenPage()) {
-                    // The preview flag is set only if the current page turns out to actually be hidden!
-                    $this->fePreview = 1;
-                    $this->showHiddenPage = true;
-                }
-                // For Live workspace: Check root line for proper connection to tree root (done because of possible preview of page / branch versions)
-                if (!$this->fePreview && $this->whichWorkspace() === 0) {
-                    // Initialize the page-select functions to check rootline:
-                    $temp_sys_page = GeneralUtility::makeInstance(PageRepository::class);
-                    $temp_sys_page->init($this->showHiddenPage);
-                    // If root line contained NO records and ->error_getRootLine_failPid tells us that it was because of a pid=-1 (indicating a "version" record)...:
-                    if (empty($temp_sys_page->getRootLine($this->id, $this->MP)) && $temp_sys_page->error_getRootLine_failPid == -1) {
-                        // Setting versioningPreview flag and try again:
-                        $temp_sys_page->versioningPreview = true;
-                        if (!empty($temp_sys_page->getRootLine($this->id, $this->MP))) {
-                            // Finally, we got a root line (meaning that it WAS due to versioning preview of a page somewhere) and we set the fePreview flag which in itself will allow sys_page class to display previews of versionized records.
-                            $this->fePreview = 1;
-                        }
-                    }
-                }
+            if ($this->id && $this->determineIdIsHiddenPage()) {
+                // The preview flag is set only if the current page turns out to actually be hidden!
+                $this->fePreview = 1;
+                $this->showHiddenPage = true;
             }
             // The preview flag will be set if a backend user is in an offline workspace
             if (
@@ -1492,23 +1475,13 @@ class TypoScriptFrontendController
         $this->rootLine = $this->sys_page->getRootLine($this->id, $this->MP);
         // If not rootline we're off...
         if (empty($this->rootLine)) {
-            $ws = $this->whichWorkspace();
-            if ($this->sys_page->error_getRootLine_failPid == -1 && $ws) {
-                $this->sys_page->versioningPreview = true;
-                $this->sys_page->versioningWorkspaceId = $ws;
-                $this->rootLine = $this->sys_page->getRootLine($this->id, $this->MP);
-            }
-            if (empty($this->rootLine)) {
-                $message = 'The requested page didn\'t have a proper connection to the tree-root!';
-                if ($this->checkPageUnavailableHandler()) {
-                    $this->pageUnavailableAndExit($message);
-                } else {
-                    $rootline = '(' . $this->sys_page->error_getRootLine . ')';
-                    GeneralUtility::sysLog($message, 'cms', GeneralUtility::SYSLOG_SEVERITY_ERROR);
-                    throw new ServiceUnavailableException($message . '<br /><br />' . $rootline, 1301648167);
-                }
+            $message = 'The requested page didn\'t have a proper connection to the tree-root!';
+            if ($this->checkPageUnavailableHandler()) {
+                $this->pageUnavailableAndExit($message);
+            } else {
+                GeneralUtility::sysLog($message, 'cms', GeneralUtility::SYSLOG_SEVERITY_ERROR);
+                throw new ServiceUnavailableException($message, 1301648167);
             }
-            $this->fePreview = 1;
         }
         // Checking for include section regarding the hidden/starttime/endtime/fe_user (that is access control of a whole subbranch!)
         if ($this->checkRootlineForIncludeSection()) {