@@ -, +, @@ from db after X days --- misc/cronjobs/cleanup_database.pl | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) --- a/misc/cronjobs/cleanup_database.pl +++ a/misc/cronjobs/cleanup_database.pl @@ -84,7 +84,8 @@ Usage: $0 [-h|--help] [--confirm] [--sessions] [--sessdays DAYS] [-v|--verbose] days. Defaults to 14 days if no days specified. --restrictions DAYS purge patrons restrictions expired since more than DAYS days. Defaults to 30 days if no days specified. - --all-restrictions purge all expired patrons restrictions. + --all-restrictions purge all expired patrons restrictions. + --return-claims DAYS Purge all resolved return claims older than DAYS --del-exp-selfreg Delete expired self registration accounts --del-unv-selfreg DAYS Delete unverified self registrations older than DAYS --unique-holidays DAYS Delete all unique holidays older than DAYS @@ -122,6 +123,7 @@ my $pZ3950; my $pListShareInvites; my $pDebarments; my $allDebarments; +my $return_claims; my $pExpSelfReg; my $pUnvSelfReg; my $fees_days; @@ -155,6 +157,7 @@ GetOptions( 'list-invites:i' => \$pListShareInvites, 'restrictions:i' => \$pDebarments, 'all-restrictions' => \$allDebarments, + 'return-claims:i' => \$return_claims, 'del-exp-selfreg' => \$pExpSelfReg, 'del-unv-selfreg' => \$pUnvSelfReg, 'unique-holidays:i' => \$special_holidays_days, @@ -214,6 +217,7 @@ unless ( $sessions || defined $pPseudoTransactions || $pPseudoTransactionsFrom || $pPseudoTransactionsTo + || $return_claims ) { print "You did not specify any cleanup work for the script to do.\n\n"; usage(1); @@ -484,6 +488,18 @@ if ($pStatistics) { } } +if ($return_claims) { + print "Purging return claims older than $return_claims days.\n" if $verbose; + $sth = $dbh->prepare( + q{ + DELETE FROM return_claims + WHERE resolved_on < DATE_SUB(CURDATE(), INTERVAL ? DAY) + } + ); + $sth->execute($return_claims); + print "Done with purging return claims.\n" if $verbose; +} + if ($pDeletedCatalog) { print "Purging deleted catalog older than $pDeletedCatalog days.\n" if $verbose; --