Comment fixes
[civicrm-core.git] / CRM / Utils / Check.php
index f1b5cd281be5830097074595dc7b9ceadb0306f6..ed441b13ba5edf7c786f486b9e61d78575b65f44 100644 (file)
@@ -81,6 +81,9 @@ class CRM_Utils_Check {
         $statusMessages = array();
         $statusType = 'alert';
         foreach ($messages as $message) {
+          if (!$message->isVisible()) {
+            continue;
+          }
           if ($filter === TRUE || $message->getSeverity() >= 3) {
             $statusType = $message->getSeverity() >= 4 ? 'error' : $statusType;
             $statusMessage = $message->getMessage();
@@ -168,21 +171,18 @@ class CRM_Utils_Check {
   }
 
   /**
-   * Run some sanity checks.
+   * Run all system checks.
    *
-   * This could become a hook so that CiviCRM can run both built-in
-   * configuration & sanity checks, and modules/extensions can add
-   * their own checks.
+   * This functon is wrapped by the System.check api.
    *
-   * We might even expose the results of these checks on the Wordpress
-   * plugin status page or the Drupal admin/reports/status path.
+   * Calls hook_civicrm_check() for extensions to add or modify messages.
+   * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_check
    *
    * @param bool $max
    *   Whether to return just the maximum non-hushed severity
    *
    * @return array
-   *   Array of messages
-   * @link https://api.drupal.org/api/drupal/modules%21system%21system.api.php/function/hook_requirements
+   *   Array of CRM_Utils_Check_Message objects
    */
   public static function checkAll($max = FALSE) {
     $checks = array();
@@ -209,7 +209,7 @@ class CRM_Utils_Check {
 
     foreach ($messages as $key => $message) {
       $hush = self::checkHushSnooze($message);
-      $message->setVisible(!$hush);
+      $messages[$key]->setVisible(!$hush);
     }
     uasort($messages, array(__CLASS__, 'severitySort'));
 
@@ -232,7 +232,8 @@ class CRM_Utils_Check {
   /**
    * Evaluate if a system check should be hushed/snoozed.
    *
-   * @param string $message
+   * @param CRM_Utils_Check_Message $message
+   *   The message to evaluate.
    *
    * @return bool
    *   TRUE means hush/snooze, FALSE means display.