[BUGFIX] Store page title information in cache 59/38959/2
authorMarkus Klein <klein.t3@reelworx.at>
Tue, 21 Apr 2015 16:36:40 +0000 (18:36 +0200)
committerAndreas Fernandez <andreas.fernandez@aspedia.de>
Mon, 27 Apr 2015 13:19:13 +0000 (15:19 +0200)
Store page title information in page cache as well,
so we have a proper state when rendering partially cached pages.

On those pages *_INT objects might be present, which modify
the title and this has to be handled correctly.

Releases: master, 6.2
Resolves: #66499
Change-Id: If03568d36bd847c9a4ca41881a1723f6f1de7671
Reviewed-on: http://review.typo3.org/38959
Reviewed-by: Andreas Fernandez <andreas.fernandez@aspedia.de>
Tested-by: Andreas Fernandez <andreas.fernandez@aspedia.de>
typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php

index 9116db7..de869a1 100644 (file)
@@ -2424,6 +2424,12 @@ class TypoScriptFrontendController {
                                        $this->cacheContentFlag = TRUE;
                                        $this->cacheExpires = $row['expires'];
 
+                                       // Restore page title information, this is needed to generate the page title for
+                                       // partially cached pages.
+                                       $this->page['title'] = $row['pageTitleInfo']['title'];
+                                       $this->altPageTitle = $row['pageTitleInfo']['altPageTitle'];
+                                       $this->indexedDocTitle = $row['pageTitleInfo']['indexedDocTitle'];
+
                                        if (isset($this->config['config']['debug'])) {
                                                $debugCacheTime = (bool)$this->config['config']['debug'];
                                        } else {
@@ -3347,7 +3353,12 @@ class TypoScriptFrontendController {
                        'temp_content' => $this->tempContent,
                        'cache_data' => $data,
                        'expires' => $expirationTstamp,
-                       'tstamp' => $GLOBALS['EXEC_TIME']
+                       'tstamp' => $GLOBALS['EXEC_TIME'],
+                       'pageTitleInfo' => array(
+                               'title' => $this->page['title'],
+                               'altPageTitle' => $this->altPageTitle,
+                               'indexedDocTitle' => $this->indexedDocTitle
+                       )
                );
                $this->cacheExpires = $expirationTstamp;
                $this->pageCacheTags[] = 'pageId_' . $cacheData['page_id'];
@@ -3611,13 +3622,13 @@ class TypoScriptFrontendController {
                        /** @var PageRenderer $pageRenderer */
                        $pageRenderer = unserialize($this->config['INTincScript_ext']['pageRenderer']);
                        $this->setPageRenderer($pageRenderer);
-                       // restore current page title in this class to prevent overwriting custom titles of USER plugin coming from the cache
-                       $this->indexedDocTitle = $this->altPageTitle = $this->page['title'] = $pageRenderer->getTitle();
                }
+
                $this->recursivelyReplaceIntPlaceholdersInContent();
                $GLOBALS['TT']->push('Substitute header section');
                $this->INTincScript_loadJSCode();
                $this->regeneratePageTitle();
+
                $this->content = str_replace(
                        array(
                                '<!--HD_' . $this->config['INTincScript_ext']['divKey'] . '-->',