From 7a0b88dc117fcbfb40032ba5b706893b4b53b0b2 Mon Sep 17 00:00:00 2001 From: Helmut Hummel <typo3@helhum.io> Date: Tue, 1 May 2018 18:57:06 +0200 Subject: [PATCH] [TASK] Simplify frontend page generation code The additional isINTincScript check stems from the time where this code was in a separate file, which was included two times and page generation should be skipped for the second inclusion. As INT scripts are only generated during page rendering (or when fetching the page from cache) we can safely remove this condition now. Additionally, we can now easily get rid of the elseif and move the page rendering preparation directly after the same condition is checked later in the code flow. This is fine, because this code does not need to be executed before the lock is released. Last but not least we clean up admin panel messages to clearly distinguish between page generation and rendering preparation. As this is a pure non breaking cleanup, this can safely go into 8.7 branch as well. Resolves: #84945 Releases: master, 8.7 Change-Id: If12b82a549d4cc47619c46f73c5423df70621b1b Reviewed-on: https://review.typo3.org/56884 Reviewed-by: Daniel Goerz <ervaude@gmail.com> Tested-by: TYPO3com <no-reply@typo3.com> Reviewed-by: Frank Naegler <frank.naegler@typo3.org> Tested-by: Frank Naegler <frank.naegler@typo3.org> Reviewed-by: Markus Klein <markus.klein@typo3.org> Tested-by: Markus Klein <markus.klein@typo3.org> --- .../Controller/TypoScriptFrontendController.php | 2 ++ .../frontend/Classes/Http/RequestHandler.php | 17 +++++++---------- .../PrepareTypoScriptFrontendRendering.php | 1 + 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php b/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php index 3308b878cd32..67b807878662 100644 --- a/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php +++ b/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php @@ -3248,6 +3248,7 @@ class TypoScriptFrontendController implements LoggerAwareInterface */ public function preparePageContentGeneration() { + $this->getTimeTracker()->push('Prepare page content generation'); if ($this->page['content_from_pid'] > 0) { // make REAL copy of TSFE object - not reference! $temp_copy_TSFE = clone $this; @@ -3329,6 +3330,7 @@ class TypoScriptFrontendController implements LoggerAwareInterface // Global content object $this->newCObj(); + $this->getTimeTracker()->pull(); } /** diff --git a/typo3/sysext/frontend/Classes/Http/RequestHandler.php b/typo3/sysext/frontend/Classes/Http/RequestHandler.php index 044d0ddddc47..94ce4c09ae38 100644 --- a/typo3/sysext/frontend/Classes/Http/RequestHandler.php +++ b/typo3/sysext/frontend/Classes/Http/RequestHandler.php @@ -74,25 +74,22 @@ class RequestHandler implements RequestHandlerInterface, PsrRequestHandlerInterf // Generate page $controller->setUrlIdToken(); - $this->timeTracker->push('Page generation', ''); if ($controller->isGeneratePage()) { + $this->timeTracker->push('Page generation'); $controller->generatePage_preProcessing(); $controller->preparePageContentGeneration(); // Content generation - if (!$controller->isINTincScript()) { - PageGenerator::renderContent(); - $controller->setAbsRefPrefix(); - } + PageGenerator::renderContent(); + $controller->setAbsRefPrefix(); $controller->generatePage_postProcessing(); - } elseif ($controller->isINTincScript()) { - $controller->preparePageContentGeneration(); + $this->timeTracker->pull(); } $controller->releaseLocks(); - $this->timeTracker->pull(); - // Render non-cached parts + // Render non-cached page parts by replacing placeholders which are taken from cache or added during page generation if ($controller->isINTincScript()) { - $this->timeTracker->push('Non-cached objects', ''); + $controller->preparePageContentGeneration(); + $this->timeTracker->push('Non-cached objects'); $controller->INTincScript(); $this->timeTracker->pull(); } diff --git a/typo3/sysext/frontend/Classes/Middleware/PrepareTypoScriptFrontendRendering.php b/typo3/sysext/frontend/Classes/Middleware/PrepareTypoScriptFrontendRendering.php index fccdaa450b18..e67889a79d5a 100644 --- a/typo3/sysext/frontend/Classes/Middleware/PrepareTypoScriptFrontendRendering.php +++ b/typo3/sysext/frontend/Classes/Middleware/PrepareTypoScriptFrontendRendering.php @@ -62,6 +62,7 @@ class PrepareTypoScriptFrontendRendering implements MiddlewareInterface $this->timeTracker->pull(); // Get from cache $this->timeTracker->push('Get Page from cache', ''); + // Locks may be acquired here $this->controller->getFromCache(); $this->timeTracker->pull(); // Get config if not already gotten -- GitLab