Lines 2-7
Link Here
|
2 |
|
2 |
|
3 |
use Modern::Perl; |
3 |
use Modern::Perl; |
4 |
|
4 |
|
|
|
5 |
use Getopt::Long qw( GetOptions ); |
6 |
use Pod::Usage qw( pod2usage ); |
5 |
use Try::Tiny qw( catch try ); |
7 |
use Try::Tiny qw( catch try ); |
6 |
|
8 |
|
7 |
use C4::Context; |
9 |
use C4::Context; |
Lines 13-23
use Koha::Script -cron;
Link Here
|
13 |
my $command_line_options = join(" ",@ARGV); |
15 |
my $command_line_options = join(" ",@ARGV); |
14 |
cronlogaction({ info => $command_line_options }); |
16 |
cronlogaction({ info => $command_line_options }); |
15 |
|
17 |
|
|
|
18 |
my $metadata; |
19 |
my $help; |
20 |
GetOptions( |
21 |
'm|metadata=s%' => \$metadata, |
22 |
'h|help' => \$help, |
23 |
) or pod2usage(2); |
24 |
pod2usage(1) if $help; |
25 |
|
16 |
my $logger = Koha::Logger->get(); |
26 |
my $logger = Koha::Logger->get(); |
17 |
if ( C4::Context->config("enable_plugins") ) { |
27 |
if ( C4::Context->config("enable_plugins") ) { |
18 |
my @plugins = Koha::Plugins->new->GetPlugins( |
28 |
my @plugins = Koha::Plugins->new->GetPlugins( |
19 |
{ |
29 |
{ |
20 |
method => 'cronjob_nightly', |
30 |
method => 'cronjob_nightly', |
|
|
31 |
metadata => $metadata, |
21 |
} |
32 |
} |
22 |
); |
33 |
); |
23 |
|
34 |
|
Lines 44-50
plugins_nightly.pl - Run nightly tasks specified by plugins
Link Here
|
44 |
|
55 |
|
45 |
=head1 SYNOPSIS |
56 |
=head1 SYNOPSIS |
46 |
|
57 |
|
47 |
plugins_nightly.pl |
58 |
plugins_nightly.pl [-m|--metadata key=value] |
|
|
59 |
|
60 |
-m --metadata, repeatable, specify a metadata key and value to run only plugins |
61 |
with nightly_cronjob methods and matching metadata. |
62 |
e.g. plugins_nightly.pl -m name="My Awesome Plugin" |
48 |
|
63 |
|
49 |
=head1 AUTHOR |
64 |
=head1 AUTHOR |
50 |
|
65 |
|
51 |
- |
|
|