Civi\Core\SettingsManager - Don't try to read settings if there's no DB
authorTim Otten <totten@civicrm.org>
Fri, 11 Sep 2015 05:03:37 +0000 (22:03 -0700)
committerTim Otten <totten@civicrm.org>
Thu, 17 Sep 2015 22:49:29 +0000 (15:49 -0700)
Civi/Core/SettingsBag.php
Civi/Core/SettingsManager.php

index 6d8810bbf6767eed4da5c4793f22d6d32e76dab0..e439bbaedd1fda79d85ad9646fe381b36f264af3 100644 (file)
@@ -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;
   }
index 6f4930dd343ef787b750a2045cba0e06a18b9358..1c89e50abf1e82de5e470f5866aac61e8c0837e8 100644 (file)
@@ -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'));
     }