35 public function isActive($a_ts_last_run, $a_schedule_type, $a_schedule_value, $a_manual =
false)
44 return $this->
checkSchedule($a_ts_last_run, $a_schedule_type, $a_schedule_value);
55 return $this->schedule_type;
67 return $this->schedule_value;
82 $this->schedule_type = $a_type;
83 $this->schedule_value = $a_value;
94 self::SCHEDULE_TYPE_DAILY,
95 self::SCHEDULE_TYPE_WEEKLY,
96 self::SCHEDULE_TYPE_MONTHLY,
97 self::SCHEDULE_TYPE_QUARTERLY,
98 self::SCHEDULE_TYPE_YEARLY,
99 self::SCHEDULE_TYPE_IN_MINUTES,
100 self::SCHEDULE_TYPE_IN_HOURS,
101 self::SCHEDULE_TYPE_IN_DAYS
134 protected function checkSchedule($a_ts_last_run, $a_schedule_type, $a_schedule_value)
136 if (!$a_schedule_type) {
139 if (!$a_ts_last_run) {
145 switch ($a_schedule_type) {
147 $last = date(
"Y-m-d", $a_ts_last_run);
148 $ref = date(
"Y-m-d", $now);
149 return ($last != $ref);
152 $last = date(
"Y-W", $a_ts_last_run);
153 $ref = date(
"Y-W", $now);
154 return ($last != $ref);
157 $last = date(
"Y-n", $a_ts_last_run);
158 $ref = date(
"Y-n", $now);
159 return ($last != $ref);
162 $last = date(
"Y", $a_ts_last_run) .
"-" . ceil(date(
"n", $a_ts_last_run) / 3);
163 $ref = date(
"Y", $now) .
"-" . ceil(date(
"n", $now) / 3);
164 return ($last != $ref);
167 $last = date(
"Y", $a_ts_last_run);
168 $ref = date(
"Y", $now);
169 return ($last != $ref);
172 $diff = floor(($now - $a_ts_last_run) / 60);
173 return ($diff >= $a_schedule_value);
176 $diff = floor(($now - $a_ts_last_run) / (60 * 60));
177 return ($diff >= $a_schedule_value);
180 $diff = floor(($now - $a_ts_last_run) / (60 * 60 * 24));
181 return ($diff >= $a_schedule_value);
323 abstract public function run();
An exception for terminatinating execution or to throw for unit testing.
Cron job application base class.
getScheduleType()
Get current schedule type (if flexible)
const SCHEDULE_TYPE_IN_DAYS
setSchedule($a_type, $a_value)
Update current schedule (if flexible)
getDefaultScheduleType()
Get schedule type.
getDescription()
Get description.
activationWasToggled($a_currently_active)
Cron job status was changed.
addToExternalSettingsForm($a_form_id, array &$a_fields, $a_is_active)
Add external settings to form.
const SCHEDULE_TYPE_IN_HOURS
getDefaultScheduleValue()
Get schedule value.
hasCustomSettings()
Has cron job any custom setting which can be edited?
addCustomSettingsToForm(ilPropertyFormGUI $a_form)
Add custom settings to form.
saveCustomSettings(ilPropertyFormGUI $a_form)
Save custom settings.
checkSchedule($a_ts_last_run, $a_schedule_type, $a_schedule_value)
getScheduleTypesWithValues()
const SCHEDULE_TYPE_IN_MINUTES
isManuallyExecutable()
Defines whether or not a cron job can be started manually.
getScheduleValue()
Get current schedule value (if flexible)
const SCHEDULE_TYPE_WEEKLY
const SCHEDULE_TYPE_YEARLY
isActive($a_ts_last_run, $a_schedule_type, $a_schedule_value, $a_manual=false)
Is job currently active?
hasAutoActivation()
Is to be activated on "installation".
const SCHEDULE_TYPE_DAILY
hasFlexibleSchedule()
Can the schedule be configured?
const SCHEDULE_TYPE_QUARTERLY
const SCHEDULE_TYPE_MONTHLY
getValidScheduleTypes()
Returns a collection of all valid schedule types for a specific job.
getAllScheduleTypes()
Get all available schedule types.