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