As I was working on a module I realized that Drupal doesn't keep track of the last cron run, which is strange, since it adds a watchdog() after every run but nothing keeps track of the time of the last run. So this patch fixes that and as a result, cleans up a few core modules to make use of this new variable.
Additionally, since we can keep track of the last cron run, it makes sense to test to see if cron is configured properly. Neil suggested this as a result of my proposed patch so I expanded it's capabilities to do just that. On the settings page there is new 'cron jobs' section which notifies the user of the status of cron: it's running, it hasn't run within the past 1.5 hours (Neil suggested this time check, I agree, Drupal installs probably benefit most from 1.5 hour checks), or it hasn't run at all. This really makes setting up cron a bit easier and also makes it easier to pinpoint any errors if cron for some reason or other stops running.
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | cron_3.patch | 4.91 KB | m3avrck |
| #2 | cron_2.patch | 4.62 KB | m3avrck |
| cron_1.patch | 4.6 KB | m3avrck |
Comments
Comment #1
Steven commentedIt is preferable to put URLs outside of translatable strings, like this:
t('Linking to <a href="%url">some page</a>.', array('%url' => 'http://...'));Comment #2
m3avrck commentedNice catch Steven, new patch attached.
Comment #3
drummLets put an update in updates.inc to clear out those old vaiables (and maybe copy the value into the new variable).
Comment #4
dries commentedWhy does cron have to run every 1.5 hours? Isn't that a reasonably short interval? Does that align with cron-curl.sh and cron-lynx.sh?
Comment #5
dries commentedI think it is sufficient to know that cron runs, and that it last ran x hours/minutes ago. It doesn't really matter whether it ran within the 1.5 hour. I'd modify the patch. Just say, 'cron ran x ago' using format_interval().
Comment #6
m3avrck commentedDrumm, nice catch, patch updated to clear those variables and set the new one.
Dries, good idea as well, that seems to make the most sense. We came up with the 1.5 hours last night (late and tired!) but after thinking about that today, it seems to make the most sense. If it says cron last run 4 weeks, 2 days ago, then the user/admin will obviously know if that number is good or bad.
Patch has been updated, should be good to go now.
Comment #7
drummCode looks okay. +1
Comment #8
m3avrck commentedJust talked with Drumm on IRC, says we should set this to commit, nothing is in the way. And I'll be out of town for a week so I can't reroll this later if other updates make it in before this.
Comment #9
dries commentedCommitted to HEAD. Thanks.
Comment #10
(not verified) commented