Bugzilla – Attachment 103003 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 batch deletion to cleanup_database
Bug-15563-Add-label-batch-deletion-to-cleanupdatab.patch (text/plain), 2.86 KB, created by
ByWater Sandboxes
on 2020-04-15 13:49:01 UTC
(
hide
)
Description:
Bug 15563: Add label batch deletion to cleanup_database
Filename:
MIME Type:
Creator:
ByWater Sandboxes
Created:
2020-04-15 13:49:01 UTC
Size:
2.86 KB
patch
obsolete
>From 82a5c7965bc72e00a1fdc2323819d98f9fcb8c32 Mon Sep 17 00:00:00 2001 >From: Andrew Fuerste-Henry <andrew@bywatersolutions.com> >Date: Tue, 14 Apr 2020 15:30:17 +0000 >Subject: [PATCH] Bug 15563: Add label 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 > >Signed-off-by: Kelly McElligott <kelly@bywatersolutions.com> >--- > misc/cronjobs/cleanup_database.pl | 17 +++++++++++++++++ > 1 file changed, 17 insertions(+) > >diff --git a/misc/cronjobs/cleanup_database.pl b/misc/cronjobs/cleanup_database.pl >index a1a9cae442..abafdad3b5 100755 >--- a/misc/cronjobs/cleanup_database.pl >+++ b/misc/cronjobs/cleanup_database.pl >@@ -90,6 +90,8 @@ Usage: $0 [-h|--help] [--sessions] [--sessdays DAYS] [-v|--verbose] [--zebraqueu > --old-issues DAYS Purge checkouts (old_issues) returned more than DAYS days ago. > --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. >+ > USAGE > exit $_[0]; > } >@@ -122,6 +124,7 @@ my $pDeletedPatrons; > my $pOldIssues; > my $pOldReserves; > my $pTransfers; >+my $labels; > > GetOptions( > 'h|help' => \$help, >@@ -152,6 +155,7 @@ GetOptions( > 'old-issues:i' => \$pOldIssues, > 'old-reserves:i' => \$pOldReserves, > 'transfers:i' => \$pTransfers, >+ 'labels:i' => \$labels, > ) || usage(1); > > # Use default values >@@ -192,6 +196,7 @@ unless ( $sessions > || $pOldIssues > || $pOldReserves > || $pTransfers >+ || $labels > ) { > print "You did not specify any cleanup work for the script to do.\n\n"; > usage(1); >@@ -480,6 +485,18 @@ if ($pTransfers) { > print "Done with purging transfers.\n" if $verbose; > } > >+if ($labels) { >+ print "Purging label items older than $labels days from batches.\n" if $verbose; >+ $sth = $dbh->prepare( >+ q{ >+ DELETE FROM creator_batches >+ WHERE timestamp < date_sub(curdate(), interval ? day) AND creator='Labels' >+ } >+ ); >+ $sth->execute($labels) or die $dbh->errstr; >+ print "Done with purging label items older than $labels 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