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