CRM_Utils_Check_Security - Split allChecks in two:
authorTim Otten <totten@civicrm.org>
Wed, 5 Feb 2014 18:04:01 +0000 (10:04 -0800)
committerTim Otten <totten@civicrm.org>
Wed, 5 Feb 2014 18:04:01 +0000 (10:04 -0800)
 * checkAll - Simply aggregates the other checks
 * showPeriodicAlerts - Application logic for when/how to run check

CRM/Core/Page.php
CRM/Utils/Check/Security.php

index 4fc023cac4504154d2c54e56c02f9ff0a986ee81..520a6f4febecc11f4ab7b1d7fc391e04311a97a6 100644 (file)
@@ -195,7 +195,7 @@ class CRM_Core_Page {
     if (empty($_GET['snippet'])) {
       // Version check and intermittent alert to admins
       CRM_Utils_VersionCheck::singleton()->versionAlert();
-      CRM_Utils_Check_Security::singleton()->allChecks();
+      CRM_Utils_Check_Security::singleton()->showPeriodicAlerts();
 
       // Debug msg once per hour
       if ($config->debug && CRM_Core_Permission::check('administer CiviCRM') && CRM_Core_Session::singleton()->timer('debug_alert', 3600)) {
index 35b47cfbd4fc1c237de369969d3369e4de056bc5..d3d3d4dec6ff0ecdb790c90c4afbbac3066f45bc 100644 (file)
@@ -75,6 +75,18 @@ class CRM_Utils_Check_Security {
     }
   }
 
+  /**
+   * Execute "checkAll"
+   */
+  public function showPeriodicAlerts() {
+    if (CRM_Core_Permission::check('administer CiviCRM')) {
+      $session = CRM_Core_Session::singleton();
+      if ($session->timer('check_' . __CLASS__, self::CHECK_TIMER)) {
+        $this->checkAll();
+      }
+    }
+  }
+
   /**
    * Run some sanity checks.
    *
@@ -88,15 +100,10 @@ class CRM_Utils_Check_Security {
    * @see Drupal's hook_requirements() -
    * https://api.drupal.org/api/drupal/modules%21system%21system.api.php/function/hook_requirements
    */
-  public function allChecks() {
-    if (CRM_Core_Permission::check('administer CiviCRM')) {
-      $session = CRM_Core_Session::singleton();
-      if ($session->timer('check_' . __CLASS__, self::CHECK_TIMER)) {
-        CRM_Utils_Check_Security::singleton()->checkLogFileIsNotAccessible();
-        CRM_Utils_Check_Security::singleton()->checkUploadsAreNotAccessible();
-        CRM_Utils_Check_Security::singleton()->checkDirectoriesAreNotBrowseable();
-      }
-    }
+  public function checkAll() {
+    CRM_Utils_Check_Security::singleton()->checkLogFileIsNotAccessible();
+    CRM_Utils_Check_Security::singleton()->checkUploadsAreNotAccessible();
+    CRM_Utils_Check_Security::singleton()->checkDirectoriesAreNotBrowseable();
   }
 
   /**