From ab5b89b854746c76a26b70612c1220a8f3841824 Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Thu, 30 Oct 2014 03:59:52 -0400
Subject: [PATCH] Improve load_config() so when called many times it will read config file only once

---
 program/lib/Roundcube/rcube_plugin.php |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/program/lib/Roundcube/rcube_plugin.php b/program/lib/Roundcube/rcube_plugin.php
index 9c7a9c2..71a7ccf 100644
--- a/program/lib/Roundcube/rcube_plugin.php
+++ b/program/lib/Roundcube/rcube_plugin.php
@@ -71,6 +71,7 @@
     protected $home;
     protected $urlbase;
     private $mytask;
+    private $loaded_config = array();
 
 
     /**
@@ -141,6 +142,12 @@
      */
     public function load_config($fname = 'config.inc.php')
     {
+        if (in_array($fname, $this->loaded_config)) {
+            return;
+        }
+
+        $this->loaded_config[] = $fname;
+
         $fpath = $this->home.'/'.$fname;
         $rcube = rcube::get_instance();
 

--
Gitblit v1.9.1