/**
  * Index.
  *
  * @return \Symfony\Component\HttpFoundation\RedirectResponse
  *   RedirectResponse.
  */
 public function index()
 {
     module_load_include('inc', 'scheduler', 'scheduler.cron');
     _scheduler_run_cron();
     return new Response('', 204);
 }
 /**
  * Form submission handler to run the lightweight cron.
  *
  * This only fires when "Run Scheduler's lightweight cron now" is clicked.
  *
  * @param array $form
  *   An associative array containing the structure of the form.
  * @param \Drupal\Core\Form\FormStateInterface $form_state
  *   The current state of the form.
  */
 public function runLightweightCron(array &$form, FormStateInterface $form_state)
 {
     module_load_include('inc', 'scheduler', 'scheduler.cron');
     _scheduler_run_cron();
     if ($this->moduleHandler->moduleExists('dblog')) {
         $url = Url::fromRoute('dblog.overview')->toString();
         $message = $this->t('Lightweight cron run completed. See the <a href="@url">log</a> for details.', array('@url' => $url));
     } else {
         // If the Database Logging module is not enabled the route to the log
         // overview does not exist. Show a simple status message.
         $message = $this->t('Lightweight cron run completed.');
     }
     // @todo Replace drupal_set_message() with an injectable service in 8.1.x.
     // @see https://www.drupal.org/node/2278383
     drupal_set_message($message);
 }