Bugzilla – Attachment 18678 Details for
Bug 10421
Add cron script to delete deleted records
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 10421 - Add cron script to delete deleted records
Bug-10421---Add-cron-script-to-delete-deleted-reco.patch (text/plain), 2.93 KB, created by
Kyle M Hall (khall)
on 2013-06-05 14:46:28 UTC
(
hide
)
Description:
Bug 10421 - Add cron script to delete deleted records
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2013-06-05 14:46:28 UTC
Size:
2.93 KB
patch
obsolete
>From 1152da9db09c2e9602eba3791db0e2c906b0cdfa Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Wed, 5 Jun 2013 10:44:18 -0400 >Subject: [PATCH] Bug 10421 - Add cron script to delete deleted records > >This script will batch delete all records where the leader's record >status ( position 5 ) is set to 'd' ( Deleted ). > >Test Plan: >1) Edit a few records, set the leader 05 to 'd' for deleted >2) Run delete_deleted_records.pl >3) Records that are deletable should be deleted! >--- > misc/cronjobs/delete_deleted_records.pl | 89 +++++++++++++++++++++++++++++++ > 1 files changed, 89 insertions(+), 0 deletions(-) > create mode 100755 misc/cronjobs/delete_deleted_records.pl > >diff --git a/misc/cronjobs/delete_deleted_records.pl b/misc/cronjobs/delete_deleted_records.pl >new file mode 100755 >index 0000000..8762687 >--- /dev/null >+++ b/misc/cronjobs/delete_deleted_records.pl >@@ -0,0 +1,89 @@ >+#!/usr/bin/perl >+ >+use Modern::Perl; >+use Getopt::Long; >+use Pod::Usage; >+ >+use C4::Biblio; >+use C4::Context; >+ >+my ($help, $confirm); >+GetOptions( >+ 'h|help' => \$help, >+ 'c|confirm' => \$confirm, >+); >+ >+pod2usage(1) if ( $help || !$confirm ); >+ >+my $dbh = C4::Context->dbh; >+ >+my $sql = q{ SELECT biblionumber FROM biblioitems WHERE SUBSTR(marcxml,INSTR(marcxml, "<leader>")+8+5,1) = "d" }; >+ >+my @biblionumbers = @{ $dbh->selectcol_arrayref($sql) }; >+ >+foreach my $biblionumber ( @biblionumbers ) { >+ print "Deleting biblionumber $biblionumber ... "; >+ my $error; >+ eval { >+ $error = DelBiblio $biblionumber; >+ }; >+ if ( $@ or $error) { >+ say "ERROR: $@ ($! | $error)"; >+ } else { >+ say "DONE!"; >+ } >+} >+ >+exit(0); >+ >+__END__ >+ >+=head1 NAME >+ >+delete_deleted_recordss.pl >+ >+=head1 SYNOPSIS >+ >+./delete_deleted_records.pl --confirm >+ >+This script will batch delete all records where the leader's record status ( position 5 ) is set to 'd' ( Deleted ). >+ >+=head1 OPTIONS >+ >+=over 8 >+ >+=item B<-h|--help> >+ >+prints this help message >+ >+=item B<-c|--confirm> >+ >+Confirm you really want to batch delete deleted records >+ >+=back >+ >+=head1 AUTHOR >+ >+Kyle M Hall <kyle@bywatersolutions.com> >+ >+=head1 COPYRIGHT >+ >+Copyright 2013 Kyle M Hall >+ >+=head1 LICENSE >+ >+This file is part of Koha. >+ >+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 2 of the License, or (at your option) any later version. >+ >+You should have received a copy of the GNU General Public License along >+with Koha; if not, write to the Free Software Foundation, Inc., >+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. >+ >+=head1 DISCLAIMER OF WARRANTY >+ >+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. >+ >+=cut >-- >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 10421
:
18678
|
20220