Commit af9859d7 authored by catch's avatar catch
Browse files

Issue #1987828 by mtift, vijaycs85: Convert system_run_cron() to a new style controller.

parent 739eb268
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
namespace Drupal\system; namespace Drupal\system;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\RedirectResponse;
/** /**
* Controller for Cron handling. * Controller for Cron handling.
...@@ -17,7 +18,7 @@ class CronController { ...@@ -17,7 +18,7 @@ class CronController {
/** /**
* Run Cron once. * Run Cron once.
* *
* @return Symfony\Component\HttpFoundation\Response * @return \Symfony\Component\HttpFoundation\Response
* A Symfony response object. * A Symfony response object.
*/ */
public function run() { public function run() {
...@@ -27,4 +28,21 @@ 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." // HTTP 204 is "No content", meaning "I did what you asked and we're done."
return new Response('', 204); 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)));
}
} }
...@@ -1307,21 +1307,6 @@ function system_status($check = FALSE) { ...@@ -1307,21 +1307,6 @@ function system_status($check = FALSE) {
return theme('status_report', array('requirements' => $requirements)); return theme('status_report', array('requirements' => $requirements));
} }
/**
* 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. * Menu callback: return information about PHP.
*/ */
......
...@@ -980,13 +980,6 @@ function system_menu() { ...@@ -980,13 +980,6 @@ function system_menu() {
'access arguments' => array('administer site configuration'), 'access arguments' => array('administer site configuration'),
'file' => 'system.admin.inc', '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( $items['admin/reports/status/php'] = array(
'title' => 'PHP', 'title' => 'PHP',
'page callback' => 'system_php', 'page callback' => 'system_php',
......
...@@ -88,6 +88,13 @@ date_format_edit: ...@@ -88,6 +88,13 @@ date_format_edit:
requirements: requirements:
_permission: 'administer site configuration' _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: date_format_delete:
pattern: 'admin/config/regional/date-time/formats/{format_id}/delete' pattern: 'admin/config/regional/date-time/formats/{format_id}/delete'
defaults: defaults:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment