Index: typo3/sysext/cms/tslib/class.tslib_fe.php =================================================================== --- typo3/sysext/cms/tslib/class.tslib_fe.php (revision 7712) +++ typo3/sysext/cms/tslib/class.tslib_fe.php (working copy) @@ -1828,7 +1828,21 @@ function cHashParams($addQueryParams) { return t3lib_div::cHashParams($addQueryParams); } - + + /** + * Sets the cache expiration timestamp + * + * @param integer Expiration timestamp when the cache is outdated + * @return void + * @access public + */ + function setPageCacheExpiresTimestamp($timestamp) { + if ($timestamp > $GLOBALS['EXEC_TIME'] && ($this->cacheExpires == 0 || $timestamp < $this->cacheExpires)) { + $this->cacheExpires = $timestamp; + } + } + + /** * Initialize the TypoScript template parser * @@ -2830,29 +2844,39 @@ * @see realPageCacheContent(), tempPageCacheContent() */ function setPageCacheContent($content, $data, $expirationTstamp) { + + // only if content is not "message_page_is_being_generated" + // which expires after 30 seconds + if (!$this->tempContent) { + // can be changed from an extension via $GLOBALS['TSFE']->setPageCacheExpiresTimestamp() + // $this->cacheExpires is default 0 + if ($this->cacheExpires > $GLOBALS['EXEC_TIME'] && $expirationTstamp > $this->cacheExpires) { + $expirationTstamp = $this->cacheExpires; + } + } + + $cacheData = array( + 'hash' => $this->newHash, + 'page_id' => $this->id, + 'temp_content' => $this->tempContent, + 'cache_data' => serialize($data), + 'expires' => $expirationTstamp, + 'tstamp' => $GLOBALS['EXEC_TIME'] + ); + if ($this->page_cache_reg1) { + $reg1 = intval($this->page_cache_reg1); + $cacheData['reg1'] = $reg1; + $this->pageCacheTags[] = 'reg1_' . $reg1; + } + + $this->cacheExpires = $expirationTstamp; + if (TYPO3_UseCachingFramework) { - $cacheData = array( - 'identifier' => $this->newHash, - 'page_id' => $this->id, - 'content' => $content, - 'temp_content' => $this->tempContent, - 'cache_data' => serialize($data), - 'expires' => $expirationTstamp, - 'tstamp' => $GLOBALS['EXEC_TIME'] - ); - - $this->cacheExpires = $expirationTstamp; + $cacheData['content'] = $content; $this->pageCacheTags[] = 'pageId_' . $cacheData['page_id']; - if ($this->page_cache_reg1) { - $reg1 = intval($this->page_cache_reg1); - - $cacheData['reg1'] = $reg1; - $this->pageCacheTags[] = 'reg1_' . $reg1; - } - $this->pageCache->set( $this->newHash, $cacheData, @@ -2861,23 +2885,10 @@ ); } else { $this->clearPageCacheContent(); - $insertFields = array( - 'hash' => $this->newHash, - 'page_id' => $this->id, - 'HTML' => $content, - 'temp_content' => $this->tempContent, - 'cache_data' => serialize($data), - 'expires' => $expirationTstamp, - 'tstamp' => $GLOBALS['EXEC_TIME'] - ); - - $this->cacheExpires = $expirationTstamp; + $cacheData['HTML'] = $content; - if ($this->page_cache_reg1) { - $insertFields['reg1'] = intval($this->page_cache_reg1); - } - $this->pageCachePostProcess($insertFields,'set'); - $GLOBALS['TYPO3_DB']->exec_INSERTquery('cache_pages', $insertFields); + $this->pageCachePostProcess($cacheData,'set'); + $GLOBALS['TYPO3_DB']->exec_INSERTquery('cache_pages', $cacheData); } }