Documentation

Tasks
in package
implements ActionInterface Uses BackwardCompatibility

This class concerns itself with scheduled tasks management.

Table of Contents

Interfaces

ActionInterface
Interface for all action classes.

Properties

$subaction  : string
$subactions  : array<string|int, mixed>
$obj  : object
$backcompat  : array<string|int, mixed>

Methods

call()  : void
Convenience method to load() and execute() an instance of this class.
edit()  : void
Method for editing a task.
editTask()  : void
Backward compatibility wrapper for the taskedit sub-action.
execute()  : void
Dispatcher to whichever sub-action method is necessary.
exportStatic()  : void
Provides a way to export a class's public static properties and methods to global namespace.
getConfigVars()  : array<string|int, mixed>
Gets the configuration variables for this admin area.
list_getNumTaskLogEntries()  : int
Callback function for SMF\ItemList() in $this->log().
list_getScheduledTasks()  : array<string|int, mixed>
Callback function for SMF\ItemList() in $this->tasks().
list_getTaskLogEntries()  : array<string|int, mixed>
Callback function for SMF\ItemList() in $this->log().
load()  : object
Static wrapper for constructor.
log()  : void
Show the log of all tasks that have taken place.
scheduledTasks()  : void
Backward compatibility wrapper for the tasks sub-action.
settings()  : void
This handles settings related to scheduled tasks
taskLog()  : void
Backward compatibility wrapper for the tasklog sub-action.
tasks()  : void
List all the scheduled task in place on the forum.
taskSettings()  : void|array<string|int, mixed>
Backward compatibility wrapper for the settings sub-action.
__construct()  : mixed
Constructor. Protected to force instantiation via self::load().

Properties

$subaction

public string $subaction = 'tasks'

The requested sub-action. This should be set by the constructor.

$subactions

public static array<string|int, mixed> $subactions = ['tasks' => 'tasks', 'taskedit' => 'edit', 'tasklog' => 'log', 'settings' => 'settings']

Available sub-actions.

$obj

protected static object $obj

An instance of this class. This is used by the load() method to prevent mulitple instantiations.

$backcompat

private static array<string|int, mixed> $backcompat = ['func_names' => ['call' => 'ManageScheduledTasks', 'list_getScheduledTasks' => 'list_getScheduledTasks', 'list_getTaskLogEntries' => 'list_getTaskLogEntries', 'list_getNumTaskLogEntries' => 'list_getNumTaskLogEntries', 'scheduledTasks' => 'ScheduledTasks', 'editTask' => 'EditTask', 'taskLog' => 'TaskLog', 'taskSettings' => 'TaskSettings']]

BackwardCompatibility settings for this class.

Methods

call()

Convenience method to load() and execute() an instance of this class.

public static call() : void

edit()

Method for editing a task.

public edit() : void

editTask()

Backward compatibility wrapper for the taskedit sub-action.

public static editTask() : void

execute()

Dispatcher to whichever sub-action method is necessary.

public execute() : void

exportStatic()

Provides a way to export a class's public static properties and methods to global namespace.

public static exportStatic() : void

To do so:

  1. Use this trait in the class.
  2. At the END of the class's file, call its exportStatic() method.

Although it might not seem that way at first glance, this approach conforms to section 2.3 of PSR 1, since executing this method is simply a dynamic means of declaring functions when the file is included; it has no other side effects.

Regarding the $backcompat items:

A class's static properties are not exported to global variables unless explicitly included in $backcompat['prop_names']. Likewise, a class's static methods are not exported as global functions unless explicitly included in $backcompat['func_names'].

$backcompat['prop_names'] is a simple array where the keys are the names of one or more of a class's static properties, and the values are the names of global variables. In each case, the global variable will be set to a reference to the static property. Static properties that are not named in this array will not be exported.

$backcompat['func_names'] is a simple array where the keys are the names of one or more of a class's static methods, and the values are the names that should be used for global functions that will encapsulate those methods. Methods that are not named in this array will not be exported.

Adding non-static properties or methods to the $backcompat arrays will produce runtime errors. It is the responsibility of the developer to make sure not to do this.

getConfigVars()

Gets the configuration variables for this admin area.

public static getConfigVars() : array<string|int, mixed>
Return values
array<string|int, mixed>

$config_vars for the scheduled tasks area.

list_getNumTaskLogEntries()

Callback function for SMF\ItemList() in $this->log().

public static list_getNumTaskLogEntries() : int
Return values
int

The number of log entries

list_getScheduledTasks()

Callback function for SMF\ItemList() in $this->tasks().

public static list_getScheduledTasks(int $start, int $items_per_page, string $sort) : array<string|int, mixed>
Parameters
$start : int

The item to start with (not used here)

$items_per_page : int

The number of items to display per page (not used here)

$sort : string

A string indicating how to sort things (not used here)

Return values
array<string|int, mixed>

An array of information about available scheduled tasks

list_getTaskLogEntries()

Callback function for SMF\ItemList() in $this->log().

public static list_getTaskLogEntries(int $start, int $items_per_page, string $sort) : array<string|int, mixed>
Parameters
$start : int

The item to start with (for pagination purposes)

$items_per_page : int

How many items to display per page

$sort : string

A string indicating how to sort the results

Return values
array<string|int, mixed>

An array of info about task log entries

load()

Static wrapper for constructor.

public static load() : object
Return values
object

An instance of this class.

log()

Show the log of all tasks that have taken place.

public log() : void

scheduledTasks()

Backward compatibility wrapper for the tasks sub-action.

public static scheduledTasks() : void

settings()

This handles settings related to scheduled tasks

public settings() : void

taskLog()

Backward compatibility wrapper for the tasklog sub-action.

public static taskLog() : void

tasks()

List all the scheduled task in place on the forum.

public tasks() : void

taskSettings()

Backward compatibility wrapper for the settings sub-action.

public static taskSettings([bool $return_config = false ]) : void|array<string|int, mixed>
Parameters
$return_config : bool = false

Whether to return the config_vars array.

Return values
void|array<string|int, mixed>

Returns nothing or returns the config_vars array.

__construct()

Constructor. Protected to force instantiation via self::load().

protected __construct() : mixed

        
On this page

Search results