From 3a83e3b1737942e6fa15de1c0d239716a27e9060 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Tue, 23 Nov 2010 13:55:15 -0700 Subject: [PATCH] Add theme cache checking options. Defaults to application version checking. --- framework/Core/lib/Horde/Themes/Cache.php | 18 ++++++++++++------ horde/config/conf.xml | 15 +++++++++++++++ 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/framework/Core/lib/Horde/Themes/Cache.php b/framework/Core/lib/Horde/Themes/Cache.php index 5e732af95..52ee5af42 100644 --- a/framework/Core/lib/Horde/Themes/Cache.php +++ b/framework/Core/lib/Horde/Themes/Cache.php @@ -211,12 +211,18 @@ class Horde_Themes_Cache implements Serializable */ protected function _getExpireId() { - $id = array($GLOBALS['registry']->getVersion($this->_app)); - if ($this->_app != 'horde') { - $id[] = $GLOBALS['registry']->getVersion('horde'); - } + switch ($GLOBALS['config']['themescacheparams']['check']) { + case 'appversion': + default: + $id = array($GLOBALS['registry']->getVersion($this->_app)); + if ($this->_app != 'horde') { + $id[] = $GLOBALS['registry']->getVersion('horde'); + } + return 'v:' . implode('|', $id); - return 'v:' . implode('|', $id); + case 'none': + return ''; + } } /* Serializable methods. */ @@ -244,7 +250,7 @@ class Horde_Themes_Cache implements Serializable $this->_theme ) = unserialize($data); - if ($expire_id != $this->_getExpireId()) { + if ($expire_id && ($expire_id != $this->_getExpireId())) { throw new Exception('Cache invalidated'); } } diff --git a/horde/config/conf.xml b/horde/config/conf.xml index e2de2fdff..efe7bb112 100644 --- a/horde/config/conf.xml +++ b/horde/config/conf.xml @@ -1170,6 +1170,21 @@ + appversion + + + The theme cache will be updated only when a new Horde version is + installed. This is the RECOMMENDED setting for most installations. + + + + + The theme cache is never checked for consistency. Once created, it + will be used until the cache entry expires. + + + 604800 -- 2.11.0