Commit 92a8de72 authored by totten's avatar totten

checksum_timeout - Use consistent naming

This was a weird one:

 * The admin form rendered HTML element "checksumTimeout" but saved setting "checksum_timeout", which required workarounds.
 * The runtime code read the setting as "checksum_timeout".
 * The metadata defined setting "checksumTimeout". `prefetch` is enabled, but there's no `config_key` or `legacy_key`.

I believe this means that the runtime and admin form worked (because they
agreed that the name was "checksum_timeout"), but the Setting API would not
work (because it used "checksumTimeout").

This revision standardizes on "checksum_timeout" on the theory that
"checksum_timeout" was the actual value used at runtime. This means:

 * If you had configured the form and had it working correctly, it should
   still work correctly.
 * If you had a script to set "checksumTimeout" via API, then it wasn't
   working before, and it's still not working now.
parent d356cdeb
......@@ -230,14 +230,6 @@ class CRM_Admin_Form_Setting extends CRM_Core_Form {
unset($params['enableComponents']);
}
// save checksum timeout
if (!empty($params['checksumTimeout'])) {
CRM_Core_BAO_Setting::setItem($params['checksumTimeout'],
CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
'checksum_timeout'
);
}
// verify ssl peer option
if (isset($params['verifySSL'])) {
CRM_Core_BAO_Setting::setItem($params['verifySSL'],
......
......@@ -48,7 +48,7 @@ class CRM_Admin_Form_Setting_Miscellaneous extends CRM_Admin_Form_Setting {
'maxFileSize' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
'doNotAttachPDFReceipt' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
'secondDegRelPermissions' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
'checksumTimeout' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
'checksum_timeout' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
);
public $_uploadMaxSize;
......@@ -99,7 +99,7 @@ class CRM_Admin_Form_Setting_Miscellaneous extends CRM_Admin_Form_Setting {
$this->addFormRule(array('CRM_Admin_Form_Setting_Miscellaneous', 'formRule'), $this);
parent::buildQuickForm();
$this->addRule('checksumTimeout', ts('Value should be a positive number'), 'positiveInteger');
$this->addRule('checksum_timeout', ts('Value should be a positive number'), 'positiveInteger');
}
/**
......
......@@ -201,11 +201,7 @@ WHERE id IN ( $idString )
}
if (!$live) {
$days = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
'checksum_timeout',
NULL,
7
);
$days = Civi::settings()->get('checksum_timeout');
$live = 24 * $days;
}
......
......@@ -736,6 +736,7 @@ WHERE option_group_id = (
'autocompleteContactSearch',
'autocompleteContactReference',
'checksumTimeout',
'checksum_timeout',
);
}
......
......@@ -520,12 +520,10 @@ return array(
'description' => NULL,
'help_text' => NULL,
),
'checksumTimeout' => array(
'checksum_timeout' => array(
'group_name' => 'CiviCRM Preferences',
'group' => 'core',
'name' => 'checksumTimeout',
'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
'name' => 'checksum_timeout',
'type' => 'Integer',
'quick_form_type' => 'Element',
'html_attributes' => array(
......
......@@ -34,9 +34,9 @@
</table>
<table class="form-layout">
<tr class="crm-miscellaneous-form-block-checksumTimeout">
<td class="label">{$form.checksumTimeout.label}</td>
<td>{$form.checksumTimeout.html}<br />
<tr class="crm-miscellaneous-form-block-checksum_timeout">
<td class="label">{$form.checksum_timeout.label}</td>
<td>{$form.checksum_timeout.html}<br />
<span class="description">{ts}The number of days before a personalized (hashed) link will expire.{/ts}</span></td>
</tr>
</table>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment