add link for running cron manually to devel block

dww - August 9, 2006 - 07:57
Project:Devel
Version:7.x-1.x-dev
Component:devel
Category:feature request
Priority:normal
Assigned:dww
Status:closed
Description

now that http://drupal.org/node/76958 hit core, it'd be trivial to add a link on the devel block to run cron manually. i think this would be handy for debugging hook_cron() stuff, without having to dig around in the admin pages to find the link.

#1

asimmonds - August 9, 2006 - 08:39
Status:active» patch (code needs review)

Attached is my attempt at this, "run cron" link calls drupal_cron_run() and set_message' the status, then redirects to the previous page (similar to how the "empty cache" link works).

AttachmentSize
devel_cron_run.patch1.63 KB

#2

forngren - August 9, 2006 - 11:13

New patch using drupal_goto() insterad of header().

Please note: I haven't tested the code, nor the previous patch, I just opened the patch file and edited it.

AttachmentSize
devel_cron_run.patch.txt1.62 KB

#3

asimmonds - August 9, 2006 - 18:48

I couldn't get drupal_goto() to work properly, so I copied the redirect code from devel_cache_clear(). Also when using drupal_goto(), you'll get the devel_redirect_page if you have that enabled.

#4

forngren - August 9, 2006 - 19:30

How about his code then? (still not tested)

<?php
/**
* Menu callback; runs cron manually, then redirects to the previous page.
*/
function devel_cron_run() {
  if (
drupal_cron_run()) {
   
drupal_set_message(t('Cron ran successfully'));
  }
  else {
   
drupal_set_message(t('Cron run failed'));
  }
 
$referer = '';
 
$referer = referer_uri();
  if (!empty(
$referer)) {
   
$referer = $base_url;
  }
 
drupal_goto($referer);
}
?>

#5

moshe weitzman - August 9, 2006 - 23:33

no referer crap. thats what destination= is for

#6

dww - August 9, 2006 - 23:41
Status:patch (code needs review)» patch (code needs work)

i'm w/ moshe. please re-roll. thanks. ;)

#7

dww - December 13, 2007 - 08:03
Version:7.x-1.x-dev» 5.x-1.x-dev
Component:User interface» devel
Status:patch (code needs work)» patch (code needs review)

See http://drupal.org/files/issues/devel-DRUPAL-5.patch

#8

dww - December 13, 2007 - 08:18
Version:5.x-1.x-dev» 7.x-1.x-dev
Assigned to:Anonymous» dww
Status:patch (code needs review)» fixed

Committed that to DRUPAL-5, ported to D6 myself, and committed to HEAD. Attached is the D6 patch for posterity/reference.

AttachmentSize
devel_run_cron_d6.patch1.21 KB

#9

Anonymous - December 27, 2007 - 09:34
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.