From 5b7292eb1d03f49d58fe93ae1a456e44b8e0ab38 Mon Sep 17 00:00:00 2001
From: Peter Rotich <peter@osticket.com>
Date: Fri, 8 Apr 2016 15:57:38 +0000
Subject: [PATCH] Config  Items

Make config items caching class instance based.
---
 include/class.config.php | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/include/class.config.php b/include/class.config.php
index 165ad0846..1cbb1407c 100644
--- a/include/class.config.php
+++ b/include/class.config.php
@@ -30,6 +30,10 @@ class Config {
     # new settings and the corresponding default values.
     var $defaults = array();                # List of default values
 
+
+    # Items
+    var $items = null;
+
     function __construct($section=null, $defaults=array()) {
         if ($section)
             $this->section = $section;
@@ -129,16 +133,18 @@ class Config {
 
     function destroy() {
         unset($this->session);
-        return $this->items()->delete();
+        if ($this->items)
+            $this->items->delete();
+
+        return true;
     }
 
     function items() {
-        static $items;
 
-        if (!isset($items))
-            $items = ConfigItem::items($this->section, $this->section_column);
+        if (!isset($this->items))
+            $this->items = ConfigItem::items($this->section, $this->section_column);
 
-        return $items;
+        return $this->items;
     }
 }
 
-- 
GitLab