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