1910f61b0d31a2178db9692b257a54c97876189e
[civicrm-core.git] / Civi / Api4 / Action / System / Check.php
1 <?php
2 namespace Civi\Api4\Action\System;
3
4 /**
5 * Retrieve system notices, warnings, errors, etc.
6 */
7 class Check extends \Civi\Api4\Generic\BasicGetAction {
8
9 protected function getRecords() {
10 $messages = [];
11 foreach (\CRM_Utils_Check::checkAll() as $message) {
12 $messages[] = $message->toArray();
13 }
14 return $messages;
15 }
16
17 public static function fields() {
18 return [
19 [
20 'name' => 'name',
21 'title' => 'Name',
22 'description' => 'Unique identifier',
23 'data_type' => 'String',
24 ],
25 [
26 'name' => 'title',
27 'title' => 'Title',
28 'description' => 'Short title text',
29 'data_type' => 'String',
30 ],
31 [
32 'name' => 'message',
33 'title' => 'Message',
34 'description' => 'Long description html',
35 'data_type' => 'String',
36 ],
37 [
38 'name' => 'help',
39 'title' => 'Help',
40 'description' => 'Optional extra help (html string)',
41 'data_type' => 'String',
42 ],
43 [
44 'name' => 'icon',
45 'description' => 'crm-i class of icon to display with message',
46 'data_type' => 'String',
47 ],
48 [
49 'name' => 'severity',
50 'title' => 'Severity',
51 'description' => 'Psr\Log\LogLevel string',
52 'data_type' => 'String',
53 'options' => array_combine(\CRM_Utils_Check::getSeverityList(), \CRM_Utils_Check::getSeverityList()),
54 ],
55 [
56 'name' => 'severity_id',
57 'title' => 'Severity ID',
58 'description' => 'Integer representation of Psr\Log\LogLevel',
59 'data_type' => 'Integer',
60 'options' => \CRM_Utils_Check::getSeverityList(),
61 ],
62 [
63 'name' => 'is_visible',
64 'title' => 'is visible',
65 'description' => '0 if message has been hidden by the user',
66 'data_type' => 'Boolean',
67 ],
68 [
69 'name' => 'hidden_until',
70 'title' => 'Hidden until',
71 'description' => 'When will hidden message be visible again?',
72 'data_type' => 'Date',
73 ],
74 [
75 'name' => 'actions',
76 'title' => 'Actions',
77 'description' => 'List of actions user can perform',
78 'data_type' => 'Array',
79 ],
80 ];
81 }
82
83 }