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:f82dad9ad461884c5d45428b341dfbb4)
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;
41 * Standardized message
55 * error level per PSR3
62 * Timestamp of when event occurred.
69 * Optional Contact ID that created the log. Not an FK as we keep this regardless
76 * Optional Name of logging host
85 public function __construct() {
86 $this->__table
= 'civicrm_system_log';
87 parent
::__construct();
91 * Returns localized title of this entity.
94 * Whether to return the plural version of the title.
96 public static function getEntityTitle($plural = FALSE) {
97 return $plural ?
ts('System Logs') : ts('System Log');
101 * Returns all the column names of this table
105 public static function &fields() {
106 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
107 Civi
::$statics[__CLASS__
]['fields'] = [
110 'type' => CRM_Utils_Type
::T_INT
,
111 'title' => ts('System Log ID'),
112 'description' => ts('Primary key ID'),
114 'where' => 'civicrm_system_log.id',
115 'table_name' => 'civicrm_system_log',
116 'entity' => 'SystemLog',
117 'bao' => 'CRM_Core_DAO_SystemLog',
127 'type' => CRM_Utils_Type
::T_STRING
,
128 'title' => ts('System Log Message'),
129 'description' => ts('Standardized message'),
132 'size' => CRM_Utils_Type
::HUGE
,
133 'where' => 'civicrm_system_log.message',
134 'table_name' => 'civicrm_system_log',
135 'entity' => 'SystemLog',
136 'bao' => 'CRM_Core_DAO_SystemLog',
142 'type' => CRM_Utils_Type
::T_LONGTEXT
,
143 'title' => ts('Detailed Log Data'),
144 'description' => ts('JSON encoded data'),
145 'where' => 'civicrm_system_log.context',
146 'table_name' => 'civicrm_system_log',
147 'entity' => 'SystemLog',
148 'bao' => 'CRM_Core_DAO_SystemLog',
154 'type' => CRM_Utils_Type
::T_STRING
,
155 'title' => ts('Detailed Log Data'),
156 'description' => ts('error level per PSR3'),
158 'size' => CRM_Utils_Type
::TWELVE
,
159 'where' => 'civicrm_system_log.level',
161 'table_name' => 'civicrm_system_log',
162 'entity' => 'SystemLog',
163 'bao' => 'CRM_Core_DAO_SystemLog',
168 'name' => 'timestamp',
169 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
170 'title' => ts('Log Timestamp'),
171 'description' => ts('Timestamp of when event occurred.'),
172 'where' => 'civicrm_system_log.timestamp',
173 'default' => 'CURRENT_TIMESTAMP',
174 'table_name' => 'civicrm_system_log',
175 'entity' => 'SystemLog',
176 'bao' => 'CRM_Core_DAO_SystemLog',
181 'name' => 'contact_id',
182 'type' => CRM_Utils_Type
::T_INT
,
183 'title' => ts('Log Contact ID'),
184 'description' => ts('Optional Contact ID that created the log. Not an FK as we keep this regardless'),
185 'where' => 'civicrm_system_log.contact_id',
186 'table_name' => 'civicrm_system_log',
187 'entity' => 'SystemLog',
188 'bao' => 'CRM_Core_DAO_SystemLog',
193 'name' => 'hostname',
194 'type' => CRM_Utils_Type
::T_STRING
,
195 'title' => ts('Log Host'),
196 'description' => ts('Optional Name of logging host'),
198 'size' => CRM_Utils_Type
::HUGE
,
199 'where' => 'civicrm_system_log.hostname',
200 'table_name' => 'civicrm_system_log',
201 'entity' => 'SystemLog',
202 'bao' => 'CRM_Core_DAO_SystemLog',
207 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
209 return Civi
::$statics[__CLASS__
]['fields'];
213 * Return a mapping from field-name to the corresponding key (as used in fields()).
216 * Array(string $name => string $uniqueName).
218 public static function &fieldKeys() {
219 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
220 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
222 return Civi
::$statics[__CLASS__
]['fieldKeys'];
226 * Returns the names of this table
230 public static function getTableName() {
231 return self
::$_tableName;
235 * Returns if this table needs to be logged
239 public function getLog() {
244 * Returns the list of fields that can be imported
246 * @param bool $prefix
250 public static function &import($prefix = FALSE) {
251 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'system_log', $prefix, []);
256 * Returns the list of fields that can be exported
258 * @param bool $prefix
262 public static function &export($prefix = FALSE) {
263 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'system_log', $prefix, []);
268 * Returns the list of indices
270 * @param bool $localize
274 public static function indices($localize = TRUE) {
276 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;