class run extends command

Properties

protected user $user from  command
protected manager $cron_manager
protected db $lock_db

Methods

__construct(user $user, manager $cron_manager, db $lock_db)

Construct method

ProgressBar
create_progress_bar(int $max, SymfonyStyle $io, OutputInterface $output, bool $message = false)

Create a styled progress bar

from  command
null
configure()

Sets the command name and description

int
execute(InputInterface $input, OutputInterface $output)

Executes the command cron:run.

int
run_all(InputInterface $input, OutputInterface $output)

Executes all ready cron tasks.

int
run_one(InputInterface $input, OutputInterface $output, string $task_name)

Executes a given cron task, if it is ready.

Details

at line 38
__construct(user $user, manager $cron_manager, db $lock_db)

Construct method

Parameters

user $user

User instance (mostly for translation)

manager $cron_manager

The cron manager containing the cron tasks to be executed.

db $lock_db

The lock for accessing database.

in command at line 45
ProgressBar create_progress_bar(int $max, SymfonyStyle $io, OutputInterface $output, bool $message = false)

Create a styled progress bar

Parameters

int $max

Max value for the progress bar

SymfonyStyle $io

Symfony style output decorator

OutputInterface $output

The output stream, used to print messages

bool $message

Should we display message output under the progress bar?

Return Value

ProgressBar

at line 50
protected null configure()

Sets the command name and description

Return Value

null

at line 79
protected int execute(InputInterface $input, OutputInterface $output)

Executes the command cron:run.

Tries to acquire the cron lock, then if no argument has been given runs all ready cron tasks. If the cron lock can not be obtained, an error message is printed and the exit status is set to 1. If the verbose option is specified, each start of a task is printed. Otherwise there is no output. If an argument is given to the command, only the task whose name matches the argument will be started. If verbose option is specified, an info message containing the name of the task is printed. If no task matches the argument given, an error message is printed and the exit status is set to 2.

Parameters

InputInterface $input

The input stream used to get the argument and verboe option.

OutputInterface $output

The output stream, used for printing verbose-mode and error information.

Return Value

int

0 if all is ok, 1 if a lock error occurred and 2 if no task matching the argument was found.

at line 114
protected int run_all(InputInterface $input, OutputInterface $output)

Executes all ready cron tasks.

If verbose mode is set, an info message will be printed if there is no task to be run, or else for each starting task.

Parameters

InputInterface $input

The input stream used to get the argument and verbose option.

OutputInterface $output

The output stream, used for printing verbose-mode and error information.

Return Value

int

0

See also

execute

at line 157
protected int run_one(InputInterface $input, OutputInterface $output, string $task_name)

Executes a given cron task, if it is ready.

If there is a task whose name matches $task_name, it is run and 0 is returned. and if verbose mode is set, print an info message with the name of the task. If there is no task matching $task_name, the function prints an error message and returns with status 2.

Parameters

InputInterface $input

The input stream used to get the argument and verbose option.

OutputInterface $output

The output stream, used for printing verbose-mode and error information.

string $task_name

The name of the task that should be run.

Return Value

int

0 if all is well, 2 if no task matches $task_name.

See also

execute