Same filename and directory in other branches
- 8.9.x core/modules/system/src/CronController.php
- 9 core/modules/system/src/CronController.php
Namespace
Drupal\system
File
core/modules/system/src/CronController.php
View source
<?php
namespace Drupal\system;
use Drupal\Core\Controller\ControllerBase;
use Drupal\Core\CronInterface;
use Symfony\Component\HttpFoundation\Response;
class CronController extends ControllerBase {
protected $cron;
public function __construct(CronInterface $cron) {
$this->cron = $cron;
}
public function run() {
$this->cron
->run();
return new Response('', 204);
}
public function runManually() {
if ($this->cron
->run()) {
$this
->messenger()
->addStatus($this
->t('Cron ran successfully.'));
}
else {
$this
->messenger()
->addError($this
->t('Cron run failed.'));
}
return $this
->redirect('system.status');
}
}
Classes