Class CrontabUtil
Class providing an abstraction layer for cron table editing.
Abstracted data comes in the form (for each line of the X2Engine-managed section of the cron table): an array with keys
<dl> <dt>schedule</dt><dd>Preset schedule. If this key is set, min-dayOfWeek keys will not be set.</dd> <dt>min</dt><dd>Minutes of the hour at which to run</dd> <dt>hour</dt><dd>Hours of the day at which to run</dd> <dt>dayOfMonth</dt><dd>Days of the month at which to run</dd> <dt>month</dt><dd>Months of the year at which to run</dd> <dt>dayOfWeek</dt><dd>Days of the week at which to run</dd> <dt>cmd</dt><dd>The cmd to run</dd> <dt>tag</dt><dd>Unique string identifying the cron job</dd> <dt>desc</dt><dd>Brief one-line (no carraige returns) description</dd> </dl> For each of the above that are defined as plural, the values could be either an array of possible values or "*" for "all" (see https://en.wikipedia.org/wiki/Cron for more information on cron table formatting and specification).
NOTE: the crontab field and manged section delimeters are set the way they are for backwards compatibility (with old crontabs that use the old markers) despite the change in product naming (from X2Engine back to X2Engine).
Author: Demitri Morgan <demitri@x2engine.com>
Located at x2engine/protected/components/util/CrontabUtil.php
public static
|
#
addCronMarker( string & $crontab, boolean $check = false )
Adds delimiters for identifying X2Engine-managed cron tasks to the crontab, if they don't already exist. |
public static
|
#
arrayToCrontab( string & $crontab, array $crontabArray )
Modifies an existing cron table according to a specified array. |
public static
|
#
cronJobToForm( mixed $crontabLine )
Takes a crontab line array and converts it to an array appropriate for pre-populating the cron job schedule/configuration form (i.e. with a preexisting cron job). |
public static
string
|
#
crontabLine( type $l )
Formats a crontab line according to the specification defined in crontabArray |
public static
array
|
|
public static
string
|
|
public static
|
|
public static
boolean|array
|
#
parseCrontabLine( string $line )
The inverse operation of |
public static
|
#
processForm( mixed $form = array() )
Takes data from an instance of the crontab form generated in |
public static
string
|
|
public static
type
|
string |
CRONTAB_FIELD_DELIM
|
'#@X2CRM@' |
|
string |
CRONTAB_MANAGED_BEGIN
|
'#<X2CRM>' |
|
string |
CRONTAB_MANAGED_END
|
'#</X2CRM>' |
public static
type
|
$printHint | true |
#
If set to true, the cron tab form will include the hint. |
public static
array
|
$taskFields | array('cmd', 'tag', 'desc') |
#
The parts of the cron entry that define the task itself, including
metadata |
public static
array
|
$schedules | array('hourly','daily','weekly','monthly','yearly') |
|
public static
array
|
$schedFields | array('min', 'hour', 'dayOfMonth', 'month', 'dayOfWeek') |
#
The fields of the cron entry that define its schedule |