public
|
#
__construct( )
Initialize Cron Tasks
Overrides
|
public
mixed
|
#
get( integer $id )
Retrieves a cron task
Parameters
- $id
integer $id The cron task ID
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
array $vars An array of key=>value fields including: - key A unique key
representing this cron task - plugin_dir The plugin directory of the plugin 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
integer $task_id The cron task ID to edit
- $vars
array $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
|
#
delete( integer $task_id, integer $plugin_dir )
Deletes a plugin's cron task
Deletes a plugin's cron task
Parameters
- $task_id
integer $task_id The ID of this cron task
- $plugin_dir
integer $plugin_dir The plugin directory of the plugin this cron task belongs to
|
public
mixed
|
#
addTaskRun( array $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
array $vars A list of key=>value fields to add, including: - task_id The cron task
ID associated with this runnable task - 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)
- $vars
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
integer $task_run_id The cron task run ID
- $vars
array $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
integer $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
integer $task_run_id The cron task run ID
- $system
boolean $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 )
Retrieves a cron task and its company-specific run settings
Retrieves a cron task and its company-specific run settings
Parameters
- $key
string $key The cron task key
- $plugin_dir
string $plugin_dir The cron task plugin directory (optional, default null)
- $system
boolean $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
array
|
#
getAllTaskRun( boolean $system = false )
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
boolean $system True to fetch only system cron tasks, false to fetch company cron tasks
(default false)
Returns
array A list of stdClass objects representing each cron task, or an empty array if
none exist
|
private
Record
|
#
getAllTaskRuns( )
Partially constructs a Record object for queries required by both
CronTasks::getAllTaskRun() and CronTasks::deleteTaskRun()
Partially constructs a Record object for queries required by both
CronTasks::getAllTaskRun() and CronTasks::deleteTaskRun()
Returns
Record
The partially constructed query Record object
|
private
|
#
setLanguage( stdClass & $task )
Sets the real name and description values, including language defines, for
the given task by reference
Sets the real name and description values, including language defines, for
the given task by reference
Parameters
- $task
stdClass
$task A cron task object containing: - name The name of the cron task -
description The description of the cron task - is_lang 1 if the name and
description are language definitions, or 0 otherwise
|
private
array
|
#
getTaskRunRules( array $vars, boolean $edit = false )
Retrieves the rules for adding/editing cron task runs
Retrieves the rules for adding/editing cron task runs
Parameters
- $vars
array $vars A list of input fields
- $edit
boolean $edit Trtue for edit rules, false for add rules (optional, default false)
Returns
array A list of rules
|
private
array
|
#
getRules( array $vars, boolean $edit = false )
Retrieves the rules for adding/editing cron tasks
Retrieves the rules for adding/editing cron tasks
Parameters
- $vars
array $vars A list of input fields
- $edit
boolean $edit True for edit rules, false for add rules (optional, default false)
Returns
array A list of rules
|
public
boolean
|
#
validateKeyUnique( string $key, string $plugin_dir, integer $cron_task_id = null )
Validates whether the given cron task key and plugin directory are in use by
another cron task
Validates whether the given cron task key and plugin directory are in use by
another cron task
Parameters
- $key
string $key The key to check
- $plugin_dir
string $plugin_dir The plugin directory
- $cron_task_id
integer $cron_task_id The cron task ID to exclude from the check (optional)
Returns
boolean True if the given key is unique, false otherwise
|
public
boolean
|
#
validateTaskType( string $type )
Validates that the given task type is a valid type
Validates that the given task type is a valid type
Parameters
- $type
string $type The cron task type
Returns
boolean True if the type is valid, false otherwise
|