Bugzilla – Attachment 45257 Details for
Bug 15188
remove_unused_authorities.pl will delete all authorities if zebra is not running
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15188 - remove_unused_authorities.pl exit if all authorities should be deleted
Bug-15188---removeunusedauthoritiespl-exit-if-all-.patch (text/plain), 2.00 KB, created by
Alex Arnaud
on 2015-12-01 11:00:44 UTC
(
hide
)
Description:
Bug 15188 - remove_unused_authorities.pl exit if all authorities should be deleted
Filename:
MIME Type:
Creator:
Alex Arnaud
Created:
2015-12-01 11:00:44 UTC
Size:
2.00 KB
patch
obsolete
>From 7484b455a7b4187d86df001d4acfe80ec8d3f1a6 Mon Sep 17 00:00:00 2001 >From: Alex Arnaud <alex.arnaud@biblibre.com> >Date: Tue, 1 Dec 2015 12:00:10 +0100 >Subject: [PATCH] Bug 15188 - remove_unused_authorities.pl exit if all > authorities should be deleted > >--- > misc/migration_tools/remove_unused_authorities.pl | 21 ++++++++++++++++++++- > 1 file changed, 20 insertions(+), 1 deletion(-) > >diff --git a/misc/migration_tools/remove_unused_authorities.pl b/misc/migration_tools/remove_unused_authorities.pl >index 2509318..f48cb39 100755 >--- a/misc/migration_tools/remove_unused_authorities.pl >+++ b/misc/migration_tools/remove_unused_authorities.pl >@@ -30,9 +30,11 @@ use Getopt::Long; > my @authtypes; > my $want_help = 0; > my $test = 0; >+my $force = 0; > GetOptions( > 'aut|authtypecode:s' => \@authtypes, > 't|test' => \$test, >+ 'f|force' => \$force, > 'h|help' => \$want_help > ); > >@@ -59,6 +61,7 @@ $rqselect->execute; > my $counter=0; > my $totdeleted=0; > my $totundeleted=0; >+my @to_delete; > while (my $data=$rqselect->fetchrow_hashref){ > my $query; > $query= "an=".$data->{'authid'}; >@@ -72,13 +75,29 @@ while (my $data=$rqselect->fetchrow_hashref){ > print "$counter\n" unless $counter++ % 100; > # if found, delete, otherwise, just count > if ($used>=$thresholdmin and $used<=$thresholdmax){ >- DelAuthority($data->{'authid'}) unless $test; >+ push @to_delete, $data->{'authid'}; > $totdeleted++; > } else { > $totundeleted++; > } > } > >+if ($totdeleted >= $counter && !$force) { >+ print "\nTo many authorities to deleted ($totdeleted)\n"; >+ print "Please check zebra daemon is running. Use --force option to delete all authorities\n"; >+ exit; >+} >+ >+unless ($totdeleted) { >+ print "\n Nothing to delete\n"; >+ exit 1; >+} >+ >+unless ($test) { >+ print "Deleting $totdeleted ...\n"; >+ DelAuthority($_) for @to_delete; >+} >+ > print "$counter authorities parsed, $totdeleted deleted and $totundeleted unchanged because used\n"; > > >-- >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 15188
:
45257
|
46018
|
46741
|
46849
|
46850