Skip to content

Commit

Permalink
[TASK] Simplify frontend page generation code
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
helhum authored and liayn committed May 9, 2018
1 parent 2cdbfde commit 7a0b88d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
Expand Up @@ -3248,6 +3248,7 @@ public function generatePage_preProcessing()
*/
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;
Expand Down Expand Up @@ -3329,6 +3330,7 @@ public function preparePageContentGeneration()

// Global content object
$this->newCObj();
$this->getTimeTracker()->pull();
}

/**
Expand Down
17 changes: 7 additions & 10 deletions typo3/sysext/frontend/Classes/Http/RequestHandler.php
Expand Up @@ -74,25 +74,22 @@ public function handle(ServerRequestInterface $request): ResponseInterface

// 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();
}
Expand Down
Expand Up @@ -62,6 +62,7 @@ public function process(ServerRequestInterface $request, PsrRequestHandlerInterf
$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
Expand Down

0 comments on commit 7a0b88d

Please sign in to comment.