Line 0
Link Here
|
0 |
- |
1 |
#!/usr/bin/perl |
|
|
2 |
|
3 |
# This script runs the 'cronjob' methods of installed plugins. |
4 |
|
5 |
# Copyright 2020 Koha-Suomi |
6 |
# |
7 |
# This file is part of Koha. |
8 |
# |
9 |
# Koha is free software; you can redistribute it and/or modify it |
10 |
# under the terms of the GNU General Public License as published by |
11 |
# the Free Software Foundation; either version 3 of the License, or |
12 |
# (at your option) any later version. |
13 |
# |
14 |
# Koha is distributed in the hope that it will be useful, but |
15 |
# WITHOUT ANY WARRANTY; without even the implied warranty of |
16 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
17 |
# GNU General Public License for more details. |
18 |
# |
19 |
# You should have received a copy of the GNU General Public License |
20 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
21 |
|
22 |
use Modern::Perl; |
23 |
use Getopt::Long; |
24 |
use Pod::Usage; |
25 |
|
26 |
BEGIN { |
27 |
|
28 |
# find Koha's Perl modules |
29 |
# test carefully before changing this |
30 |
use FindBin; |
31 |
eval { require "$FindBin::Bin/../kohalib.pl" }; |
32 |
} |
33 |
|
34 |
use Koha::Plugins; |
35 |
use C4::Context; |
36 |
|
37 |
my $help = 0; |
38 |
|
39 |
GetOptions( |
40 |
'h|help' => \$help, |
41 |
); |
42 |
|
43 |
if ($help) { |
44 |
pod2usage(1); |
45 |
} else { |
46 |
if ( C4::Context->preference('UseKohaPlugins') && C4::Context->config("enable_plugins") ) { |
47 |
my @plugins = Koha::Plugins->new()->GetPlugins( { method => 'cronjob' } ); |
48 |
foreach my $plugin (@plugins) { |
49 |
$plugin->cronjob(); |
50 |
} |
51 |
} else { |
52 |
warn "Koha plugins not enabled."; |
53 |
} |
54 |
} |
55 |
|
56 |
=head1 NAME |
57 |
|
58 |
run_cronjob_plugins.pl |
59 |
|
60 |
=head1 DESCRIPTION |
61 |
|
62 |
Cron script to run the 'cronjob' methods of installed plugins. |
63 |
|
64 |
=head1 SYNOPSIS |
65 |
|
66 |
run_cronjob_plugins.pl |
67 |
|
68 |
run_cronjob_plugins.pl -h |
69 |
|
70 |
=head1 OPTIONS |
71 |
|
72 |
-h : this help message |
73 |
|
74 |
=cut |