? cron_info_2.patch
? files
? sites/default/settings.php
? sites/default/themes
Index: install.php
===================================================================
RCS file: /cvs/drupal/drupal/install.php,v
retrieving revision 1.91
diff -u -p -r1.91 install.php
--- install.php	19 Nov 2007 13:56:14 -0000	1.91
+++ install.php	19 Nov 2007 14:34:41 -0000
@@ -1073,6 +1073,9 @@ function install_configure_form_submit($
   // The user is now logged in, but has no session ID yet, which
   // would be required later in the request, so remember it.
   $user->sid = session_id();
+
+  // Record when this install ran.
+  variable_set('install_time', time());
 }
 
 // Start the installer.
Index: modules/system/system.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.install,v
retrieving revision 1.183
diff -u -p -r1.183 system.install
--- modules/system/system.install	17 Nov 2007 14:01:24 -0000	1.183
+++ modules/system/system.install	19 Nov 2007 14:34:44 -0000
@@ -89,25 +89,59 @@ function system_requirements($phase) {
     $requirements['settings.php']['title'] = $t('Configuration file');
   }
 
-  // Report cron status
+  // Report cron status.
   if ($phase == 'runtime') {
+    // Cron warning threshold defaults to two days.
+    $threshold_warning = variable_get('cron_threshold_warning', 172800);
+    // Cron error threshold defaults to two weeks.
+    $threshold_error = variable_get('cron_threshold_error', 1209600);
+    // Cron configuration help text.
+    $help = $t('Please check the help pages for <a href="@url">configuring cron jobs</a>.', array('@url' => 'http://drupal.org/cron'));
+
+    // Determine when cron last ran. If never, use the install time to
+    // determine the warning or error status.
     $cron_last = variable_get('cron_last', NULL);
+    $never_run = FALSE;
+    if (!is_numeric($cron_last)) {
+      $never_run = TRUE;
+      $cron_last = variable_get('install_time', 0);
+    }
 
-    if (is_numeric($cron_last)) {
-      $requirements['cron']['value'] = $t('Last run !time ago', array('!time' => format_interval(time() - $cron_last)));
+    // Determine severity based on time since cron last ran.
+    $severity = REQUIREMENT_OK;
+    if (time() - $cron_last > $threshold_error) {
+      $severity = REQUIREMENT_ERROR;
     }
-    else {
-      $requirements['cron'] = array(
-        'description' => $t('Cron has not run. It appears cron jobs have not been setup on your system. Please check the help pages for <a href="@url">configuring cron jobs</a>.', array('@url' => 'http://drupal.org/cron')),
-        'severity' => REQUIREMENT_ERROR,
-        'value' => $t('Never run'),
-      );
+    else if (time() - $cron_last > $threshold_warning) {
+      $severity = REQUIREMENT_WARNING;
+    }
+
+    // If cron hasn't been run, and the user is viewing the main
+    // administration page, instead of an error, we display a helpful reminder
+    // to configure cron jobs.
+    if ($never_run && $severity != REQUIREMENT_ERROR && $_GET['q'] == 'admin') {
+      drupal_set_message($t('Cron has not run.') .' '. $help);
     }
-    $requirements['cron'] += array('description' => '');
 
-    $requirements['cron']['description'] .= ' '. $t('You can <a href="@cron">run cron manually</a>.', array('@cron' => url('admin/reports/status/run-cron')));
+    // Set summary and description based on values determined above.
+    if ($never_run) {
+      $summary = $t('Never run');
+      $description = $t('Cron has not run.') .' '. $help;
+    }
+    else {
+      $summary = $t('Last run !time ago', array('!time' => format_interval(time() - $cron_last)));
+      $description = '';
+      if ($severity != REQUIREMENT_OK) {
+        $description = $t('Cron has not run recently.') .' '. $help;
+      }
+    }
 
-    $requirements['cron']['title'] = $t('Cron maintenance tasks');
+    $requirements['cron'] = array(
+      'title' => $t('Cron maintenance tasks'),
+      'severity' => $severity,
+      'value' => $summary,
+      'description' => $description .' '. $t('You can <a href="@cron">run cron manually</a>.', array('@cron' => url('admin/reports/status/run-cron'))),
+    );
   }
 
   // Test files directory
