function log_cleanup_settings in Util 6.3
Same name and namespace in other branches
- 7 contribs/log_cleanup/log_cleanup.module \log_cleanup_settings()
Module settings form.
1 string reference to 'log_cleanup_settings'
- log_cleanup_menu in contribs/
log_cleanup/ log_cleanup.module - Implements hook_menu().
File
- contribs/
log_cleanup/ log_cleanup.module, line 89 - Clean up watchdog messages.
Code
function log_cleanup_settings() {
$form = array();
$types = variable_get('log_cleanup_intervals', array());
// Previous module version defaults.
if (!$types) {
$types = array(
'actions' => LOG_CLEANUP_DEFAULT_INTERVAL,
'aggregator' => 86400,
// 1 day
'cleaner' => LOG_CLEANUP_DEFAULT_INTERVAL,
'content' => 604800,
// 1 week
'features' => 604800,
// 1 week
'php' => 86400,
// 1 day
'user' => 86400,
// 1 day
'xmlsitemap' => 43200,
);
}
$result = db_query("SELECT DISTINCT type FROM {watchdog}");
while ($row = db_fetch_object($result)) {
if (!isset($types[$row->type])) {
$types[$row->type] = LOG_CLEANUP_DEFAULT_INTERVAL;
}
}
ksort($types);
$intervals = array(
0 => t('always'),
3600 => t('1 hour'),
7200 => t('2 hours'),
10800 => t('3 hours'),
21600 => t('6 hours'),
43200 => t('12 hours'),
86400 => t('1 day'),
172800 => t('2 days'),
259200 => t('3 days'),
345600 => t('4 days'),
604800 => t('1 week'),
1209600 => t('2 weeks'),
-1 => t('never'),
);
foreach ($types as $type => $interval) {
$form['intervals'][$type] = array(
'#type' => 'select',
'#options' => $intervals,
'#default_value' => $interval,
);
}
$form['#tree'] = TRUE;
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Save configuration'),
);
$form['reset'] = array(
'#type' => 'submit',
'#value' => t('Reset'),
);
return $form;
}