Skip to content

Commit

Permalink
Merge pull request civicrm#9 from ginkgostreet/status-page-1
Browse files Browse the repository at this point in the history
CRM-13823 Sort status messages by severity, name - even in API
  • Loading branch information
agh1 committed Apr 26, 2015
2 parents 1039eae + 631861b commit dca2dad
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions CRM/Utils/Check.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}

Expand Down Expand Up @@ -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));
}
Expand Down Expand Up @@ -208,6 +207,8 @@ public function checkAll($showHushed = false) {
$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;
}

Expand Down

0 comments on commit dca2dad

Please sign in to comment.