Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Currently the status page only reports if the cron has been run once. It would be nice if it warned if it hadn't been run since...
The attached patch adds a warning if the cron was last run more than 24 hours ago, and that warning becomes an error after 7 days.
I'm not sure of the appropriate length of time before the warning and the error, but the numbers I used seem reasonable.
Comment | File | Size | Author |
---|---|---|---|
#34 | patch.txt | 2.14 KB | webernet |
#33 | patch.txt | 1.83 KB | webernet |
#27 | cron_usability_help_text.patch | 1.5 KB | KentBye |
#25 | cron_info_2.patch | 4.14 KB | webernet |
#20 | cron-status-100909-20.patch | 4.98 KB | bjaspan |
Comments
Comment #1
webernet CreditAttribution: webernet commentedImproved patch which removes unnecessary line.
Comment #2
RobRoy CreditAttribution: RobRoy commentedNice! Here is a screenshot of what the warning and error look like.
A couple code style things:
- Should be spaces in between *
- 2nd comment needs a space after //
After that this is RTBC IMO. +1 webernet!
Comment #3
RobRoy CreditAttribution: RobRoy commentedAlso, not sure if it generates a notice or not, but regardless I think
should be
so it is properly initialized. Just minor stuff.
Comment #4
BioALIEN CreditAttribution: BioALIEN commented+1 to this patch. Nice idea :)
Comment #5
webernet CreditAttribution: webernet commentedAttached patch addresses the code style issues and the array initialization comment.
Comment #6
Dries CreditAttribution: Dries commentedGoing to move this to D6.
Comment #7
webernet CreditAttribution: webernet commentedRerolled.
Adjusted times to:
- Warning after 2 days
- Error after 2 weeks
Comment #8
webernet CreditAttribution: webernet commentedRerolled.
This may be more important now that uploaded temporary files are deleted on cron runs.
Comment #9
Dries CreditAttribution: Dries commentedI don't think this behavior is correct. Not running cron is not necessarily an error.
Comment #10
webernet CreditAttribution: webernet commentedAttached patch is an alternative version that removes the error status.
Not running cron may not always be an error, but it certainly deserves a warning.
Comment #11
moshe weitzman CreditAttribution: moshe weitzman commented99% of sites do use watchdog so why hold back the patch for 1%. even more true now that we omitted the error after 7 days.
Comment #12
Gábor HojtsyI think it is an error, not to run cron. Most sites would use something, which needs cron to run. Ie. watchdog, stats module (required by throttle) and so on. Even system module itself does cleanup on cron: cleans up the flood table, the batch table, removes old temporary files. I think it pretty much an error, if cron is not run regularly. Let's discuss this!
Comment #13
webchickI agree that it's an error, and would go one step further of re-displaying the error if cron hasn't run within some specified time-frame, say a week.
Lullabot has been asked to save Drupal sites before from crippling performance problems. More often than you'd think, one of the biggest problems is that their watchdog table has 29 billion records from cron only having been run once, a year and a half ago. Truncate that table and suddenly the site gets a lot more zippy.
Comment #14
webchickOMG. RTFI. Sorry. :(
Comment #15
bjaspan CreditAttribution: bjaspan commentedDoesn't the update module use cron to perform its checks? And isn't update enabled by default? If so, by not running cron, you are disabling a core default-enabled module, perhaps inadvertently, and you'll never be notified of security updates. I'd call that an error-worthy condition.
This patch also has the opportunity to fix another user-friendliness pet peeve of mine: On a fresh install, the first thing the new admin-user does is visit Administer, and the first thing they see is an error message ("On or more problems have been detected with your Drupal installation.")! It turns out the error is that cron has never run. Of course it hasn't, the site was just created 30 seconds ago. Presenting an error message so early in the game does not make a good first impression.
This patch can solve that problem simply by declaring that "cron never run" is no longer an error. After two days (or however long we decide), it can become an error if they haven't gotten to it yet.
So, +1 from me. Since I think this is a pretty serious UI/useability improvement, I'd vote for it going into D6. I have not yet reviewed the patch, though.
Comment #16
catchpatch doesn't suppress the error message for me on a fresh install.
+1 though. It's no fun getting that warning just after you install the site, and good to have it refresh the error if cron stops running (say on moving a site to a different server and forgetting to set up a new cron job).
Comment #17
webernet CreditAttribution: webernet commentedAdded a couple of lines to the installer so that cron is run for the first time during installation.
Changed the time constants to use variable_get() so they can be overridden if necessary.
Comment #18
bjaspan CreditAttribution: bjaspan commentedRunning cron during install solves my pet peeve of not reporting an error immediately upon installation but is somewhat misleading: it may make the user wonder who invoked cron.php when in fact no one did. Also, a one-time message during installation "please see the docs re: cron" is likely to be missed.
A new version of the patch is attached. It's behavior:
If Dries questions whether this 'cron not run becomes an error' behavior is correct at all, however, I doubt this is getting to D6. I think it is fairly important, though.
Comment #19
Gábor HojtsyI think this is pretty important functionality as it helps administrators a lot with fixing a condition which could lead in their databases grow very big, their search indexes getting outdated, some of their mails not being sent, etc.
I only looked through the code and noticed these:
- "Administer page" should not be capitalized IMHO... we also say "administration page" or something along those lines (ie. don't use the verb)
- there is a code style error on the last line added
Otherwise it would indeed be great to know what Dries thinks about this now.
Comment #20
bjaspan CreditAttribution: bjaspan commented@#19: "Administer page" and code style error corrected.
Comment #21
moshe weitzman CreditAttribution: moshe weitzman commentedI tested this with an existing install and a new install. worked as advertised. this is a significant usability bump. code looks clean as well.
Comment #22
Dries CreditAttribution: Dries commented- I wouldn't classify this a "significant usability bump". It's only a small improvement for me.
- The PHP doc comments are hard to understand, especially the one in the first blob of the patch. I can't make sense of it.
- Code like this is simply not needed, IMO:
+ $description .= ' '. $t('This will become an error condition in !time.', array('!time' => format_interval($cron_last + $threshold_error - time())));
. It's too verbose. I think the patch can be simplified a bit.Comment #23
Gábor HojtsyDries, the big glaring red error message shown because cron is not run yet is also mentioned by Chris Messina's review (http://factoryjoe.pbwiki.com/FeedbackForDrupal6) you pointed us to. This patch solves that problem, so one item to tick off of Chris' list.
Comment #24
Gábor HojtsyAnyone interested in moving this forward to get this into Drupal 6? We are pretty short on time now.
Comment #25
webernet CreditAttribution: webernet commentedRerolled and simplified.
Comment #26
Gábor HojtsyOK, tested the patch, and it works nicely. Also reviewed the code, and all looks fine, IMHO the code flow is easy to understand. Thanks, committed.
Comment #27
KentBye CreditAttribution: KentBye commentedHaving a green box at the top of the admin screen is a much better improvement than having a big red box, however, the ability to easily get rid of that green box has been removed causing a new usability annoyance.
This patch presents the following text & option to run cron manually directly from the status message in additional to the drupal.org help page.
This is the current text on the /admin page.
Note no quick and easy option to get rid of this message.
This is the current text on the admin/reports/status page.
The sentence structure is choppy, and combined to be consistent in both places.
Bumping this to critical to sneak in before the usability freeze.
Feel free to downgrade otherwise.
Comment #28
Gábor HojtsyWell, I don't think this is critical. I see a problem with advocating running cron by hand. It is not in an 'or' relationship with setting it up properly, so it should not be presented as such. I am also not sure we need this full information on the admin page. The goal of the note is to get people set up cron, not to get over it with a click. IMHO this is back to fixed.
Comment #29
KentBye CreditAttribution: KentBye commentedGabor,
I want to make a few more points.
Please re-consider re-activating it for more feedback if you find merit.
Consider what Chris Messina had to say about this:
Do we really want to direct brand new users who've never heard of a cron job to this overwhelming help page within the first 15 minutes of their Drupal experience? Try going to this page and actually reading it from start to finish through the eyes of one of these "normal humans" Messina speaks of.
Correct me if I'm wrong, but isn't this /admin cron status message going to show up every two days if they do opt to run it by hand?
So it's not fair to say that they'd be getting over it with just one click -- they would soon realize after a week that they have to manually run it every other day, or to invest the time to set it up properly. IMHO, that's an option I'd like to leave up to these normal human users. Otherwise these types of users will have to see that cron status message on the top of their admin page forever possibly without ever figuring out an easy way for them to do something about it.
My understanding was that "admin/reports/status/run-cron" exists for those who either can't automate it for some hosting reason, don't have the technical expertise to properly set it up or want more frequent cron job updates.
So I don't think it's advocating running cron by hand to because the status message will reappear every couple of days.
If the goal is to improve the initial first impression, then give the user a quick workaround for running cron jobs and let them focus on getting started with exploring the power of Drupal. If they're still around in a couple of days, then they'll be more motivated to sift through this help page that'll be prominently linked at the top of their admin page.
Comment #30
Gábor HojtsyFirst of all, if the help page is overwhelming, it is a documentation issue, it is not solved by looking in a different direction.
Why not run cron in the install process then automatically at the finished stage (ie. after update status is enabled so the update information can be collected also)? This clicking is completely pointless, if we talk about first impressions of brand new users.
Comment #31
Dries CreditAttribution: Dries commentedI see value in this follow-up patch, but Gabor's last comment makes sense to. Because we're short on time, I decided to commit this patch and to recategorize this as 'code needs work' in Drupal 7.
So, patch committed to Drupal 6. Thanks.
Comment #32
catchMight be too late, but it seems I got credited for this patch, when it should've been KentBye.
Comment #33
webernet CreditAttribution: webernet commented@ Gabor's comment in #30 -- That's exactly what the patch in #17 did.
I'm bumping this back to 6.x and attaching a patch since the patch in #27 removed the manual link from the status report page since the help text isn't displayed if the cron has run in the last 48 hours -- That's a regression.
Comment #34
webernet CreditAttribution: webernet commented-Changes the never run message to points to status report, which in turn points to the docs / manual run link.
-Sets the status to warning (until the error threshold) if cron has never run.
Comment #35
Dries CreditAttribution: Dries commentedThat last patch looks good to me. Committed tot CVS HEAD. Thanks.
Comment #36
KentBye CreditAttribution: KentBye commentedJust checked out the changes, and it's much better that it now links to the /admin/reports/status page from that initial message of "Cron has not run. Please visit the status report for more information."
I think that's a lot more friendly than linking to the handbook page.
Thanks for getting this change in everyone.
Comment #37
(not verified) CreditAttribution: commentedAutomatically closed -- issue fixed for two weeks with no activity.