[FEATURE] Add hook to tslib_fe->get_cache_timeout()
authorFabrizio Branca <mail@fabrizio-branca.de>
Mon, 27 Feb 2012 19:46:34 +0000 (20:46 +0100)
committerGeorg Ringer <mail@ringerge.org>
Wed, 29 Feb 2012 10:02:26 +0000 (11:02 +0100)
I'd like to have a hook here to influence the calculated cacheTimeout.

This could be used to have the cache lifetime of a page shortened if
there are objects on it with a shorter lifetimes.
(See #34299 and #34343)

Change-Id: I21aa08478f23fb9c6695fb6dfe403be143c98a4d
Resolves: #34346
Releases: 4.7, 4.6-backports, 4.5-backports
Reviewed-on: http://review.typo3.org/9265
Reviewed-by: Tolleiv Nietsch
Tested-by: Tolleiv Nietsch
Reviewed-by: Daniel Poetzinger
Tested-by: Daniel Poetzinger
Reviewed-by: Georg Ringer
Tested-by: Georg Ringer
typo3/sysext/cms/tslib/class.tslib_fe.php

index 6603def..6cf3a30 100644 (file)
@@ -4656,6 +4656,14 @@ if (version == "n3") {
                                $calculatedCacheTimeout = $this->calculatePageCacheTimeout();
                                $cacheTimeout = ($calculatedCacheTimeout < $cacheTimeout) ? $calculatedCacheTimeout : $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);
+                                       $cacheTimeout = t3lib_div::callUserFunction($_funcRef, $params, $this);
+                               }
+                       }
+
                        $runtimeCache->set($cachedCacheLifetimeIdentifier, $cacheTimeout);
                        $cachedCacheLifetime = $cacheTimeout;
                }