Methods summary
public
|
#
__construct( )
Initialize Cron Tasks
Overrides
|
public
mixed
|
#
get( integer $id )
Retrieves a cron task
Parameters
Returns
mixed An stdClass object representing the cron task, or false if it does not exist
|
public
mixed
|
#
getByKey( string $key, string $plugin_dir = null, string $task_type = 'plugin' )
Retrieves a cron task
Parameters
- $key
- The cron task key
- $plugin_dir
The plugin directory of the plugin this cron task belongs to
OR if $task_type is given, the directory that this cron task belongs to, plugin or not
- $task_type
The type of task to fetch (one of 'system', 'plugin', or 'module'),
default 'plugin' for backward compatibility
Returns
mixed An stdClass object representing the cron task, or false if it does not exist
|
public
array
|
#
getAll( )
Retrieves a list of all cron tasks in the system
Retrieves a list of all cron tasks in the system
Returns
array An array of stdClass objects representing each cron task
|
public
mixed
|
#
add( array $vars )
Adds a new cron task
Parameters
- $vars
An array of key=>value fields including:
- key A unique key representing this cron task
- task_type The type of cron task this represents (system, module, or plugin)
- dir The directory this cron task belongs to (optional)
- name The name of this cron task
- description The description of this cron task (optional)
- is_lang 1 if name and description are language definitions in the
language file, 0 otherwise (optional, default 0)
- type The type of cron task this is ("time" or "interval" based, optional, default "interval")
Returns
mixed The cron task ID created, or void on error
|
public
|
#
edit( integer $task_id, array $vars )
Edits a cron task
Parameters
- $task_id
- The cron task ID to edit
- $vars
A list of key=>value fields to update, including:
- name The name of this cron task
- description The description of this cron task (optional)
- is_lang 1 if name and description are language definitions in the
language file, 0 otherwise (optional, default 0)
|
public
|
#
deleteTask( integer $task_id, string $task_type, string $dir )
Deletes a cron task
Parameters
- $task_id
- The ID of the cron task to delete
- $task_type
- The task's task_type (i.e., 'plugin', or 'module')
- $dir
- The directory this cron task belongs to
|
public
mixed
|
#
addTaskRun( integer $task_id, array $vars )
Sets when a cron task should run for a given company
Sets when a cron task should run for a given company
Parameters
- $task_id
- The cron task ID associated with this runnable task
- $vars
A list of key=>value fields to add, including:
- time The daily 24-hour time that this task should run
(e.g. "14:25", optional, required if interval is not given)
- interval The interval, in minutes, that this cron task should run
(optional, required if time is not given)
- enabled 1 if this cron task is enabled, 0 otherwise (optional, default 1)
Returns
mixed The cron task run ID created, or void on error
|
public
|
#
editTaskRun( integer $task_run_id, array $vars )
Updates when a cron task should run for the given company
Updates when a cron task should run for the given company
Parameters
- $task_run_id
- The cron task run ID
- $vars
A list of key=>value fields to update, including:
- time The daily 24-hour time that this task should run
(e.g. "14:25", optional, required if interval is not given)
- interval The interval, in minutes, that this cron task should run
(optional, required if time is not given)
- enabled 1 if this cron task is enabled, 0 otherwise (optional, default 1)
|
public
|
#
deleteTaskRun( integer $task_run_id )
Deletes when a cron task should run for the given company.
NOTE: This will also delete the cron task itself iff the cron task is no longer used by any other company
and this cron task is related to a plugin
Deletes when a cron task should run for the given company.
NOTE: This will also delete the cron task itself iff the cron task is no longer used by any other company
and this cron task is related to a plugin
Parameters
- $task_run_id
- The cron task run ID
|
public
mixed
|
#
getTaskRun( integer $task_run_id, boolean $system = false )
Retrieves a cron task and its company-specific run settings
Retrieves a cron task and its company-specific run settings
Parameters
- $task_run_id
- The cron task run ID
- $system
- True to fetch only system cron tasks, false to fetch company cron tasks (default false)
Returns
mixed An stdClass object representing the runnable cron task, or false if one does not exist
|
public
mixed
|
#
getTaskRunByKey( string $key, string $plugin_dir = null, boolean $system = false, string $task_type = 'plugin' )
Retrieves a cron task and its company-specific run settings
Retrieves a cron task and its company-specific run settings
Parameters
- $key
- The cron task key
- $plugin_dir
The plugin directory of the plugin this cron task belongs to
OR if $task_type is given, the directory that this cron task belongs to, plugin or not (default null)
- $system
- True to fetch only system cron tasks, false to fetch company cron tasks (default false)
- $task_type
The type of task to fetch (one of 'system', 'plugin', or 'module'),
(default 'plugin' for backward compatibility)
Returns
mixed An stdClass object representing the runnable cron task, or false if one does not exist
|
public
array
|
#
getAllTaskRun( boolean $system = false, string $task_type = 'all', string $dir = null )
Retrieves a list of all cron tasks and their company-specific run settings for this company
Retrieves a list of all cron tasks and their company-specific run settings for this company
Parameters
- $system
- True to fetch only system cron tasks, false to fetch company cron tasks (default false)
- $task_type
The type of task to fetch (i.e. 'system', 'plugin', 'module',
or 'all' for any, default 'all')
- $dir
The directory this cron task belongs to iff $task_type is
'plugin' or 'module' (optional)
Returns
array A list of stdClass objects representing each cron task, or an empty array if none exist
|
public
array
|
#
getTaskTypes( )
Retrieves a list of the task types and their language
Retrieves a list of the task types and their language
Returns
array A key/value list of task types and their language
|