class CronCommand
Same name and namespace in other branches
- main core/modules/system/src/Command/CronCommand.php \Drupal\system\Command\CronCommand
Runs cron implementations.
@internal
Attributes
#[AsCommand(name: 'system:cron', description: 'Runs cron implementations.', aliases: [
'cron',
'core:cron',
])]
Hierarchy
- class \Drupal\system\Command\CronCommand
Expanded class hierarchy of CronCommand
1 file declares its use of CronCommand
- CronCommandTest.php in core/
modules/ system/ tests/ src/ Functional/ Command/ CronCommandTest.php
File
-
core/
modules/ system/ src/ Command/ CronCommand.php, line 19
Namespace
Drupal\system\CommandView source
class CronCommand {
public function __construct(protected CronInterface $cron) {
}
/**
* Runs cron implementations.
*/
public function __invoke(InputInterface $input, OutputInterface $output) : int {
$io = new SymfonyStyle($input, $output);
if ($this->cron
->run()) {
$io->success('Cron ran successfully.');
return Command::SUCCESS;
}
$io->error('Cron run failed.');
return Command::FAILURE;
}
}
Members
| Title Sort descending | Modifiers | Object type | Summary |
|---|---|---|---|
| CronCommand::__construct | public | function | |
| CronCommand::__invoke | public | function | Runs cron implementations. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.