From 8c74acc392ac4082cd5c79d940529fcf834b0297 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Thu, 10 Sep 2015 22:03:37 -0700 Subject: [PATCH] Civi\Core\SettingsManager - Don't try to read settings if there's no DB --- Civi/Core/SettingsBag.php | 1 + Civi/Core/SettingsManager.php | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Civi/Core/SettingsBag.php b/Civi/Core/SettingsBag.php index 6d8810bbf6..e439bbaedd 100644 --- a/Civi/Core/SettingsBag.php +++ b/Civi/Core/SettingsBag.php @@ -91,6 +91,7 @@ class SettingsBag { public function __construct($domainId, $contactId) { $this->domainId = $domainId; $this->contactId = $contactId; + $this->values = array(); $this->filteredValues = array(); $this->combined = NULL; } diff --git a/Civi/Core/SettingsManager.php b/Civi/Core/SettingsManager.php index 6f4930dd34..1c89e50abf 100644 --- a/Civi/Core/SettingsManager.php +++ b/Civi/Core/SettingsManager.php @@ -128,7 +128,10 @@ class SettingsManager { if (!isset($this->bagsByDomain[$domainId])) { $this->bagsByDomain[$domainId] = new SettingsBag($domainId, NULL); - $this->bagsByDomain[$domainId]->loadValues() + if (\CRM_Core_Config::singleton()->dsn) { + $this->bagsByDomain[$domainId]->loadValues(); + } + $this->bagsByDomain[$domainId] ->loadMandatory($this->getMandatory('domain')) ->loadDefaults($this->getDefaults('domain')); } @@ -148,7 +151,10 @@ class SettingsManager { $key = "$domainId:$contactId"; if (!isset($this->bagsByContact[$key])) { $this->bagsByContact[$key] = new SettingsBag($domainId, $contactId); - $this->bagsByContact[$key]->loadValues() + if (\CRM_Core_Config::singleton()->dsn) { + $this->bagsByContact[$key]->loadValues(); + } + $this->bagsByContact[$key] ->loadDefaults($this->getDefaults('contact')) ->loadMandatory($this->getMandatory('contact')); } -- 2.25.1