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 | |
449c4e6b | 9 | * (GenCodeChecksum:99bd9a916303fe5167b981e14e05351e) |
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 | */ | |
fa45b5b9 | 22 | public 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 | */ |
fa45b5b9 | 29 | public static $_log = FALSE; |
c3fc2621 | 30 | |
e501603b TO |
31 | /** |
32 | * Primary key ID | |
33 | * | |
e6ca0a57 | 34 | * @var int |
e501603b TO |
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 | * | |
e6ca0a57 | 69 | * @var int |
e501603b TO |
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 | |
449c4e6b CW |
88 | /** |
89 | * Returns localized title of this entity. | |
90 | */ | |
91 | public static function getEntityTitle() { | |
92 | return ts('System Logs'); | |
93 | } | |
94 | ||
e501603b TO |
95 | /** |
96 | * Returns all the column names of this table | |
97 | * | |
98 | * @return array | |
99 | */ | |
c3fc2621 | 100 | public static function &fields() { |
346aaaba | 101 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
c3fc2621 CW |
102 | Civi::$statics[__CLASS__]['fields'] = [ |
103 | 'id' => [ | |
e501603b TO |
104 | 'name' => 'id', |
105 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 106 | 'title' => ts('System Log ID'), |
215b423e | 107 | 'description' => ts('Primary key ID'), |
c3fc2621 | 108 | 'required' => TRUE, |
a36434b9 | 109 | 'where' => 'civicrm_system_log.id', |
522a26c9 | 110 | 'table_name' => 'civicrm_system_log', |
111 | 'entity' => 'SystemLog', | |
112 | 'bao' => 'CRM_Core_DAO_SystemLog', | |
6a7e5e5d | 113 | 'localizable' => 0, |
c3fc2621 CW |
114 | ], |
115 | 'message' => [ | |
e501603b TO |
116 | 'name' => 'message', |
117 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 118 | 'title' => ts('System Log Message'), |
215b423e | 119 | 'description' => ts('Standardized message'), |
c3fc2621 | 120 | 'required' => TRUE, |
e501603b TO |
121 | 'maxlength' => 128, |
122 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 123 | 'where' => 'civicrm_system_log.message', |
522a26c9 | 124 | 'table_name' => 'civicrm_system_log', |
125 | 'entity' => 'SystemLog', | |
126 | 'bao' => 'CRM_Core_DAO_SystemLog', | |
6a7e5e5d | 127 | 'localizable' => 0, |
c3fc2621 CW |
128 | ], |
129 | 'context' => [ | |
e501603b TO |
130 | 'name' => 'context', |
131 | 'type' => CRM_Utils_Type::T_LONGTEXT, | |
c3fc2621 | 132 | 'title' => ts('Detailed Log Data'), |
215b423e | 133 | 'description' => ts('JSON encoded data'), |
a36434b9 | 134 | 'where' => 'civicrm_system_log.context', |
522a26c9 | 135 | 'table_name' => 'civicrm_system_log', |
136 | 'entity' => 'SystemLog', | |
137 | 'bao' => 'CRM_Core_DAO_SystemLog', | |
6a7e5e5d | 138 | 'localizable' => 0, |
c3fc2621 CW |
139 | ], |
140 | 'level' => [ | |
e501603b TO |
141 | 'name' => 'level', |
142 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 143 | 'title' => ts('Detailed Log Data'), |
215b423e | 144 | 'description' => ts('error level per PSR3'), |
e501603b TO |
145 | 'maxlength' => 9, |
146 | 'size' => CRM_Utils_Type::TWELVE, | |
a36434b9 | 147 | 'where' => 'civicrm_system_log.level', |
e501603b | 148 | 'default' => 'info', |
522a26c9 | 149 | 'table_name' => 'civicrm_system_log', |
150 | 'entity' => 'SystemLog', | |
151 | 'bao' => 'CRM_Core_DAO_SystemLog', | |
6a7e5e5d | 152 | 'localizable' => 0, |
c3fc2621 CW |
153 | ], |
154 | 'timestamp' => [ | |
e501603b TO |
155 | 'name' => 'timestamp', |
156 | 'type' => CRM_Utils_Type::T_TIMESTAMP, | |
c3fc2621 | 157 | 'title' => ts('Log Timestamp'), |
215b423e | 158 | 'description' => ts('Timestamp of when event occurred.'), |
a36434b9 | 159 | 'where' => 'civicrm_system_log.timestamp', |
e501603b | 160 | 'default' => 'CURRENT_TIMESTAMP', |
522a26c9 | 161 | 'table_name' => 'civicrm_system_log', |
162 | 'entity' => 'SystemLog', | |
163 | 'bao' => 'CRM_Core_DAO_SystemLog', | |
6a7e5e5d | 164 | 'localizable' => 0, |
c3fc2621 CW |
165 | ], |
166 | 'contact_id' => [ | |
e501603b TO |
167 | 'name' => 'contact_id', |
168 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 169 | 'title' => ts('Log Contact ID'), |
215b423e | 170 | 'description' => ts('Optional Contact ID that created the log. Not an FK as we keep this regardless'), |
a36434b9 | 171 | 'where' => 'civicrm_system_log.contact_id', |
522a26c9 | 172 | 'table_name' => 'civicrm_system_log', |
173 | 'entity' => 'SystemLog', | |
174 | 'bao' => 'CRM_Core_DAO_SystemLog', | |
6a7e5e5d | 175 | 'localizable' => 0, |
c3fc2621 CW |
176 | ], |
177 | 'hostname' => [ | |
e501603b TO |
178 | 'name' => 'hostname', |
179 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 180 | 'title' => ts('Log Host'), |
215b423e | 181 | 'description' => ts('Optional Name of logging host'), |
e501603b TO |
182 | 'maxlength' => 128, |
183 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 184 | 'where' => 'civicrm_system_log.hostname', |
522a26c9 | 185 | 'table_name' => 'civicrm_system_log', |
186 | 'entity' => 'SystemLog', | |
187 | 'bao' => 'CRM_Core_DAO_SystemLog', | |
6a7e5e5d | 188 | 'localizable' => 0, |
c3fc2621 CW |
189 | ], |
190 | ]; | |
346aaaba | 191 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 192 | } |
346aaaba | 193 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 194 | } |
c3fc2621 | 195 | |
e501603b | 196 | /** |
bd8e0b14 | 197 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
198 | * |
199 | * @return array | |
bd8e0b14 | 200 | * Array(string $name => string $uniqueName). |
e501603b | 201 | */ |
c3fc2621 | 202 | public static function &fieldKeys() { |
bd8e0b14 TO |
203 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
204 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 205 | } |
bd8e0b14 | 206 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 207 | } |
c3fc2621 | 208 | |
e501603b TO |
209 | /** |
210 | * Returns the names of this table | |
211 | * | |
212 | * @return string | |
213 | */ | |
c3fc2621 | 214 | public static function getTableName() { |
e501603b TO |
215 | return self::$_tableName; |
216 | } | |
c3fc2621 | 217 | |
e501603b TO |
218 | /** |
219 | * Returns if this table needs to be logged | |
220 | * | |
c3fc2621 | 221 | * @return bool |
e501603b | 222 | */ |
c3fc2621 | 223 | public function getLog() { |
e501603b TO |
224 | return self::$_log; |
225 | } | |
c3fc2621 | 226 | |
e501603b TO |
227 | /** |
228 | * Returns the list of fields that can be imported | |
229 | * | |
230 | * @param bool $prefix | |
231 | * | |
232 | * @return array | |
233 | */ | |
c3fc2621 CW |
234 | public static function &import($prefix = FALSE) { |
235 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'system_log', $prefix, []); | |
60808919 | 236 | return $r; |
e501603b | 237 | } |
c3fc2621 | 238 | |
e501603b TO |
239 | /** |
240 | * Returns the list of fields that can be exported | |
241 | * | |
242 | * @param bool $prefix | |
243 | * | |
244 | * @return array | |
245 | */ | |
c3fc2621 CW |
246 | public static function &export($prefix = FALSE) { |
247 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'system_log', $prefix, []); | |
60808919 | 248 | return $r; |
e501603b | 249 | } |
c3fc2621 | 250 | |
e7a6b91a AS |
251 | /** |
252 | * Returns the list of indices | |
c3fc2621 CW |
253 | * |
254 | * @param bool $localize | |
255 | * | |
256 | * @return array | |
e7a6b91a AS |
257 | */ |
258 | public static function indices($localize = TRUE) { | |
c3fc2621 | 259 | $indices = []; |
e7a6b91a AS |
260 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
261 | } | |
c3fc2621 | 262 | |
e501603b | 263 | } |