From c56d12c721684bfd3bac0e9bd9cf17f8f29651a9 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 Adds purging completed entries from need_merge_authorities table. If you set dontmerge to ON, you need to periodically remove records. Signed-off-by: Ian Walls Signed-off-by: Chris Cormack --- misc/cronjobs/cleanup_database.pl | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/misc/cronjobs/cleanup_database.pl b/misc/cronjobs/cleanup_database.pl index 1333111789..2b0cf9028e 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 { -- 2.39.5