CronCommand.php
Same filename and directory in other branches
Namespace
Drupal\system\CommandFile
-
core/
modules/ system/ src/ Command/ CronCommand.php
View source
<?php
declare (strict_types=1);
namespace Drupal\system\Command;
use Drupal\Core\CronInterface;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
/**
* Runs cron implementations.
*
* @internal
*/
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;
}
}
Classes
| Title | Deprecated | Summary |
|---|---|---|
| CronCommand | Runs cron implementations. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.