Support from Acquia helps fund testing for Drupal Acquia logo

Comments

vijaycs85’s picture

Status: Active » Needs review
FileSize
1.96 KB

Initial patch...

vijaycs85’s picture

Adding hook_menu change...

ParisLiakos’s picture

Status: Needs review » Needs work
+++ b/core/modules/system/lib/Drupal/system/CronController.phpundefined
@@ -27,4 +27,19 @@ public function run() {
+  /**
+   * Run cron manually.
+   */

Misses @return docs (see below)

+++ b/core/modules/system/lib/Drupal/system/CronController.phpundefined
@@ -27,4 +27,19 @@ public function run() {
+  public function runManual() {

i think calling it runManually sounds better

+++ b/core/modules/system/lib/Drupal/system/CronController.phpundefined
@@ -27,4 +27,19 @@ public function run() {
+    drupal_goto('admin/reports/status');

Should return a RedirectResponse.
sth like:

return new RedirectResponse('admin/reports/status', array('absolute' => TRUE));

dont forget the use statement;)

mtift’s picture

Status: Needs work » Needs review
FileSize
1.07 KB
1.07 KB

I think this patch addresses the items in #3

Status: Needs review » Needs work

The last submitted patch, 1987828-route-system-cron-run-4.patch, failed testing.

ParisLiakos’s picture

i think you changed the existing method:P
you should apply the patch from #2 first

mtift’s picture

Status: Needs work » Needs review
FileSize
1.08 KB
3.17 KB

Re-rolled the patch and consolidated all of the changes

ParisLiakos’s picture

+++ b/core/modules/system/lib/Drupal/system/CronController.phpundefined
@@ -17,14 +17,28 @@ class CronController {
-  public function run() {
+  public function runManually() {

still the changes are on the existing method. run() should stay as is, runManual() is the method i was reffering above

mtift’s picture

Ahh. That makes more sense.

Status: Needs review » Needs work

The last submitted patch, 1987828-route-system-cron-run-9.patch, failed testing.

ParisLiakos’s picture

+++ b/core/modules/system/lib/Drupal/system/CronController.phpundefined
@@ -17,14 +17,28 @@ class CronController {
-   * @return Symfony\Component\HttpFoundation\Response
-   *   A Symfony response object.
+   * @return Symfony\Component\HttpFoundation\RedirectResponse
+   *   A Symfony direct response object.
...
-    // HTTP 204 is "No content", meaning "I did what you asked and we're done."
-    return new Response('', 204);
+    return new RedirectResponse('admin/reports/status', array('absolute' => TRUE));

still those changes are irrelevant.

+++ b/core/modules/system/lib/Drupal/system/CronController.phpundefined
@@ -17,14 +17,28 @@ class CronController {
+    drupal_goto('admin/reports/status');

instead this drupal_goto should be replaced with the RedirectResponse above

+++ b/core/modules/system/lib/Drupal/system/CronController.phpundefined
@@ -17,14 +17,28 @@ class CronController {
+  /**
+   * Run cron manually.
+   */

and after you move it, this should be updated to reflect the @return value

mtift’s picture

Status: Needs work » Needs review
FileSize
1.46 KB
2.88 KB

Updated patch attached

ParisLiakos’s picture

looks a lot better now, thanks!

+++ b/core/modules/system/lib/Drupal/system/CronController.phpundefined
@@ -27,4 +28,22 @@ public function run() {
+   * @return Symfony\Component\HttpFoundation\RedirectResponse

really minor: while in documentation we should always use the full namespace of the class (including preceding \)

+++ b/core/modules/system/system.routing.ymlundefined
@@ -74,6 +74,13 @@ system_site_maintenance_mode:
+    _controller: '\Drupal\system\CronController::runManual'

lets update the method name here to reflect reality:)

dawehner’s picture

+++ b/core/modules/system/system.moduleundefined
@@ -998,8 +998,7 @@ function system_menu() {
   $items['admin/reports/status/run-cron'] = array(
     'title' => 'Run cron',
-    'page callback' => 'system_run_cron',
-    'access arguments' => array('administer site configuration'),
+    'route_name' => 'system_run_cron',
     'type' => MENU_CALLBACK,
     'file' => 'system.admin.inc',

If you have a MENU_CALLBACK you can directly remove the entry in hook_menu.

mtift’s picture

Here's an updated patch

dawehner’s picture

+++ b/core/modules/system/lib/Drupal/system/CronController.phpundefined
@@ -27,4 +28,22 @@ public function run() {
+    if (drupal_cron_run()) {
+      drupal_set_message(t('Cron ran successfully.'));

Just to note: On the longrun there should be something like a cronRunner service, which has everything injected.

+++ b/core/modules/system/lib/Drupal/system/CronController.phpundefined
@@ -27,4 +28,22 @@ public function run() {
+    return new RedirectResponse('admin/reports/status', array('absolute' => TRUE));

it should be url('admin/reports/status', array('absolute' => TRUE));

+++ b/core/modules/system/system.moduleundefined
@@ -998,9 +998,7 @@ function system_menu() {
   $items['admin/reports/status/run-cron'] = array(
     'title' => 'Run cron',
-    'page callback' => 'system_run_cron',
-    'access arguments' => array('administer site configuration'),
-    'type' => MENU_CALLBACK,
+    'route_name' => 'system_run_cron',
     'file' => 'system.admin.inc',
   );

Just remove all of it

ParisLiakos’s picture

Just to note: On the longrun there should be something like a cronRunner service, which has everything injected.

Agreed, there is already a @todo in the method above:)

mtift’s picture

Revised patch attached

Status: Needs review » Needs work
Issue tags: -WSCCI-conversion

The last submitted patch, 1987828-route-system-cron-run-18.patch, failed testing.

ParisLiakos’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 1987828-route-system-cron-run-18.patch, failed testing.

ParisLiakos’s picture

Status: Needs work » Needs review
Issue tags: +WSCCI-conversion
ParisLiakos’s picture

Status: Needs review » Reviewed & tested by the community

thats ready, thanks

catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed/pushed to 8.x, thanks!

Automatically closed -- issue fixed for 2 weeks with no activity.