systemStatusCheckResult - Migrate from settings to cache
authorTim Otten <totten@civicrm.org>
Thu, 29 Mar 2018 20:36:52 +0000 (13:36 -0700)
committerTim Otten <totten@civicrm.org>
Mon, 18 Jun 2018 23:28:26 +0000 (16:28 -0700)
This is fundamentally an ephemeral value. Storing this in the settings
table prevents one from accessing the system with a read-only database.

CRM/Core/Invoke.php
CRM/Utils/Check.php
Civi/Core/Container.php
api/v3/examples/Setting/GetFields.php
settings/Core.setting.php

index e5edcd82c95608fe0fc71d00580392a0f92d412c..eb2bef51af7f0f6c715323aa9c702aa9e8e97924 100644 (file)
@@ -350,7 +350,7 @@ class CRM_Core_Invoke {
       return;
     }
     // always use cached results - they will be refreshed by the session timer
-    $status = Civi::settings()->get('systemStatusCheckResult');
+    $status = Civi::cache('checks')->get('systemStatusCheckResult');
     $template->assign('footer_status_severity', $status);
     $template->assign('footer_status_message', CRM_Utils_Check::toStatusLabel($status));
   }
index 24fd07062a1862571b4196ba3fa4306c81dda4bb..57d15a741ff8c06689727020de2b8c2d9a6d5b29 100644 (file)
@@ -223,7 +223,7 @@ class CRM_Utils_Check {
       break;
     }
 
-    Civi::settings()->set('systemStatusCheckResult', $maxSeverity);
+    Civi::cache('checks')->set('systemStatusCheckResult', $maxSeverity);
 
     return ($max) ? $maxSeverity : $messages;
   }
index c582b01b3092037bfff3765728cefb69da18037b..a137d166b56a0567df3077db50c0504eebe5f202 100644 (file)
@@ -163,6 +163,7 @@ class Container {
     $basicCaches = array(
       'js_strings' => 'js_strings',
       'community_messages' => 'community_messages',
+      'checks' => 'checks',
     );
     foreach ($basicCaches as $cacheSvc => $cacheGrp) {
       $container->setDefinition("cache.{$cacheSvc}", new Definition(
index 8a4ccd83d82282b288659cbd0112c9e20344c0fb..32c450e058a8fae06cef9b0456a6ac33e0dfef39 100644 (file)
@@ -1170,21 +1170,6 @@ function setting_getfields_expectedresult() {
         'description' => '',
         'help_text' => '',
       ),
-      'systemStatusCheckResult' => array(
-        'group_name' => 'CiviCRM Preferences',
-        'group' => 'core',
-        'name' => 'systemStatusCheckResult',
-        'type' => 'Integer',
-        'quick_form_type' => 'Element',
-        'html_type' => 'text',
-        'default' => 0,
-        'add' => '4.7',
-        'title' => 'systemStatusCheckResult',
-        'is_domain' => 1,
-        'is_contact' => 0,
-        'description' => '',
-        'help_text' => '',
-      ),
       'recentItemsMaxCount' => array(
         'group_name' => 'CiviCRM Preferences',
         'group' => 'core',
index b95baf8d0ed7727855a4dc598c80af245c55c8d1..c95ed3d01850e49bb91d0f9c9591ac644a194aae 100644 (file)
@@ -883,21 +883,6 @@ return array(
     'description' => NULL,
     'help_text' => NULL,
   ),
-  'systemStatusCheckResult' => array(
-    'group_name' => 'CiviCRM Preferences',
-    'group' => 'core',
-    'name' => 'systemStatusCheckResult',
-    'type' => 'Integer',
-    'quick_form_type' => 'Element',
-    'html_type' => 'text',
-    'default' => 0,
-    'add' => '4.7',
-    'title' => 'systemStatusCheckResult',
-    'is_domain' => 1,
-    'is_contact' => 0,
-    'description' => NULL,
-    'help_text' => NULL,
-  ),
   'recentItemsMaxCount' => array(
     'group_name' => 'CiviCRM Preferences',
     'group' => 'core',