X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FCore%2FBAO%2FSetting.php;h=7ab3f5778fc666fb345504b5ec225621dd48c87b;hb=6f2500ee7589360102875df4367568fe87485df6;hp=a4602f9e1cb655b0adbfa65f90d90e036d30c04e;hpb=f9f40af3ba65d47c6710d450e989124d9b3e3b70;p=civicrm-core.git diff --git a/CRM/Core/BAO/Setting.php b/CRM/Core/BAO/Setting.php index a4602f9e1c..7ab3f5778f 100644 --- a/CRM/Core/BAO/Setting.php +++ b/CRM/Core/BAO/Setting.php @@ -117,7 +117,7 @@ class CRM_Core_BAO_Setting extends CRM_Core_DAO_Setting { * Allow key o be cleared * @param string $cacheKey */ - public static function flushCache($cacheKey){ + public static function flushCache($cacheKey) { unset(self::$_cache[$cacheKey]); $globalCache = CRM_Utils_Cache::singleton(); $globalCache->delete($cacheKey); @@ -283,22 +283,22 @@ class CRM_Core_BAO_Setting extends CRM_Core_DAO_Setting { $fields = $result = array(); $fieldsToGet = self::validateSettingsInput(array_flip($settingsToReturn), $fields, FALSE); foreach ($domains as $domainID) { - if($domainID != CRM_Core_Config::domainID()){ + if ($domainID != CRM_Core_Config::domainID()) { $reloadConfig = TRUE; CRM_Core_BAO_Domain::setDomain($domainID); } $config = CRM_Core_Config::singleton($reloadConfig, $reloadConfig); $result[$domainID] = array(); foreach ($fieldsToGet as $name => $value) { - if(!empty($fields['values'][$name]['prefetch'])){ - if(isset($params['filters']) && isset($params['filters']['prefetch']) - && $params['filters']['prefetch'] == 0){ + if (!empty($fields['values'][$name]['prefetch'])) { + if (isset($params['filters']) && isset($params['filters']['prefetch']) + && $params['filters']['prefetch'] == 0) { // we are filtering out the prefetches from the return array // so we will skip continue; } $configKey = CRM_Utils_Array::value('config_key', $fields['values'][$name], $name); - if(isset($config->$configKey)){ + if (isset($config->$configKey)) { $setting = $config->$configKey; } } @@ -476,13 +476,13 @@ class CRM_Core_BAO_Setting extends CRM_Core_DAO_Setting { } foreach ($domains as $domainID) { - if($domainID != CRM_Core_Config::domainID()){ + if ($domainID != CRM_Core_Config::domainID()) { $reloadConfig = TRUE; CRM_Core_BAO_Domain::setDomain($domainID); } $result[$domainID] = array(); foreach ($fieldsToSet as $name => $value) { - if(empty($fields['values'][$name]['config_only'])){ + if (empty($fields['values'][$name]['config_only'])) { CRM_Core_BAO_Setting::_setItem( $fields['values'][$name], $value, @@ -494,22 +494,22 @@ class CRM_Core_BAO_Setting extends CRM_Core_DAO_Setting { $domainID ); } - if(!empty($fields['values'][$name]['prefetch'])){ - if(!empty($fields['values'][$name]['config_key'])){ + if (!empty($fields['values'][$name]['prefetch'])) { + if (!empty($fields['values'][$name]['config_key'])) { $name = $fields['values'][$name]['config_key']; } $config_keys[$name] = $value; } $result[$domainID][$name] = $value; } - if($reloadConfig){ + if ($reloadConfig) { CRM_Core_Config::singleton($reloadConfig, $reloadConfig); } - if(!empty($config_keys)){ + if (!empty($config_keys)) { CRM_Core_BAO_ConfigSetting::create($config_keys); } - if($reloadConfig){ + if ($reloadConfig) { CRM_Core_BAO_Domain::resetDomain(); } } @@ -555,7 +555,7 @@ class CRM_Core_BAO_Setting extends CRM_Core_DAO_Setting { ); $settingParams = array_diff_key($params, array_fill_keys($ignoredParams, TRUE)); $getFieldsParams = array('version' => 3); - if (count($settingParams) ==1) { + if (count($settingParams) == 1) { // ie we are only setting one field - we'll pass it into getfields for efficiency list($name) = array_keys($settingParams); $getFieldsParams['name'] = $name; @@ -582,7 +582,7 @@ class CRM_Core_BAO_Setting extends CRM_Core_DAO_Setting { * @fieldSpec array Metadata for given field (drawn from the xml) */ public static function validateSetting(&$value, $fieldSpec) { - if($fieldSpec['type'] == 'String' && is_array($value)){ + if ($fieldSpec['type'] == 'String' && is_array($value)) { $value = CRM_Core_DAO::VALUE_SEPARATOR . implode(CRM_Core_DAO::VALUE_SEPARATOR,$value) . CRM_Core_DAO::VALUE_SEPARATOR; } if (empty($fieldSpec['validate_callback'])) { @@ -663,7 +663,7 @@ class CRM_Core_BAO_Setting extends CRM_Core_DAO_Setting { $settingsMetadata = CRM_Core_BAO_Cache::getItem('CiviCRM setting Spec', 'All', $componentID); if (empty($settingsMetadata)) { global $civicrm_root; - $metaDataFolders = array($civicrm_root. '/settings'); + $metaDataFolders = array($civicrm_root . '/settings'); CRM_Utils_Hook::alterSettingsFolders($metaDataFolders); $settingsMetadata = self::loadSettingsMetaDataFolders($metaDataFolders); CRM_Core_BAO_Cache::setItem($settingsMetadata,'CiviCRM setting Spec', 'All', $componentID); @@ -735,7 +735,7 @@ class CRM_Core_BAO_Setting extends CRM_Core_DAO_Setting { if (empty($filters)) { return; } - else if (array_keys($filters) == array('name')) { + elseif (array_keys($filters) == array('name')) { $settingSpec = array($filters['name'] => CRM_Utils_Array::value($filters['name'], $settingSpec, '')); return; } @@ -788,20 +788,21 @@ class CRM_Core_BAO_Setting extends CRM_Core_DAO_Setting { // whenever there is a possibility of more than one domain we must force it $config = CRM_Core_Config::singleton(); if (empty($domainID)) { - $domainID= CRM_Core_Config::domainID(); + $domainID = CRM_Core_Config::domainID(); } $domain = new CRM_Core_DAO_Domain(); $domain->id = $domainID; $domain->find(TRUE); if ($domain->config_backend) { $values = unserialize($domain->config_backend); - } else { + } + else { $values = array(); } $spec = self::getSettingSpecification(NULL, array('name' => $name), $domainID); $configKey = CRM_Utils_Array::value('config_key', $spec[$name], CRM_Utils_Array::value('legacy_key', $spec[$name], $name)); //if the key is set to config_only we don't need to do anything - if(empty($spec[$name]['config_only'])){ + if (empty($spec[$name]['config_only'])) { if (!empty($values[$configKey])) { civicrm_api('setting', 'create', array('version' => 3, $name => $values[$configKey], 'domain_id' => $domainID)); }