[BUGFIX] cache_clearAtMidnight conflicts with content start/endtime 60/27560/2
authorDmitry Dulepov <dmitry.dulepov@gmail.com>
Tue, 22 Oct 2013 07:30:09 +0000 (11:30 +0400)
committerHelmut Hummel <helmut.hummel@typo3.org>
Tue, 11 Feb 2014 21:29:18 +0000 (22:29 +0100)
If the config.cache_ClearAtMidnight is set, the current code of
TypoScriptFrontendController::get_cache_timeout() will not take
content's starttime/endtime into account. Thus if the content
(or other configured record) has start or end time before the
midnight, it will not be taken into account and the cache timeout
will be wrong.

Change-Id: I732da8f07270a86c62b7ce5028b12b630bb2e027
Resolves: #53028
Releases: 6.2, 6.1, 6.0
Reviewed-on: https://review.typo3.org/27560
Reviewed-by: Helmut Hummel
Tested-by: Helmut Hummel
typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php

index a2b4ac6..7255e20 100644 (file)
@@ -4517,11 +4517,11 @@ if (version == "n3") {
                                if ($midnightTime > $GLOBALS['EXEC_TIME']) {
                                        $cacheTimeout = $midnightTime - $GLOBALS['EXEC_TIME'];
                                }
-                       } else {
-                               // If cache_clearAtMidnight is not set calculate the timeout time for records on the page
-                               $calculatedCacheTimeout = $this->calculatePageCacheTimeout();
-                               $cacheTimeout = $calculatedCacheTimeout < $cacheTimeout ? $calculatedCacheTimeout : $cacheTimeout;
                        }
+
+                       // Calculate the timeout time for records on the page and adjust cache timeout if necessary
+                       $cacheTimeout = min($this->calculatePageCacheTimeout(), $cacheTimeout);
+
                        if (is_array($this->TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['get_cache_timeout'])) {
                                foreach ($this->TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['get_cache_timeout'] as $_funcRef) {
                                        $params = array('cacheTimeout' => $cacheTimeout);