Skip to content

Commit

Permalink
[TASK] Streamline TSFE/RequestHandler for "Page Generation"
Browse files Browse the repository at this point in the history
Various documentation in TSFE is updated,
in addition to having $TSFE->setAbsRefPrefix()
to be set within the postProcessing to overcome
issues when the call is forgotten in custom
TSFE instances.

Resolves: #88555
Releases: master
Change-Id: Ib3ce22db1e6ce7b0985d486d584c26f25755efa4
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/60998
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
  • Loading branch information
bmack authored and andreaskienast committed Jun 13, 2019
1 parent 6d80870 commit 2c163af
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
Expand Up @@ -299,9 +299,9 @@ class TypoScriptFrontendController implements LoggerAwareInterface
public $newHash = '';

/**
* This flag is set before inclusion of RequestHandler IF no_cache is set. If this
* flag is set after the inclusion of RequestHandler, no_cache is forced to be set.
* This is done in order to make sure that php-code from pagegen does not falsely
* This flag is set before the page is generated IF $this->no_cache is set. If this
* flag is set after the page content was generated, $this->no_cache is forced to be set.
* This is done in order to make sure that PHP code from Plugins / USER scripts does not falsely
* clear the no_cache flag.
* @var bool
* @internal
Expand Down Expand Up @@ -399,7 +399,7 @@ class TypoScriptFrontendController implements LoggerAwareInterface
public $fileTarget = '';

/**
* If set, typolink() function encrypts email addresses. Is set in pagegen-class.
* If set, typolink() function encrypts email addresses.
* @var string|int
*/
public $spamProtectEmailAddresses = 0;
Expand Down Expand Up @@ -2473,21 +2473,20 @@ public function getPageCacheTags(): array
*
*******************************************/
/**
* Does some processing BEFORE the pagegen script is included.
* Does some processing BEFORE the page content is generated / built.
*/
public function generatePage_preProcessing()
{
// Same codeline as in getFromCache(). But $this->all has been changed by
// \TYPO3\CMS\Core\TypoScript\TemplateService::start() in the meantime, so this must be called again!
$this->newHash = $this->getHash();

// Page is generated
// Used as a safety check in case a PHP script is falsely disabling $this->no_cache during page generation.
$this->no_cacheBeforePageGen = $this->no_cache;
}

/**
* Previously located in static method in PageGenerator::init. Is solely used to set up TypoScript
* config. options and set properties in $TSFE for that.
* Sets up TypoScript "config." options and set properties in $TSFE.
*
* @param ServerRequestInterface $request
*/
Expand Down Expand Up @@ -2591,11 +2590,13 @@ protected function initializeSearchWordData($searchWords)
}

/**
* Does some processing AFTER the pagegen script is included.
* Does processing of the content after the page content was generated.
*
* This includes caching the page, indexing the page (if configured) and setting sysLastChanged
*/
public function generatePage_postProcessing()
{
$this->setAbsRefPrefix();
// This is to ensure, that the page is NOT cached if the no_cache parameter was set before the page was generated. This is a safety precaution, as it could have been unset by some script.
if ($this->no_cacheBeforePageGen) {
$this->set_no_cache('no_cache has been set before the page was generated - safety check', true);
Expand Down
1 change: 0 additions & 1 deletion typo3/sysext/frontend/Classes/Http/RequestHandler.php
Expand Up @@ -123,7 +123,6 @@ public function handle(ServerRequestInterface $request): ResponseInterface
$this->timeTracker->pull($this->timeTracker->LR ? $controller->content : '');
$this->timeTracker->decStackPointer();

$controller->setAbsRefPrefix();
$controller->generatePage_postProcessing();
$this->timeTracker->pull();
}
Expand Down

0 comments on commit 2c163af

Please sign in to comment.