Martin Renvoize
d2e189ca1c
This patch change Koha::Cron to be a more generic Koha::Script class and update all commanline driven scripts to use it. Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
73 lines
2.2 KiB
Perl
Executable file
73 lines
2.2 KiB
Perl
Executable file
#!/usr/bin/perl
|
|
|
|
# Copyright (c) 2012 Equinox Software, Inc.
|
|
# This file is part of Koha.
|
|
#
|
|
# Koha is free software; you can redistribute it and/or modify it
|
|
# under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation; either version 3 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# Koha is distributed in the hope that it will be useful, but
|
|
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with Koha; if not, see <http://www.gnu.org/licenses>.
|
|
|
|
use strict;
|
|
use warnings;
|
|
use 5.010;
|
|
|
|
use Koha::Script;
|
|
use Koha::Indexer::Utils;
|
|
|
|
use Getopt::Long;
|
|
|
|
my $input_file;
|
|
my $output_file;
|
|
my $want_help;
|
|
my $result = GetOptions(
|
|
'input:s' => \$input_file,
|
|
'output:s' => \$output_file,
|
|
'help|h' => \$want_help,
|
|
);
|
|
|
|
if ( not $result or $want_help or not defined $input_file or not defined $output_file ) {
|
|
print_usage();
|
|
exit 0;
|
|
}
|
|
|
|
open my $infh, '<', $input_file or die "$0: cannot open input file $input_file: $!\n";
|
|
open my $outfh, '>', $output_file or die "$0: cannot open output file $output_file: $!\n";
|
|
|
|
my $grs1_cfg = join('', <$infh>);
|
|
close $infh;
|
|
my $dom_cfg = Koha::Indexer::Utils::zebra_record_abs_to_dom($grs1_cfg);
|
|
print $outfh $dom_cfg;
|
|
close $outfh;
|
|
|
|
sub print_usage {
|
|
print <<_USAGE_;
|
|
$0: generate a DOM filter Zebra index config from a GRS-1 config
|
|
|
|
Given a Zebra record.abs file containing a set of index definitions for
|
|
Zebra's GRS-1 filter, write an equivalent DOM filter configuration.
|
|
|
|
To generate the XSLT that is to be used by Zebra, run something like
|
|
the following on the output of this utility:
|
|
|
|
xsltproc ZEBRA_CFG_DIR/xsl/koha-indexdefs-to-zebra.xsl \\
|
|
biblio-koha-indexdefs.xml \\
|
|
> ZEBRA_CFG_DIR/marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl
|
|
|
|
The above example assumes that the output of the program was named
|
|
biblio-koha-indexdefs.xsl.
|
|
|
|
Parameters:
|
|
--input input file name
|
|
--output output file name
|
|
--help or -h show this message
|
|
_USAGE_
|
|
}
|