diff options
author | Angie Byron <webchick@24967.no-reply.drupal.org> | 2009-08-29 03:32:46 +0000 |
---|---|---|
committer | Angie Byron <webchick@24967.no-reply.drupal.org> | 2009-08-29 03:32:46 +0000 |
commit | 0092db8e2c64d2bd5bda5fb25b8b8744e63d7b38 (patch) | |
tree | 36d28474d207e33b947630ed22a01677af39af14 | |
parent | f4c6b2ba5e4330674f30674547bb399c62085662 (diff) | |
download | brdo-0092db8e2c64d2bd5bda5fb25b8b8744e63d7b38.tar.gz brdo-0092db8e2c64d2bd5bda5fb25b8b8744e63d7b38.tar.bz2 |
#49941 by geodaniel and Davy Van Den Bremt: Allow access logs to never be discarded.
-rw-r--r-- | modules/statistics/statistics.admin.inc | 2 | ||||
-rw-r--r-- | modules/statistics/statistics.module | 10 |
2 files changed, 7 insertions, 5 deletions
diff --git a/modules/statistics/statistics.admin.inc b/modules/statistics/statistics.admin.inc index 9139a2567..dc92ba126 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 424203262..533490c1f 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(); + } } /** |