[Koha-patches] [PATCH] Bug 3582: Missing usage information for -h / --help switch for rebuild_nozebra.pl

Ricardo Dias Marques koha at ricmarques.net
Sun Sep 6 18:44:13 CEST 2009


Fix for Bug 3582:  Missing usage information for -h / --help switch for rebuild_nozebra.pl

http://bugs.koha.org/cgi-bin/bugzilla3/show_bug.cgi?id=3582
---
 misc/migration_tools/rebuild_nozebra.pl |   53 ++++++++++++++++++++++++------
 1 files changed, 42 insertions(+), 11 deletions(-)

diff --git a/misc/migration_tools/rebuild_nozebra.pl b/misc/migration_tools/rebuild_nozebra.pl
index cbcafff..7432c5e 100755
--- a/misc/migration_tools/rebuild_nozebra.pl
+++ b/misc/migration_tools/rebuild_nozebra.pl
@@ -16,25 +16,56 @@ $|=1; # flushes output
 # limit for database dumping
 my $limit;# = "LIMIT 100";
 my $directory;
-my $skip_export;
-my $keep_export;
-my $reset;
-my $biblios;
+#my $skip_export;
+#my $keep_export;
+#my $reset;
+#my $biblios;
 my $authorities;
 my $sysprefs;
 my $commit;
+my $want_help;
 
-GetOptions(
+my $result = GetOptions(
     'd:s'      => \$directory,
-    'reset'      => \$reset,
-    's'        => \$skip_export,
-    'k'        => \$keep_export,
-    'b'        => \$biblios,
-    'a'        => \$authorities,
+#    'reset'      => \$reset,
+#    's'        => \$skip_export,    # Not used and conflicts with 's' option some lines below for sysprefs!!!
+#    'k'        => \$keep_export,
+#    'b'        => \$biblios,
+#    'a'        => \$authorities,
     's'        => \$sysprefs,  # rebuild 'NoZebraIndexes' syspref
-    'commit:f'    => \$commit,
+    'h|help'        => \$want_help,
+   'commit:f'    => \$commit,
     );
 
+if (not $result or $want_help) {
+    print_usage();
+    exit 0;
+}
+
+
+sub print_usage {
+    print <<_USAGE_;
+$0: reindex MARC bibs and authorities if NOT using Zebra ("NoZebra").
+
+Use this batch job to reindex all biblio and authority
+records in your Koha database.  This job is useful
+only if you are NOT using Zebra ('NoZebra'); if you are 
+using the 'Zebra'mode, this job should NOT be used.
+
+Parameters:
+    -d                      Temporary directory for indexing.
+                            If not specified, one is automatically
+                            created.  The export directory
+                            is automatically deleted unless
+                            you supply the -k switch.
+
+    -s                      Rebuild "NoZebraIndexes" System Preference 
+
+    --help or -h            show this message.
+_USAGE_
+}   # END of print_usage sub
+
+
 my $commitnum = 1000; 
 $commitnum = $commit if ($commit) ;
 
-- 
1.5.6.5




More information about the Koha-patches mailing list