class wrapper

Cron task wrapper class.

Enhances cron tasks with convenience methods that work identically for all tasks.

Properties

protected helper $routing_helper
protected task $task
protected template $template

Methods

__construct(task $task, helper $routing_helper, template $template)

Constructor.

bool
is_parametrized()

Returns whether the wrapped task is parametrised.

bool
is_ready()

Returns whether the wrapped task is ready to run.

string
get_url()

Returns a url through which this task may be invoked via web.

string
get_html_tag()

Returns HTML for an invisible img tag that can be displayed on page load to trigger a request to the relevant cron task endpoint.

mixed
__call($name, $args)

Forwards all other method calls to the wrapped task implementation.

Details

at line 48
__construct(task $task, helper $routing_helper, template $template)

Constructor.

Wraps a task $task, which must implement cron_task interface.

Parameters

task $task

The cron task to wrap.

helper $routing_helper

Routing helper for route generation

template $template

at line 63
bool is_parametrized()

Returns whether the wrapped task is parametrised.

Parametrized tasks accept parameters during initialization and must normally be scheduled with parameters.

Return Value

bool

Whether or not this task is parametrized.

at line 76
bool is_ready()

Returns whether the wrapped task is ready to run.

A task is ready to run when it is runnable according to current configuration and enough time has passed since it was last run.

Return Value

bool

Whether the wrapped task is ready to run.

at line 90
string get_url()

Returns a url through which this task may be invoked via web.

When system cron is not in use, running a cron task is accomplished by outputting an image with the url returned by this function as source.

Return Value

string

URL through which this task may be invoked.

at line 108
string get_html_tag()

Returns HTML for an invisible img tag that can be displayed on page load to trigger a request to the relevant cron task endpoint.

Return Value

string

HTML to render to trigger cron task

at line 124
mixed __call($name, $args)

Forwards all other method calls to the wrapped task implementation.

Parameters

$name
$args

Return Value

mixed