Same name and namespace in other branches
  1. 8.9.x core/modules/system/src/CronController.php \Drupal\system\CronController::runManually()
  2. 9 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 50

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