4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC. All rights reserved. |
7 | This work is published under the GNU AGPLv3 license with some |
8 | permitted exceptions and without any warranty. For full license |
9 | and copyright information, see https://civicrm.org/licensing |
10 +--------------------------------------------------------------------+
13 namespace Civi\Api4\Action\System
;
16 * Retrieve system notices, warnings, errors, etc.
17 * @method bool getIncludeDisabled()
19 class Check
extends \Civi\Api4\Generic\BasicGetAction
{
22 * Run checks that have been explicitly disabled (default false)
25 protected $includeDisabled = FALSE;
28 * @param bool $includeDisabled
31 public function setIncludeDisabled(bool $includeDisabled): Check
{
32 $this->includeDisabled
= $includeDisabled;
36 protected function getRecords() {
37 $messages = $names = [];
39 // Filtering by name relies on the component check rather than the api arrayQuery
40 // @see \CRM_Utils_Check_Component::isCheckable
41 foreach ($this->where
as $i => $clause) {
42 if ($clause[0] == 'name' && !empty($clause[2]) && in_array($clause[1], ['=', 'IN'], TRUE)) {
43 $names = (array) $clause[2];
44 unset($this->where
[$i]);
49 foreach (\CRM_Utils_Check
::checkStatus($names, $this->includeDisabled
) as $message) {
50 $messages[] = $message->toArray();
55 public static function fields() {
60 'description' => 'Unique identifier',
61 'data_type' => 'String',
66 'description' => 'Short title text',
67 'data_type' => 'String',
72 'description' => 'Long description html',
73 'data_type' => 'String',
78 'description' => 'Optional extra help (html string)',
79 'data_type' => 'String',
83 'description' => 'crm-i class of icon to display with message',
84 'data_type' => 'String',
88 'title' => 'Severity',
89 'description' => 'Psr\Log\LogLevel string',
90 'data_type' => 'String',
91 'options' => array_combine(\CRM_Utils_Check
::getSeverityList(), \CRM_Utils_Check
::getSeverityList()),
94 'name' => 'severity_id',
95 'title' => 'Severity ID',
96 'description' => 'Integer representation of Psr\Log\LogLevel',
97 'data_type' => 'Integer',
98 'options' => \CRM_Utils_Check
::getSeverityOptions(),
101 'name' => 'is_visible',
102 'title' => 'is visible',
103 'description' => '0 if message has been hidden by the user',
104 'data_type' => 'Boolean',
107 'name' => 'hidden_until',
108 'title' => 'Hidden until',
109 'description' => 'When will hidden message be visible again?',
110 'data_type' => 'Date',
114 'title' => 'Actions',
115 'description' => 'List of actions user can perform',
116 'data_type' => 'Array',