From 2671fc3837059d1d80cf71ebc7d11162093f5416 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Tue, 4 Aug 2009 21:32:30 -0600 Subject: [PATCH] Ignore caching if a Horde_Cache_Null object is returned --- imp/lib/IMP.php | 7 +++++-- imp/lib/Imap/Tree.php | 3 +-- 2 files changed, 6 insertions(+), 4 deletions(-) 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()); } -- 2.11.0