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

Comments

jonathan1055’s picture

Status: Active » Needs review
StatusFileSize
new1.53 KB

The message and return should only be executed if arg(0) == 'admin'
Patch against 1.1+27

jonathan1055’s picture

StatusFileSize
new1.67 KB

Required a re-roll following 1.1+34

pfrenssen’s picture

Issue summary: View changes
Status: Needs review » Fixed

Using 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:

  $menu_item = menu_get_item();
  if ($menu_item['path'] == 'admin/config/content/scheduler/cron') {
  }

Committed f8f4651, thanks!!

jonathan1055’s picture

Ah, yes that is a better way to check the path.

Status: Fixed » Closed (fixed)

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

jonathan1055’s picture

For completeness and in case we need this again, I used the following in my tests:

/usr/local/bin/wget -O - http://localhost/drupal7/scheduler/cron

instead of the normal

/usr/local/bin/wget -q -O /dev/null http://localhost/drupal7/scheduler/cron