class manager

Cron manager class.

Finds installed cron tasks, stores task objects, provides task selection.

Properties

protected ContainerInterface $phpbb_container
protected helper $routing_helper
protected array $tasks

Set of \phpbb\cron\task\wrapper objects.

protected bool $is_initialised_from_container

Flag indicating if $this->tasks contains tasks registered in the container

protected string $phpbb_root_path
protected string $php_ext
protected template $template

Methods

__construct(ContainerInterface $phpbb_container, helper $routing_helper, string $phpbb_root_path, string $php_ext, template $template)

Constructor. Loads all available tasks.

load_tasks(array|Traversable $tasks)

Loads tasks given by name, wraps them and puts them into $this->tasks.

load_tasks_from_container()

Loads registered tasks from the container, wraps them and puts them into $this->tasks.

wrapper|null
find_one_ready_task()

Finds a task that is ready to run.

array
find_all_ready_tasks()

Finds all tasks that are ready to run.

find_task(string $name)

Finds a task by name.

array
get_tasks()

Find all tasks and return them.

wrap_task(task $task)

Wraps a task inside an instance of \phpbb\cron\task\wrapper.

Details

at line 76
__construct(ContainerInterface $phpbb_container, helper $routing_helper, string $phpbb_root_path, string $php_ext, template $template)

Constructor. Loads all available tasks.

Parameters

ContainerInterface $phpbb_container Container
helper $routing_helper

Routing helper

string $phpbb_root_path

Relative path to phpBB root

string $php_ext

PHP file extension

template $template

at line 91
load_tasks(array|Traversable $tasks)

Loads tasks given by name, wraps them and puts them into $this->tasks.

Parameters

array|Traversable $tasks

Array of instances of \phpbb\cron\task\task

at line 103
load_tasks_from_container()

Loads registered tasks from the container, wraps them and puts them into $this->tasks.

at line 124
wrapper|null find_one_ready_task()

Finds a task that is ready to run.

If several tasks are ready, any one of them could be returned.

If no tasks are ready, null is returned.

Return Value

wrapper|null

at line 144
array find_all_ready_tasks()

Finds all tasks that are ready to run.

Return Value

array

List of tasks which are ready to run (wrapped in \phpbb\cron\task\wrapper).

at line 169
wrapper find_task(string $name)

Finds a task by name.

If there is no task with the specified name, null is returned.

Web runner uses this method to resolve names to tasks.

Parameters

string $name

Name of the task to look up.

Return Value

wrapper

A wrapped task corresponding to the given name, or null.

at line 188
array get_tasks()

Find all tasks and return them.

Return Value

array

List of all tasks.

at line 201
wrapper wrap_task(task $task)

Wraps a task inside an instance of \phpbb\cron\task\wrapper.

Parameters

task $task

The task.

Return Value

wrapper

The wrapped task.