Commit 0092db8e authored by webchick's avatar webchick

#49941 by geodaniel and Davy Van Den Bremt: Allow access logs to never be discarded.

parent f4c6b2ba
......@@ -265,7 +265,7 @@ function statistics_settings_form() {
'#type' => 'select',
'#title' => t('Discard access logs older than'),
'#default_value' => 259200,
'#options' => drupal_map_assoc(array(3600, 10800, 21600, 32400, 43200, 86400, 172800, 259200, 604800, 1209600, 2419200, 4838400, 9676800), 'format_interval'),
'#options' => array(0 => t('Never')) + drupal_map_assoc(array(3600, 10800, 21600, 32400, 43200, 86400, 172800, 259200, 604800, 1209600, 2419200, 4838400, 9676800), 'format_interval'),
'#description' => t('Older access log entries (including referrer statistics) will be automatically discarded. (Requires a correctly configured <a href="@cron">cron maintenance task</a>.)', array('@cron' => url('admin/reports/status'))),
);
......
......@@ -228,10 +228,12 @@ function statistics_cron() {
variable_set('statistics_day_timestamp', REQUEST_TIME);
}
// Clean up expired access logs.
db_delete('accesslog')
->condition('timestamp', REQUEST_TIME - variable_get('statistics_flush_accesslog_timer', 259200), '<')
->execute();
// Clean up expired access logs (if applicable).
if (variable_get('statistics_flush_accesslog_timer', 259200) > 0) {
db_delete('accesslog')
->condition('timestamp', REQUEST_TIME - variable_get('statistics_flush_accesslog_timer', 259200), '<')
->execute();
}
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment