CRM-17663 - Configurable cache time per dashlet & auto-refresh
[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
437fafcf 33 * (GenCodeChecksum:de437db587f1fb4d7f90320e3e42db2c)
e501603b
TO
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';
e501603b
TO
44 /**
45 * static value to see if we should log any modifications to
46 * this table in the civicrm_log table
47 *
48 * @var boolean
49 */
50 static $_log = false;
51 /**
52 * Primary key ID
53 *
54 * @var int unsigned
55 */
56 public $id;
57 /**
58 * Standardized message
59 *
60 * @var string
61 */
62 public $message;
63 /**
64 * JSON encoded data
65 *
66 * @var longtext
67 */
68 public $context;
69 /**
70 * error level per PSR3
71 *
72 * @var string
73 */
74 public $level;
75 /**
76 * Timestamp of when event occurred.
77 *
78 * @var timestamp
79 */
80 public $timestamp;
81 /**
82 * Optional Contact ID that created the log. Not an FK as we keep this regardless
83 *
84 * @var int unsigned
85 */
86 public $contact_id;
87 /**
88 * Optional Name of logging host
89 *
90 * @var string
91 */
92 public $hostname;
93 /**
94 * class constructor
95 *
96 * @return civicrm_system_log
97 */
98 function __construct() {
99 $this->__table = 'civicrm_system_log';
100 parent::__construct();
101 }
102 /**
103 * Returns all the column names of this table
104 *
105 * @return array
106 */
107 static function &fields() {
346aaaba
TO
108 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
109 Civi::$statics[__CLASS__]['fields'] = array(
e501603b
TO
110 'id' => array(
111 'name' => 'id',
112 'type' => CRM_Utils_Type::T_INT,
113 'title' => ts('System Log ID') ,
114 'description' => 'Primary key ID',
115 'required' => true,
116 ) ,
117 'message' => array(
118 'name' => 'message',
119 'type' => CRM_Utils_Type::T_STRING,
120 'title' => ts('System Log Message') ,
121 'description' => 'Standardized message',
122 'required' => true,
123 'maxlength' => 128,
124 'size' => CRM_Utils_Type::HUGE,
125 ) ,
126 'context' => array(
127 'name' => 'context',
128 'type' => CRM_Utils_Type::T_LONGTEXT,
129 'title' => ts('Detailed Log Data') ,
130 'description' => 'JSON encoded data',
131 ) ,
132 'level' => array(
133 'name' => 'level',
134 'type' => CRM_Utils_Type::T_STRING,
135 'title' => ts('Detailed Log Data') ,
136 'description' => 'error level per PSR3',
137 'maxlength' => 9,
138 'size' => CRM_Utils_Type::TWELVE,
139 'default' => 'info',
140 ) ,
141 'timestamp' => array(
142 'name' => 'timestamp',
143 'type' => CRM_Utils_Type::T_TIMESTAMP,
144 'title' => ts('Log Timestamp') ,
145 'description' => 'Timestamp of when event occurred.',
146 'default' => 'CURRENT_TIMESTAMP',
147 ) ,
148 'contact_id' => array(
149 'name' => 'contact_id',
150 'type' => CRM_Utils_Type::T_INT,
151 'title' => ts('Log Contact ID') ,
152 'description' => 'Optional Contact ID that created the log. Not an FK as we keep this regardless',
153 ) ,
154 'hostname' => array(
155 'name' => 'hostname',
156 'type' => CRM_Utils_Type::T_STRING,
157 'title' => ts('Log Host') ,
158 'description' => 'Optional Name of logging host',
159 'maxlength' => 128,
160 'size' => CRM_Utils_Type::HUGE,
161 ) ,
162 );
346aaaba 163 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 164 }
346aaaba 165 return Civi::$statics[__CLASS__]['fields'];
e501603b
TO
166 }
167 /**
bd8e0b14 168 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
169 *
170 * @return array
bd8e0b14 171 * Array(string $name => string $uniqueName).
e501603b
TO
172 */
173 static function &fieldKeys() {
bd8e0b14
TO
174 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
175 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 176 }
bd8e0b14 177 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b
TO
178 }
179 /**
180 * Returns the names of this table
181 *
182 * @return string
183 */
184 static function getTableName() {
185 return self::$_tableName;
186 }
187 /**
188 * Returns if this table needs to be logged
189 *
190 * @return boolean
191 */
192 function getLog() {
193 return self::$_log;
194 }
195 /**
196 * Returns the list of fields that can be imported
197 *
198 * @param bool $prefix
199 *
200 * @return array
201 */
202 static function &import($prefix = false) {
60808919
TO
203 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'system_log', $prefix, array());
204 return $r;
e501603b
TO
205 }
206 /**
207 * Returns the list of fields that can be exported
208 *
209 * @param bool $prefix
210 *
211 * @return array
212 */
213 static function &export($prefix = false) {
60808919
TO
214 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'system_log', $prefix, array());
215 return $r;
e501603b
TO
216 }
217}