Bug 16506: (Followup) remove warnings
authorTomas Cohen Arazi <tomascohen@theke.io>
Mon, 16 May 2016 15:15:06 +0000 (12:15 -0300)
committerKyle M Hall <kyle@bywatersolutions.com>
Mon, 23 May 2016 17:29:12 +0000 (17:29 +0000)
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
misc/migration_tools/rebuild_zebra.pl

index fb06aab..595673f 100755 (executable)
@@ -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 {