Bug 11252: remove deprecated -munge-config switch from rebuild_zebra.pl

The -munge-config switch has been deprecated for years, and
trying to use it would either not work at all or, if it did "work",
almost certainly damage one's Zebra configuration for Koha.

This patch removes this switch.

To test:

[1] Run rebuild_zebra.pl and verify that no mention is made
    of -munge-config.
[2] Run rebuild_zebra.pl to index records in one's test database
    and verify that there are no regressions.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Removing a really dangerous option

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script.
Ran rebuild_zebra.pl with various options and confirmed
that data was reindexed successfully.
No regressions found.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This commit is contained in:
Galen Charlton 2013-11-14 18:48:07 +00:00
parent d000a71635
commit b26870e53d

View file

@ -33,7 +33,6 @@ my $biblios;
my $authorities;
my $noxml;
my $noshadow;
my $do_munge;
my $want_help;
my $as_xml;
my $process_zebraqueue;
@ -58,7 +57,6 @@ my $result = GetOptions(
'b' => \$biblios,
'noxml' => \$noxml,
'w' => \$noshadow,
'munge-config' => \$do_munge,
'a' => \$authorities,
'h|help' => \$want_help,
'x' => \$as_xml,
@ -164,10 +162,6 @@ if ( $verbose_logging ) {
print "================================\n";
}
if ($do_munge) {
munge_config();
}
my $tester = XML::LibXML->new();
if ($daemon_mode) {
@ -813,385 +807,8 @@ Parameters:
--where let you specify a WHERE query, like itemtype='BOOK'
or something like that
--munge-config Deprecated option to try
to fix Zebra config files.
--run-as-root explicitily allow script to run as 'root' user
--help or -h show this message.
_USAGE_
}
# FIXME: the following routines are deprecated and
# will be removed once it is determined whether
# a script to fix Zebra configuration files is
# actually needed.
sub munge_config {
#
# creating zebra-biblios.cfg depending on system
#
# getting zebraidx directory
my $zebraidxdir;
foreach (qw(/usr/local/bin/zebraidx
/opt/bin/zebraidx
/usr/bin/zebraidx
)) {
if ( -f $_ ) {
$zebraidxdir=$_;
}
}
unless ($zebraidxdir) {
print qq|
ERROR: could not find zebraidx directory
ERROR: Either zebra is not installed,
ERROR: or it's in a directory I don't checked.
ERROR: do a which zebraidx and edit this file to add the result you get
|;
exit;
}
$zebraidxdir =~ s/\/bin\/.*//;
print "Info : zebra is in $zebraidxdir \n";
# getting modules directory
my $modulesdir;
foreach (qw(/usr/local/lib/idzebra-2.0/modules/mod-grs-xml.so
/usr/local/lib/idzebra/modules/mod-grs-xml.so
/usr/lib/idzebra/modules/mod-grs-xml.so
/usr/lib/idzebra-2.0/modules/mod-grs-xml.so
)) {
if ( -f $_ ) {
$modulesdir=$_;
}
}
unless ($modulesdir) {
print qq|
ERROR: could not find mod-grs-xml.so directory
ERROR: Either zebra is not properly compiled (libxml2 is not setup and you don t have mod-grs-xml.so,
ERROR: or it's in a directory I don't checked.
ERROR: find where mod-grs-xml.so is and edit this file to add the result you get
|;
exit;
}
$modulesdir =~ s/\/modules\/.*//;
print "Info: zebra modules dir : $modulesdir\n";
# getting tab directory
my $tabdir;
foreach (qw(/usr/local/share/idzebra/tab/explain.att
/usr/local/share/idzebra-2.0/tab/explain.att
/usr/share/idzebra/tab/explain.att
/usr/share/idzebra-2.0/tab/explain.att
)) {
if ( -f $_ ) {
$tabdir=$_;
}
}
unless ($tabdir) {
print qq|
ERROR: could not find explain.att directory
ERROR: Either zebra is not properly compiled,
ERROR: or it's in a directory I don't checked.
ERROR: find where explain.att is and edit this file to add the result you get
|;
exit;
}
$tabdir =~ s/\/tab\/.*//;
print "Info: tab dir : $tabdir\n";
#
# AUTHORITIES creating directory structure
#
my $created_dir_or_file = 0;
if ($authorities) {
if ( $verbose_logging ) {
print "====================\n";
print "checking directories & files for authorities\n";
print "====================\n";
}
unless (-d "$authorityserverdir") {
system("mkdir -p $authorityserverdir");
print "Info: created $authorityserverdir\n";
$created_dir_or_file++;
}
unless (-d "$authorityserverdir/lock") {
mkdir "$authorityserverdir/lock";
print "Info: created $authorityserverdir/lock\n";
$created_dir_or_file++;
}
unless (-d "$authorityserverdir/register") {
mkdir "$authorityserverdir/register";
print "Info: created $authorityserverdir/register\n";
$created_dir_or_file++;
}
unless (-d "$authorityserverdir/shadow") {
mkdir "$authorityserverdir/shadow";
print "Info: created $authorityserverdir/shadow\n";
$created_dir_or_file++;
}
unless (-d "$authorityserverdir/tab") {
mkdir "$authorityserverdir/tab";
print "Info: created $authorityserverdir/tab\n";
$created_dir_or_file++;
}
unless (-d "$authorityserverdir/key") {
mkdir "$authorityserverdir/key";
print "Info: created $authorityserverdir/key\n";
$created_dir_or_file++;
}
unless (-d "$authorityserverdir/etc") {
mkdir "$authorityserverdir/etc";
print "Info: created $authorityserverdir/etc\n";
$created_dir_or_file++;
}
#
# AUTHORITIES : copying mandatory files
#
# the record model, depending on marc flavour
unless (-f "$authorityserverdir/tab/record.abs") {
if (C4::Context->preference("marcflavour") eq "UNIMARC") {
system("cp -f $kohadir/etc/zebradb/marc_defs/unimarc/authorities/record.abs $authorityserverdir/tab/record.abs");
print "Info: copied record.abs for UNIMARC\n";
} else {
system("cp -f $kohadir/etc/zebradb/marc_defs/marc21/authorities/record.abs $authorityserverdir/tab/record.abs");
print "Info: copied record.abs for USMARC\n";
}
$created_dir_or_file++;
}
unless (-f "$authorityserverdir/tab/sort-string-utf.chr") {
system("cp -f $kohadir/etc/zebradb/lang_defs/fr/sort-string-utf.chr $authorityserverdir/tab/sort-string-utf.chr");
print "Info: copied sort-string-utf.chr\n";
$created_dir_or_file++;
}
unless (-f "$authorityserverdir/tab/word-phrase-utf.chr") {
system("cp -f $kohadir/etc/zebradb/lang_defs/fr/sort-string-utf.chr $authorityserverdir/tab/word-phrase-utf.chr");
print "Info: copied word-phase-utf.chr\n";
$created_dir_or_file++;
}
unless (-f "$authorityserverdir/tab/auth1.att") {
system("cp -f $kohadir/etc/zebradb/authorities/etc/bib1.att $authorityserverdir/tab/auth1.att");
print "Info: copied auth1.att\n";
$created_dir_or_file++;
}
unless (-f "$authorityserverdir/tab/default.idx") {
system("cp -f $kohadir/etc/zebradb/etc/default.idx $authorityserverdir/tab/default.idx");
print "Info: copied default.idx\n";
$created_dir_or_file++;
}
unless (-f "$authorityserverdir/etc/ccl.properties") {
# system("cp -f $kohadir/etc/zebradb/ccl.properties ".C4::Context->zebraconfig('authorityserver')->{ccl2rpn});
system("cp -f $kohadir/etc/zebradb/ccl.properties $authorityserverdir/etc/ccl.properties");
print "Info: copied ccl.properties\n";
$created_dir_or_file++;
}
unless (-f "$authorityserverdir/etc/pqf.properties") {
# system("cp -f $kohadir/etc/zebradb/pqf.properties ".C4::Context->zebraconfig('authorityserver')->{ccl2rpn});
system("cp -f $kohadir/etc/zebradb/pqf.properties $authorityserverdir/etc/pqf.properties");
print "Info: copied pqf.properties\n";
$created_dir_or_file++;
}
#
# AUTHORITIES : copying mandatory files
#
unless (-f C4::Context->zebraconfig('authorityserver')->{config}) {
open my $zd, '>:encoding(UTF-8)' ,C4::Context->zebraconfig('authorityserver')->{config};
print {$zd} "
# generated by KOHA/misc/migration_tools/rebuild_zebra.pl
profilePath:\${srcdir:-.}:$authorityserverdir/tab/:$tabdir/tab/:\${srcdir:-.}/tab/
encoding: UTF-8
# Files that describe the attribute sets supported.
attset: auth1.att
attset: explain.att
attset: gils.att
modulePath:$modulesdir/modules/
# Specify record type
iso2709.recordType:grs.marcxml.record
recordType:grs.xml
recordId: (auth1,Local-Number)
storeKeys:1
storeData:1
# Lock File Area
lockDir: $authorityserverdir/lock
perm.anonymous:r
perm.kohaadmin:rw
register: $authorityserverdir/register:4G
shadow: $authorityserverdir/shadow:4G
# Temp File area for result sets
setTmpDir: $authorityserverdir/tmp
# Temp File area for index program
keyTmpDir: $authorityserverdir/key
# Approx. Memory usage during indexing
memMax: 40M
rank:rank-1
";
print "Info: creating zebra-authorities.cfg\n";
$created_dir_or_file++;
}
if ($created_dir_or_file) {
print "Info: created : $created_dir_or_file directories & files\n";
} else {
print "Info: file & directories OK\n";
}
}
if ($biblios) {
if ( $verbose_logging ) {
print "====================\n";
print "checking directories & files for biblios\n";
print "====================\n";
}
#
# BIBLIOS : creating directory structure
#
unless (-d "$biblioserverdir") {
system("mkdir -p $biblioserverdir");
print "Info: created $biblioserverdir\n";
$created_dir_or_file++;
}
unless (-d "$biblioserverdir/lock") {
mkdir "$biblioserverdir/lock";
print "Info: created $biblioserverdir/lock\n";
$created_dir_or_file++;
}
unless (-d "$biblioserverdir/register") {
mkdir "$biblioserverdir/register";
print "Info: created $biblioserverdir/register\n";
$created_dir_or_file++;
}
unless (-d "$biblioserverdir/shadow") {
mkdir "$biblioserverdir/shadow";
print "Info: created $biblioserverdir/shadow\n";
$created_dir_or_file++;
}
unless (-d "$biblioserverdir/tab") {
mkdir "$biblioserverdir/tab";
print "Info: created $biblioserverdir/tab\n";
$created_dir_or_file++;
}
unless (-d "$biblioserverdir/key") {
mkdir "$biblioserverdir/key";
print "Info: created $biblioserverdir/key\n";
$created_dir_or_file++;
}
unless (-d "$biblioserverdir/etc") {
mkdir "$biblioserverdir/etc";
print "Info: created $biblioserverdir/etc\n";
$created_dir_or_file++;
}
#
# BIBLIOS : copying mandatory files
#
# the record model, depending on marc flavour
unless (-f "$biblioserverdir/tab/record.abs") {
if (C4::Context->preference("marcflavour") eq "UNIMARC") {
system("cp -f $kohadir/etc/zebradb/marc_defs/unimarc/biblios/record.abs $biblioserverdir/tab/record.abs");
print "Info: copied record.abs for UNIMARC\n";
} else {
system("cp -f $kohadir/etc/zebradb/marc_defs/marc21/biblios/record.abs $biblioserverdir/tab/record.abs");
print "Info: copied record.abs for USMARC\n";
}
$created_dir_or_file++;
}
unless (-f "$biblioserverdir/tab/sort-string-utf.chr") {
system("cp -f $kohadir/etc/zebradb/lang_defs/fr/sort-string-utf.chr $biblioserverdir/tab/sort-string-utf.chr");
print "Info: copied sort-string-utf.chr\n";
$created_dir_or_file++;
}
unless (-f "$biblioserverdir/tab/word-phrase-utf.chr") {
system("cp -f $kohadir/etc/zebradb/lang_defs/fr/sort-string-utf.chr $biblioserverdir/tab/word-phrase-utf.chr");
print "Info: copied word-phase-utf.chr\n";
$created_dir_or_file++;
}
unless (-f "$biblioserverdir/tab/bib1.att") {
system("cp -f $kohadir/etc/zebradb/biblios/etc/bib1.att $biblioserverdir/tab/bib1.att");
print "Info: copied bib1.att\n";
$created_dir_or_file++;
}
unless (-f "$biblioserverdir/tab/default.idx") {
system("cp -f $kohadir/etc/zebradb/etc/default.idx $biblioserverdir/tab/default.idx");
print "Info: copied default.idx\n";
$created_dir_or_file++;
}
unless (-f "$biblioserverdir/etc/ccl.properties") {
# system("cp -f $kohadir/etc/zebradb/ccl.properties ".C4::Context->zebraconfig('biblioserver')->{ccl2rpn});
system("cp -f $kohadir/etc/zebradb/ccl.properties $biblioserverdir/etc/ccl.properties");
print "Info: copied ccl.properties\n";
$created_dir_or_file++;
}
unless (-f "$biblioserverdir/etc/pqf.properties") {
# system("cp -f $kohadir/etc/zebradb/pqf.properties ".C4::Context->zebraconfig('biblioserver')->{ccl2rpn});
system("cp -f $kohadir/etc/zebradb/pqf.properties $biblioserverdir/etc/pqf.properties");
print "Info: copied pqf.properties\n";
$created_dir_or_file++;
}
#
# BIBLIOS : copying mandatory files
#
unless (-f C4::Context->zebraconfig('biblioserver')->{config}) {
open my $zd, '>:encoding(UTF-8)', C4::Context->zebraconfig('biblioserver')->{config};
print {$zd} "
# generated by KOHA/misc/migrtion_tools/rebuild_zebra.pl
profilePath:\${srcdir:-.}:$biblioserverdir/tab/:$tabdir/tab/:\${srcdir:-.}/tab/
encoding: UTF-8
# Files that describe the attribute sets supported.
attset:bib1.att
attset:explain.att
attset:gils.att
modulePath:$modulesdir/modules/
# Specify record type
iso2709.recordType:grs.marcxml.record
recordType:grs.xml
recordId: (bib1,Local-Number)
storeKeys:1
storeData:1
# Lock File Area
lockDir: $biblioserverdir/lock
perm.anonymous:r
perm.kohaadmin:rw
register: $biblioserverdir/register:4G
shadow: $biblioserverdir/shadow:4G
# Temp File area for result sets
setTmpDir: $biblioserverdir/tmp
# Temp File area for index program
keyTmpDir: $biblioserverdir/key
# Approx. Memory usage during indexing
memMax: 40M
rank:rank-1
";
print "Info: creating zebra-biblios.cfg\n";
$created_dir_or_file++;
}
if ($created_dir_or_file) {
print "Info: created : $created_dir_or_file directories & files\n";
} else {
print "Info: file & directories OK\n";
}
}
}