Task extends AbstractCron
Represents a Blesta cron task
Table of Contents
Methods
| __construct() | Initialize the cron task with cron task data |
| canRun() | Determines whether the automation type can be run given a date |
| log() | Logs the given content to the cron log |
| logComplete() | Marks the current cron task log complete |
| raw() | Retrieves the raw input for this task |
Methods
__construct()
Initialize the cron task with cron task data
public
__construct(stdClass $task, Date $date[, array<string|int, mixed> $options = [] ]) : mixed
Parameters
- $task : stdClass
-
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 : Date
- $options : array<string|int, mixed> = []
-
An array of options, including:
- log_group The name of the cron log group to use for logging purposes
canRun()
Determines whether the automation type can be run given a date
public
canRun(mixed $date) : bool
Parameters
- $date : mixed
-
A date timestamp representing the date the automation type may be run at
Return values
bool —True if the automation type may be run, or false otherwise
log()
Logs the given content to the cron log
public
log(string $content) : mixed
Parameters
- $content : string
-
The content to log
logComplete()
Marks the current cron task log complete
public
logComplete() : mixed
raw()
Retrieves the raw input for this task
public
raw() : stdClass
Return values
stdClass —An stdClass object representing the cron task