Bug 29238: Cataloging cron jobs are not logged

Testing plan:

1. set CronjobLog to "Log"
2. Run the three cron jobs
   `perl misc/link_bibs_to_authorities.pl; perl misc/cronjobs/merge_authorities.pl -b; perl misc/migration_tools/remove_unused_authorities.pl --confirm`
3. Visit the log viewer /cgi-bin/koha/tools/viewlog.pl, select the "Cron jobs" module, & note it's empty
4. apply the patch
5. Repeat steps 2 & 3 but note the cron logs aren't empty

squash

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 97c2437bb3)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
This commit is contained in:
phette23 2024-09-30 14:38:27 -07:00 committed by Paul Derscheid
parent 60c9d227f7
commit 0896db1dc2
No known key found for this signature in database
GPG Key ID: C25F9FD44CED595B
3 changed files with 12 additions and 0 deletions

View File

@ -7,12 +7,14 @@ use Time::HiRes qw( gettimeofday );
use Koha::Script -cron;
use C4::AuthoritiesMarc qw( GetAuthority merge );
use C4::Log qw( cronlogaction );
use Koha::Authority::MergeRequests;
use constant RESET_HOURS => 24;
use constant REMOVE_DAYS => 30;
my ( $params );
my $command_line_options = join(" ", @ARGV);
GetOptions(
'h' => \$params->{help},
'v' => \$params->{verbose},
@ -21,6 +23,7 @@ GetOptions(
$|=1; # flushes output
if ( $params->{batch} ) {
cronlogaction( { info => $command_line_options } );
handle_batch($params);
} else {
pod2usage(1);

View File

@ -24,6 +24,7 @@ use C4::Biblio qw(
LinkBibHeadingsToAuthorities
ModBiblio
);
use C4::Log qw( cronlogaction );
use Koha::Biblios;
use Getopt::Long qw( GetOptions );
use Pod::Usage qw( pod2usage );
@ -53,6 +54,7 @@ my $commit = 100;
my $tagtolink;
my $allowrelink = C4::Context->preference("LinkerRelink") // '';
my $command_line_options = join(" ", @ARGV);
my $result = GetOptions(
'v|verbose' => \$verbose,
't|test' => \$test_only,
@ -70,6 +72,8 @@ if ( not $result or $want_help ) {
usage();
}
cronlogaction( { info => $command_line_options } );
my $linker_module =
"C4::Linker::" . ( C4::Context->preference("LinkerModule") || 'Default' );
unless ( can_load( modules => { $linker_module => undef } ) ) {

View File

@ -25,12 +25,14 @@ use Modern::Perl;
use Koha::Script;
use C4::Context;
use C4::AuthoritiesMarc qw( DelAuthority );
use C4::Log qw( cronlogaction );
use Getopt::Long qw( GetOptions );
use Koha::SearchEngine::Search;
my @authtypes;
my ($confirm, $test, $want_help);
my $command_line_options = join(" ", @ARGV);
GetOptions(
'aut|authtypecode:s' => \@authtypes,
'c|confirm' => \$confirm,
@ -42,6 +44,9 @@ if ( $want_help || !($test || $confirm) ) {
print_usage();
exit 0;
}
cronlogaction( { info => $command_line_options } );
if ($test) {
print "*** Testing only, authorities will not be deleted. ***\n";
}