From fc50f47002dec89ca30050104a96b300d46c3058 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Tue, 15 Sep 2015 19:55:04 -0700 Subject: [PATCH] CRM_Core_Config - Simplify. Current cache commands are pointless. --- CRM/Core/Config.php | 29 +++++++++++------------------ CRM/Core/Config/Runtime.php | 2 -- 2 files changed, 11 insertions(+), 20 deletions(-) diff --git a/CRM/Core/Config.php b/CRM/Core/Config.php index ba1f0c5a86..33eec9344b 100644 --- a/CRM/Core/Config.php +++ b/CRM/Core/Config.php @@ -86,31 +86,24 @@ class CRM_Core_Config extends CRM_Core_Config_MagicMerge { error_reporting(error_reporting() & ~E_DEPRECATED); } - $cache = CRM_Utils_Cache::singleton(); - self::$_singleton = $cache->get('CRM_Core_Config' . CRM_Core_Config::domainID()); - if (!self::$_singleton) { - self::$_singleton = new CRM_Core_Config(); - self::$_singleton->getRuntime()->initialize($loadFromDB); - $cache->set('CRM_Core_Config' . CRM_Core_Config::domainID(), self::$_singleton); - } - else { - self::$_singleton->getRuntime()->initialize(FALSE); - } + self::$_singleton = new CRM_Core_Config(); + self::$_singleton->getRuntime()->initialize($loadFromDB); + if ($loadFromDB && self::$_singleton->getRuntime()->dsn) { + CRM_Core_DAO::init(self::$_singleton->getRuntime()->dsn); - if (self::$_singleton->getRuntime()->dsn) { $domain = \CRM_Core_BAO_Domain::getDomain(); \CRM_Core_BAO_ConfigSetting::applyLocale(\Civi::settings($domain->id), $domain->locales); - } - unset($errorScope); + unset($errorScope); - CRM_Utils_Hook::config(self::$_singleton); - self::$_singleton->authenticate(); + CRM_Utils_Hook::config(self::$_singleton); + self::$_singleton->authenticate(); - // Extreme backward compat: $config binds to active domain at moment of setup. - self::$_singleton->getSettings(); + // Extreme backward compat: $config binds to active domain at moment of setup. + self::$_singleton->getSettings(); - Civi::service('settings_manager')->useDefaults(); + Civi::service('settings_manager')->useDefaults(); + } } return self::$_singleton; } diff --git a/CRM/Core/Config/Runtime.php b/CRM/Core/Config/Runtime.php index 7382811a1c..46c16ae289 100644 --- a/CRM/Core/Config/Runtime.php +++ b/CRM/Core/Config/Runtime.php @@ -126,8 +126,6 @@ class CRM_Core_Config_Runtime { CRM_Utils_File::restrictAccess($this->templateCompileDir); } - CRM_Core_DAO::init($this->dsn); - if (!defined('CIVICRM_UF')) { $this->fatal('You need to define CIVICRM_UF in civicrm.settings.php'); } -- 2.25.1