Class \Prado\Util\Cron\TTimeScheduler
This class keeps track of Scheduling event times. It specifies a schedule and the dates and times to trigger
cron setup '* * * * * *' (minute) (hour) (day of month) (month of year) (day of week) (year) (0-59) (0-23) (1-31) (1-12|Jan,Feb,-,Dec) (0-6|Sun-Sat) (20xx)
'*' (star) is any time. adding '/(\d)' is every \d moments. Day of Month can add '(\d)W' after the day to signify closest weekday. Day of Month can add 'L' for last day, or 'L-2' for last day minus two. Day of Week can add '(\d)L' after the day of week for last day of month of that type. Day of Week can add "#(\d)" after the day to signify which week the day is from.
Generally avoid 01:00:00 to 2:59:59 as they may not trigger or double trigger during daylight savings time changes.
The Months of the Year supports English, German, Spanish, French, Italian, Russian, Hindi, and Arabic and their abbreviations. The Days of the Week supports English, German, Spanish, French, Italian, Russian, and Hindi and their abbreviations.
There are schedule shortcuts: '@yearly' => '0 0 1 1 ?' '@annually' => '0 0 1 1 ?' '@monthly' => '0 0 1 * ?' '@weekly' => '0 0 ? * 0' '@midnight' => '0 0 * * ?' '@daily' => '0 0 * * ?' '@hourly' => '0 * * * ?'
An efficient one-off task at a specified unix time can be scheduled with '@(\d)' where \d is the unix time in the local php instance time zone. This minimizes costly validation, parsing, and nextTriggerTime processing. This allows for a higher cron task throughput to handle more cron tasks.
e.g. '@1668165071' for 2022-11-11 11:11:11 and will trigger after the specified time at '12 11 11 11 ? 2022'.
Class hierarchy
Author: Brad Anderson <belisoful@icloud.com>Since: 4.2.0
public
|
days_in_month(mixed $month, mixed $year) : mixed
Returns the number of days in a given month and year, taking into account leap years.
|
public
|
getNextTriggerTime([false|(numeric)|string $priortime = false ]) : numeric-string|int|float
This calculates the next trigger time for the schedule based on the $priortime
If no parameter time is given, the current system time is used.
|
public
|
|
public
|
|
protected
|
getDaysArray(mixed $month, mixed $year) : mixed
Given which days are valid for the parsed time stamp, this generates
an array of valid days for the given month and year. Each day is available
as the key to the array and the value contains true or false whether the day
meets the cron time stamp
|
protected
|
getHoursArray() : mixed
Given which hours are valid for the parsed time stamp, this generates
an array of valid hours. Each hour is available as the key to the array
and the value contains true or false whether the hour meets the cron
time stamp
|
protected
|
getMinutesArray() : mixed
Given which minutes are valid for the parsed time stamp, this generates
an array of valid minutes. Each minute is available as the key to the array
and the value contains true or false whether the minute meets the cron
time stamp
|
protected
|
getMonthsArray() : mixed
Given which month are valid for the parsed time stamp, this generates
an array of valid months. Each month is available as the key to the array
and the value contains true or false whether the month meets the cron
time stamp
|
protected
|
getYearsArray() : array<string|int, mixed>
Given which years are valid for the parsed time stamp, this generates
an array of valid years. Each year is available as the key to the array
and the value contains true or false whether the year meets the cron
time stamp. Only the previos 2 years and next 33 years are available
|
protected
|
|
protected
|
public
mixed
|
YEAR_MAX
|
2099
|
public
mixed
|
YEAR_MIN
|
1970
|
protected
mixed
|
DAY_OF_MONTH
the day of month attributes of the schedule
|
2
|
protected
mixed
|
DAY_OF_WEEK
the day of week attributes of the schedule
|
4
|
protected
mixed
|
HOUR
the hour attributes of the schedule
|
1
|
protected
mixed
|
MINUTE
the minute attributes of the schedule
|
0
|
protected
mixed
|
MONTH_OF_YEAR
the month of year attributes of the schedule
|
3
|
protected
mixed
|
YEAR
the year attributes of the schedule
|
5
|
\Prado\TComponent::GLOBAL_RAISE_EVENT_LISTENER |