From: Deepak Srivastava Date: Mon, 8 Jul 2013 11:53:26 +0000 (+0530) Subject: CRM-12846, give preference to settings table X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=4acb1c974ddf106c7f09eb6bf75c08fa56a4c368;p=civicrm-core.git CRM-12846, give preference to settings table ---------------------------------------- * CRM-12846: API support for toggling components by storing 'enableComponents' config in settings table http://issues.civicrm.org/jira/browse/CRM-12846 --- diff --git a/CRM/Core/BAO/ConfigSetting.php b/CRM/Core/BAO/ConfigSetting.php index 40a807361a..95933fba60 100644 --- a/CRM/Core/BAO/ConfigSetting.php +++ b/CRM/Core/BAO/ConfigSetting.php @@ -353,12 +353,11 @@ class CRM_Core_BAO_ConfigSetting { // retrieve directory and url preferences also CRM_Core_BAO_Setting::retrieveDirectoryAndURLPreferences($defaults); - // Pickup enabled-components from settings table. - // For backward compatibility we will have to make sure we not finding the values from config-backend. - if (!CRM_Utils_Array::value('enableComponents', $defaults)) { - $defaults['enableComponents'] = - CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'enable_components', NULL, array()); - + // Pickup enabled-components from settings table if found. + $enableComponents = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'enable_components', NULL, array()); + if (!empty($enableComponents)) { + $defaults['enableComponents'] = $enableComponents; + $components = CRM_Core_Component::getComponents(); $enabledComponentIDs = array(); foreach ($defaults['enableComponents'] as $name) {