Cache imp backends.php config
authorMichael M Slusarz <slusarz@curecanti.org>
Wed, 22 Dec 2010 18:36:36 +0000 (11:36 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Wed, 22 Dec 2010 18:36:36 +0000 (11:36 -0700)
imp/lib/Imap.php

index de04f69..061ec7a 100644 (file)
@@ -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)) {