Merge pull request #22292 from totten/master-authxlogin-2
[civicrm-core.git] / CRM / Core / DAO / JobLog.php
CommitLineData
e501603b 1<?php
c3fc2621 2
e501603b
TO
3/**
4 * @package CRM
ca5cec67 5 * @copyright CiviCRM LLC https://civicrm.org/licensing
e501603b
TO
6 *
7 * Generated from xml/schema/CRM/Core/JobLog.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
2562d09a 9 * (GenCodeChecksum:6677b28207cbf86835164b7b33c38608)
e501603b 10 */
c3fc2621 11
f41f0342 12/**
c3fc2621 13 * Database access object for the JobLog entity.
f41f0342 14 */
e501603b 15class CRM_Core_DAO_JobLog extends CRM_Core_DAO {
929a1c14
CW
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '4.1';
c3fc2621 18
e501603b 19 /**
f41f0342 20 * Static instance to hold the table name.
e501603b
TO
21 *
22 * @var string
23 */
fa45b5b9 24 public static $_tableName = 'civicrm_job_log';
c3fc2621 25
e501603b 26 /**
f41f0342 27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
e501603b 28 *
c3fc2621 29 * @var bool
e501603b 30 */
fa45b5b9 31 public static $_log = FALSE;
c3fc2621 32
e501603b 33 /**
2cbbebe8 34 * Job log entry ID
e501603b 35 *
e6ca0a57 36 * @var int
e501603b
TO
37 */
38 public $id;
c3fc2621 39
e501603b
TO
40 /**
41 * Which Domain is this scheduled job for
42 *
e6ca0a57 43 * @var int
e501603b
TO
44 */
45 public $domain_id;
c3fc2621 46
e501603b
TO
47 /**
48 * Log entry date
49 *
50 * @var timestamp
51 */
52 public $run_time;
c3fc2621 53
e501603b
TO
54 /**
55 * Pointer to job id - not a FK though, just for logging purposes
56 *
e6ca0a57 57 * @var int
e501603b
TO
58 */
59 public $job_id;
c3fc2621 60
e501603b
TO
61 /**
62 * Title of the job
63 *
64 * @var string
65 */
66 public $name;
c3fc2621 67
e501603b
TO
68 /**
69 * Full path to file containing job script
70 *
71 * @var string
72 */
73 public $command;
c3fc2621 74
e501603b
TO
75 /**
76 * Title line of log entry
77 *
78 * @var string
79 */
80 public $description;
c3fc2621 81
e501603b
TO
82 /**
83 * Potential extended data for specific job run (e.g. tracebacks).
84 *
85 * @var text
86 */
87 public $data;
c3fc2621 88
e501603b 89 /**
f41f0342 90 * Class constructor.
e501603b 91 */
c3fc2621 92 public function __construct() {
e501603b
TO
93 $this->__table = 'civicrm_job_log';
94 parent::__construct();
95 }
c3fc2621 96
449c4e6b
CW
97 /**
98 * Returns localized title of this entity.
7b66c3b5
AH
99 *
100 * @param bool $plural
101 * Whether to return the plural version of the title.
449c4e6b 102 */
7b66c3b5
AH
103 public static function getEntityTitle($plural = FALSE) {
104 return $plural ? ts('Job Logs') : ts('Job Log');
449c4e6b
CW
105 }
106
e501603b 107 /**
f41f0342 108 * Returns foreign keys and entity references.
e501603b
TO
109 *
110 * @return array
111 * [CRM_Core_Reference_Interface]
112 */
c3fc2621 113 public static function getReferenceColumns() {
346aaaba 114 if (!isset(Civi::$statics[__CLASS__]['links'])) {
fa45b5b9 115 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
c3fc2621 116 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'domain_id', 'civicrm_domain', 'id');
346aaaba 117 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 118 }
346aaaba 119 return Civi::$statics[__CLASS__]['links'];
e501603b 120 }
c3fc2621 121
e501603b
TO
122 /**
123 * Returns all the column names of this table
124 *
125 * @return array
126 */
c3fc2621 127 public static function &fields() {
346aaaba 128 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
129 Civi::$statics[__CLASS__]['fields'] = [
130 'id' => [
e501603b
TO
131 'name' => 'id',
132 'type' => CRM_Utils_Type::T_INT,
c3fc2621 133 'title' => ts('Job Log ID'),
2cbbebe8 134 'description' => ts('Job log entry ID'),
c3fc2621 135 'required' => TRUE,
a36434b9 136 'where' => 'civicrm_job_log.id',
522a26c9 137 'table_name' => 'civicrm_job_log',
138 'entity' => 'JobLog',
139 'bao' => 'CRM_Core_DAO_JobLog',
6a7e5e5d 140 'localizable' => 0,
2cbbebe8
A
141 'html' => [
142 'type' => 'Number',
143 ],
1fe423d6 144 'readonly' => TRUE,
a9d0587b 145 'add' => '4.1',
c3fc2621
CW
146 ],
147 'domain_id' => [
e501603b
TO
148 'name' => 'domain_id',
149 'type' => CRM_Utils_Type::T_INT,
c3fc2621 150 'title' => ts('Domain ID'),
215b423e 151 'description' => ts('Which Domain is this scheduled job for'),
c3fc2621 152 'required' => TRUE,
a36434b9 153 'where' => 'civicrm_job_log.domain_id',
522a26c9 154 'table_name' => 'civicrm_job_log',
155 'entity' => 'JobLog',
156 'bao' => 'CRM_Core_DAO_JobLog',
6a7e5e5d 157 'localizable' => 0,
e501603b 158 'FKClassName' => 'CRM_Core_DAO_Domain',
2cbbebe8
A
159 'html' => [
160 'label' => ts("Domain"),
161 ],
c3fc2621 162 'pseudoconstant' => [
e501603b
TO
163 'table' => 'civicrm_domain',
164 'keyColumn' => 'id',
165 'labelColumn' => 'name',
e6ca0a57 166 ],
a9d0587b 167 'add' => '4.1',
c3fc2621
CW
168 ],
169 'run_time' => [
e501603b
TO
170 'name' => 'run_time',
171 'type' => CRM_Utils_Type::T_TIMESTAMP,
c3fc2621 172 'title' => ts('Timestamp'),
215b423e 173 'description' => ts('Log entry date'),
a36434b9 174 'where' => 'civicrm_job_log.run_time',
522a26c9 175 'table_name' => 'civicrm_job_log',
176 'entity' => 'JobLog',
177 'bao' => 'CRM_Core_DAO_JobLog',
6a7e5e5d 178 'localizable' => 0,
a9d0587b 179 'add' => '4.1',
c3fc2621
CW
180 ],
181 'job_id' => [
e501603b
TO
182 'name' => 'job_id',
183 'type' => CRM_Utils_Type::T_INT,
c3fc2621 184 'title' => ts('Job ID'),
215b423e 185 'description' => ts('Pointer to job id - not a FK though, just for logging purposes'),
a36434b9 186 'where' => 'civicrm_job_log.job_id',
522a26c9 187 'table_name' => 'civicrm_job_log',
188 'entity' => 'JobLog',
189 'bao' => 'CRM_Core_DAO_JobLog',
6a7e5e5d 190 'localizable' => 0,
a9d0587b 191 'add' => '4.1',
c3fc2621
CW
192 ],
193 'name' => [
e501603b
TO
194 'name' => 'name',
195 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 196 'title' => ts('Job Name'),
215b423e 197 'description' => ts('Title of the job'),
e501603b
TO
198 'maxlength' => 255,
199 'size' => CRM_Utils_Type::HUGE,
a36434b9 200 'where' => 'civicrm_job_log.name',
522a26c9 201 'table_name' => 'civicrm_job_log',
202 'entity' => 'JobLog',
203 'bao' => 'CRM_Core_DAO_JobLog',
6a7e5e5d 204 'localizable' => 0,
a9d0587b 205 'add' => '4.1',
c3fc2621
CW
206 ],
207 'command' => [
e501603b
TO
208 'name' => 'command',
209 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 210 'title' => ts('Command'),
215b423e 211 'description' => ts('Full path to file containing job script'),
e501603b
TO
212 'maxlength' => 255,
213 'size' => CRM_Utils_Type::HUGE,
a36434b9 214 'where' => 'civicrm_job_log.command',
522a26c9 215 'table_name' => 'civicrm_job_log',
216 'entity' => 'JobLog',
217 'bao' => 'CRM_Core_DAO_JobLog',
6a7e5e5d 218 'localizable' => 0,
a9d0587b 219 'add' => '4.1',
c3fc2621
CW
220 ],
221 'description' => [
e501603b
TO
222 'name' => 'description',
223 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 224 'title' => ts('Description'),
215b423e 225 'description' => ts('Title line of log entry'),
e501603b
TO
226 'maxlength' => 255,
227 'size' => CRM_Utils_Type::HUGE,
a36434b9 228 'where' => 'civicrm_job_log.description',
522a26c9 229 'table_name' => 'civicrm_job_log',
230 'entity' => 'JobLog',
231 'bao' => 'CRM_Core_DAO_JobLog',
6a7e5e5d 232 'localizable' => 0,
a9d0587b 233 'add' => '4.1',
c3fc2621
CW
234 ],
235 'data' => [
e501603b
TO
236 'name' => 'data',
237 'type' => CRM_Utils_Type::T_TEXT,
c3fc2621 238 'title' => ts('Extended Data'),
215b423e 239 'description' => ts('Potential extended data for specific job run (e.g. tracebacks).'),
a36434b9 240 'where' => 'civicrm_job_log.data',
522a26c9 241 'table_name' => 'civicrm_job_log',
242 'entity' => 'JobLog',
243 'bao' => 'CRM_Core_DAO_JobLog',
6a7e5e5d 244 'localizable' => 0,
a9d0587b 245 'add' => '4.1',
c3fc2621
CW
246 ],
247 ];
346aaaba 248 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 249 }
346aaaba 250 return Civi::$statics[__CLASS__]['fields'];
e501603b 251 }
c3fc2621 252
e501603b 253 /**
bd8e0b14 254 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
255 *
256 * @return array
bd8e0b14 257 * Array(string $name => string $uniqueName).
e501603b 258 */
c3fc2621 259 public static function &fieldKeys() {
bd8e0b14
TO
260 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
261 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 262 }
bd8e0b14 263 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 264 }
c3fc2621 265
e501603b
TO
266 /**
267 * Returns the names of this table
268 *
269 * @return string
270 */
c3fc2621 271 public static function getTableName() {
e501603b
TO
272 return self::$_tableName;
273 }
c3fc2621 274
e501603b
TO
275 /**
276 * Returns if this table needs to be logged
277 *
c3fc2621 278 * @return bool
e501603b 279 */
c3fc2621 280 public function getLog() {
e501603b
TO
281 return self::$_log;
282 }
c3fc2621 283
e501603b
TO
284 /**
285 * Returns the list of fields that can be imported
286 *
287 * @param bool $prefix
288 *
289 * @return array
290 */
c3fc2621
CW
291 public static function &import($prefix = FALSE) {
292 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'job_log', $prefix, []);
60808919 293 return $r;
e501603b 294 }
c3fc2621 295
e501603b
TO
296 /**
297 * Returns the list of fields that can be exported
298 *
299 * @param bool $prefix
300 *
301 * @return array
302 */
c3fc2621
CW
303 public static function &export($prefix = FALSE) {
304 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'job_log', $prefix, []);
60808919 305 return $r;
e501603b 306 }
c3fc2621 307
e7a6b91a
AS
308 /**
309 * Returns the list of indices
c3fc2621
CW
310 *
311 * @param bool $localize
312 *
313 * @return array
e7a6b91a
AS
314 */
315 public static function indices($localize = TRUE) {
c3fc2621 316 $indices = [];
e7a6b91a
AS
317 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
318 }
c3fc2621 319
e501603b 320}