You are here

function poormanscron_menu in Poormanscron 5.2

Same name and namespace in other branches
  1. 5 poormanscron.module \poormanscron_menu()
  2. 6.2 poormanscron.module \poormanscron_menu()
  3. 6 poormanscron.module \poormanscron_menu()

Implements hook_menu().

File

./poormanscron.module, line 11
A module which runs Drupal cron jobs without the cron application.

Code

function poormanscron_menu($may_cache) {
  if ($may_cache) {
    $items[] = array(
      'path' => 'poormanscron/run-cron-check',
      'title' => t('Run Poormanscron'),
      'callback' => 'poormanscron_run_cron_check',
      'access' => poormanscron_run_cron_check_access(),
      'type' => MENU_CALLBACK,
    );
  }
  else {
    if (poormanscron_run_cron_check_access()) {
      drupal_add_js(drupal_get_path('module', 'poormanscron') . '/poormanscron.js');
      $settings = array(
        'basePath' => url('poormanscron'),
        'runNext' => variable_get('cron_last', 0) + variable_get('cron_safe_threshold', 10800),
      );
      drupal_add_js(array(
        'cron' => $settings,
      ), 'setting');
    }
  }
  return $items;
}