From 5cbb902e29a70daf2faca24ecbec3645d8896427 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Wed, 22 Dec 2010 11:36:36 -0700 Subject: [PATCH] Cache imp backends.php config --- imp/lib/Imap.php | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/imp/lib/Imap.php b/imp/lib/Imap.php index de04f695d..061ec7aac 100644 --- a/imp/lib/Imap.php +++ b/imp/lib/Imap.php @@ -23,6 +23,13 @@ class IMP_Imap implements Serializable public $ob = null; /** + * Server configuration file. + * + * @var array + */ + static protected $_config; + + /** * Is connection read-only? * * @var array @@ -350,14 +357,20 @@ class IMP_Imap implements Serializable */ static public function loadServerConfig($server = null) { - try { - $servers = Horde::loadConfiguration('backends.php', 'servers', 'imp'); - if ($servers === null) { - $servers = false; + if (isset(self::$_config)) { + $servers = self::$_config; + } else { + try { + $servers = Horde::loadConfiguration('backends.php', 'servers', 'imp'); + if (is_null($servers)) { + return false; + } + } catch (Horde_Exception $e) { + Horde::logMessage($e, 'ERR'); + return false; } - } catch (Horde_Exception $e) { - Horde::logMessage($e, 'ERR'); - return false; + + self::$_config = $servers; } if (is_null($server)) { -- 2.11.0