Bugzilla – Attachment 23978 Details for
Bug 11484
Add option to purge z39.50 search records from import table to cleanup_database.pl
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 11484 - Add option to purge z39.50 search records from import table to cleanup_database.pl
Bug-11484---Add-option-to-purge-z3950-search-recor.patch (text/plain), 3.40 KB, created by
Kyle M Hall
on 2014-01-06 18:47:51 UTC
(
hide
)
Description:
Bug 11484 - Add option to purge z39.50 search records from import table to cleanup_database.pl
Filename:
MIME Type:
Creator:
Kyle M Hall
Created:
2014-01-06 18:47:51 UTC
Size:
3.40 KB
patch
obsolete
>From 64bbc4714f6ac352d5861560bd76aa58b4755f12 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Mon, 6 Jan 2014 13:46:02 -0500 >Subject: [PATCH] Bug 11484 - Add option to purge z39.50 search records from import table to cleanup_database.pl > >It would be good to be able to specifically target import records from >z39.50 for cleanup. > >Test Plan: >1) Apply this patch >2) Import one or more batch record sets into Koha >3) Perform some z39.50 searches >4) Run this command: misc/cronjobs/cleanup_database.pl -v --z3950 >5) Verify that only z39.50 records were deleted >--- > misc/cronjobs/cleanup_database.pl | 33 +++++++++++++++++++++++++++++++-- > 1 files changed, 31 insertions(+), 2 deletions(-) > >diff --git a/misc/cronjobs/cleanup_database.pl b/misc/cronjobs/cleanup_database.pl >index c190a80..27d92c2 100755 >--- a/misc/cronjobs/cleanup_database.pl >+++ b/misc/cronjobs/cleanup_database.pl >@@ -58,6 +58,8 @@ Usage: $0 [-h|--help] [--sessions] [--sessdays DAYS] [-v|--verbose] [--zebraqueu > --merged purged completed entries from need_merge_authorities. > --import DAYS purge records from import tables older than DAYS days. > Defaults to 60 days if no days specified. >+ --z3950 purge records from import tables that are the result >+ of z39.50 searches > --logs DAYS purge entries from action_logs older than DAYS days. > Defaults to 180 days if no days specified. > --searchhistory DAYS purge entries from search_history older than DAYS days. >@@ -66,7 +68,11 @@ USAGE > exit $_[0]; > } > >-my ( $help, $sessions, $sess_days, $verbose, $zebraqueue_days, $mail, $purge_merged, $pImport, $pLogs, $pSearchhistory); >+my ( >+ $help, $sessions, $sess_days, $verbose, >+ $zebraqueue_days, $mail, $purge_merged, $pImport, >+ $pLogs, $pSearchhistory, $pZ3950 >+); > > GetOptions( > 'h|help' => \$help, >@@ -77,6 +83,7 @@ GetOptions( > 'zebraqueue:i' => \$zebraqueue_days, > 'merged' => \$purge_merged, > 'import:i' => \$pImport, >+ 'z3950' => \$pZ3950, > 'logs:i' => \$pLogs, > 'searchhistory:i' => \$pSearchhistory, > ) || usage(1); >@@ -94,7 +101,15 @@ if ($help) { > usage(0); > } > >-if ( !( $sessions || $zebraqueue_days || $mail || $purge_merged || $pImport || $pLogs || $pSearchhistory ) ) { >+unless ( $sessions >+ || $zebraqueue_days >+ || $mail >+ || $purge_merged >+ || $pImport >+ || $pLogs >+ || $pSearchhistory >+ || $pZ3950 ) >+{ > print "You did not specify any cleanup work for the script to do.\n\n"; > usage(1); > } >@@ -172,6 +187,12 @@ if($pImport) { > print "Done with purging import tables.\n" if $verbose; > } > >+if($pZ3950) { >+ print "Purging z39.50 records from import tables.\n" if $verbose; >+ PurgeZ3950(); >+ print "Done with purging z39.50 records from import tables.\n" if $verbose; >+} >+ > if($pLogs) { > print "Purging records from action_logs.\n" if $verbose; > $sth = $dbh->prepare("DELETE FROM action_logs WHERE timestamp < date_sub(curdate(), interval ? DAY)"); >@@ -232,3 +253,11 @@ sub PurgeImportTables { > ba.upload_timestamp < date_sub(curdate(), interval ? DAY)"); > $sth->execute($pImport) or die $dbh->errstr; > } >+ >+ >+sub PurgeZ3950 { >+ $sth = $dbh->prepare(q{ >+ DELETE FROM import_batches WHERE batch_type = 'z3950' >+ }); >+ $sth->execute() or die $dbh->errstr; >+} >-- >1.7.2.5
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 11484
:
23978
|
25774
|
27226