Ignore caching if a Horde_Cache_Null object is returned
authorMichael M Slusarz <slusarz@curecanti.org>
Wed, 5 Aug 2009 03:32:30 +0000 (21:32 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Wed, 5 Aug 2009 03:32:30 +0000 (21:32 -0600)
imp/lib/IMP.php
imp/lib/Imap/Tree.php

index 73e273a..97372ab 100644 (file)
@@ -1209,12 +1209,15 @@ class IMP
      * Returns a Horde_Cache object (if configured) and handles any errors
      * associated with creating the object.
      *
-     * @return Horde_Cache  A pointer to a Horde_Cache object.
+     * @return mixed  A Horde_Cache object or null.
      * @throws Horde_Exception
      */
     public static function getCache()
     {
-        return Horde_Cache::singleton($GLOBALS['conf']['cache']['driver'], Horde::getDriverConfig('cache', $GLOBALS['conf']['cache']['driver']));
+        $cache = Horde_Cache::singleton($GLOBALS['conf']['cache']['driver'], Horde::getDriverConfig('cache', $GLOBALS['conf']['cache']['driver']));
+        return ($cache instanceof Horde_Cache_Null)
+            ? null
+            : $cache;
     }
 
     /**
index b9c886b..147dcdd 100644 (file)
@@ -245,8 +245,7 @@ class IMP_Imap_Tree
                 : $ns;
         }
 
-        $imp_cache = IMP::getCache();
-        if ($imp_cache) {
+        if ($imp_cache = IMP::getCache()) {
             $_SESSION['imp']['cache']['tree'] = uniqid(mt_rand() . Horde_Auth::getAuth());
         }