From e57b3169f99260567490cccc9529cbf5f2d850e9 Mon Sep 17 00:00:00 2001
From: Elmar Hinz <t3elmar@gmail.com>
Date: Mon, 29 May 2017 19:22:11 +0200
Subject: [PATCH] [CLEANUP] Review comment of getPageAndRootline()

Releases: master
Resolves: #81280
Change-Id: Ib67d57b69e9d5cd4f46cd8c7201107ec5945d64c
Reviewed-on: https://review.typo3.org/52963
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Frank Naegler <frank.naegler@typo3.org>
Tested-by: Frank Naegler <frank.naegler@typo3.org>
---
 .../TypoScriptFrontendController.php          | 45 ++++++++++++++++---
 1 file changed, 40 insertions(+), 5 deletions(-)

diff --git a/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php b/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php
index 92c875250a18..8d7c34c6820e 100644
--- a/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php
+++ b/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php
@@ -1382,14 +1382,49 @@ class TypoScriptFrontendController
     }
 
     /**
-     * Gets the page and rootline arrays based on the id, $this->id
+     * Loads the page and root line records based on $this->id
      *
-     * If the id does not correspond to a proper page, the 'previous' valid page in the rootline is found
-     * If the page is a shortcut (doktype=4), the ->id is loaded with that id
+     * A final page and the matching root line are determined and loaded by
+     * the algorithm defined by this method.
      *
-     * Whether or not the ->id is changed to the shortcut id or the previous id in rootline (eg if a page is hidden), the ->page-array and ->rootline is found and must also be valid.
+     * First it loads the initial page from the page repository for $this->id.
+     * If that can't be loaded directly, it gets the root line for $this->id.
+     * It walks up the root line towards the root page until the page
+     * repository can deliver a page record. (The loading restrictions of
+     * the root line records are more liberal than that of the page record.)
      *
-     * Sets or manipulates internal variables such as: $this->id, $this->page, $this->rootLine, $this->MP, $this->pageNotFound
+     * Now the page type is evaluated and handled if necessary. If the page is
+     * a short cut, it is replaced by the target page. If the page is a mount
+     * point in overlay mode, the page is replaced by the mounted page.
+     *
+     * After this potential replacements are done, the root line is loaded
+     * (again) for this page record. It walks up the root line up to
+     * the first viewable record.
+     *
+     * (While upon the first accessibility check of the root line it was done
+     * by loading page by page from the page repository, this time the method
+     * checkRootlineForIncludeSection() is used to find the most distant
+     * accessible page within the root line.)
+     *
+     * Having found the final page id, the page record and the root line are
+     * loaded for last time by this method.
+     *
+     * Exceptions may be thrown for DOKTYPE_SPACER and not loadable page records
+     * or root lines.
+     *
+     * If $GLOBALS['TYPO3_CONF_VARS']['FE']['pageNotFound_handling'] is set,
+     * instead of throwing an exception it's handled by a page unavailable
+     * handler.
+     *
+     * May set or update this properties:
+     *
+     * @see TypoScriptFrontendController::$id
+     * @see TypoScriptFrontendController::$MP
+     * @see TypoScriptFrontendController::$page
+     * @see TypoScriptFrontendController::$pageNotFound
+     * @see TypoScriptFrontendController::$pageAccessFailureHistory
+     * @see TypoScriptFrontendController::$originalMountPointPage
+     * @see TypoScriptFrontendController::$originalShortcutPage
      *
      * @throws ServiceUnavailableException
      * @throws PageNotFoundException
-- 
GitLab