Add theme cache checking options.
authorMichael M Slusarz <slusarz@curecanti.org>
Tue, 23 Nov 2010 20:55:15 +0000 (13:55 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Tue, 23 Nov 2010 22:47:18 +0000 (15:47 -0700)
Defaults to application version checking.

framework/Core/lib/Horde/Themes/Cache.php
horde/config/conf.xml

index 5e732af..52ee5af 100644 (file)
@@ -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');
         }
     }
index e2de2fd..efe7bb1 100644 (file)
    <case name="false" desc="No" />
    <case name="true" desc="Yes">
     <configsection name="cachethemesparams">
+     <configswitch name="check" desc="The method to use to check for updated
+     theme information.">appversion
+      <case name="appversion" desc="Application versions">
+       <configdescription>
+        The theme cache will be updated only when a new Horde version is
+        installed. This is the RECOMMENDED setting for most installations.
+       </configdescription>
+      </case>
+      <case name="none" desc="None">
+       <configdescription>
+        The theme cache is never checked for consistency. Once created, it
+        will be used until the cache entry expires.
+       </configdescription>
+      </case>
+     </configswitch>
      <configinteger name="lifetime" desc="Lifetime of the cached files, in
      seconds.">604800</configinteger>
     </configsection>