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:3765c5a89ca1e9ff224fbd49e31a4037)
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',
123 'type' => CRM_Utils_Type
::T_STRING
,
124 'title' => ts('System Log Message'),
125 'description' => ts('Standardized message'),
128 'size' => CRM_Utils_Type
::HUGE
,
129 'where' => 'civicrm_system_log.message',
130 'table_name' => 'civicrm_system_log',
131 'entity' => 'SystemLog',
132 'bao' => 'CRM_Core_DAO_SystemLog',
138 'type' => CRM_Utils_Type
::T_LONGTEXT
,
139 'title' => ts('Detailed Log Data'),
140 'description' => ts('JSON encoded data'),
141 'where' => 'civicrm_system_log.context',
142 'table_name' => 'civicrm_system_log',
143 'entity' => 'SystemLog',
144 'bao' => 'CRM_Core_DAO_SystemLog',
150 'type' => CRM_Utils_Type
::T_STRING
,
151 'title' => ts('Detailed Log Data'),
152 'description' => ts('error level per PSR3'),
154 'size' => CRM_Utils_Type
::TWELVE
,
155 'where' => 'civicrm_system_log.level',
157 'table_name' => 'civicrm_system_log',
158 'entity' => 'SystemLog',
159 'bao' => 'CRM_Core_DAO_SystemLog',
164 'name' => 'timestamp',
165 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
166 'title' => ts('Log Timestamp'),
167 'description' => ts('Timestamp of when event occurred.'),
168 'where' => 'civicrm_system_log.timestamp',
169 'default' => 'CURRENT_TIMESTAMP',
170 'table_name' => 'civicrm_system_log',
171 'entity' => 'SystemLog',
172 'bao' => 'CRM_Core_DAO_SystemLog',
177 'name' => 'contact_id',
178 'type' => CRM_Utils_Type
::T_INT
,
179 'title' => ts('Log Contact ID'),
180 'description' => ts('Optional Contact ID that created the log. Not an FK as we keep this regardless'),
181 'where' => 'civicrm_system_log.contact_id',
182 'table_name' => 'civicrm_system_log',
183 'entity' => 'SystemLog',
184 'bao' => 'CRM_Core_DAO_SystemLog',
189 'name' => 'hostname',
190 'type' => CRM_Utils_Type
::T_STRING
,
191 'title' => ts('Log Host'),
192 'description' => ts('Optional Name of logging host'),
194 'size' => CRM_Utils_Type
::HUGE
,
195 'where' => 'civicrm_system_log.hostname',
196 'table_name' => 'civicrm_system_log',
197 'entity' => 'SystemLog',
198 'bao' => 'CRM_Core_DAO_SystemLog',
203 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
205 return Civi
::$statics[__CLASS__
]['fields'];
209 * Return a mapping from field-name to the corresponding key (as used in fields()).
212 * Array(string $name => string $uniqueName).
214 public static function &fieldKeys() {
215 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
216 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
218 return Civi
::$statics[__CLASS__
]['fieldKeys'];
222 * Returns the names of this table
226 public static function getTableName() {
227 return self
::$_tableName;
231 * Returns if this table needs to be logged
235 public function getLog() {
240 * Returns the list of fields that can be imported
242 * @param bool $prefix
246 public static function &import($prefix = FALSE) {
247 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'system_log', $prefix, []);
252 * Returns the list of fields that can be exported
254 * @param bool $prefix
258 public static function &export($prefix = FALSE) {
259 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'system_log', $prefix, []);
264 * Returns the list of indices
266 * @param bool $localize
270 public static function indices($localize = TRUE) {
272 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;