| 1 |
<?php |
<?php |
| 2 |
/** |
/** |
| 3 |
* $Id: cronplus.module,v 1.8.2.3 2008/12/19 04:45:24 syscrusher Exp $ |
* $Id: cronplus.module,v 1.8 2007/03/22 23:41:18 syscrusher Exp $ |
| 4 |
* |
* |
| 5 |
* CronPlus enhances the Drupal cron feature to provide specific calls to |
* CronPlus enhances the Drupal cron feature to provide specific calls to |
| 6 |
* other modules at hourly, daily, weekly, monthly, and yearly intervals. |
* other modules at hourly, daily, weekly, monthly, and yearly intervals. |
| 22 |
/** |
/** |
| 23 |
* Implements hook_menu(). |
* Implements hook_menu(). |
| 24 |
*/ |
*/ |
| 25 |
function cronplus_menu() { |
function cronplus_menu($may_cache) { |
| 26 |
$items = array(); |
$items = array(); |
| 27 |
$items['admin/settings/cronplus'] = array( |
if ($may_cache) { |
| 28 |
'title' => t('cronplus'), |
$items[] = array( |
| 29 |
'page callback' => 'cronplus_settings_main', |
'path' => 'admin/settings/cronplus', |
| 30 |
'description' => 'Select which hour and on what day you would like houly and daily crons to run. Also see the status of cronplus', |
'title' => t('cronplus'), |
| 31 |
'access callback' => 'user_access', |
'callback' => 'cronplus_settings_main', |
| 32 |
'access arguments' => array('administer site configuration'), |
'description' => 'Select which hour and on what day you would like houly and daily crons to run. Also see the status of cronplus', |
| 33 |
// 'type' => MENU_LOCAL_TASK, |
'access' => user_access('administer site configuration'), |
| 34 |
); |
// 'type' => MENU_LOCAL_TASK, |
| 35 |
$items['admin/settings/cronplus/main'] = array( |
); |
| 36 |
'title' => t('configuration'), |
$items[] = array( |
| 37 |
'type' => MENU_DEFAULT_LOCAL_TASK, |
'path' => 'admin/settings/cronplus/main', |
| 38 |
'access callback' => 'user_access', |
'title' => t('configuration'), |
| 39 |
'access arguments' => array('administer site configuration'), |
'type' => MENU_DEFAULT_LOCAL_TASK, |
| 40 |
'weight' => -10, |
'weight' => -10, |
| 41 |
); |
); |
| 42 |
$items['admin/settings/cronplus/status'] = array( |
} |
| 43 |
'title' => t('status report'), |
else { |
| 44 |
'page callback' => 'cronplus_settings_status', 'access' => user_access('administer site configuration'), |
$items[] = array( |
| 45 |
'access callback' => 'user_access', |
'path' => 'admin/settings/cronplus/status', |
| 46 |
'access arguments' => array('administer site configuration'), |
'title' => t('status report'), |
| 47 |
'type' => MENU_LOCAL_TASK, 'weight' => 10 |
'callback' => 'cronplus_settings_status', 'access' => user_access('administer site configuration'), |
| 48 |
); |
'type' => MENU_LOCAL_TASK, 'weight' => 10); |
| 49 |
|
} |
| 50 |
return $items; |
return $items; |
| 51 |
} |
} |
| 52 |
|
|
| 105 |
'#type' => 'submit', |
'#type' => 'submit', |
| 106 |
'#value' => t('Save settings'), |
'#value' => t('Save settings'), |
| 107 |
); |
); |
| 108 |
return system_settings_form($form); |
return $form; |
| 109 |
} |
} |
| 110 |
|
|
| 111 |
/** |
/** |
| 143 |
*/ |
*/ |
| 144 |
function cronplus_logview_form_submit($form_id, $form_values) { |
function cronplus_logview_form_submit($form_id, $form_values) { |
| 145 |
$_SESSION['watchdog_overview_filter'] = 'cronplus'; |
$_SESSION['watchdog_overview_filter'] = 'cronplus'; |
| 146 |
drupal_goto('admin/reports/dblog'); |
drupal_goto('admin/logs/watchdog'); |
| 147 |
} |
} |
| 148 |
|
|
| 149 |
/** |
/** |
| 274 |
$function_name = 'cronplus_'. $period; |
$function_name = 'cronplus_'. $period; |
| 275 |
$last_this = variable_get($function_name .'_last', 0); |
$last_this = variable_get($function_name .'_last', 0); |
| 276 |
variable_set($function_name .'_last', $now); |
variable_set($function_name .'_last', $now); |
| 277 |
watchdog('cronplus', 'Processing %period cron for %d UTC, calling {module}_%func() for all modules', array('%d' => $now_fmt, '%period' => t($period), '%func' => $function_name), WATCHDOG_NOTICE); |
watchdog('cronplus', t('Processing %period cron for %d UTC, calling {module}_%func() for all modules', array('%d' => $now_fmt, '%period' => t($period), '%func' => $function_name)), WATCHDOG_NOTICE); |
| 278 |
@module_invoke_all($function_name, $now, $last_cron, $last_this); |
@module_invoke_all($function_name, $now, $last_cron, $last_this); |
| 279 |
@module_invoke_all('cronplus', $period, $now, $last_cron, $last_this); |
@module_invoke_all('cronplus', $period, $now, $last_cron, $last_this); |
| 280 |
} |
} |
| 296 |
} |
} |
| 297 |
return $options; |
return $options; |
| 298 |
} |
} |
| 299 |
|
?> |