Bug 27820: fix missing import in plugins_nightly.pl
[srvgit] / misc / cronjobs / plugins_nightly.pl
1 #!/usr/bin/perl
2
3 use Modern::Perl;
4
5 use Koha::Logger;
6 use Koha::Script -cron;
7 use C4::Log;
8
9 cronlogaction();
10
11 my $logger = Koha::Logger->get();
12 if ( C4::Context->config("enable_plugins") ) {
13     my @plugins = Koha::Plugins->new->GetPlugins(
14         {
15             method => 'cronjob_nightly',
16         }
17     );
18
19     foreach my $plugin (@plugins) {
20         try {
21             $plugin->cronjob_nightly();
22         }
23         catch {
24             warn "$_";
25             $logger->warn("$_");
26         };
27     }
28 }
29
30 =head1 NAME
31
32 plugins_nightly.pl - Run nightly tasks specified by plugins
33
34 =head1 SYNOPSIS
35
36 plugins_nightly.pl
37
38 =head1 AUTHOR
39
40 Martin Renvoize <martin.renvoize@ptfs-europe.com>
41
42 =head1 LICENSE
43
44 This file is part of Koha.
45
46 Koha is free software; you can redistribute it and/or modify it
47 under the terms of the GNU General Public License as published by
48 the Free Software Foundation; either version 3 of the License, or
49 (at your option) any later version.
50
51 Koha is distributed in the hope that it will be useful, but
52 WITHOUT ANY WARRANTY; without even the implied warranty of
53 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
54 GNU General Public License for more details.
55
56 You should have received a copy of the GNU General Public License
57 along with Koha; if not, see <http://www.gnu.org/licenses>.
58
59 =cut