Class AbstractCron
Base abstract class for representing a Blesta cron task.
Also provides for logging task output to the cron log.
-
Blesta\Core\Automation\Type\Cron\AbstractCron
implements
Blesta\Core\Automation\Type\Common\AutomationTypeInterface,
Blesta\Core\Automation\Tasks\Common\LoggableInterface
Methods summary
public
|
#
__construct( stdClass $task, Minphp\Date\Date $date, array $options = [] )
Initialize the cron task with cron task data
Initialize the cron task with cron task data
Parameters
- $task
An stdClass object containing:
- id The cron task ID
- key The cron task key
- name The name of the cron task
- type The type of cron task (e.g. interval or time)
- task_run_id The ID of the runnable task
- company_id The ID of the company
- time The time of day to run the task
- interval The time interval to run the task
- enabled Whether or not the task is enabled
- date_enabled The date timestamp that the task was enabled
- date_last_started The date timestamp that the task last started
- date_last_completed The date timestamp that the task last completed
- plugin_id The ID of the plugin associated with the cron task
- plugin_dir The plugin directory
- plugin_name The name of the plugin associated with the cron task
- plugin_version The version of the plugin associated with the cron task
- plugin_enabled Whether or not the plugin is enabled
- $date
- instance of Minphp\Date\Date
- $options
An array of options, including:
- log_group The name of the cron log group to use for logging purposes
|
public
stdClass
|
#
raw( )
Retrieves the raw input for this task
Retrieves the raw input for this task
Returns
stdClass An stdClass object representing the cron task
Implementation of
|
public
|
#
log( string $content )
Logs the given content to the cron log
Logs the given content to the cron log
Parameters
- $content
- The content to log
Implementation of
|
public
|
#
logComplete( )
Marks the current cron task log complete
Marks the current cron task log complete
Implementation of
|
public
boolean
|
#
canRun( string $date )
Determines whether the automation type can be run given a date
Determines whether the automation type can be run given a date
Parameters
- $date
- A date timestamp representing the date the automation type may be run at
Returns
boolean True if the automation type may be run, or false otherwise
Implementation of
|