Commit | Line | Data |
---|---|---|
e501603b | 1 | <?php |
c3fc2621 | 2 | |
e501603b TO |
3 | /** |
4 | * @package CRM | |
6b83d5bd | 5 | * @copyright CiviCRM LLC (c) 2004-2019 |
e501603b TO |
6 | * |
7 | * Generated from xml/schema/CRM/Core/SystemLog.xml | |
8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
e380ee3b | 9 | * (GenCodeChecksum:edcf9c070365c92afa56f7f3fe79acee) |
e501603b | 10 | */ |
c3fc2621 | 11 | |
f41f0342 | 12 | /** |
c3fc2621 | 13 | * Database access object for the SystemLog entity. |
f41f0342 | 14 | */ |
e501603b | 15 | class CRM_Core_DAO_SystemLog extends CRM_Core_DAO { |
c3fc2621 | 16 | |
e501603b | 17 | /** |
f41f0342 | 18 | * Static instance to hold the table name. |
e501603b TO |
19 | * |
20 | * @var string | |
21 | */ | |
22 | static $_tableName = 'civicrm_system_log'; | |
c3fc2621 | 23 | |
e501603b | 24 | /** |
f41f0342 | 25 | * Should CiviCRM log any modifications to this table in the civicrm_log table. |
e501603b | 26 | * |
c3fc2621 | 27 | * @var bool |
e501603b | 28 | */ |
c3fc2621 CW |
29 | static $_log = FALSE; |
30 | ||
e501603b TO |
31 | /** |
32 | * Primary key ID | |
33 | * | |
34 | * @var int unsigned | |
35 | */ | |
36 | public $id; | |
c3fc2621 | 37 | |
e501603b TO |
38 | /** |
39 | * Standardized message | |
40 | * | |
41 | * @var string | |
42 | */ | |
43 | public $message; | |
c3fc2621 | 44 | |
e501603b TO |
45 | /** |
46 | * JSON encoded data | |
47 | * | |
48 | * @var longtext | |
49 | */ | |
50 | public $context; | |
c3fc2621 | 51 | |
e501603b TO |
52 | /** |
53 | * error level per PSR3 | |
54 | * | |
55 | * @var string | |
56 | */ | |
57 | public $level; | |
c3fc2621 | 58 | |
e501603b TO |
59 | /** |
60 | * Timestamp of when event occurred. | |
61 | * | |
62 | * @var timestamp | |
63 | */ | |
64 | public $timestamp; | |
c3fc2621 | 65 | |
e501603b TO |
66 | /** |
67 | * Optional Contact ID that created the log. Not an FK as we keep this regardless | |
68 | * | |
69 | * @var int unsigned | |
70 | */ | |
71 | public $contact_id; | |
c3fc2621 | 72 | |
e501603b TO |
73 | /** |
74 | * Optional Name of logging host | |
75 | * | |
76 | * @var string | |
77 | */ | |
78 | public $hostname; | |
c3fc2621 | 79 | |
e501603b | 80 | /** |
f41f0342 | 81 | * Class constructor. |
e501603b | 82 | */ |
c3fc2621 | 83 | public function __construct() { |
e501603b TO |
84 | $this->__table = 'civicrm_system_log'; |
85 | parent::__construct(); | |
86 | } | |
c3fc2621 | 87 | |
e501603b TO |
88 | /** |
89 | * Returns all the column names of this table | |
90 | * | |
91 | * @return array | |
92 | */ | |
c3fc2621 | 93 | public static function &fields() { |
346aaaba | 94 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
c3fc2621 CW |
95 | Civi::$statics[__CLASS__]['fields'] = [ |
96 | 'id' => [ | |
e501603b TO |
97 | 'name' => 'id', |
98 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 99 | 'title' => ts('System Log ID'), |
215b423e | 100 | 'description' => ts('Primary key ID'), |
c3fc2621 | 101 | 'required' => TRUE, |
522a26c9 | 102 | 'table_name' => 'civicrm_system_log', |
103 | 'entity' => 'SystemLog', | |
104 | 'bao' => 'CRM_Core_DAO_SystemLog', | |
6a7e5e5d | 105 | 'localizable' => 0, |
c3fc2621 CW |
106 | ], |
107 | 'message' => [ | |
e501603b TO |
108 | 'name' => 'message', |
109 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 110 | 'title' => ts('System Log Message'), |
215b423e | 111 | 'description' => ts('Standardized message'), |
c3fc2621 | 112 | 'required' => TRUE, |
e501603b TO |
113 | 'maxlength' => 128, |
114 | 'size' => CRM_Utils_Type::HUGE, | |
522a26c9 | 115 | 'table_name' => 'civicrm_system_log', |
116 | 'entity' => 'SystemLog', | |
117 | 'bao' => 'CRM_Core_DAO_SystemLog', | |
6a7e5e5d | 118 | 'localizable' => 0, |
c3fc2621 CW |
119 | ], |
120 | 'context' => [ | |
e501603b TO |
121 | 'name' => 'context', |
122 | 'type' => CRM_Utils_Type::T_LONGTEXT, | |
c3fc2621 | 123 | 'title' => ts('Detailed Log Data'), |
215b423e | 124 | 'description' => ts('JSON encoded data'), |
522a26c9 | 125 | 'table_name' => 'civicrm_system_log', |
126 | 'entity' => 'SystemLog', | |
127 | 'bao' => 'CRM_Core_DAO_SystemLog', | |
6a7e5e5d | 128 | 'localizable' => 0, |
c3fc2621 CW |
129 | ], |
130 | 'level' => [ | |
e501603b TO |
131 | 'name' => 'level', |
132 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 133 | 'title' => ts('Detailed Log Data'), |
215b423e | 134 | 'description' => ts('error level per PSR3'), |
e501603b TO |
135 | 'maxlength' => 9, |
136 | 'size' => CRM_Utils_Type::TWELVE, | |
137 | 'default' => 'info', | |
522a26c9 | 138 | 'table_name' => 'civicrm_system_log', |
139 | 'entity' => 'SystemLog', | |
140 | 'bao' => 'CRM_Core_DAO_SystemLog', | |
6a7e5e5d | 141 | 'localizable' => 0, |
c3fc2621 CW |
142 | ], |
143 | 'timestamp' => [ | |
e501603b TO |
144 | 'name' => 'timestamp', |
145 | 'type' => CRM_Utils_Type::T_TIMESTAMP, | |
c3fc2621 | 146 | 'title' => ts('Log Timestamp'), |
215b423e | 147 | 'description' => ts('Timestamp of when event occurred.'), |
e501603b | 148 | 'default' => 'CURRENT_TIMESTAMP', |
522a26c9 | 149 | 'table_name' => 'civicrm_system_log', |
150 | 'entity' => 'SystemLog', | |
151 | 'bao' => 'CRM_Core_DAO_SystemLog', | |
6a7e5e5d | 152 | 'localizable' => 0, |
c3fc2621 CW |
153 | ], |
154 | 'contact_id' => [ | |
e501603b TO |
155 | 'name' => 'contact_id', |
156 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 157 | 'title' => ts('Log Contact ID'), |
215b423e | 158 | 'description' => ts('Optional Contact ID that created the log. Not an FK as we keep this regardless'), |
522a26c9 | 159 | 'table_name' => 'civicrm_system_log', |
160 | 'entity' => 'SystemLog', | |
161 | 'bao' => 'CRM_Core_DAO_SystemLog', | |
6a7e5e5d | 162 | 'localizable' => 0, |
c3fc2621 CW |
163 | ], |
164 | 'hostname' => [ | |
e501603b TO |
165 | 'name' => 'hostname', |
166 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 167 | 'title' => ts('Log Host'), |
215b423e | 168 | 'description' => ts('Optional Name of logging host'), |
e501603b TO |
169 | 'maxlength' => 128, |
170 | 'size' => CRM_Utils_Type::HUGE, | |
522a26c9 | 171 | 'table_name' => 'civicrm_system_log', |
172 | 'entity' => 'SystemLog', | |
173 | 'bao' => 'CRM_Core_DAO_SystemLog', | |
6a7e5e5d | 174 | 'localizable' => 0, |
c3fc2621 CW |
175 | ], |
176 | ]; | |
346aaaba | 177 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 178 | } |
346aaaba | 179 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 180 | } |
c3fc2621 | 181 | |
e501603b | 182 | /** |
bd8e0b14 | 183 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
184 | * |
185 | * @return array | |
bd8e0b14 | 186 | * Array(string $name => string $uniqueName). |
e501603b | 187 | */ |
c3fc2621 | 188 | public static function &fieldKeys() { |
bd8e0b14 TO |
189 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
190 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 191 | } |
bd8e0b14 | 192 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 193 | } |
c3fc2621 | 194 | |
e501603b TO |
195 | /** |
196 | * Returns the names of this table | |
197 | * | |
198 | * @return string | |
199 | */ | |
c3fc2621 | 200 | public static function getTableName() { |
e501603b TO |
201 | return self::$_tableName; |
202 | } | |
c3fc2621 | 203 | |
e501603b TO |
204 | /** |
205 | * Returns if this table needs to be logged | |
206 | * | |
c3fc2621 | 207 | * @return bool |
e501603b | 208 | */ |
c3fc2621 | 209 | public function getLog() { |
e501603b TO |
210 | return self::$_log; |
211 | } | |
c3fc2621 | 212 | |
e501603b TO |
213 | /** |
214 | * Returns the list of fields that can be imported | |
215 | * | |
216 | * @param bool $prefix | |
217 | * | |
218 | * @return array | |
219 | */ | |
c3fc2621 CW |
220 | public static function &import($prefix = FALSE) { |
221 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'system_log', $prefix, []); | |
60808919 | 222 | return $r; |
e501603b | 223 | } |
c3fc2621 | 224 | |
e501603b TO |
225 | /** |
226 | * Returns the list of fields that can be exported | |
227 | * | |
228 | * @param bool $prefix | |
229 | * | |
230 | * @return array | |
231 | */ | |
c3fc2621 CW |
232 | public static function &export($prefix = FALSE) { |
233 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'system_log', $prefix, []); | |
60808919 | 234 | return $r; |
e501603b | 235 | } |
c3fc2621 | 236 | |
e7a6b91a AS |
237 | /** |
238 | * Returns the list of indices | |
c3fc2621 CW |
239 | * |
240 | * @param bool $localize | |
241 | * | |
242 | * @return array | |
e7a6b91a AS |
243 | */ |
244 | public static function indices($localize = TRUE) { | |
c3fc2621 | 245 | $indices = []; |
e7a6b91a AS |
246 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
247 | } | |
c3fc2621 | 248 | |
e501603b | 249 | } |