You are here

function cron_debug_help in Cron Debug 7

Implements hook_help().

File

./cron_debug.module, line 29
Cron debugging for administrators.

Code

function cron_debug_help($path, $arg) {
  switch ($path) {
    case 'admin/help#cron_debug':
      $output = '';
      $output .= '<p>' . t('Cron Debug will help you find cron processes which:') . '</p>';
      $output .= '<ul>';
      $output .= '<li>' . t('fail due to programming or runtime errors') . '</li>';
      $output .= '<li>' . t('time out (PHP, server, database)') . '</li>';
      $output .= '<li>' . t('are very slow') . '</li>';
      $output .= '</ul>';
      $output .= '<p>' . t('Cron Debug will also allow you to test run specific cron functions while not running others. This can be nice for developing cron functions where you do not want to run a full cron.php with all maintenece, alerts and other tasks everytime you test your own function.') . '</p>';
      $output .= '<p>' . t('Cron Debug can run cron hooks while registering success and time elapsed for each. You can see which hooks will be run in which sequence, select which hooks to run and see their duration in the results as well as in the log.') . '</p>';
      $output .= '<p>' . t('If a cron process times out, hangs or fails, you can see which ones finished succesfully and which single one did not finish properly by looking in the log when returning to Drupal\'s reports. All Cron Debug log entries are registered as "cron debug" and can be filtered separately. If the cron run failed, the usurper will be the top/last entry in the list of Cron Debug entries in the log.') . '</p>';
      $output .= '<p>' . t('A flag is set when the Cron Debug run is started and removed when it finishes succesfully and reports its results. If some part of the cron run fails, hangs or times out, this flag will most likely still be set upon returning to Drupal, and if you go into Cron Debug again, you will get a message telling you so, urging you to look in the log to diagnose the problem. Cron Debug will also try to display details on the failed process when it has halted with an error.') . '</p>';
      $output .= '<p>' . t('Cron jobs can also be run "individually", meaning that they are not called as a part of a joint cron run, but called individually as single functions with immediate return to Cron Debug. This enables you to quickly and easily track down syntax and runtime errors in a single function and possibly analyze the output that it might generate; legitimate or erroneous, which can be helpful in debugging. This way of executing the function will also time it, and give you the option to analyze the single function\'s influence on database, variables, files and other system elements. The start and the end of the run is marked in the log, and errors logged between these two marks come from that particular function or functions that it calls.') . '</p>';
      $output .= '<p>' . t('Notice that your regular cron jobs will run as usual if you have set them up. You might want to disable cron on the server while debugging with Cron Debug. This module runs the cron jobs for each module separately from the usual cron run found in common.inc and invoked by running example.com/cron.php. Running cron.php will not register any debug code. You will have to run the Cron Debug routine to get this registration.') . '</p>';
      $output .= '<p>' . t('Also notice that:');
      $output .= '<ul>';
      $output .= '<li>' . t('some modules have local settings, which enable and disable or configure cron runs for that module. In such cases it might appear in Cron Debug\'s runs as if the hook ran smoothly even though the function in the module might return without having done anything. In order to debug cron jobs in such modules, you will have to tamper with the module\'s own settings and enable the relevant cron routines.') . '</li>';
      $output .= '<li>' . t('some custom modules may call external functions and not return properly to Drupal in which case they may run as planned, but not register as finished in the log. Disable those jobs in order to have a smooth cron run, and (hopefully) a successful return to Drupal.') . '</li>';
      $output .= '</ul>';
      $output .= '</p>';
      return $output;
      break;
    case 'admin/config/system/cron/debug':
      return '<p>' . t('Set up and run Cron Debug. Select or deselect the cron hooks you want to execute or not and press the button Run. After they have run, the results will be displayed in the form. If the run fails, click the back button in your browser and reload this page (do not reload the form submission!), or look <a href="@url">in the log</a> for more details.', array(
        '@url' => url('admin/reports/dblog'),
      )) . '</p>';
  }
}