5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Core/SystemLog.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:0859d091be6dca4edd108b6a1803ef35)
13 * Database access object for the SystemLog entity.
15 class CRM_Core_DAO_SystemLog
extends CRM_Core_DAO
{
16 const EXT
= 'civicrm';
17 const TABLE_ADDED
= '4.5';
20 * Static instance to hold the table name.
24 public static $_tableName = 'civicrm_system_log';
27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
31 public static $_log = FALSE;
36 * @var int|string|null
37 * (SQL type: int unsigned)
38 * Note that values will be retrieved from the database as a string.
43 * Standardized message
46 * (SQL type: varchar(128))
47 * Note that values will be retrieved from the database as a string.
55 * (SQL type: longtext)
56 * Note that values will be retrieved from the database as a string.
61 * error level per PSR3
64 * (SQL type: varchar(9))
65 * Note that values will be retrieved from the database as a string.
70 * Timestamp of when event occurred.
73 * (SQL type: timestamp)
74 * Note that values will be retrieved from the database as a string.
79 * Optional Contact ID that created the log. Not an FK as we keep this regardless
81 * @var int|string|null
82 * (SQL type: int unsigned)
83 * Note that values will be retrieved from the database as a string.
88 * Optional Name of logging host
91 * (SQL type: varchar(128))
92 * Note that values will be retrieved from the database as a string.
99 public function __construct() {
100 $this->__table
= 'civicrm_system_log';
101 parent
::__construct();
105 * Returns localized title of this entity.
107 * @param bool $plural
108 * Whether to return the plural version of the title.
110 public static function getEntityTitle($plural = FALSE) {
111 return $plural ?
ts('System Logs') : ts('System Log');
115 * Returns all the column names of this table
119 public static function &fields() {
120 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
121 Civi
::$statics[__CLASS__
]['fields'] = [
124 'type' => CRM_Utils_Type
::T_INT
,
125 'title' => ts('System Log ID'),
126 'description' => ts('Primary key ID'),
128 'where' => 'civicrm_system_log.id',
129 'table_name' => 'civicrm_system_log',
130 'entity' => 'SystemLog',
131 'bao' => 'CRM_Core_DAO_SystemLog',
141 'type' => CRM_Utils_Type
::T_STRING
,
142 'title' => ts('System Log Message'),
143 'description' => ts('Standardized message'),
146 'size' => CRM_Utils_Type
::HUGE
,
147 'where' => 'civicrm_system_log.message',
148 'table_name' => 'civicrm_system_log',
149 'entity' => 'SystemLog',
150 'bao' => 'CRM_Core_DAO_SystemLog',
156 'type' => CRM_Utils_Type
::T_LONGTEXT
,
157 'title' => ts('Detailed Log Data'),
158 'description' => ts('JSON encoded data'),
159 'where' => 'civicrm_system_log.context',
160 'table_name' => 'civicrm_system_log',
161 'entity' => 'SystemLog',
162 'bao' => 'CRM_Core_DAO_SystemLog',
168 'type' => CRM_Utils_Type
::T_STRING
,
169 'title' => ts('Detailed Log Data'),
170 'description' => ts('error level per PSR3'),
172 'size' => CRM_Utils_Type
::TWELVE
,
173 'where' => 'civicrm_system_log.level',
175 'table_name' => 'civicrm_system_log',
176 'entity' => 'SystemLog',
177 'bao' => 'CRM_Core_DAO_SystemLog',
182 'name' => 'timestamp',
183 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
184 'title' => ts('Log Timestamp'),
185 'description' => ts('Timestamp of when event occurred.'),
186 'where' => 'civicrm_system_log.timestamp',
187 'default' => 'CURRENT_TIMESTAMP',
188 'table_name' => 'civicrm_system_log',
189 'entity' => 'SystemLog',
190 'bao' => 'CRM_Core_DAO_SystemLog',
195 'name' => 'contact_id',
196 'type' => CRM_Utils_Type
::T_INT
,
197 'title' => ts('Log Contact ID'),
198 'description' => ts('Optional Contact ID that created the log. Not an FK as we keep this regardless'),
199 'where' => 'civicrm_system_log.contact_id',
200 'table_name' => 'civicrm_system_log',
201 'entity' => 'SystemLog',
202 'bao' => 'CRM_Core_DAO_SystemLog',
207 'name' => 'hostname',
208 'type' => CRM_Utils_Type
::T_STRING
,
209 'title' => ts('Log Host'),
210 'description' => ts('Optional Name of logging host'),
212 'size' => CRM_Utils_Type
::HUGE
,
213 'where' => 'civicrm_system_log.hostname',
214 'table_name' => 'civicrm_system_log',
215 'entity' => 'SystemLog',
216 'bao' => 'CRM_Core_DAO_SystemLog',
221 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
223 return Civi
::$statics[__CLASS__
]['fields'];
227 * Return a mapping from field-name to the corresponding key (as used in fields()).
230 * Array(string $name => string $uniqueName).
232 public static function &fieldKeys() {
233 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
234 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
236 return Civi
::$statics[__CLASS__
]['fieldKeys'];
240 * Returns the names of this table
244 public static function getTableName() {
245 return self
::$_tableName;
249 * Returns if this table needs to be logged
253 public function getLog() {
258 * Returns the list of fields that can be imported
260 * @param bool $prefix
264 public static function &import($prefix = FALSE) {
265 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'system_log', $prefix, []);
270 * Returns the list of fields that can be exported
272 * @param bool $prefix
276 public static function &export($prefix = FALSE) {
277 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'system_log', $prefix, []);
282 * Returns the list of indices
284 * @param bool $localize
288 public static function indices($localize = TRUE) {
290 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;