Merge pull request #15665 from MikeyMJCO/patch-1
[civicrm-core.git] / Civi / Api4 / Action / System / Check.php
1 <?php
2
3 /*
4 +--------------------------------------------------------------------+
5 | CiviCRM version 5 |
6 +--------------------------------------------------------------------+
7 | Copyright CiviCRM LLC (c) 2004-2020 |
8 +--------------------------------------------------------------------+
9 | This file is a part of CiviCRM. |
10 | |
11 | CiviCRM is free software; you can copy, modify, and distribute it |
12 | under the terms of the GNU Affero General Public License |
13 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
14 | |
15 | CiviCRM is distributed in the hope that it will be useful, but |
16 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. |
19 | |
20 | You should have received a copy of the GNU Affero General Public |
21 | License and the CiviCRM Licensing Exception along |
22 | with this program; if not, contact CiviCRM LLC |
23 | at info[AT]civicrm[DOT]org. If you have questions about the |
24 | GNU Affero General Public License or the licensing of CiviCRM, |
25 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
26 +--------------------------------------------------------------------+
27 */
28
29 /**
30 *
31 * @package CRM
32 * @copyright CiviCRM LLC (c) 2004-2020
33 * $Id$
34 *
35 */
36
37 namespace Civi\Api4\Action\System;
38
39 /**
40 * Retrieve system notices, warnings, errors, etc.
41 */
42 class Check extends \Civi\Api4\Generic\BasicGetAction {
43
44 protected function getRecords() {
45 $messages = [];
46 foreach (\CRM_Utils_Check::checkAll() as $message) {
47 $messages[] = $message->toArray();
48 }
49 return $messages;
50 }
51
52 public static function fields() {
53 return [
54 [
55 'name' => 'name',
56 'title' => 'Name',
57 'description' => 'Unique identifier',
58 'data_type' => 'String',
59 ],
60 [
61 'name' => 'title',
62 'title' => 'Title',
63 'description' => 'Short title text',
64 'data_type' => 'String',
65 ],
66 [
67 'name' => 'message',
68 'title' => 'Message',
69 'description' => 'Long description html',
70 'data_type' => 'String',
71 ],
72 [
73 'name' => 'help',
74 'title' => 'Help',
75 'description' => 'Optional extra help (html string)',
76 'data_type' => 'String',
77 ],
78 [
79 'name' => 'icon',
80 'description' => 'crm-i class of icon to display with message',
81 'data_type' => 'String',
82 ],
83 [
84 'name' => 'severity',
85 'title' => 'Severity',
86 'description' => 'Psr\Log\LogLevel string',
87 'data_type' => 'String',
88 'options' => array_combine(\CRM_Utils_Check::getSeverityList(), \CRM_Utils_Check::getSeverityList()),
89 ],
90 [
91 'name' => 'severity_id',
92 'title' => 'Severity ID',
93 'description' => 'Integer representation of Psr\Log\LogLevel',
94 'data_type' => 'Integer',
95 'options' => \CRM_Utils_Check::getSeverityList(),
96 ],
97 [
98 'name' => 'is_visible',
99 'title' => 'is visible',
100 'description' => '0 if message has been hidden by the user',
101 'data_type' => 'Boolean',
102 ],
103 [
104 'name' => 'hidden_until',
105 'title' => 'Hidden until',
106 'description' => 'When will hidden message be visible again?',
107 'data_type' => 'Date',
108 ],
109 [
110 'name' => 'actions',
111 'title' => 'Actions',
112 'description' => 'List of actions user can perform',
113 'data_type' => 'Array',
114 ],
115 ];
116 }
117
118 }