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