From bf4b8752004aabddb1b7f6b7cd8b5c9da63c1b9c Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Wed, 18 Nov 2015 16:45:00 -0500 Subject: [PATCH] CRM-13823 - Remove unncessary settings Now that status messages can be snoozed and disabled there is no need for settings specific to version checks. --- CRM/Admin/Form/Setting/Miscellaneous.php | 3 - CRM/Utils/Check/Env.php | 4 +- CRM/Utils/VersionCheck.php | 16 +---- api/v3/examples/Setting/GetFields.php | 60 ------------------- settings/Core.setting.php | 38 +----------- .../CRM/Admin/Form/Setting/Miscellaneous.tpl | 23 ------- .../CRM/common/civicrm.settings.php.template | 4 -- 7 files changed, 6 insertions(+), 142 deletions(-) diff --git a/CRM/Admin/Form/Setting/Miscellaneous.php b/CRM/Admin/Form/Setting/Miscellaneous.php index 6daba5212b..4a4645a628 100644 --- a/CRM/Admin/Form/Setting/Miscellaneous.php +++ b/CRM/Admin/Form/Setting/Miscellaneous.php @@ -40,10 +40,7 @@ class CRM_Admin_Form_Setting_Miscellaneous extends CRM_Admin_Form_Setting { 'max_attachments' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'contact_undelete' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'dashboardCacheTimeout' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, - 'versionAlert' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, - 'securityUpdateAlert' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'versionCheck' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, - 'versionCheckIgnoreDate' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'empoweredBy' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'logging' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'maxFileSize' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, diff --git a/CRM/Utils/Check/Env.php b/CRM/Utils/Check/Env.php index b01f5db17d..5927d7b5de 100644 --- a/CRM/Utils/Check/Env.php +++ b/CRM/Utils/Check/Env.php @@ -292,7 +292,7 @@ class CRM_Utils_Check_Env { public function checkVersion() { $messages = array(); - if (CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'versionAlert', NULL, 1)) { + if (Civi::settings()->get('versionCheck')) { $vc = CRM_Utils_VersionCheck::singleton(); $newerVersion = $vc->isNewerVersionAvailable(); @@ -348,7 +348,7 @@ class CRM_Utils_Check_Env { else { $messages[] = new CRM_Utils_Check_Message( __FUNCTION__, - ts('The check for new versions of CiviCRM has been disabled.'), + ts('The check for new versions of CiviCRM has been disabled. Re-enable the setting to receive important security update notifications.', array(1 => CRM_Utils_System::url('civicrm/admin/setting/misc', 'reset=1'))), ts('Update Check Disabled'), \Psr\Log\LogLevel::NOTICE, 'fa-times-circle-o' diff --git a/CRM/Utils/VersionCheck.php b/CRM/Utils/VersionCheck.php index 380c4b61db..583c5d1153 100644 --- a/CRM/Utils/VersionCheck.php +++ b/CRM/Utils/VersionCheck.php @@ -64,13 +64,6 @@ class CRM_Utils_VersionCheck { */ public $localMajorVersion; - /** - * User setting to skip updates prior to a certain date - * - * @var string - */ - public $ignoreDate; - /** * Info about available versions * @@ -120,7 +113,6 @@ class CRM_Utils_VersionCheck { // Get the latest version and send site info $this->pingBack(); } - $this->ignoreDate = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'versionCheckIgnoreDate'); // Sort version info in ascending order for easier comparisons ksort($this->versionInfo, SORT_NUMERIC); @@ -257,11 +249,9 @@ class CRM_Utils_VersionCheck { if (!empty($majorVersion['releases'])) { foreach ($majorVersion['releases'] as $release) { if (version_compare($this->localVersion, $release['version']) < 0) { - if (!$this->ignoreDate || $this->ignoreDate < $release['date']) { - $newerVersion['newest'] = $release['version']; - if (CRM_Utils_Array::value('security', $release)) { - $newerVersion['security'] = $release['version']; - } + $newerVersion['newest'] = $release['version']; + if (CRM_Utils_Array::value('security', $release)) { + $newerVersion['security'] = $release['version']; } } } diff --git a/api/v3/examples/Setting/GetFields.php b/api/v3/examples/Setting/GetFields.php index c797b6fe95..2f1b5d0ff8 100644 --- a/api/v3/examples/Setting/GetFields.php +++ b/api/v3/examples/Setting/GetFields.php @@ -527,48 +527,6 @@ function setting_getfields_expectedresult() { 'description' => 'Allow Permanent Delete for contacts who are linked to live financial transactions', 'help_text' => '', ), - 'versionAlert' => array( - 'group_name' => 'CiviCRM Preferences', - 'group' => 'core', - 'name' => 'versionAlert', - 'type' => 'Integer', - 'quick_form_type' => 'Element', - 'html_type' => 'select', - 'option_values' => array( - '0' => 'Disabled', - '1' => 'Display In Page Footer', - '2' => 'Display As Popup Alert', - '3' => 'Page Footer + Popup Alert', - ), - 'default' => 1, - 'add' => '4.3', - 'title' => 'New Version Alerts', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => '', - 'help_text' => '', - ), - 'securityUpdateAlert' => array( - 'group_name' => 'CiviCRM Preferences', - 'group' => 'core', - 'name' => 'securityUpdateAlert', - 'type' => 'Integer', - 'quick_form_type' => 'Element', - 'html_type' => 'select', - 'option_values' => array( - '0' => 'Disabled', - '1' => 'Display In Page Footer', - '2' => 'Display As Popup Alert', - '3' => 'Page Footer + Popup Alert', - ), - 'default' => 3, - 'add' => '4.6', - 'title' => 'Security Update Alerts', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => '', - 'help_text' => '', - ), 'versionCheck' => array( 'group_name' => 'CiviCRM Preferences', 'group' => 'core', @@ -583,24 +541,6 @@ function setting_getfields_expectedresult() { 'description' => '', 'help_text' => '', ), - 'versionCheckIgnoreDate' => array( - 'group_name' => 'CiviCRM Preferences', - 'group' => 'core', - 'name' => 'versionCheckIgnoreDate', - 'type' => 'String', - 'quick_form_type' => 'Element', - 'html_type' => 'text', - 'html_attributes' => array( - 'placeholder' => 'YYYY-MM-DD', - ), - 'default' => '', - 'add' => '4.6', - 'title' => 'Ignore Updates Prior to', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => '', - 'help_text' => '', - ), 'securityAlert' => array( 'group_name' => 'CiviCRM Preferences', 'group' => 'core', diff --git a/settings/Core.setting.php b/settings/Core.setting.php index d7d817c13b..a09ffbde7b 100644 --- a/settings/Core.setting.php +++ b/settings/Core.setting.php @@ -361,20 +361,6 @@ return array( 'description' => 'Allow Permanent Delete for contacts who are linked to live financial transactions', 'help_text' => NULL, ), - 'versionAlert' => array( - 'group_name' => 'CiviCRM Preferences', - 'group' => 'core', - 'name' => 'versionAlert', - 'type' => 'Boolean', - 'quick_form_type' => 'YesNo', - 'default' => 1, - 'add' => '4.3', - 'title' => 'New Version Alerts', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => "", - 'help_text' => NULL, - ), 'versionCheck' => array( 'group_name' => 'CiviCRM Preferences', 'group' => 'core', @@ -389,22 +375,6 @@ return array( 'description' => "", 'help_text' => NULL, ), - 'versionCheckIgnoreDate' => array( - 'group_name' => 'CiviCRM Preferences', - 'group' => 'core', - 'name' => 'versionCheckIgnoreDate', - 'type' => 'String', - 'quick_form_type' => 'Element', - 'html_type' => 'text', - 'html_attributes' => array('placeholder' => 'YYYY-MM-DD'), - 'default' => '', - 'add' => '4.6', - 'title' => 'Ignore Updates Prior to', - 'is_domain' => 1, - 'is_contact' => 0, - 'description' => "", - 'help_text' => NULL, - ), 'securityAlert' => array( 'group_name' => 'CiviCRM Preferences', 'group' => 'core', @@ -609,15 +579,9 @@ return array( 'group' => 'core', 'name' => 'resCacheCode', 'type' => 'String', - 'quick_form_type' => 'Element', - 'html_attributes' => array( - 'size' => 16, - 'maxlength' => 16, - ), - 'html_type' => 'Text', 'default' => NULL, 'add' => '4.3', - 'title' => 'Resource Cache Code', + 'title' => NULL, 'is_domain' => 1, 'is_contact' => 0, 'description' => 'Code appended to resource URLs (JS/CSS) to coerce HTTP caching', diff --git a/templates/CRM/Admin/Form/Setting/Miscellaneous.tpl b/templates/CRM/Admin/Form/Setting/Miscellaneous.tpl index fe742e72d0..5af743be02 100644 --- a/templates/CRM/Admin/Form/Setting/Miscellaneous.tpl +++ b/templates/CRM/Admin/Form/Setting/Miscellaneous.tpl @@ -77,21 +77,6 @@ {$form.versionCheck.html}

{ts}When enabled, statistics about your CiviCRM installation are reported anonymously to the CiviCRM team to assist in prioritizing ongoing development efforts. The following information is gathered: CiviCRM version, versions of PHP, MySQL and framework (Drupal/Joomla/standalone), and default language. Counts (but no actual data) of the following record types are reported: contacts, activities, cases, relationships, contributions, contribution pages, contribution products, contribution widgets, discounts, price sets, profiles, events, participants, tell-a-friend pages, grants, mailings, memberships, membership blocks, pledges, pledge blocks and active payment processor types.{/ts}

- - {$form.versionCheckIgnoreDate.label} - {$form.versionCheckIgnoreDate.html|crmReplace:type:date}
-

{ts}If you wish to stop receiving alerts about a current update (for example, if you have applied a security patch manually), set this to today's date.{/ts}

- - - {$form.securityUpdateAlert.label} - {$form.securityUpdateAlert.html}
-

{ts}Alert site admins about security advisories. Strongly recommended.{/ts}

- - - {$form.versionAlert.label} - {$form.versionAlert.html}
-

{ts}Alert site admins about all new CiviCRM releases.{/ts}

- {$form.empoweredBy.label} {$form.empoweredBy.html}
@@ -154,14 +139,6 @@ }) } }); - $('select[name=securityUpdateAlert]').change(function() { - if ($(this).val() == '0') { - CRM.confirm({message: {/literal}"{ts escape='js'}Disabling this option will prevent CiviCRM from checking for important security updates. Are you sure?{/ts}"{literal}}) - .on('crmConfirm:no', function() { - $('select[name=securityUpdateAlert]').val('3'); - }) - } - }); }); {/literal} \ No newline at end of file diff --git a/templates/CRM/common/civicrm.settings.php.template b/templates/CRM/common/civicrm.settings.php.template index 1c0e64fe54..10fbe26b91 100644 --- a/templates/CRM/common/civicrm.settings.php.template +++ b/templates/CRM/common/civicrm.settings.php.template @@ -218,10 +218,6 @@ if (!defined('CIVICRM_UF_BASEURL')) { // Disable automatic download / installation of extensions // $civicrm_setting['Extension Preferences']['ext_repo_url'] = false; - // Disable version update alerts. - // $civicrm_setting['CiviCRM Preferences']['versionAlert']; = false; - - /** * If you are using any CiviCRM script in the bin directory that * requires authentication, then you also need to set this key. -- 2.25.1