From 47cac46683552d54c8d081daf5ce7b7b3651a368 Mon Sep 17 00:00:00 2001
From: Tomas Cohen Arazi <tomascohen@theke.io>
Date: Mon, 16 May 2016 12:15:06 -0300
Subject: [PATCH] Bug 16506: (Followup) remove warnings

---
 misc/migration_tools/rebuild_zebra.pl | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/misc/migration_tools/rebuild_zebra.pl b/misc/migration_tools/rebuild_zebra.pl
index fb06aab..595673f 100755
--- a/misc/migration_tools/rebuild_zebra.pl
+++ b/misc/migration_tools/rebuild_zebra.pl
@@ -127,14 +127,6 @@ if ($process_zebraqueue and $do_not_clear_zebraqueue) {
     die $msg;
 }
 
-if ($reset) {
-    $noshadow = 1;
-}
-
-if ($noshadow) {
-    $noshadow = ' -n ';
-}
-
 if ($daemon_mode) {
     # incompatible flags handled above: help, reset, and do_not_clear_zebraqueue
     if ($skip_export or $keep_export or $skip_index or
@@ -815,10 +807,15 @@ sub do_indexing {
     my $zebra_config  = C4::Context->zebraconfig($zebra_server)->{'config'};
     my $zebra_db_dir  = C4::Context->zebraconfig($zebra_server)->{'directory'};
 
+    $noshadow //= '';
+
+    if ($noshadow or $reset_index) {
+        $noshadow = '-n';
+    }
+
     system("zebraidx -c $zebra_config $zebraidx_log_opt -g $record_format -d $zebra_db_name init") if $reset_index;
     system("zebraidx -c $zebra_config $zebraidx_log_opt $noshadow -g $record_format -d $zebra_db_name $op $record_dir");
     system("zebraidx -c $zebra_config $zebraidx_log_opt -g $record_format -d $zebra_db_name commit") unless $noshadow;
-
 }
 
 sub _flock {
-- 
2.7.4