+2007-04-30 Oliver Hader <oh@inpublica.de>
+
+ * Fixed feature request #5424: Menu cache expire time should be configurable
+
2007-04-28 Ernesto Baschny <ernst@cron-it.de>
* Fixed bug #4957: CSV export stop exporting a field when there is a linebreak. Thanks for Oliver Klee for the idea and solution.
* @return void
*/
function realPageCacheContent() {
- $cache_timeout = $this->page['cache_timeout'] ? $this->page['cache_timeout'] : ($this->cacheTimeOutDefault ? $this->cacheTimeOutDefault : 60*60*24); // seconds until a cached page is too old
+ $cache_timeout = $this->get_cache_timeout(); // seconds until a cached page is too old
$timeOutTime = $GLOBALS['EXEC_TIME']+$cache_timeout;
if ($this->config['config']['cache_clearAtMidnight']) {
$midnightTime = mktime (0,0,0,date('m',$timeOutTime),date('d',$timeOutTime),date('Y',$timeOutTime));
$this->cacheTimeOutDefault = intval($seconds);
}
+ /**
+ * Get the cache timeout for the current page.
+ *
+ * @return integer The cache timeout for the current page.
+ */
+ function get_cache_timeout() {
+ // Cache period was set for the page:
+ if ($this->page['cache_timeout']) {
+ $cacheTimeout = $this->page['cache_timeout'];
+ // Cache period was set for the whole site:
+ } elseif ($this->cacheTimeOutDefault) {
+ $cacheTimeout = $this->cacheTimeOutDefault;
+ // No cache period set at all, so we take one day (60*60*24 seconds = 86400 seconds):
+ } else {
+ $cacheTimeout = 86400;
+ }
+ return $cacheTimeout;
+ }
+
/**
* Substitute function for the PHP mail() function.
* It will encode the email with the setting of TS 'config.notification_email_encoding' (base64 or none)
}
$this->hash = md5(serialize($this->menuArr).serialize($this->mconf).serialize($this->tmpl->rootLine).serialize($this->MP_array));
- $serData = $this->sys_page->getHash($this->hash, 60*60*24);
+ // Get the cache timeout:
+ if ($this->conf['cache_period']) {
+ $cacheTimeout = $this->conf['cache_period'];
+ } else {
+ $cacheTimeout = $GLOBALS['TSFE']->get_cache_timeout();
+ }
+ $serData = $this->sys_page->getHash($this->hash, $cacheTimeout);
if (!$serData) {
$this->generate();
$this->sys_page->storeHash($this->hash, serialize($this->result),'MENUDATA');