Bugzilla – Attachment 71775 Details for
Bug 19008
Add more options to cleanup database script
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19008 - More database cleanups - old reserves
Bug-19008---More-database-cleanups---old-reserves.patch (text/plain), 3.51 KB, created by
Kyle M Hall (khall)
on 2018-02-16 13:56:35 UTC
(
hide
)
Description:
Bug 19008 - More database cleanups - old reserves
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2018-02-16 13:56:35 UTC
Size:
3.51 KB
patch
obsolete
>From 0d762397c08a96f92edbddd8b3c7aa40f60601a7 Mon Sep 17 00:00:00 2001 >From: Fridolin Somers <fridolin.somers@biblibre.com> >Date: Fri, 28 Jul 2017 16:01:51 +0200 >Subject: [PATCH] Bug 19008 - More database cleanups - old reserves > >misc/cronjobs/cleanup_database.pl provides some database cleanup. >Yet some tables that could need cleanup are not in this script. > >This patch adds cleanup for old_reserves table. > >Test plan : >- Count : select count(*),date(timestamp) from old_reserves group by date(timestamp); >- Run cleanup : misc/cronjobs/cleanup_database.pl -v --old-reserves 30 >- Recount > >Signed-off-by: Mark Tompsett <mtompset@hotmail.com> > >Signed-off-by: Kyle M Hall <kyle@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 80bd33b..6e00517 100755 >--- a/misc/cronjobs/cleanup_database.pl >+++ b/misc/cronjobs/cleanup_database.pl >@@ -44,7 +44,7 @@ use Koha::UploadedFiles; > > sub usage { > print STDERR <<USAGE; >-Usage: $0 [-h|--help] [--sessions] [--sessdays DAYS] [-v|--verbose] [--zebraqueue DAYS] [-m|--mail] [--merged] [--import DAYS] [--logs DAYS] [--searchhistory DAYS] [--restrictions DAYS] [--all-restrictions] [--fees DAYS] [--temp-uploads] [--temp-uploads-days DAYS] [--uploads-missing 0|1 ] [--statistics DAYS] [--deleted-catalog DAYS] [--deleted-patrons DAYS] [--old-issues DAYS] >+Usage: $0 [-h|--help] [--sessions] [--sessdays DAYS] [-v|--verbose] [--zebraqueue DAYS] [-m|--mail] [--merged] [--import DAYS] [--logs DAYS] [--searchhistory DAYS] [--restrictions DAYS] [--all-restrictions] [--fees DAYS] [--temp-uploads] [--temp-uploads-days DAYS] [--uploads-missing 0|1 ] [--statistics DAYS] [--deleted-catalog DAYS] [--deleted-patrons DAYS] [--old-issues DAYS] [--old-reserves DAYS] > > -h --help prints this help message, and exits, ignoring all > other options >@@ -89,6 +89,7 @@ Usage: $0 [-h|--help] [--sessions] [--sessdays DAYS] [-v|--verbose] [--zebraqueu > in tables deleteditems, deletedbiblioitems, deletedbiblio_metadata and deletedbiblio > --deleted-patrons DAYS Purge deleted patrons older than DAYS days. > --old-issues DAYS Purge old issues older than DAYS days. >+ --old-reserves DAYS Purge old reserves older than DAYS days. > USAGE > exit $_[0]; > } >@@ -118,6 +119,7 @@ my $pStatistics; > my $pDeletedCatalog; > my $pDeletedPatrons; > my $pOldIssues; >+my $pOldReserves; > > GetOptions( > 'h|help' => \$help, >@@ -145,6 +147,7 @@ GetOptions( > 'deleted-catalog:i' => \$pDeletedCatalog, > 'deleted-patrons:i' => \$pDeletedPatrons, > 'old-issues:i' => \$pOldIssues, >+ 'old-reserves:i' => \$pOldReserves, > ) || usage(1); > > # Use default values >@@ -182,6 +185,7 @@ unless ( $sessions > || $pDeletedCatalog > || $pDeletedPatrons > || $pOldIssues >+ || $pOldReserves > ) { > print "You did not specify any cleanup work for the script to do.\n\n"; > usage(1); >@@ -416,6 +420,18 @@ if ($pOldIssues) { > print "Done with purging old issues.\n" if $verbose; > } > >+if ($pOldReserves) { >+ print "Purging old reserves older than $pOldReserves days.\n" if $verbose; >+ $sth = $dbh->prepare( >+ q{ >+ DELETE FROM old_reserves >+ WHERE timestamp < DATE_SUB(CURDATE(), INTERVAL ? DAY) >+ } >+ ); >+ $sth->execute($pOldReserves); >+ print "Done with purging old reserves.\n" if $verbose; >+} >+ > exit(0); > > sub RemoveOldSessions { >-- >2.10.2
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 19008
:
65351
|
65352
|
65353
|
65354
|
65355
|
65356
|
68491
|
68492
|
68493
|
68494
|
68495
|
68496
|
71771
|
71772
|
71773
|
71774
|
71775
|
71776
|
91922
|
91923
|
91924
|
91925
|
91926
|
91927
|
91928
|
98373
|
98374
|
98375
|
98376
|
98377
|
98378
|
98379
|
98380