$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
- ) {
- // 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)) {
- $setting = $config->$configKey;
- }
- }
- else {
- $setting = CRM_Core_BAO_Setting::getItem(
- $fields['values'][$name]['group_name'],
- $name,
- CRM_Utils_Array::value('component_id', $params),
- NULL,
- CRM_Utils_Array::value('contact_id', $params),
- $domainID
- );
- }
+ $setting = CRM_Core_BAO_Setting::getItem(
+ $fields['values'][$name]['group_name'],
+ $name,
+ CRM_Utils_Array::value('component_id', $params),
+ NULL,
+ CRM_Utils_Array::value('contact_id', $params),
+ $domainID
+ );
if (!is_null($setting)) {
// we won't return if not set - helps in return all scenario - otherwise we can't indentify the missing ones
// e.g for revert of fill actions
* Store multiple items in the setting table. Note that this will also store config keys
* the storage is determined by the metdata and is affected by
* 'name' setting's name
- * 'prefetch' = store in config
- * 'config_only' = don't store in settings
* 'config_key' = the config key is different to the settings key - e.g. debug where there was a conflict
* 'legacy_key' = rename from config or setting with this name
*
$result[$domainID] = array();
$realSettingsToSet = array(); // need to separate config_backend stuff
foreach ($fieldsToSet as $name => $value) {
- if (empty($fields['values'][$name]['config_only'])) {
- $realSettingsToSet[$name] = $value;
- }
- if (!empty($fields['values'][$name]['prefetch'])) {
- if (!empty($fields['values'][$name]['config_key'])) {
- $name = $fields['values'][$name]['config_key'];
- }
- $config_keys[$name] = $value;
- }
+ $realSettingsToSet[$name] = $value;
$result[$domainID][$name] = $value;
}
$manager->getBagByDomain($domainID)->add($realSettingsToSet);
}
$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($values[$configKey])) {
- civicrm_api('setting', 'create', array('version' => 3, $name => $values[$configKey], 'domain_id' => $domainID));
- }
- else {
- civicrm_api('setting', 'fill', array('version' => 3, 'name' => $name, 'domain_id' => $domainID));
- }
+ if (!empty($values[$configKey])) {
+ civicrm_api('setting', 'create', array('version' => 3, $name => $values[$configKey], 'domain_id' => $domainID));
+ }
+ else {
+ civicrm_api('setting', 'fill', array('version' => 3, 'name' => $name, 'domain_id' => $domainID));
+ }
- if (empty($spec[$name]['prefetch']) && !empty($values[$configKey])) {
- unset($values[$configKey]);
- $domain->config_backend = serialize($values);
- $domain->save();
- unset($config->$configKey);
- }
+ if (!empty($values[$configKey])) {
+ unset($values[$configKey]);
+ $domain->config_backend = serialize($values);
+ $domain->save();
}
}
'group' => 'core',
'name' => 'max_attachments',
'legacy_key' => 'maxAttachments',
- 'prefetch' => 0,
'type' => 'Integer',
'quick_form_type' => 'Element',
'html_type' => 'text',
'group_name' => 'CiviCRM Preferences',
'group' => 'core',
'name' => 'maxFileSize',
- 'prefetch' => 1,
- // prefetch causes it to be cached in config settings. Usually this is a transitional setting. Some things like urls are permanent. Remove this comment if you have assessed & it should be permanent
'type' => 'Integer',
'quick_form_type' => 'Element',
'html_type' => 'text',
'group_name' => 'CiviCRM Preferences',
'group' => 'core',
'name' => 'doNotAttachPDFReceipt',
- 'prefetch' => 1,
- // prefetch causes it to be cached in config object. Usually this is a transitional setting. Some things like urls are permanent. Remove this comment if you have assessed & it should be permanent
'type' => 'Boolean',
'quick_form_type' => 'YesNo',
'default' => 1,
'group_name' => 'CiviCRM Preferences',
'group' => 'core',
'name' => 'wkhtmltopdfPath',
- 'prefetch' => 1,
- // prefetch causes it to be cached in config settings. Usually this is a transitional setting. Some things like urls are permanent. Remove this comment if you have assessed & it should be permanent
'type' => 'String',
'quick_form_type' => 'Element',
'html_attributes' => array(
'group_name' => 'CiviCRM Preferences',
'group' => 'core',
'name' => 'recaptchaOptions',
- 'prefetch' => 1,
- // prefetch causes it to be cached in config settings. Usually this is a transitional setting. Some things like urls are permanent. Remove this comment if you have assessed & it should be permanent
'type' => 'String',
'quick_form_type' => 'Element',
'html_attributes' => array(
'group_name' => 'CiviCRM Preferences',
'group' => 'core',
'name' => 'recaptchaPublicKey',
- 'prefetch' => 1,
- // prefetch causes it to be cached in config settings. Usually this is a transitional setting. Some things like urls are permanent. Remove this comment if you have assessed & it should be permanent
'type' => 'String',
'quick_form_type' => 'Element',
'html_attributes' => array(
'group_name' => 'CiviCRM Preferences',
'group' => 'core',
'name' => 'recaptchaPrivateKey',
- 'prefetch' => 1,
- // prefetch causes it to be cached in config settings. Usually this is a transitional setting. Some things like urls are permanent. Remove this comment if you have assessed & it should be permanent
'type' => 'String',
'quick_form_type' => 'Element',
'html_attributes' => array(
'group_name' => 'CiviCRM Preferences',
'group' => 'core',
'name' => 'dashboardCacheTimeout',
- 'prefetch' => 1,
- // prefetch causes it to be cached in config settings. Usually this is a transitional setting. Some things like urls are permanent. Remove this comment if you have assessed & it should be permanent
'type' => 'Integer',
'quick_form_type' => 'Element',
'html_attributes' => array(
'group_name' => 'CiviCRM Preferences',
'group' => 'core',
'name' => 'blogUrl',
- 'prefetch' => 0,
'type' => 'String',
'quick_form_type' => 'Element',
'html_attributes' => array(
'group_name' => 'CiviCRM Preferences',
'group' => 'core',
'name' => 'communityMessagesUrl',
- 'prefetch' => 0,
'type' => 'String',
'quick_form_type' => 'Element',
'html_attributes' => array(
'type' => 'String',
'html_type' => 'text',
'quick_form_type' => 'Element',
- 'prefetch' => 1,
- // prefetch causes it to be cached in config settings. Usually this is a transitional setting. Some things like urls are permanent. Remove this comment if you have assessed & it should be permanent
'default' => '',
'add' => '4.3',
'title' => 'WordPress Base Page',
'group_name' => 'CiviCRM Preferences',
'group' => 'core',
'name' => 'secondDegRelPermissions',
- 'prefetch' => 1,
- // prefetch causes it to be cached in config settings. Usually this is a transitional setting. Some things like urls are permanent. Remove this comment if you have assessed & it should be permanent
'type' => 'Boolean',
'quick_form_type' => 'YesNo',
'default' => 0,
'group_name' => 'CiviCRM Preferences',
'group' => 'core',
'name' => 'empoweredBy',
- 'prefetch' => 1,
- // prefetch causes it to be cached in config settings. Usually this is a transitional setting. Some things like urls are permanent. Remove this comment if you have assessed & it should be permanent
'type' => 'Boolean',
'quick_form_type' => 'YesNo',
'default' => 1,
),
'logging' => array(
'add' => '4.7',
- 'prefetch' => 1,
'help_text' => NULL,
'is_domain' => 1,
'is_contact' => 0,
'type' => 'String',
'html_type' => 'text',
'quick_form_type' => 'Element',
- 'prefetch' => 1,
- // prefetch causes it to be cached in config settings. Usually this is a transitional setting. Some things like urls are permanent. Remove this comment if you have assessed & it should be permanent
'default' => '',
'add' => '4.6',
'title' => 'WordPress Path to wp-load.php',
'is_domain' => 1,
'is_contact' => 0,
'description' => "Set this value to Yes if you want CiviCRM error/debugging messages to appear in the Drupal error logs",
- 'prefetch' => 1,
'help_text' => "Set this value to Yes if you want CiviCRM error/debugging messages the appear in your CMS' error log. In the case of Drupal, this will cause all CiviCRM error messages to appear in the watchdog (assuming you have Drupal's watchdog enabled)",
),
'debug_enabled' => array(
'is_domain' => 1,
'is_contact' => 0,
'description' => "Set this value to Yes if you want to use one of CiviCRM's debugging tools. This feature should NOT be enabled for production sites",
- 'prefetch' => 1,
'help_text' => 'Do not turn this on on production sites',
),
'backtrace' => array(
'is_domain' => 1,
'is_contact' => 0,
'description' => "Set this value to Yes if you want to display a backtrace listing when a fatal error is encountered. This feature should NOT be enabled for production sites",
- 'prefetch' => 1,
),
'fatalErrorHandler' => array(
'group_name' => 'Developer Preferences',
'is_domain' => 1,
'is_contact' => 0,
'description' => "Enter the path and class for a custom PHP error-handling function if you want to override built-in CiviCRM error handling for your site.",
- 'prefetch' => 1,
),
);
return array(
'customTranslateFunction' => array(
'add' => '4.7',
- 'prefetch' => 1,
'help_text' => NULL,
'is_domain' => 1,
'is_contact' => 0,
'group_name' => 'Localization Preferences',
'group' => 'localization',
'name' => 'monetaryThousandSeparator',
- 'prefetch' => 1,
- // prefetch causes it to be cached in config settings. Usually this is a transitional setting. Some things like urls are permanent. Remove this comment if you have assessed & it should be permanent
'type' => 'String',
'quick_form_type' => 'Element',
'html_type' => 'text',
'group_name' => 'Localization Preferences',
'group' => 'localization',
'name' => 'monetaryDecimalPoint',
- 'prefetch' => 1,
- // prefetch causes it to be cached in config settings. Usually this is a transitional setting. Some things like urls are permanent. Remove this comment if you have assessed & it should be permanent
'type' => 'String',
'quick_form_type' => 'Element',
'html_type' => 'text',
'group_name' => 'Localization Preferences',
'group' => 'localization',
'name' => 'moneyformat',
- 'prefetch' => 1,
- // prefetch causes it to be cached in config settings. Usually this is a transitional setting. Some things like urls are permanent. Remove this comment if you have assessed & it should be permanent
'type' => 'String',
'quick_form_type' => 'Element',
'html_type' => 'text',
'group_name' => 'Localization Preferences',
'group' => 'localization',
'name' => 'moneyvalueformat',
- 'prefetch' => 1,
- // prefetch causes it to be cached in config settings. Usually this is a transitional setting. Some things like urls are permanent. Remove this comment if you have assessed & it should be permanent
'type' => 'String',
'quick_form_type' => 'Element',
'html_type' => 'text',
'group_name' => 'Localization Preferences',
'group' => 'localization',
'name' => 'defaultCurrency',
- 'prefetch' => 1,
- // prefetch causes it to be cached in config settings. Usually this is a transitional setting. Some things like urls are permanent. Remove this comment if you have assessed & it should be permanent
'type' => 'String',
'quick_form_type' => 'Select',
'html_type' => 'Select',
'group_name' => 'Localization Preferences',
'group' => 'localization',
'name' => 'defaultContactCountry',
- 'prefetch' => 1,
- // prefetch causes it to be cached in config settings. Usually this is a transitional setting. Some things like urls are permanent. Remove this comment if you have assessed & it should be permanent
'type' => 'String',
'quick_form_type' => 'Select',
'html_type' => 'Select',
),
'defaultContactStateProvince' => array(
'add' => '4.7',
- 'prefetch' => 1,
'help_text' => NULL,
'is_domain' => 1,
'is_contact' => 0,
'group_name' => 'Localization Preferences',
'group' => 'localization',
'name' => 'countryLimit',
- 'prefetch' => 1,
- // prefetch causes it to be cached in config settings. Usually this is a transitional setting. Some things like urls are permanent. Remove this comment if you have assessed & it should be permanent
'type' => 'Array',
'quick_form_type' => 'Select',
'html_type' => 'Select',
'group_name' => 'Localization Preferences',
'group' => 'localization',
'name' => 'provinceLimit',
- 'prefetch' => 1,
- // prefetch causes it to be cached in config settings. Usually this is a transitional setting. Some things like urls are permanent. Remove this comment if you have assessed & it should be permanent
'type' => 'Array',
'quick_form_type' => 'Select',
'html_type' => 'Select',
'group_name' => 'Localization Preferences',
'group' => 'localization',
'name' => 'inheritLocale',
- 'prefetch' => 1,
- // prefetch causes it to be cached in config settings. Usually this is a transitional setting. Some things like urls are permanent. Remove this comment if you have assessed & it should be permanent
'type' => 'Boolean',
'quick_form_type' => 'YesNo',
'default' => '0',
'group_name' => 'Localization Preferences',
'group' => 'localization',
'name' => 'dateformatDatetime',
- 'prefetch' => 1,
- // prefetch causes it to be cached in config settings. Usually this is a transitional setting. Some things like urls are permanent. Remove this comment if you have assessed & it should be permanent
'type' => 'String',
'quick_form_type' => 'Element',
'html_type' => 'text',
'group_name' => 'Localization Preferences',
'group' => 'localization',
'name' => 'dateformatFull',
- 'prefetch' => 1,
- // prefetch causes it to be cached in config settings. Usually this is a transitional setting. Some things like urls are permanent. Remove this comment if you have assessed & it should be permanent
'type' => 'String',
'quick_form_type' => 'Element',
'html_type' => 'text',
'group_name' => 'Localization Preferences',
'group' => 'localization',
'name' => 'dateformatPartial',
- 'prefetch' => 1,
- // prefetch causes it to be cached in config settings. Usually this is a transitional setting. Some things like urls are permanent. Remove this comment if you have assessed & it should be permanent
'type' => 'String',
'quick_form_type' => 'Element',
'html_type' => 'text',
),
'dateformatTime' => array(
'add' => '4.7',
- 'prefetch' => 1,
'help_text' => NULL,
'is_domain' => 1,
'is_contact' => 0,
),
'dateformatYear' => array(
'add' => '4.7',
- 'prefetch' => 1,
'help_text' => NULL,
'is_domain' => 1,
'is_contact' => 0,
),
'dateInputFormat' => array(
'add' => '4.7',
- 'prefetch' => 1,
'help_text' => NULL,
'is_domain' => 1,
'is_contact' => 0,
),
'fieldSeparator' => array(
'add' => '4.7',
- 'prefetch' => 1,
'help_text' => NULL,
'is_domain' => 1,
'is_contact' => 0,
),
'fiscalYearStart' => array(
'add' => '4.7',
- 'prefetch' => 1,
'help_text' => NULL,
'is_domain' => 1,
'is_contact' => 0,
'group_name' => 'Localization Preferences',
'group' => 'localization',
'name' => 'lcMessages',
- 'prefetch' => 1,
- // prefetch causes it to be cached in config settings. Usually this is a transitional setting. Some things like urls are permanent. Remove this comment if you have assessed & it should be permanent
'type' => 'String',
'quick_form_type' => 'Select',
'html_type' => 'Select',
),
'legacyEncoding' => array(
'add' => '4.7',
- 'prefetch' => 1,
'help_text' => NULL,
'is_domain' => 1,
'is_contact' => 0,
),
'timeInputFormat' => array(
'add' => '4.7',
- 'prefetch' => 1,
'help_text' => NULL,
'is_domain' => 1,
'is_contact' => 0,
'is_contact' => 0,
'description' => 'Throttle email delivery by setting the maximum number of emails sent during each CiviMail run (0 = unlimited).',
'help_text' => NULL,
- 'prefetch' => 1,
),
'mailerJobSize' => array(
'group_name' => 'Mailing Preferences',
'is_contact' => 0,
'description' => 'If you want to utilize multi-threading enter the size you want your sub jobs to be split into. Recommended values are between 1,000 and 10,000. Use a lower value if your server has multiple cron jobs running simultaneously, but do not use values smaller than 1,000. Enter "0" to disable multi-threading and process mail as one single job - batch limits still apply.',
'help_text' => NULL,
- 'prefetch' => 1,
),
'mailerJobsMax' => array(
'group_name' => 'Mailing Preferences',
'is_contact' => 0,
'description' => 'The maximum number of mailer delivery jobs executing simultaneously (0 = allow as many processes to execute as started by cron)',
'help_text' => NULL,
- 'prefetch' => 1,
),
'mailThrottleTime' => array(
'group_name' => 'Mailing Preferences',
'is_contact' => 0,
'description' => 'The time to sleep in between each e-mail in micro seconds. Setting this above 0 allows you to control the rate at which e-mail messages are sent to the mail server, avoiding filling up the mail queue very quickly. Set to 0 to disable.',
'help_text' => NULL,
- 'prefetch' => 1,
),
'verpSeparator' => array(
'group_name' => 'Mailing Preferences',
'is_contact' => 0,
'description' => 'Separator character used when CiviMail generates VERP (variable envelope return path) Mail-From addresses.',
'help_text' => NULL,
- 'prefetch' => 1,
),
);
return array(
'geoAPIKey' => array(
'add' => '4.7',
- 'prefetch' => 1,
'help_text' => NULL,
'is_domain' => 1,
'is_contact' => 0,
),
'geoProvider' => array(
'add' => '4.7',
- 'prefetch' => 1,
'help_text' => NULL,
'is_domain' => 1,
'is_contact' => 0,
),
'mapAPIKey' => array(
'add' => '4.7',
- 'prefetch' => 1,
'help_text' => NULL,
'is_domain' => 1,
'is_contact' => 0,
),
'mapProvider' => array(
'add' => '4.7',
- 'prefetch' => 1,
'help_text' => NULL,
'is_domain' => 1,
'is_contact' => 0,
'group_name' => 'Search Preferences',
'group' => 'Search Preferences',
'name' => 'search_autocomplete_count',
- 'prefetch' => 0,
'type' => 'Integer',
'quick_form_type' => 'Element',
'html_type' => 'text',
'group_name' => 'Search Preferences',
'group' => 'Search Preferences',
'name' => 'enable_innodb_fts',
- 'prefetch' => 0,
'type' => 'Boolean',
'quick_form_type' => 'YesNo',
'default' => 0,
'group_name' => 'Search Preferences',
'group' => 'Search Preferences',
'name' => 'fts_query_mode',
- 'prefetch' => 0,
'type' => 'String',
'quick_form_type' => 'Element',
'html_attributes' => array(
'group_name' => 'Search Preferences',
'group' => 'Search Preferences',
'name' => 'includeOrderByClause',
- 'prefetch' => 1,
- // prefetch causes it to be cached in config settings. Usually this is a transitional setting. Some things like urls are permanent. Remove this comment if you have assessed & it should be permanent
'type' => 'Boolean',
'quick_form_type' => 'YesNo',
'default' => 1,
'group_name' => 'Search Preferences',
'group' => 'Search Preferences',
'name' => 'includeWildCardInName',
- 'prefetch' => 1,
- // prefetch causes it to be cached in config settings. Usually this is a transitional setting. Some things like urls are permanent. Remove this comment if you have assessed & it should be permanent
'type' => 'Boolean',
'quick_form_type' => 'YesNo',
'default' => 1,
'group_name' => 'Search Preferences',
'group' => 'Search Preferences',
'name' => 'includeEmailInName',
- 'prefetch' => 1,
- // prefetch causes it to be cached in config settings. Usually this is a transitional setting. Some things like urls are permanent. Remove this comment if you have assessed & it should be permanent
'type' => 'Boolean',
'quick_form_type' => 'YesNo',
'default' => 1,
'group_name' => 'Search Preferences',
'group' => 'Search Preferences',
'name' => 'includeNickNameInName',
- 'prefetch' => 1,
- // prefetch causes it to be cached in config settings. Usually this is a transitional setting. Some things like urls are permanent. Remove this comment if you have assessed & it should be permanent
'type' => 'Boolean',
'quick_form_type' => 'YesNo',
'default' => 0,
'group_name' => 'Search Preferences',
'group' => 'Search Preferences',
'name' => 'includeAlphabeticalPager',
- 'prefetch' => 1,
- // prefetch causes it to be cached in config settings. Usually this is a transitional setting. Some things like urls are permanent. Remove this comment if you have assessed & it should be permanent
'type' => 'Boolean',
'quick_form_type' => 'YesNo',
'default' => 1,
'group_name' => 'Search Preferences',
'group' => 'Search Preferences',
'name' => 'smartGroupCacheTimeout',
- 'prefetch' => 1,
- // prefetch causes it to be cached in config settings. Usually this is a transitional setting. Some things like urls are permanent. Remove this comment if you have assessed & it should be permanent
'type' => 'Integer',
'quick_form_type' => 'Element',
'html_type' => 'text',
'group_name' => 'Search Preferences',
'group' => 'Search Preferences',
'name' => 'defaultSearchProfileID',
- 'prefetch' => 1,
- // prefetch causes it to be cached in config settings. Usually this is a transitional setting. Some things like urls are permanent. Remove this comment if you have assessed & it should be permanent
'type' => 'Integer',
'quick_form_type' => 'Select',
'html_type' => 'Select',
$this->assertArrayHasKey('domain_group_id', $result['values']);
}
- /**
- * Test that getfields will filter on another field (prefetch)
- */
- public function testGetFieldsPrefetchFilters() {
- $params = array('filters' => array('prefetch' => 1));
- $result = $this->callAPISuccess('setting', 'getfields', $params);
- $this->assertArrayNotHasKey('disable_mandatory_tokens_check', $result['values']);
- $this->assertArrayHasKey('monetaryDecimalPoint', $result['values']);
- }
-
/**
* Ensure that on_change callbacks fire.
*