Browse Source

Bug 12031: [QA Follow-up] Undefined routine and change to koha-conf.xml

[1] Routine add_cron_job was added in 2007 but has not been defined.
    Parameter Recurring is not used.
[2] Made some changes to koha-conf.xml. Instead of an example to edit,
    I replaced it by the SCRIPT_NONDEV_DIR install variable.
[3] SCRIPT_NONDEV_DIR had to be included in rewrite-config.pl and the
    path had to be corrected for dev installs in Makefile.PL

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Tested single and dev install for supportdir change.
Compared installations with and without the patches for this report.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
MM-OPAC/theme_dep
Marcel de Rooy 9 years ago
committed by Tomas Cohen Arazi
parent
commit
e949eba409
  1. 4
      Makefile.PL
  2. 8
      etc/koha-conf.xml
  3. 1
      rewrite-config.PL
  4. 29
      tools/scheduler.pl

4
Makefile.PL

@ -1259,7 +1259,9 @@ sub get_target_directories {
$dirmap{'PAZPAR2_CONF_DIR'} = File::Spec->catdir(@basedir, $package, 'etc', 'pazpar2');
$dirmap{'MISC_DIR'} = File::Spec->catdir(@basedir, $package, 'misc');
$dirmap{'SCRIPT_DIR'} = File::Spec->catdir(@basedir, $package, 'bin');
$dirmap{'SCRIPT_NONDEV_DIR'} = $dirmap{'SCRIPT_DIR'};
#For dev install, point NONDEV_DIR to misc in current dir (not base)
#Used by supportdir in koha-conf.xml (BZ 12031)
$dirmap{'SCRIPT_NONDEV_DIR'} = File::Spec->catdir($curdir, 'misc');
$skipdirs{'SCRIPT_NONDEV_DIR'} = 1;
$dirmap{'MAN_DIR'} = File::Spec->catdir(@basedir, $package, 'man');
$dirmap{'DOC_DIR'} = File::Spec->catdir(@basedir, $package, 'doc');

8
etc/koha-conf.xml

@ -106,11 +106,9 @@ __PAZPAR2_TOGGLE_XML_POST__
tool -->
<backup_db_via_tools>0</backup_db_via_tools>
<backup_conf_via_tools>0</backup_conf_via_tools>
<!-- Uncomment the following line if you are not using packages and need to schedule reports through the web interface
Example:
My runreports.pl is in /home/user/koha-src/koha/misc/cronjobs
my <supportdir> would be as follows:
<supportdir>/home/user/koha-src/koha/misc</supportdir>
<!-- Uncomment the following line if you are not using packages and need to schedule reports through the web interface. supportdir should contain cronjobs/runreport.pl -->
<!--
<supportdir>__SCRIPT_NONDEV_DIR__</supportdir>
-->
<pazpar2url>http://__PAZPAR2_HOST__:__PAZPAR2_PORT__/search.pz2</pazpar2url>
<install_log>__MISC_DIR__/koha-install-log</install_log>

1
rewrite-config.PL

@ -115,6 +115,7 @@ $prefix = $ENV{'INSTALL_BASE'} || "/usr";
'__PAZPAR2_CONF_DIR__' => "$prefix/etc/koha/pazpar2",
'__MISC_DIR__' => "$prefix/misc",
'__SCRIPT_DIR__' => "$prefix/bin",
'__SCRIPT_NONDEV_DIR__' => "$prefix/bin",
'__MAN_DIR__' => "$prefix/man",
'__DOC_DIR__' => "$prefix/doc",
'__ZEBRA_LOCK_DIR__' => "$prefix/var/lock/zebradb",

29
tools/scheduler.pl

@ -40,7 +40,7 @@ if ( C4::Context->config('supportdir') ) {
$base = C4::Context->config('supportdir');
}
else {
$base = "/usr/share/koha/bin";
$base = "/usr/share/koha/bin";
}
my $CONFIG_NAME = $ENV{'KOHA_CONF'};
@ -68,24 +68,27 @@ if ( $mode eq 'job_add' ) {
my $startdate = join('', (split /-/, $c4date->output("iso")));
my $starttime = $input->param('starttime');
my $recurring = $input->param('recurring');
$starttime =~ s/\://g;
my $start = $startdate . $starttime;
my $report = $input->param('report');
my $format = $input->param('format');
my $email = $input->param('email');
my $command =
"export KOHA_CONF=\"$CONFIG_NAME\"; " . $base
. "/cronjobs/runreport.pl $report --format=$format --to=$email";
if ($recurring) {
my $frequency = $input->param('frequency');
add_cron_job( $start, $command );
}
else {
unless ( add_at_job( $start, $command ) ) {
$template->param( job_add_failed => 1 );
}
"export KOHA_CONF=\"$CONFIG_NAME\"; " .
"$base/cronjobs/runreport.pl $report --format=$format --to=$email";
#FIXME commit ea899bc55933cd74e4665d70b1c48cab82cd1257 added recurring parameter (it is not in template) and call to add_cron_job (undefined)
# my $recurring = $input->param('recurring');
# if ($recurring) {
# my $frequency = $input->param('frequency');
# add_cron_job( $start, $command );
# }
# else {
# #here was the the unless ( add_at_job
# }
unless ( add_at_job( $start, $command ) ) {
$template->param( job_add_failed => 1 );
}
}

Loading…
Cancel
Save