Bugzilla – Attachment 40703 Details for
Bug 14469
Script to delete Z39.50 results from the reservoir
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14469 - Script to delete Z39.50 results from the reservoir
Bug-14469---Script-to-delete-Z3950-results-from-th.patch (text/plain), 3.24 KB, created by
Mirko Tietgen
on 2015-06-28 10:31:23 UTC
(
hide
)
Description:
Bug 14469 - Script to delete Z39.50 results from the reservoir
Filename:
MIME Type:
Creator:
Mirko Tietgen
Created:
2015-06-28 10:31:23 UTC
Size:
3.24 KB
patch
obsolete
>From 0eb56aecef14df746a27b3d07b033d7b70c952ca Mon Sep 17 00:00:00 2001 >From: Mirko Tietgen <mirko@abunchofthings.net> >Date: Sun, 28 Jun 2015 12:07:37 +0200 >Subject: [PATCH] Bug 14469 - Script to delete Z39.50 results from the > reservoir > >With every Z39.50 search, the reservoir gets filled with results. >This script is supposed to delete all entries from z39.50 results >from the reservoir. > >Test plan: > >- stage a mrc file for import >- do a z3950 search >- do a cataloguing search for something that will show results of > both the staged mrc and the z3950 results, find results for both > types in the reservoir part of the page >- run this script >- repeat the search, observe that results from mrc are still in the > reservoir but those from z3950 are gone >- check db for records from z3950 batches: > > SELECT import_record_id, import_batches.batch_type, import_batches.file_name > FROM import_records > JOIN import_batches USING (import_batch_id) > WHERE batch_type LIKE 'z3950'; > > There should not be any results. >- check db for batches from z3950: > > SELECT * FROM import_batches WHERE batch_type LIKE 'z3950'; > > There should not be any results. >--- > misc/cronjobs/clean_reservoir_z3950.pl | 70 ++++++++++++++++++++++++++++++++ > 1 file changed, 70 insertions(+) > create mode 100755 misc/cronjobs/clean_reservoir_z3950.pl > >diff --git a/misc/cronjobs/clean_reservoir_z3950.pl b/misc/cronjobs/clean_reservoir_z3950.pl >new file mode 100755 >index 0000000..e690bd9 >--- /dev/null >+++ b/misc/cronjobs/clean_reservoir_z3950.pl >@@ -0,0 +1,70 @@ >+#!/usr/bin/perl >+ >+# This file is part of Koha. >+# >+# Copyright (C) 2015 Mirko Tietgen, http://koha.abunchofthings.net >+# >+# Koha is free software; you can redistribute it and/or modify it >+# under the terms of the GNU General Public License as published by >+# the Free Software Foundation; either version 3 of the License, or >+# (at your option) any later version. >+# >+# Koha is distributed in the hope that it will be useful, but >+# WITHOUT ANY WARRANTY; without even the implied warranty of >+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+# GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License >+# along with Koha; if not, see <http://www.gnu.org/licenses>. >+ >+=head1 NAME >+ >+clean_reservoir_z3950.pl - cron script to delete all z3950 results >+from the reservoir >+ >+=head1 SYNOPSIS >+ >+./clean_reservoir_z3950.pl >+ >+or, in crontab: >+0 0 * * 0 clean_reservoir_z3950.pl >+ >+=head1 DESCRIPTION >+ >+With every Z39.50 search, the reservoir gets filled with results. >+This script is supposed to delete all entries from z39.50 results >+from the reservoir. >+ >+=head1 OPTIONS >+ >+No options. >+ >+=cut >+ >+use Modern::Perl; >+ >+use C4::Circulation; >+use C4::Context; >+use C4::Log; >+ >+cronlogaction(); >+ >+my $dbh = C4::Context->dbh; >+ >+# delete records from reservoir >+my $query = "DELETE FROM import_records >+ WHERE import_batch_id IN ( >+ SELECT import_batch_id >+ FROM import_batches >+ WHERE batch_type LIKE 'z3950')"; >+ >+my $sth = $dbh->prepare($query); >+$sth->execute(); >+ >+# delete empty batches >+$query = "DELETE FROM import_batches >+ WHERE batch_type LIKE 'z3950'"; >+ >+$sth = $dbh->prepare($query); >+$sth->execute(); >+ >-- >1.7.10.4
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 14469
:
40703
|
40704