[TASK] Simplify frontend page generation code 84/56884/4
authorHelmut Hummel <typo3@helhum.io>
Tue, 1 May 2018 16:57:06 +0000 (18:57 +0200)
committerMarkus Klein <markus.klein@typo3.org>
Wed, 9 May 2018 07:44:31 +0000 (09:44 +0200)
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>
typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php
typo3/sysext/frontend/Classes/Http/RequestHandler.php
typo3/sysext/frontend/Classes/Middleware/PrepareTypoScriptFrontendRendering.php

index 3308b87..67b8078 100644 (file)
@@ -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();
     }
 
     /**
index 044d0dd..94ce4c0 100644 (file)
@@ -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();
         }
index fccdaa4..e67889a 100644 (file)
@@ -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