Commit | Line | Data |
---|---|---|
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/JobLog.xml | |
8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
e6ca0a57 | 9 | * (GenCodeChecksum:647390b654065a0cc421975a24ae14f9) |
e501603b | 10 | */ |
c3fc2621 | 11 | |
f41f0342 | 12 | /** |
c3fc2621 | 13 | * Database access object for the JobLog entity. |
f41f0342 | 14 | */ |
e501603b | 15 | class CRM_Core_DAO_JobLog 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_job_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 | * Job log entry Id | |
33 | * | |
e6ca0a57 | 34 | * @var int |
e501603b TO |
35 | */ |
36 | public $id; | |
c3fc2621 | 37 | |
e501603b TO |
38 | /** |
39 | * Which Domain is this scheduled job for | |
40 | * | |
e6ca0a57 | 41 | * @var int |
e501603b TO |
42 | */ |
43 | public $domain_id; | |
c3fc2621 | 44 | |
e501603b TO |
45 | /** |
46 | * Log entry date | |
47 | * | |
48 | * @var timestamp | |
49 | */ | |
50 | public $run_time; | |
c3fc2621 | 51 | |
e501603b TO |
52 | /** |
53 | * Pointer to job id - not a FK though, just for logging purposes | |
54 | * | |
e6ca0a57 | 55 | * @var int |
e501603b TO |
56 | */ |
57 | public $job_id; | |
c3fc2621 | 58 | |
e501603b TO |
59 | /** |
60 | * Title of the job | |
61 | * | |
62 | * @var string | |
63 | */ | |
64 | public $name; | |
c3fc2621 | 65 | |
e501603b TO |
66 | /** |
67 | * Full path to file containing job script | |
68 | * | |
69 | * @var string | |
70 | */ | |
71 | public $command; | |
c3fc2621 | 72 | |
e501603b TO |
73 | /** |
74 | * Title line of log entry | |
75 | * | |
76 | * @var string | |
77 | */ | |
78 | public $description; | |
c3fc2621 | 79 | |
e501603b TO |
80 | /** |
81 | * Potential extended data for specific job run (e.g. tracebacks). | |
82 | * | |
83 | * @var text | |
84 | */ | |
85 | public $data; | |
c3fc2621 | 86 | |
e501603b | 87 | /** |
f41f0342 | 88 | * Class constructor. |
e501603b | 89 | */ |
c3fc2621 | 90 | public function __construct() { |
e501603b TO |
91 | $this->__table = 'civicrm_job_log'; |
92 | parent::__construct(); | |
93 | } | |
c3fc2621 | 94 | |
e501603b | 95 | /** |
f41f0342 | 96 | * Returns foreign keys and entity references. |
e501603b TO |
97 | * |
98 | * @return array | |
99 | * [CRM_Core_Reference_Interface] | |
100 | */ | |
c3fc2621 | 101 | public static function getReferenceColumns() { |
346aaaba | 102 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
fa45b5b9 | 103 | Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__); |
c3fc2621 | 104 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'domain_id', 'civicrm_domain', 'id'); |
346aaaba | 105 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); |
e501603b | 106 | } |
346aaaba | 107 | return Civi::$statics[__CLASS__]['links']; |
e501603b | 108 | } |
c3fc2621 | 109 | |
e501603b TO |
110 | /** |
111 | * Returns all the column names of this table | |
112 | * | |
113 | * @return array | |
114 | */ | |
c3fc2621 | 115 | public static function &fields() { |
346aaaba | 116 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
c3fc2621 CW |
117 | Civi::$statics[__CLASS__]['fields'] = [ |
118 | 'id' => [ | |
e501603b TO |
119 | 'name' => 'id', |
120 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 121 | 'title' => ts('Job Log ID'), |
215b423e | 122 | 'description' => ts('Job log entry Id'), |
c3fc2621 | 123 | 'required' => TRUE, |
a36434b9 | 124 | 'where' => 'civicrm_job_log.id', |
522a26c9 | 125 | 'table_name' => 'civicrm_job_log', |
126 | 'entity' => 'JobLog', | |
127 | 'bao' => 'CRM_Core_DAO_JobLog', | |
6a7e5e5d | 128 | 'localizable' => 0, |
c3fc2621 CW |
129 | ], |
130 | 'domain_id' => [ | |
e501603b TO |
131 | 'name' => 'domain_id', |
132 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 133 | 'title' => ts('Domain ID'), |
215b423e | 134 | 'description' => ts('Which Domain is this scheduled job for'), |
c3fc2621 | 135 | 'required' => TRUE, |
a36434b9 | 136 | 'where' => 'civicrm_job_log.domain_id', |
522a26c9 | 137 | 'table_name' => 'civicrm_job_log', |
138 | 'entity' => 'JobLog', | |
139 | 'bao' => 'CRM_Core_DAO_JobLog', | |
6a7e5e5d | 140 | 'localizable' => 0, |
e501603b | 141 | 'FKClassName' => 'CRM_Core_DAO_Domain', |
c3fc2621 | 142 | 'pseudoconstant' => [ |
e501603b TO |
143 | 'table' => 'civicrm_domain', |
144 | 'keyColumn' => 'id', | |
145 | 'labelColumn' => 'name', | |
e6ca0a57 | 146 | ], |
c3fc2621 CW |
147 | ], |
148 | 'run_time' => [ | |
e501603b TO |
149 | 'name' => 'run_time', |
150 | 'type' => CRM_Utils_Type::T_TIMESTAMP, | |
c3fc2621 | 151 | 'title' => ts('Timestamp'), |
215b423e | 152 | 'description' => ts('Log entry date'), |
a36434b9 | 153 | 'where' => 'civicrm_job_log.run_time', |
522a26c9 | 154 | 'table_name' => 'civicrm_job_log', |
155 | 'entity' => 'JobLog', | |
156 | 'bao' => 'CRM_Core_DAO_JobLog', | |
6a7e5e5d | 157 | 'localizable' => 0, |
c3fc2621 CW |
158 | ], |
159 | 'job_id' => [ | |
e501603b TO |
160 | 'name' => 'job_id', |
161 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 162 | 'title' => ts('Job ID'), |
215b423e | 163 | 'description' => ts('Pointer to job id - not a FK though, just for logging purposes'), |
a36434b9 | 164 | 'where' => 'civicrm_job_log.job_id', |
522a26c9 | 165 | 'table_name' => 'civicrm_job_log', |
166 | 'entity' => 'JobLog', | |
167 | 'bao' => 'CRM_Core_DAO_JobLog', | |
6a7e5e5d | 168 | 'localizable' => 0, |
c3fc2621 CW |
169 | ], |
170 | 'name' => [ | |
e501603b TO |
171 | 'name' => 'name', |
172 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 173 | 'title' => ts('Job Name'), |
215b423e | 174 | 'description' => ts('Title of the job'), |
e501603b TO |
175 | 'maxlength' => 255, |
176 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 177 | 'where' => 'civicrm_job_log.name', |
522a26c9 | 178 | 'table_name' => 'civicrm_job_log', |
179 | 'entity' => 'JobLog', | |
180 | 'bao' => 'CRM_Core_DAO_JobLog', | |
6a7e5e5d | 181 | 'localizable' => 0, |
c3fc2621 CW |
182 | ], |
183 | 'command' => [ | |
e501603b TO |
184 | 'name' => 'command', |
185 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 186 | 'title' => ts('Command'), |
215b423e | 187 | 'description' => ts('Full path to file containing job script'), |
e501603b TO |
188 | 'maxlength' => 255, |
189 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 190 | 'where' => 'civicrm_job_log.command', |
522a26c9 | 191 | 'table_name' => 'civicrm_job_log', |
192 | 'entity' => 'JobLog', | |
193 | 'bao' => 'CRM_Core_DAO_JobLog', | |
6a7e5e5d | 194 | 'localizable' => 0, |
c3fc2621 CW |
195 | ], |
196 | 'description' => [ | |
e501603b TO |
197 | 'name' => 'description', |
198 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 199 | 'title' => ts('Description'), |
215b423e | 200 | 'description' => ts('Title line of log entry'), |
e501603b TO |
201 | 'maxlength' => 255, |
202 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 203 | 'where' => 'civicrm_job_log.description', |
522a26c9 | 204 | 'table_name' => 'civicrm_job_log', |
205 | 'entity' => 'JobLog', | |
206 | 'bao' => 'CRM_Core_DAO_JobLog', | |
6a7e5e5d | 207 | 'localizable' => 0, |
c3fc2621 CW |
208 | ], |
209 | 'data' => [ | |
e501603b TO |
210 | 'name' => 'data', |
211 | 'type' => CRM_Utils_Type::T_TEXT, | |
c3fc2621 | 212 | 'title' => ts('Extended Data'), |
215b423e | 213 | 'description' => ts('Potential extended data for specific job run (e.g. tracebacks).'), |
a36434b9 | 214 | 'where' => 'civicrm_job_log.data', |
522a26c9 | 215 | 'table_name' => 'civicrm_job_log', |
216 | 'entity' => 'JobLog', | |
217 | 'bao' => 'CRM_Core_DAO_JobLog', | |
6a7e5e5d | 218 | 'localizable' => 0, |
c3fc2621 CW |
219 | ], |
220 | ]; | |
346aaaba | 221 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 222 | } |
346aaaba | 223 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 224 | } |
c3fc2621 | 225 | |
e501603b | 226 | /** |
bd8e0b14 | 227 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
228 | * |
229 | * @return array | |
bd8e0b14 | 230 | * Array(string $name => string $uniqueName). |
e501603b | 231 | */ |
c3fc2621 | 232 | public static function &fieldKeys() { |
bd8e0b14 TO |
233 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
234 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 235 | } |
bd8e0b14 | 236 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 237 | } |
c3fc2621 | 238 | |
e501603b TO |
239 | /** |
240 | * Returns the names of this table | |
241 | * | |
242 | * @return string | |
243 | */ | |
c3fc2621 | 244 | public static function getTableName() { |
e501603b TO |
245 | return self::$_tableName; |
246 | } | |
c3fc2621 | 247 | |
e501603b TO |
248 | /** |
249 | * Returns if this table needs to be logged | |
250 | * | |
c3fc2621 | 251 | * @return bool |
e501603b | 252 | */ |
c3fc2621 | 253 | public function getLog() { |
e501603b TO |
254 | return self::$_log; |
255 | } | |
c3fc2621 | 256 | |
e501603b TO |
257 | /** |
258 | * Returns the list of fields that can be imported | |
259 | * | |
260 | * @param bool $prefix | |
261 | * | |
262 | * @return array | |
263 | */ | |
c3fc2621 CW |
264 | public static function &import($prefix = FALSE) { |
265 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'job_log', $prefix, []); | |
60808919 | 266 | return $r; |
e501603b | 267 | } |
c3fc2621 | 268 | |
e501603b TO |
269 | /** |
270 | * Returns the list of fields that can be exported | |
271 | * | |
272 | * @param bool $prefix | |
273 | * | |
274 | * @return array | |
275 | */ | |
c3fc2621 CW |
276 | public static function &export($prefix = FALSE) { |
277 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'job_log', $prefix, []); | |
60808919 | 278 | return $r; |
e501603b | 279 | } |
c3fc2621 | 280 | |
e7a6b91a AS |
281 | /** |
282 | * Returns the list of indices | |
c3fc2621 CW |
283 | * |
284 | * @param bool $localize | |
285 | * | |
286 | * @return array | |
e7a6b91a AS |
287 | */ |
288 | public static function indices($localize = TRUE) { | |
c3fc2621 | 289 | $indices = []; |
e7a6b91a AS |
290 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
291 | } | |
c3fc2621 | 292 | |
e501603b | 293 | } |