PHP Class Habari\CronJob

Inheritance: extends QueryRecord
Show file Open project: habari/system

Public Methods

Method Description
__construct ( array $paramarray = [] ) Constructor for the CronJob class.
__get ( string $name ) : mixed Magic property getter to get the cronjob properties.
__set ( string $name, mixed $value ) : mixed Magic property setter to set the cronjob properties.
default_fields ( ) : array Returns the defined database columns for a cronjob.
delete ( ) : boolean Deletes an existing cron job.
execute ( ) Runs this job.
insert ( ) : CronJob Saves a new cron job to the crontab table.
update ( ) : CronJob Updates an existing cron job to the crontab table.

Method Details

__construct() public method

Constructor for the CronJob class.
See also: QueryRecord::__construct()
public __construct ( array $paramarray = [] )
$paramarray array an associative array or querystring of initial field values

__get() public method

Unserializes the callback if called.
See also: QueryRecord::__get()
public __get ( string $name ) : mixed
$name string The name of the property to get.
return mixed The value of the property, or null if no property by that name.

__set() public method

Serializes the callback if needed.
See also: QueryRecord::__set()
public __set ( string $name, mixed $value ) : mixed
$name string The name of the property to set.
$value mixed The value of the property to set.
return mixed The new value of the property.

default_fields() public static method

Returns the defined database columns for a cronjob.
public static default_fields ( ) : array
return array Array of default columns in the crontab table

delete() public method

Deletes an existing cron job.
See also: QueryRecord::deleteRecord()
public delete ( ) : boolean
return boolean If the delete was successful

execute() public method

Executes the Cron Job callback. Deletes the Cron Job if end_time is reached or if it failed to execute the last # consecutive attempts. Also sends notification by email to specified address. Note: end_time can be null, ie. "The Never Ending Cron Job". Callback is passed a param_array of the Cron Job fields and the execution time as the 'now' field. The 'result' field contains the result of the last execution; either 'executed' or 'failed'.
public execute ( )

insert() public method

Saves a new cron job to the crontab table.
See also: QueryRecord::insertRecord()
public insert ( ) : CronJob
return CronJob The newly inserted cron job, or false if failed.

update() public method

Updates an existing cron job to the crontab table.
See also: QueryRecord::updateRecord()
public update ( ) : CronJob
return CronJob The updated cron job, or false if failed.