You are here

public function JobController::runCronJob in Ultimate Cron 8.2

Runs a single cron job.

Parameters

\Drupal\ultimate_cron\Entity\CronJob $ultimate_cron_job: The cron job which will be run.

Return value

\Symfony\Component\HttpFoundation\RedirectResponse Redirects to the job listing after running a job.

1 string reference to 'JobController::runCronJob'
ultimate_cron.routing.yml in ./ultimate_cron.routing.yml
ultimate_cron.routing.yml

File

src/Controller/JobController.php, line 23

Class

JobController
A controller to interact with CronJob entities.

Namespace

Drupal\ultimate_cron\Controller

Code

public function runCronJob(CronJob $ultimate_cron_job) {
  $ultimate_cron_job
    ->run($this
    ->t('Launched manually'));
  $this
    ->messenger()
    ->addStatus($this
    ->t('Cron job @job_label (@module) was successfully run.', [
    '@job_label' => $ultimate_cron_job
      ->label(),
    '@module' => $ultimate_cron_job
      ->getModuleName(),
  ]));
  return $this
    ->redirect('entity.ultimate_cron_job.collection');
}