* Array of messages
* @link https://api.drupal.org/api/drupal/modules%21system%21system.api.php/function/hook_requirements
*/
- public function checkAll($showHushed = FALSE) {
+ public function checkAll() {
$checks = array();
$checks[] = new CRM_Utils_Check_Security();
$checks[] = new CRM_Utils_Check_Env();
CRM_Utils_Hook::check($messages);
- if (!$showHushed) {
- foreach ($messages as $key => $message) {
- $hush = self::checkHushSnooze($message);
- if ($hush) {
- unset($messages[$key]);
- }
- }
+ foreach ($messages as $key => $message) {
+ $hush = self::checkHushSnooze($message);
+ $message->setVisible($hush);
}
uasort($messages, array(__CLASS__, 'severitySort'));
*/
private $help;
+ /**
+ *
+ * @var bool
+ * This is used for Admin Status Page to determine hushed statuses.
+ */
+ private $isVisible;
+
/**
* @param string $name
* Symbolic name for the check.
'message' => $this->message,
'title' => $this->title,
'severity' => $this->level,
+ 'isVisible' => $this->isVisible,
);
if (!empty($this->help)) {
$array['help'] = $this->help;
return $array;
}
+ public function isVisibile() {
+ return $this->isVisible;
+ }
+
+ public function setVisible($isVisible) {
+ $this->isVisible = $isVisible;
+ }
+
}
*/
function civicrm_api3_system_check($params) {
$returnValues = array();
- $messages = CRM_Utils_Check::singleton()->checkAll(CRM_Utils_Array::value('show_hushed', $params));
- foreach ($messages as $msg) {
- $returnValues[] = $msg->toArray();
+ $messages = CRM_Utils_Check::singleton()->checkAll();
+ $showHushed = CRM_Utils_Array::value('show_hushed', $params);
+ if (!$showHushed) {
+ foreach ($messages as $key => $message) {
+ if (!$message->isVisible()) {
+ unset($messages[$key]);
+ }
+ }
}
+ else {
+ foreach ($messages as $msg) {
+ $returnValues[] = $msg->toArray();
+ }
+ }
+
// Spec: civicrm_api3_create_success($values = 1, $params = array(), $entity = NULL, $action = NULL)
return civicrm_api3_create_success($returnValues, $params, 'System', 'Check');