diff --git a/core/modules/system/lib/Drupal/system/CronController.php b/core/modules/system/lib/Drupal/system/CronController.php index 1a7e50e..4c9161f 100644 --- a/core/modules/system/lib/Drupal/system/CronController.php +++ b/core/modules/system/lib/Drupal/system/CronController.php @@ -8,6 +8,7 @@ namespace Drupal\system; use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpFoundation\RedirectResponse; /** * Controller for Cron handling. @@ -17,7 +18,7 @@ class CronController { /** * Run Cron once. * - * @return Symfony\Component\HttpFoundation\Response + * @return \Symfony\Component\HttpFoundation\Response * A Symfony response object. */ public function run() { @@ -27,4 +28,21 @@ public function run() { // HTTP 204 is "No content", meaning "I did what you asked and we're done." return new Response('', 204); } + + /** + * Run cron manually. + * + * @return \Symfony\Component\HttpFoundation\RedirectResponse + * A Symfony direct response object. + */ + public function runManually() { + if (drupal_cron_run()) { + drupal_set_message(t('Cron ran successfully.')); + } + else { + drupal_set_message(t('Cron run failed.'), 'error'); + } + return new RedirectResponse(url('admin/reports/status', array('absolute' => TRUE))); + } + } diff --git a/core/modules/system/system.admin.inc b/core/modules/system/system.admin.inc index 1566c80..f25ae91 100644 --- a/core/modules/system/system.admin.inc +++ b/core/modules/system/system.admin.inc @@ -1358,21 +1358,6 @@ function system_status($check = FALSE) { } /** - * Menu callback: run cron manually. - */ -function system_run_cron() { - // Run cron manually - if (drupal_cron_run()) { - drupal_set_message(t('Cron ran successfully.')); - } - else { - drupal_set_message(t('Cron run failed.'), 'error'); - } - - drupal_goto('admin/reports/status'); -} - -/** * Menu callback: return information about PHP. */ function system_php() { diff --git a/core/modules/system/system.module b/core/modules/system/system.module index ce1b39b..4e3be02 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -996,13 +996,6 @@ function system_menu() { 'access arguments' => array('administer site configuration'), 'file' => 'system.admin.inc', ); - $items['admin/reports/status/run-cron'] = array( - 'title' => 'Run cron', - 'page callback' => 'system_run_cron', - 'access arguments' => array('administer site configuration'), - 'type' => MENU_CALLBACK, - 'file' => 'system.admin.inc', - ); $items['admin/reports/status/php'] = array( 'title' => 'PHP', 'page callback' => 'system_php', diff --git a/core/modules/system/system.routing.yml b/core/modules/system/system.routing.yml index 9859d6a..d483bff 100644 --- a/core/modules/system/system.routing.yml +++ b/core/modules/system/system.routing.yml @@ -74,6 +74,13 @@ system_site_maintenance_mode: requirements: _permission: 'administer site configuration' +system_run_cron: + pattern: '/admin/reports/status/run-cron' + defaults: + _controller: '\Drupal\system\CronController::runManually' + requirements: + _permission: 'administer site configuration' + date_format_delete: pattern: 'admin/config/regional/date-time/formats/{format_id}/delete' defaults: