From 128e7f54b17501ee43614aa8f8c50c3789921f08 Mon Sep 17 00:00:00 2001 From: Alex Arnaud Date: Tue, 29 Dec 2015 16:46:38 +0100 Subject: [PATCH] Bug 15188 - Fixes remove_unused_authorities.pl will delete all authorities if zebra is not running Test plan: 1) Shut down zebra: koha-zebra-ctl.sh stop 2) Execute the script: remove_unused_authorities.pl (with -t if you don't want to really delete from your database). 3) Check that the script would have deleted all the authorities (eg: 31449 authorities parsed, 31449 deleted and 0 unchanged because used). 4) Apply patch 5) Run, notice that the script dies because zebra is unavailable Signed-off-by: Chris Cormack Signed-off-by: Jonathan Druart Signed-off-by: Brendan A Gallagher --- misc/migration_tools/remove_unused_authorities.pl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/misc/migration_tools/remove_unused_authorities.pl b/misc/migration_tools/remove_unused_authorities.pl index 25093183fa..af8897af46 100755 --- a/misc/migration_tools/remove_unused_authorities.pl +++ b/misc/migration_tools/remove_unused_authorities.pl @@ -45,6 +45,10 @@ if ($test) { print "testing only, authorities will not be deleted.\n"; } +if (C4::Context->Zconn("biblioserver",0)->errcode() == 10000) { + die "Zebra server seems not to be available. This script needs Zebra runs." +} + my $dbh=C4::Context->dbh; my $thresholdmin=0; my $thresholdmax=0; -- 2.39.5