Commit | Line | Data |
---|---|---|
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 | |
7b66c3b5 | 9 | * (GenCodeChecksum:74e191eba977eb496bae109ca9720ab7) |
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 { |
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 TO |
33 | /** |
34 | * Job log entry Id | |
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'), |
215b423e | 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, |
a9d0587b | 141 | 'add' => '4.1', |
c3fc2621 CW |
142 | ], |
143 | 'domain_id' => [ | |
e501603b TO |
144 | 'name' => 'domain_id', |
145 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 146 | 'title' => ts('Domain ID'), |
215b423e | 147 | 'description' => ts('Which Domain is this scheduled job for'), |
c3fc2621 | 148 | 'required' => TRUE, |
a36434b9 | 149 | 'where' => 'civicrm_job_log.domain_id', |
522a26c9 | 150 | 'table_name' => 'civicrm_job_log', |
151 | 'entity' => 'JobLog', | |
152 | 'bao' => 'CRM_Core_DAO_JobLog', | |
6a7e5e5d | 153 | 'localizable' => 0, |
e501603b | 154 | 'FKClassName' => 'CRM_Core_DAO_Domain', |
c3fc2621 | 155 | 'pseudoconstant' => [ |
e501603b TO |
156 | 'table' => 'civicrm_domain', |
157 | 'keyColumn' => 'id', | |
158 | 'labelColumn' => 'name', | |
e6ca0a57 | 159 | ], |
a9d0587b | 160 | 'add' => '4.1', |
c3fc2621 CW |
161 | ], |
162 | 'run_time' => [ | |
e501603b TO |
163 | 'name' => 'run_time', |
164 | 'type' => CRM_Utils_Type::T_TIMESTAMP, | |
c3fc2621 | 165 | 'title' => ts('Timestamp'), |
215b423e | 166 | 'description' => ts('Log entry date'), |
a36434b9 | 167 | 'where' => 'civicrm_job_log.run_time', |
522a26c9 | 168 | 'table_name' => 'civicrm_job_log', |
169 | 'entity' => 'JobLog', | |
170 | 'bao' => 'CRM_Core_DAO_JobLog', | |
6a7e5e5d | 171 | 'localizable' => 0, |
a9d0587b | 172 | 'add' => '4.1', |
c3fc2621 CW |
173 | ], |
174 | 'job_id' => [ | |
e501603b TO |
175 | 'name' => 'job_id', |
176 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 177 | 'title' => ts('Job ID'), |
215b423e | 178 | 'description' => ts('Pointer to job id - not a FK though, just for logging purposes'), |
a36434b9 | 179 | 'where' => 'civicrm_job_log.job_id', |
522a26c9 | 180 | 'table_name' => 'civicrm_job_log', |
181 | 'entity' => 'JobLog', | |
182 | 'bao' => 'CRM_Core_DAO_JobLog', | |
6a7e5e5d | 183 | 'localizable' => 0, |
a9d0587b | 184 | 'add' => '4.1', |
c3fc2621 CW |
185 | ], |
186 | 'name' => [ | |
e501603b TO |
187 | 'name' => 'name', |
188 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 189 | 'title' => ts('Job Name'), |
215b423e | 190 | 'description' => ts('Title of the job'), |
e501603b TO |
191 | 'maxlength' => 255, |
192 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 193 | 'where' => 'civicrm_job_log.name', |
522a26c9 | 194 | 'table_name' => 'civicrm_job_log', |
195 | 'entity' => 'JobLog', | |
196 | 'bao' => 'CRM_Core_DAO_JobLog', | |
6a7e5e5d | 197 | 'localizable' => 0, |
a9d0587b | 198 | 'add' => '4.1', |
c3fc2621 CW |
199 | ], |
200 | 'command' => [ | |
e501603b TO |
201 | 'name' => 'command', |
202 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 203 | 'title' => ts('Command'), |
215b423e | 204 | 'description' => ts('Full path to file containing job script'), |
e501603b TO |
205 | 'maxlength' => 255, |
206 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 207 | 'where' => 'civicrm_job_log.command', |
522a26c9 | 208 | 'table_name' => 'civicrm_job_log', |
209 | 'entity' => 'JobLog', | |
210 | 'bao' => 'CRM_Core_DAO_JobLog', | |
6a7e5e5d | 211 | 'localizable' => 0, |
a9d0587b | 212 | 'add' => '4.1', |
c3fc2621 CW |
213 | ], |
214 | 'description' => [ | |
e501603b TO |
215 | 'name' => 'description', |
216 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 217 | 'title' => ts('Description'), |
215b423e | 218 | 'description' => ts('Title line of log entry'), |
e501603b TO |
219 | 'maxlength' => 255, |
220 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 221 | 'where' => 'civicrm_job_log.description', |
522a26c9 | 222 | 'table_name' => 'civicrm_job_log', |
223 | 'entity' => 'JobLog', | |
224 | 'bao' => 'CRM_Core_DAO_JobLog', | |
6a7e5e5d | 225 | 'localizable' => 0, |
a9d0587b | 226 | 'add' => '4.1', |
c3fc2621 CW |
227 | ], |
228 | 'data' => [ | |
e501603b TO |
229 | 'name' => 'data', |
230 | 'type' => CRM_Utils_Type::T_TEXT, | |
c3fc2621 | 231 | 'title' => ts('Extended Data'), |
215b423e | 232 | 'description' => ts('Potential extended data for specific job run (e.g. tracebacks).'), |
a36434b9 | 233 | 'where' => 'civicrm_job_log.data', |
522a26c9 | 234 | 'table_name' => 'civicrm_job_log', |
235 | 'entity' => 'JobLog', | |
236 | 'bao' => 'CRM_Core_DAO_JobLog', | |
6a7e5e5d | 237 | 'localizable' => 0, |
a9d0587b | 238 | 'add' => '4.1', |
c3fc2621 CW |
239 | ], |
240 | ]; | |
346aaaba | 241 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 242 | } |
346aaaba | 243 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 244 | } |
c3fc2621 | 245 | |
e501603b | 246 | /** |
bd8e0b14 | 247 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
248 | * |
249 | * @return array | |
bd8e0b14 | 250 | * Array(string $name => string $uniqueName). |
e501603b | 251 | */ |
c3fc2621 | 252 | public static function &fieldKeys() { |
bd8e0b14 TO |
253 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
254 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 255 | } |
bd8e0b14 | 256 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 257 | } |
c3fc2621 | 258 | |
e501603b TO |
259 | /** |
260 | * Returns the names of this table | |
261 | * | |
262 | * @return string | |
263 | */ | |
c3fc2621 | 264 | public static function getTableName() { |
e501603b TO |
265 | return self::$_tableName; |
266 | } | |
c3fc2621 | 267 | |
e501603b TO |
268 | /** |
269 | * Returns if this table needs to be logged | |
270 | * | |
c3fc2621 | 271 | * @return bool |
e501603b | 272 | */ |
c3fc2621 | 273 | public function getLog() { |
e501603b TO |
274 | return self::$_log; |
275 | } | |
c3fc2621 | 276 | |
e501603b TO |
277 | /** |
278 | * Returns the list of fields that can be imported | |
279 | * | |
280 | * @param bool $prefix | |
281 | * | |
282 | * @return array | |
283 | */ | |
c3fc2621 CW |
284 | public static function &import($prefix = FALSE) { |
285 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'job_log', $prefix, []); | |
60808919 | 286 | return $r; |
e501603b | 287 | } |
c3fc2621 | 288 | |
e501603b TO |
289 | /** |
290 | * Returns the list of fields that can be exported | |
291 | * | |
292 | * @param bool $prefix | |
293 | * | |
294 | * @return array | |
295 | */ | |
c3fc2621 CW |
296 | public static function &export($prefix = FALSE) { |
297 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'job_log', $prefix, []); | |
60808919 | 298 | return $r; |
e501603b | 299 | } |
c3fc2621 | 300 | |
e7a6b91a AS |
301 | /** |
302 | * Returns the list of indices | |
c3fc2621 CW |
303 | * |
304 | * @param bool $localize | |
305 | * | |
306 | * @return array | |
e7a6b91a AS |
307 | */ |
308 | public static function indices($localize = TRUE) { | |
c3fc2621 | 309 | $indices = []; |
e7a6b91a AS |
310 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
311 | } | |
c3fc2621 | 312 | |
e501603b | 313 | } |