summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAngie Byron2009-08-29 03:32:46 (GMT)
committerAngie Byron2009-08-29 03:32:46 (GMT)
commit0092db8e2c64d2bd5bda5fb25b8b8744e63d7b38 (patch)
tree36d28474d207e33b947630ed22a01677af39af14
parentf4c6b2ba5e4330674f30674547bb399c62085662 (diff)
#49941 by geodaniel and Davy Van Den Bremt: Allow access logs to never be discarded.
-rw-r--r--modules/statistics/statistics.admin.inc2
-rw-r--r--modules/statistics/statistics.module10
2 files changed, 7 insertions, 5 deletions
diff --git a/modules/statistics/statistics.admin.inc b/modules/statistics/statistics.admin.inc
index 9139a25..dc92ba1 100644
--- a/modules/statistics/statistics.admin.inc
+++ b/modules/statistics/statistics.admin.inc
@@ -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'))),
);
diff --git a/modules/statistics/statistics.module b/modules/statistics/statistics.module
index 4242032..533490c 100644
--- a/modules/statistics/statistics.module
+++ b/modules/statistics/statistics.module
@@ -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();
+ }
}
/**