CRM_Core_CodeGen_DAO::needsUpdate - Compare full code (modulo whitespace)
[civicrm-core.git] / CRM / Core / DAO / SystemLog.php
CommitLineData
e501603b
TO
1<?php
2/*
3+--------------------------------------------------------------------+
4| CiviCRM version 4.7 |
5+--------------------------------------------------------------------+
6| Copyright CiviCRM LLC (c) 2004-2016 |
7+--------------------------------------------------------------------+
8| This file is a part of CiviCRM. |
9| |
10| CiviCRM is free software; you can copy, modify, and distribute it |
11| under the terms of the GNU Affero General Public License |
12| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
13| |
14| CiviCRM is distributed in the hope that it will be useful, but |
15| WITHOUT ANY WARRANTY; without even the implied warranty of |
16| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17| See the GNU Affero General Public License for more details. |
18| |
19| You should have received a copy of the GNU Affero General Public |
20| License and the CiviCRM Licensing Exception along |
21| with this program; if not, contact CiviCRM LLC |
22| at info[AT]civicrm[DOT]org. If you have questions about the |
23| GNU Affero General Public License or the licensing of CiviCRM, |
24| see the CiviCRM license FAQ at http://civicrm.org/licensing |
25+--------------------------------------------------------------------+
26*/
27/**
28 * @package CRM
29 * @copyright CiviCRM LLC (c) 2004-2016
30 *
31 * Generated from xml/schema/CRM/Core/SystemLog.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:23db96fd481ff90d7556cad2ae90560b)
34 */
35require_once 'CRM/Core/DAO.php';
36require_once 'CRM/Utils/Type.php';
37class CRM_Core_DAO_SystemLog extends CRM_Core_DAO {
38 /**
39 * static instance to hold the table name
40 *
41 * @var string
42 */
43 static $_tableName = 'civicrm_system_log';
44 /**
45 * static instance to hold the field values
46 *
47 * @var array
48 */
49 static $_fields = null;
50 /**
51 * static instance to hold the keys used in $_fields for each field.
52 *
53 * @var array
54 */
55 static $_fieldKeys = null;
56 /**
57 * static instance to hold the FK relationships
58 *
59 * @var string
60 */
61 static $_links = null;
62 /**
63 * static instance to hold the values that can
64 * be imported
65 *
66 * @var array
67 */
68 static $_import = null;
69 /**
70 * static instance to hold the values that can
71 * be exported
72 *
73 * @var array
74 */
75 static $_export = null;
76 /**
77 * static value to see if we should log any modifications to
78 * this table in the civicrm_log table
79 *
80 * @var boolean
81 */
82 static $_log = false;
83 /**
84 * Primary key ID
85 *
86 * @var int unsigned
87 */
88 public $id;
89 /**
90 * Standardized message
91 *
92 * @var string
93 */
94 public $message;
95 /**
96 * JSON encoded data
97 *
98 * @var longtext
99 */
100 public $context;
101 /**
102 * error level per PSR3
103 *
104 * @var string
105 */
106 public $level;
107 /**
108 * Timestamp of when event occurred.
109 *
110 * @var timestamp
111 */
112 public $timestamp;
113 /**
114 * Optional Contact ID that created the log. Not an FK as we keep this regardless
115 *
116 * @var int unsigned
117 */
118 public $contact_id;
119 /**
120 * Optional Name of logging host
121 *
122 * @var string
123 */
124 public $hostname;
125 /**
126 * class constructor
127 *
128 * @return civicrm_system_log
129 */
130 function __construct() {
131 $this->__table = 'civicrm_system_log';
132 parent::__construct();
133 }
134 /**
135 * Returns all the column names of this table
136 *
137 * @return array
138 */
139 static function &fields() {
140 if (!(self::$_fields)) {
141 self::$_fields = array(
142 'id' => array(
143 'name' => 'id',
144 'type' => CRM_Utils_Type::T_INT,
145 'title' => ts('System Log ID') ,
146 'description' => 'Primary key ID',
147 'required' => true,
148 ) ,
149 'message' => array(
150 'name' => 'message',
151 'type' => CRM_Utils_Type::T_STRING,
152 'title' => ts('System Log Message') ,
153 'description' => 'Standardized message',
154 'required' => true,
155 'maxlength' => 128,
156 'size' => CRM_Utils_Type::HUGE,
157 ) ,
158 'context' => array(
159 'name' => 'context',
160 'type' => CRM_Utils_Type::T_LONGTEXT,
161 'title' => ts('Detailed Log Data') ,
162 'description' => 'JSON encoded data',
163 ) ,
164 'level' => array(
165 'name' => 'level',
166 'type' => CRM_Utils_Type::T_STRING,
167 'title' => ts('Detailed Log Data') ,
168 'description' => 'error level per PSR3',
169 'maxlength' => 9,
170 'size' => CRM_Utils_Type::TWELVE,
171 'default' => 'info',
172 ) ,
173 'timestamp' => array(
174 'name' => 'timestamp',
175 'type' => CRM_Utils_Type::T_TIMESTAMP,
176 'title' => ts('Log Timestamp') ,
177 'description' => 'Timestamp of when event occurred.',
178 'default' => 'CURRENT_TIMESTAMP',
179 ) ,
180 'contact_id' => array(
181 'name' => 'contact_id',
182 'type' => CRM_Utils_Type::T_INT,
183 'title' => ts('Log Contact ID') ,
184 'description' => 'Optional Contact ID that created the log. Not an FK as we keep this regardless',
185 ) ,
186 'hostname' => array(
187 'name' => 'hostname',
188 'type' => CRM_Utils_Type::T_STRING,
189 'title' => ts('Log Host') ,
190 'description' => 'Optional Name of logging host',
191 'maxlength' => 128,
192 'size' => CRM_Utils_Type::HUGE,
193 ) ,
194 );
195 }
196 return self::$_fields;
197 }
198 /**
199 * Returns an array containing, for each field, the arary key used for that
200 * field in self::$_fields.
201 *
202 * @return array
203 */
204 static function &fieldKeys() {
205 if (!(self::$_fieldKeys)) {
206 self::$_fieldKeys = array(
207 'id' => 'id',
208 'message' => 'message',
209 'context' => 'context',
210 'level' => 'level',
211 'timestamp' => 'timestamp',
212 'contact_id' => 'contact_id',
213 'hostname' => 'hostname',
214 );
215 }
216 return self::$_fieldKeys;
217 }
218 /**
219 * Returns the names of this table
220 *
221 * @return string
222 */
223 static function getTableName() {
224 return self::$_tableName;
225 }
226 /**
227 * Returns if this table needs to be logged
228 *
229 * @return boolean
230 */
231 function getLog() {
232 return self::$_log;
233 }
234 /**
235 * Returns the list of fields that can be imported
236 *
237 * @param bool $prefix
238 *
239 * @return array
240 */
241 static function &import($prefix = false) {
242 if (!(self::$_import)) {
243 self::$_import = array();
244 $fields = self::fields();
245 foreach($fields as $name => $field) {
246 if (CRM_Utils_Array::value('import', $field)) {
247 if ($prefix) {
248 self::$_import['system_log'] = & $fields[$name];
249 } else {
250 self::$_import[$name] = & $fields[$name];
251 }
252 }
253 }
254 }
255 return self::$_import;
256 }
257 /**
258 * Returns the list of fields that can be exported
259 *
260 * @param bool $prefix
261 *
262 * @return array
263 */
264 static function &export($prefix = false) {
265 if (!(self::$_export)) {
266 self::$_export = array();
267 $fields = self::fields();
268 foreach($fields as $name => $field) {
269 if (CRM_Utils_Array::value('export', $field)) {
270 if ($prefix) {
271 self::$_export['system_log'] = & $fields[$name];
272 } else {
273 self::$_export[$name] = & $fields[$name];
274 }
275 }
276 }
277 }
278 return self::$_export;
279 }
280}