5 * @copyright CiviCRM LLC (c) 2004-2019
7 * Generated from xml/schema/CRM/Core/SystemLog.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:a2276bcf3bb39a3947bf54b043fa0a05)
13 * Database access object for the SystemLog entity.
15 class CRM_Core_DAO_SystemLog
extends CRM_Core_DAO
{
18 * Static instance to hold the table name.
22 public static $_tableName = 'civicrm_system_log';
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
29 public static $_log = FALSE;
39 * Standardized message
53 * error level per PSR3
60 * Timestamp of when event occurred.
67 * Optional Contact ID that created the log. Not an FK as we keep this regardless
74 * Optional Name of logging host
83 public function __construct() {
84 $this->__table
= 'civicrm_system_log';
85 parent
::__construct();
89 * Returns all the column names of this table
93 public static function &fields() {
94 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
95 Civi
::$statics[__CLASS__
]['fields'] = [
98 'type' => CRM_Utils_Type
::T_INT
,
99 'title' => ts('System Log ID'),
100 'description' => ts('Primary key ID'),
102 'where' => 'civicrm_system_log.id',
103 'table_name' => 'civicrm_system_log',
104 'entity' => 'SystemLog',
105 'bao' => 'CRM_Core_DAO_SystemLog',
110 'type' => CRM_Utils_Type
::T_STRING
,
111 'title' => ts('System Log Message'),
112 'description' => ts('Standardized message'),
115 'size' => CRM_Utils_Type
::HUGE
,
116 'where' => 'civicrm_system_log.message',
117 'table_name' => 'civicrm_system_log',
118 'entity' => 'SystemLog',
119 'bao' => 'CRM_Core_DAO_SystemLog',
124 'type' => CRM_Utils_Type
::T_LONGTEXT
,
125 'title' => ts('Detailed Log Data'),
126 'description' => ts('JSON encoded data'),
127 'where' => 'civicrm_system_log.context',
128 'table_name' => 'civicrm_system_log',
129 'entity' => 'SystemLog',
130 'bao' => 'CRM_Core_DAO_SystemLog',
135 'type' => CRM_Utils_Type
::T_STRING
,
136 'title' => ts('Detailed Log Data'),
137 'description' => ts('error level per PSR3'),
139 'size' => CRM_Utils_Type
::TWELVE
,
140 'where' => 'civicrm_system_log.level',
142 'table_name' => 'civicrm_system_log',
143 'entity' => 'SystemLog',
144 'bao' => 'CRM_Core_DAO_SystemLog',
148 'name' => 'timestamp',
149 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
150 'title' => ts('Log Timestamp'),
151 'description' => ts('Timestamp of when event occurred.'),
152 'where' => 'civicrm_system_log.timestamp',
153 'default' => 'CURRENT_TIMESTAMP',
154 'table_name' => 'civicrm_system_log',
155 'entity' => 'SystemLog',
156 'bao' => 'CRM_Core_DAO_SystemLog',
160 'name' => 'contact_id',
161 'type' => CRM_Utils_Type
::T_INT
,
162 'title' => ts('Log Contact ID'),
163 'description' => ts('Optional Contact ID that created the log. Not an FK as we keep this regardless'),
164 'where' => 'civicrm_system_log.contact_id',
165 'table_name' => 'civicrm_system_log',
166 'entity' => 'SystemLog',
167 'bao' => 'CRM_Core_DAO_SystemLog',
171 'name' => 'hostname',
172 'type' => CRM_Utils_Type
::T_STRING
,
173 'title' => ts('Log Host'),
174 'description' => ts('Optional Name of logging host'),
176 'size' => CRM_Utils_Type
::HUGE
,
177 'where' => 'civicrm_system_log.hostname',
178 'table_name' => 'civicrm_system_log',
179 'entity' => 'SystemLog',
180 'bao' => 'CRM_Core_DAO_SystemLog',
184 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
186 return Civi
::$statics[__CLASS__
]['fields'];
190 * Return a mapping from field-name to the corresponding key (as used in fields()).
193 * Array(string $name => string $uniqueName).
195 public static function &fieldKeys() {
196 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
197 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
199 return Civi
::$statics[__CLASS__
]['fieldKeys'];
203 * Returns the names of this table
207 public static function getTableName() {
208 return self
::$_tableName;
212 * Returns if this table needs to be logged
216 public function getLog() {
221 * Returns the list of fields that can be imported
223 * @param bool $prefix
227 public static function &import($prefix = FALSE) {
228 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'system_log', $prefix, []);
233 * Returns the list of fields that can be exported
235 * @param bool $prefix
239 public static function &export($prefix = FALSE) {
240 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'system_log', $prefix, []);
245 * Returns the list of indices
247 * @param bool $localize
251 public static function indices($localize = TRUE) {
253 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;