CRM-13823 Sort status messages by severity, name - even in API
authorAndrew Hunt <andrew@aghstrategies.com>
Sun, 26 Apr 2015 17:24:39 +0000 (13:24 -0400)
committerJon goldberg <jon@palantetech.coop>
Tue, 21 Jul 2015 20:37:37 +0000 (16:37 -0400)
----------------------------------------
* CRM-13823: Admin Status Page
  https://issues.civicrm.org/jira/browse/CRM-13823

CRM/Utils/Check.php

index a0bdcfc048bc48301d22cd093832a82d01cb786d..f1ed405385f4fdf26bc74c1ba5399b4c84aeb1bf 100644 (file)
@@ -84,12 +84,11 @@ class CRM_Utils_Check {
         $statusMessages = array();
         $statusType = 'alert';
 
-        uasort($messages, array(__CLASS__, 'severitySort'));
         foreach ($messages as $message) {
           if ($filter === TRUE || call_user_func($filter, $message->getSeverity()) >= 3) {
             $statusType = (call_user_func($filter, $message->getSeverity()) >= 4) ? 'error' : $statusType;
-             $statusMessage = $message->getMessage();
-             $statusMessages[] = $statusTitle = $message->getTitle();
+            $statusMessage = $message->getMessage();
+            $statusMessages[] = $statusTitle = $message->getTitle();
           }
         }
 
@@ -117,7 +116,7 @@ class CRM_Utils_Check {
     $aSeverity = $a->getSeverity();
     $bSeverity = $b->getSeverity();
     if ($aSeverity == $bSeverity) {
-      return 0;
+      return strcmp($a->getName(), $b->getName());
     }
     return (self::severityMap($aSeverity) > self::severityMap($bSeverity));
   }
@@ -208,6 +207,8 @@ class CRM_Utils_Check {
       $messages[] = new CRM_Utils_Check_Message('ShowHushed', '<h2>SHOWING HUSHED [NOT]</h2>', 'Show Hushed', \Psr\Log\LogLevel::INFO);
     }
 
+    uasort($messages, array(__CLASS__, 'severitySort'));
+
     return $messages;
   }