diff --git a/resources/classes/settings.php b/resources/classes/settings.php index 29be1c9aff..7c29d41b67 100644 --- a/resources/classes/settings.php +++ b/resources/classes/settings.php @@ -114,6 +114,8 @@ class settings implements clear_cache { * Reloads the settings from the database */ public function reload() { + + //clear settings $this->settings = []; //set the default settings @@ -121,6 +123,8 @@ class settings implements clear_cache { //set the domain settings if (!empty($this->domain_uuid)) { + + //get the domain settings $this->domain_settings(); //set the user settings only when the domain_uuid was set @@ -295,8 +299,21 @@ class settings implements clear_cache { * Update the internal settings array with the domain settings from the database * @access private */ - private function domain_settings() { - $key = 'settings_domain_'.$this->domain_uuid; + private function domain_settings($domain_uuid = '', $i = 0) { + if (empty($domain_uuid)) { + $domain_uuid = $this->domain_uuid; + } + + $uuid = ''; + if (class_exists('domain')) { + $uuid = domain::get_uuid($this->database, $domain_uuid); + } + if (!empty($uuid) && $i < 3) { + $this->domain_settings($uuid, $i++); + } + + $key = 'settings_domain_'.$domain_uuid; + $result = ''; //if the apcu extension is loaded get the cached database result if ($this->apcu_enabled && apcu_exists($key)) { @@ -305,7 +322,7 @@ class settings implements clear_cache { $sql = "select * from v_domain_settings "; $sql .= "where domain_uuid = :domain_uuid "; $sql .= "and domain_setting_enabled = true "; - $parameters['domain_uuid'] = $this->domain_uuid; + $parameters['domain_uuid'] = $domain_uuid; $result = $this->database->select($sql, $parameters, 'all'); //if the apcu extension is loaded store the result if ($this->apcu_enabled) {