From 3bb68882432803a0a8bebc0dd6845a0228658aca Mon Sep 17 00:00:00 2001 From: peterbo <peter.boehlke@googlemail.com> Date: Fri, 25 Nov 2011 10:24:13 +0000 Subject: [PATCH] Fixes #2792 git-svn-id: http://dev.piwik.org/svn/trunk@5479 59fd770c-687e-43c8-a1e3-f5a4ff64c105 --- config/global.ini.php | 2 +- lang/en.php | 1 + plugins/PrivacyManager/PrivacyManager.php | 7 ++++++- plugins/PrivacyManager/templates/privacySettings.tpl | 1 + 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/config/global.ini.php b/config/global.ini.php index 4ce75b1bf6..37c540d83b 100644 --- a/config/global.ini.php +++ b/config/global.ini.php @@ -368,7 +368,7 @@ tracking_requests_require_authentication = 1 ; otherwise you may lose tracking data. ; delete_logs_schedule_lowest_interval - lowest possible interval between two table deletes (in days, 1|7|30). Default: 7. ; delete_logs_older_than - delete data older than XX (days). Default: 180 -; delete_max_rows_per_run - Maximum of rows deleted in one go (in thousands) +; delete_max_rows_per_run - Maximum of rows deleted in one go (in thousands); 0 for no limit delete_logs_enable = 0 delete_logs_schedule_lowest_interval = 7 delete_logs_older_than = 180 diff --git a/lang/en.php b/lang/en.php index 0ac65b0f34..dac12c08e4 100644 --- a/lang/en.php +++ b/lang/en.php @@ -388,6 +388,7 @@ $translations = array( 'PrivacyManager_DeleteLogsOlderThan' => 'Delete logs older than', 'PrivacyManager_DeleteLogInterval' => 'Delete old logs every', 'PrivacyManager_DeleteMaxRows' => 'Maximum number of rows to delete in one run:', + 'PrivacyManager_DeleteMaxRowsNoLimit' => 'no limit', 'PrivacyManager_LastDelete' => 'Last deletion was on', 'PrivacyManager_NextDelete' => 'Next scheduled deletion in', 'PrivacyManager_ClickHereSettings' => 'Click here to access the %s settings.', diff --git a/plugins/PrivacyManager/PrivacyManager.php b/plugins/PrivacyManager/PrivacyManager.php index 09b10afa48..40a8c40c72 100644 --- a/plugins/PrivacyManager/PrivacyManager.php +++ b/plugins/PrivacyManager/PrivacyManager.php @@ -149,7 +149,12 @@ class Piwik_PrivacyManager extends Piwik_Plugin * LOW_PRIORITY / QUICK / IGNORE read http://dev.mysql.com/doc/refman/5.0/en/delete.html */ - $sql = 'DELETE LOW_PRIORITY QUICK IGNORE FROM ' . $table . ' WHERE `idvisit` <= ? LIMIT ' . $maxRowsPerRun; + $sql = 'DELETE LOW_PRIORITY QUICK IGNORE FROM ' . $table . ' WHERE `idvisit` <= ? '; + + if(isset($maxRowsPerRun)&&$maxRowsPerRun>0) { + $sql .= ' LIMIT ' . $maxRowsPerRun; + } + Piwik_Query($sql, array($maxIdVisit)); } diff --git a/plugins/PrivacyManager/templates/privacySettings.tpl b/plugins/PrivacyManager/templates/privacySettings.tpl index 1be90a950e..5b3cff8577 100644 --- a/plugins/PrivacyManager/templates/privacySettings.tpl +++ b/plugins/PrivacyManager/templates/privacySettings.tpl @@ -127,6 +127,7 @@ <option {if $deleteLogs.config.delete_max_rows_per_run eq '100'} selected="selected" {/if} value="100">100.000</option> <option {if $deleteLogs.config.delete_max_rows_per_run eq '500'} selected="selected" {/if} value="500">500.000</option> <option {if $deleteLogs.config.delete_max_rows_per_run eq '1000'} selected="selected" {/if} value="1000">1.000.000</option> + <option {if $deleteLogs.config.delete_max_rows_per_run eq '0'} selected="selected" {/if} value="0">{'PrivacyManager_DeleteMaxRowsNoLimit'|translate}</option> </select> </td> <td width="200"></td> -- GitLab