class Scheduler (View source)

Methods

__construct()

Create a Scheduler instance

__destruct()

No description

setBackgroundTaskDispatcher(string $dispatcher)

Set the PHP script file used to execute background commands (eg.: /foo/bar/foo.php %s)

prioritizeBackgroundTasks(bool $enable)

If enabled, background tasks will be triggered before the others

setStorage(string $dir)

Set directory used to store:

setTimeZone(DateTimeZone $timeZone)

Set timeZone used to control task states

call(string $name, callable $callback)

Register a callback function to execute

command(string $name, Command $command, array $options = array())

Register a Console command from system/console.php to execute

shell(string $name, string $command)

Register a shell command to execute

int
runTask($name)

Executes a named task

int
exec()

Runs every due task. This method must be executed during all CRON/schedule calls.

Details

__construct()

Create a Scheduler instance

Exceptions

Exception

__destruct()

No description

setBackgroundTaskDispatcher(string $dispatcher)

Set the PHP script file used to execute background commands (eg.: /foo/bar/foo.php %s)

Parameters

string $dispatcher

Exceptions

Exception

prioritizeBackgroundTasks(bool $enable)

If enabled, background tasks will be triggered before the others

Parameters

bool $enable

setStorage(string $dir)

Set directory used to store:

  • Lock file is used to prevent repeated executions.
  • State file is used to check if a task has already been executed.

Parameters

string $dir

Exceptions

Exception

setTimeZone(DateTimeZone $timeZone)

Set timeZone used to control task states

Parameters

DateTimeZone $timeZone

Task call(string $name, callable $callback)

Register a callback function to execute

Parameters

string $name
callable $callback

Return Value

Task

Task command(string $name, Command $command, array $options = array())

Register a Console command from system/console.php to execute

Parameters

string $name
Command $command
array $options

Return Value

Task

Task shell(string $name, string $command)

Register a shell command to execute

Parameters

string $name
string $command

Return Value

Task

int runTask($name)

Executes a named task

Parameters

$name

Return Value

int

Exceptions

Exception

int exec()

Runs every due task. This method must be executed during all CRON/schedule calls.

Return Value

int

Exceptions

Exception