From aec6f4067367fb6c6817adef5ff33cf51d4b8d08 Mon Sep 17 00:00:00 2001 From: Jared Hancock <jared@osticket.com> Date: Thu, 20 Jun 2013 09:12:38 -0400 Subject: [PATCH] Prefer session persistent configuration over database This will allow setting something in the session and having that value override the value from the database. If ->persist() is called for a given key, a following ->get() will result in the session persisted value being returned. ->set() will still save the value in the database. This is mostly useful for last-mile scenarios (and future plugins) that need to affect the configuration of the system without altering the data in the configuration table. --- include/class.config.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/class.config.php b/include/class.config.php index d01d1be1b..b420a7325 100644 --- a/include/class.config.php +++ b/include/class.config.php @@ -49,10 +49,10 @@ class Config { } function get($key, $default=null) { - if (isset($this->config[$key])) - return $this->config[$key]['value']; - elseif (isset($this->session[$key])) + if (isset($this->session[$key])) return $this->session[$key]; + elseif (isset($this->config[$key])) + return $this->config[$key]['value']; elseif ($default !== null) return $this->set($key, $default); return null; -- GitLab