From: Michael M Slusarz Date: Wed, 5 Aug 2009 03:32:30 +0000 (-0600) Subject: Ignore caching if a Horde_Cache_Null object is returned X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=2671fc3837059d1d80cf71ebc7d11162093f5416;p=horde.git Ignore caching if a Horde_Cache_Null object is returned --- diff --git a/imp/lib/IMP.php b/imp/lib/IMP.php index 73e273aa7..97372ab8d 100644 --- a/imp/lib/IMP.php +++ b/imp/lib/IMP.php @@ -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; } /** diff --git a/imp/lib/Imap/Tree.php b/imp/lib/Imap/Tree.php index b9c886b0d..147dcddf1 100644 --- a/imp/lib/Imap/Tree.php +++ b/imp/lib/Imap/Tree.php @@ -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()); }