From 631861bc478a11833f6979e9a8d5ea3f6d88a322 Mon Sep 17 00:00:00 2001 From: Andrew Hunt Date: Sun, 26 Apr 2015 13:24:39 -0400 Subject: [PATCH] CRM-13823 Sort status messages by severity, name - even in API ---------------------------------------- * CRM-13823: Admin Status Page https://issues.civicrm.org/jira/browse/CRM-13823 --- CRM/Utils/Check.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/CRM/Utils/Check.php b/CRM/Utils/Check.php index a0bdcfc048bc..f1ed405385f4 100644 --- a/CRM/Utils/Check.php +++ b/CRM/Utils/Check.php @@ -84,12 +84,11 @@ public function showPeriodicAlerts($messages = NULL, $filter = array(__CLASS__, $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 @@ public function severitySort($a, $b) { $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 @@ public function checkAll($showHushed = false) { $messages[] = new CRM_Utils_Check_Message('ShowHushed', '

SHOWING HUSHED [NOT]

', 'Show Hushed', \Psr\Log\LogLevel::INFO); } + uasort($messages, array(__CLASS__, 'severitySort')); + return $messages; }