Currently the cron processing creates html output. This was added to enable the lightweight cron to be run interactively from the admin page. However it is against the Drupal recommendations to have real cron jobs create any html output. It means that if you need to debug your cron job and you turn off the 'quiet' option and do not send output to /dev/null, you have to sift through all the unwanted html to find the useful information about the actual cron job. The html output should only be created when running our lightweight cron from the admin page.
Attached is an example of the current cron output when running non-quiet, and the output that should be produced, with no html, just cron information.
The code change is quite simple - patch to follow.
Jonathan
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | 2115479_2.no_output_from_cron.patch | 1.67 KB | jonathan1055 |
| #1 | 2115479_1.no_output_from_cron.patch | 1.53 KB | jonathan1055 |
| cron e-mail output without html.txt | 828 bytes | jonathan1055 | |
| cron e-mail output with html.txt | 17.09 KB | jonathan1055 |
Comments
Comment #1
jonathan1055 commentedThe message and return should only be executed if arg(0) == 'admin'
Patch against 1.1+27
Comment #2
jonathan1055 commentedRequired a re-roll following 1.1+34
Comment #3
pfrenssenUsing
arg(0)is not ideal, this only check part of the path. If a site (e.g. an intranet) has a page in the administration section as the homepage this will still trigger.I changed it to the following:
Committed f8f4651, thanks!!
Comment #4
jonathan1055 commentedAh, yes that is a better way to check the path.
Comment #6
jonathan1055 commentedFor completeness and in case we need this again, I used the following in my tests:
instead of the normal