Bugzilla – Attachment 103004 Details for
Bug 15563
Add option to regularly delete patroncard and label batches to cleanup_database.pl cronjob
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15563: Add label and card creator batch deletion to cleanup_database
Bug-15563-Add-label-and-card-creator-batch-deletio.patch (text/plain), 3.05 KB, created by
ByWater Sandboxes
on 2020-04-15 13:49:03 UTC
(
hide
)
Description:
Bug 15563: Add label and card creator batch deletion to cleanup_database
Filename:
MIME Type:
Creator:
ByWater Sandboxes
Created:
2020-04-15 13:49:03 UTC
Size:
3.05 KB
patch
obsolete
>From 35d721009b038fa942bcb76732fcaf1b09eb00c8 Mon Sep 17 00:00:00 2001 >From: Andrew Fuerste-Henry <andrew@bywatersolutions.com> >Date: Tue, 14 Apr 2020 21:12:45 +0000 >Subject: [PATCH] Bug 15563: Add label and card creator batch deletion to > cleanup_database > >To test: >Apply patch >1- create a label batch with multiple items >2- update creator_batches to change timestamp on some items in batch 1 to more than 2 days ago >3- create a second label batch with multiple items >4- update creator_batches to change timestamp on all items in batch 2 to more than 2 days ago >5- create a patron card batch with multiple patrons >6- update creator_batches to change timestamp on some items to more than 2 days ago >7- run cron with --labels 2 >8- confirm all labels with timestamp more than 2 days ago were deleted >9- confirm newer labels were not deleted >10- confirm batch 2 no longer shows in label creator >11- confirm no patrons card batches were changed >12- run cron with --cards 2 >13- confirm all cards batches were deleted > >Signed-off-by: Kelly McElligott <kelly@bywatersolutions.com> >--- > misc/cronjobs/cleanup_database.pl | 18 +++++++++++++++++- > 1 file changed, 17 insertions(+), 1 deletion(-) > >diff --git a/misc/cronjobs/cleanup_database.pl b/misc/cronjobs/cleanup_database.pl >index abafdad3b5..ec5096f549 100755 >--- a/misc/cronjobs/cleanup_database.pl >+++ b/misc/cronjobs/cleanup_database.pl >@@ -91,6 +91,7 @@ Usage: $0 [-h|--help] [--sessions] [--sessdays DAYS] [-v|--verbose] [--zebraqueu > --old-reserves DAYS Purge reserves (old_reserves) more than DAYS old. > --transfers DAYS Purge transfers completed more than DAYS day ago. > --labels DAYS Purge label items added more than DAYS days ago. >+ --cards DAY Purge card creator patrons added more than DAYS days ago. > > USAGE > exit $_[0]; >@@ -125,6 +126,7 @@ my $pOldIssues; > my $pOldReserves; > my $pTransfers; > my $labels; >+my $cards; > > GetOptions( > 'h|help' => \$help, >@@ -155,7 +157,8 @@ GetOptions( > 'old-issues:i' => \$pOldIssues, > 'old-reserves:i' => \$pOldReserves, > 'transfers:i' => \$pTransfers, >- 'labels:i' => \$labels, >+ 'labels:i' => \$labels, >+ 'cards:i' => \$cards, > ) || usage(1); > > # Use default values >@@ -197,6 +200,7 @@ unless ( $sessions > || $pOldReserves > || $pTransfers > || $labels >+ || $cards > ) { > print "You did not specify any cleanup work for the script to do.\n\n"; > usage(1); >@@ -497,6 +501,18 @@ if ($labels) { > print "Done with purging label items older than $labels days from batches.\n" if $verbose; > } > >+if ($cards) { >+ print "Purging label items older than $cards days from batches.\n" if $verbose; >+ $sth = $dbh->prepare( >+ q{ >+ DELETE FROM creator_batches >+ WHERE timestamp < date_sub(curdate(), interval ? day) AND creator='Patroncards' >+ } >+ ); >+ $sth->execute($cards) or die $dbh->errstr; >+ print "Done with purging label items older than $cards days from batches.\n" if $verbose; >+} >+ > exit(0); > > sub RemoveOldSessions { >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 15563
:
102934
|
102948
|
103003
|
103004
|
103011
|
103012
|
103492
|
103493
|
107115
|
107639
|
118076
|
118078
|
118081
|
118082
|
118345
|
118762
|
118763
|
118764
|
120082
|
120221