From 069ac950739e11b7204fd2e4c9dd0b63b96b2576 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Thu, 20 Oct 2011 09:57:12 +0200 Subject: [PATCH] 6094 Follow up for cleanup_database Content-Type: text/plain; charset="utf-8" Adds purging completed entries from need_merge_authorities table. If you set dontmerge to ON, you need to periodically remove records. --- misc/cronjobs/cleanup_database.pl | 18 ++++++++++++++---- 1 files changed, 14 insertions(+), 4 deletions(-) diff --git a/misc/cronjobs/cleanup_database.pl b/misc/cronjobs/cleanup_database.pl index 1333111..2b0cf90 100755 --- a/misc/cronjobs/cleanup_database.pl +++ b/misc/cronjobs/cleanup_database.pl @@ -38,8 +38,8 @@ use Getopt::Long; sub usage { print STDERR < \$help, @@ -63,13 +64,14 @@ GetOptions( 'v|verbose' => \$verbose, 'm|mail' => \$mail, 'zebraqueue:i' => \$zebraqueue_days, + 'merged' => \$purge_merged, ) || usage(1); if ($help) { usage(0); } -if ( !( $sessions || $zebraqueue_days || $mail ) ) { +if ( !( $sessions || $zebraqueue_days || $mail || $purge_merged) ) { print "You did not specify any cleanup work for the script to do.\n\n"; usage(1); } @@ -134,6 +136,14 @@ if ($mail) { $sth->execute() or $dbh->errstr; print "Done with purging the mail queue.\n" if ($verbose); } + +if($purge_merged) { + print "Purging completed entries from need_merge_authorities.\n" if $verbose; + $sth = $dbh->prepare("DELETE FROM need_merge_authorities WHERE done=1"); + $sth->execute() or die $dbh->errstr; + print "Done with purging need_merge_authorities.\n" if $verbose; +} + exit(0); sub RemoveOldSessions { -- 1.6.0.6