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