You are here

public function CronController::runManually in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/system/src/CronController.php \Drupal\system\CronController::runManually()

Run cron manually.

Return value

\Symfony\Component\HttpFoundation\RedirectResponse A Symfony direct response object.

1 string reference to 'CronController::runManually'
system.routing.yml in core/modules/system/system.routing.yml
core/modules/system/system.routing.yml

File

core/modules/system/src/CronController.php, line 58

Class

CronController
Controller for Cron handling.

Namespace

Drupal\system

Code

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');
}