ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilCronJobEntity.php
Go to the documentation of this file.
1<?php declare(strict_types=1);
2/* Copyright (c) 1998-2020 ILIAS open source, Extended GPL, see docs/LICENSE */
3
8{
10 private $job;
12 private $isPlugin;
13
15 private $jobId;
17 private $component;
23 private $jobStatus;
43 private $class;
45 private $path;
52
59 public function __construct(ilCronJob $job, array $record, bool $isPlugin = false)
60 {
61 $this->job = $job;
62 $this->isPlugin = $isPlugin;
63 $this->mapRecord($record);
64 }
65
69 private function mapRecord(array $record) : void
70 {
71 $this->jobId = (string) $record['job_id'];
72 $this->component = (string) $record['component'];
73 $this->scheduleType = (int) $record['schedule_type'];
74 $this->scheduleValue = (int) $record['schedule_value'];
75 $this->jobStatus = (int) $record['job_status'];
76 $this->jobStatusUsrId = (int) $record['job_status_user_id'];
77 $this->jobStatusType = (int) $record['job_status_type'];
78 $this->jobStatusTimestamp = (int) $record['job_status_ts'];
79 $this->jobResultStatus = (int) $record['job_result_status'];
80 $this->jobResultUsrId = (int) $record['job_result_user_id'];
81 $this->jobResultCode = (string) $record['job_result_code'];
82 $this->jobResultMessage = (string) $record['job_result_message'];
83 $this->jobResultType = (int) $record['job_result_type'];
84 $this->jobResultTimestamp = (int) $record['job_result_ts'];
85 $this->class = (string) $record['class'];
86 $this->path = (string) $record['path'];
87 $this->runningTimestamp = (int) $record['running_ts'];
88 $this->jobResultDuration = (int) $record['job_result_dur'];
89 $this->aliveTimestamp = (int) $record['alive_ts'];
90 }
91
95 public function getJob() : ilCronJob
96 {
97 return $this->job;
98 }
99
103 public function getJobId() : string
104 {
105 return $this->jobId;
106 }
107
111 public function getComponent() : string
112 {
113 return $this->component;
114 }
115
119 public function getScheduleType() : int
120 {
121 return $this->scheduleType;
122 }
123
127 public function getScheduleValue() : int
128 {
130 }
131
135 public function getJobStatus() : int
136 {
137 return $this->jobStatus;
138 }
139
143 public function getJobStatusUsrId() : int
144 {
146 }
147
151 public function getJobStatusType() : int
152 {
154 }
155
159 public function getJobStatusTimestamp() : int
160 {
162 }
163
167 public function getJobResultStatus() : int
168 {
170 }
171
175 public function getJobResultUsrId() : int
176 {
178 }
179
183 public function getJobResultCode() : string
184 {
186 }
187
191 public function getJobResultMessage() : string
192 {
194 }
195
199 public function getJobResultType() : int
200 {
202 }
203
207 public function getJobResultTimestamp() : int
208 {
210 }
211
215 public function getClass() : string
216 {
217 return $this->class;
218 }
219
223 public function getPath() : string
224 {
225 return $this->path;
226 }
227
231 public function getRunningTimestamp() : int
232 {
234 }
235
239 public function getJobResultDuration() : int
240 {
242 }
243
247 public function getAliveTimestamp() : int
248 {
250 }
251
255 public function isPlugin() : bool
256 {
257 return $this->isPlugin;
258 }
259
263 public function getEffectiveScheduleType() : int
264 {
265 $type = $this->getScheduleType();
266 if (!$this->getJob()->hasFlexibleSchedule() || !$type) {
267 $type = (int) $this->getJob()->getDefaultScheduleType();
268 }
269
270 return $type;
271 }
272
276 public function getEffectiveScheduleValue() : int
277 {
278 $type = $this->getScheduleType();
279 $value = $this->getScheduleValue();
280 if (!$this->getJob()->hasFlexibleSchedule() || !$type) {
281 $value = (int) $this->getJob()->getDefaultScheduleValue();
282 }
283
284 return $value;
285 }
286
290 public function getEffectiveTitle() : string
291 {
292 $id = $this->getJobId();
293 if ($this->isPlugin()) {
294 $id = 'pl__' . $this->getComponent() . '__' . $id;
295 }
296
297 $title = (string) $this->getJob()->getTitle();
298 if (0 === strlen($title)) {
299 $title = $id;
300 }
301
302 return $title;
303 }
304}
An exception for terminatinating execution or to throw for unit testing.
Class ilCronJobEntity.
mapRecord(array $record)
__construct(ilCronJob $job, array $record, bool $isPlugin=false)
ilCronJobEntity constructor.
Cron job application base class.
$type