function CronController::runManually

Same name in other branches
  1. 8.9.x core/modules/system/src/CronController.php \Drupal\system\CronController::runManually()
  2. 10 core/modules/system/src/CronController.php \Drupal\system\CronController::runManually()
  3. 11.x 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');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.