task_support
final class task_support
| internal |
Utility wrapper for Moodle's Task API (scheduled and adhoc tasks).
This class provides a stable API for interacting with Moodle tasks, converting core entities into framework-specific DTOs.
Converts all Moodle entities to DTOs and provides a stable, dependency-safe API for the framework.
Methods
Retrieves a specific scheduled task by its class name.
Retrieves all scheduled tasks defined in the system.
Retrieves pending adhoc tasks for a specific task class.
Queues a new adhoc task for execution.
Reschedules an existing adhoc task or queues it if not present.
Retrieves the next scheduled task due for execution.
Retrieves the next adhoc task due for execution.
Runs a scheduled task from the command line interface.
Runs an adhoc task from the command line interface by its ID.
Retrieves a summary of all pending adhoc tasks.
Retrieves a list of currently running tasks.
Details
at line 52
scheduled_task_dto|null
get_scheduled_task(string $classname)
Retrieves a specific scheduled task by its class name.
at line 64
array
get_scheduled_tasks()
Retrieves all scheduled tasks defined in the system.
at line 86
array
get_adhoc_tasks(string $classname, bool $failedOnly = false)
Retrieves pending adhoc tasks for a specific task class.
at line 104
bool
queue_adhoc(adhoc_task $task, bool $checkExisting = false)
Queues a new adhoc task for execution.
at line 114
void
reschedule_or_queue(adhoc_task $task)
Reschedules an existing adhoc task or queues it if not present.
at line 130
scheduled_task_dto|null
next_scheduled(int $timestamp)
Retrieves the next scheduled task due for execution.
at line 146
adhoc_task_dto|null
next_adhoc(int $timestamp, bool|null $checkLimits = true, string|null $classname = null)
Retrieves the next adhoc task due for execution.
at line 164
bool
run_scheduled_from_cli(scheduled_task $task)
Runs a scheduled task from the command line interface.
at line 174
void
run_adhoc_from_cli(int $taskid)
Runs an adhoc task from the command line interface by its ID.
at line 188
array
get_adhoc_summary()
Retrieves a summary of all pending adhoc tasks.
at line 219
array
get_running_tasks(string $sort = '')
Retrieves a list of currently running tasks.