Lines 20-25
package Koha::Plugins;
Link Here
|
20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
21 |
|
21 |
|
22 |
use Class::Inspector; |
22 |
use Class::Inspector; |
|
|
23 |
use List::MoreUtils qw(any); |
23 |
use Module::Load::Conditional qw(can_load); |
24 |
use Module::Load::Conditional qw(can_load); |
24 |
use Module::Load qw(load); |
25 |
use Module::Load qw(load); |
25 |
use Module::Pluggable search_path => ['Koha::Plugin'], except => qr/::Edifact(|::Line|::Message|::Order|::Segment|::Transport)$/; |
26 |
use Module::Pluggable search_path => ['Koha::Plugin'], except => qr/::Edifact(|::Line|::Message|::Order|::Segment|::Transport)$/; |
Lines 76-83
sub GetPlugins {
Link Here
|
76 |
my $plugin_classes = $dbh->selectcol_arrayref('SELECT DISTINCT(plugin_class) FROM plugin_methods'); |
77 |
my $plugin_classes = $dbh->selectcol_arrayref('SELECT DISTINCT(plugin_class) FROM plugin_methods'); |
77 |
my @plugins; |
78 |
my @plugins; |
78 |
|
79 |
|
|
|
80 |
# Loop through all plugins that implement at least a method |
79 |
foreach my $plugin_class (@$plugin_classes) { |
81 |
foreach my $plugin_class (@$plugin_classes) { |
80 |
next if $method && !Koha::Plugins::Methods->search({ plugin_class => $plugin_class, plugin_method => $method })->count; |
82 |
# filter the plugin out by method |
|
|
83 |
next |
84 |
if $method |
85 |
&& !Koha::Plugins::Methods->search( |
86 |
{ plugin_class => $plugin_class, plugin_method => $method } )->count; |
87 |
|
81 |
load $plugin_class; |
88 |
load $plugin_class; |
82 |
my $plugin = $plugin_class->new({ enable_plugins => $self->{'enable_plugins'} }); |
89 |
my $plugin = $plugin_class->new({ enable_plugins => $self->{'enable_plugins'} }); |
83 |
|
90 |
|
Lines 91-98
sub GetPlugins {
Link Here
|
91 |
|
98 |
|
92 |
next unless $plugin_enabled; |
99 |
next unless $plugin_enabled; |
93 |
|
100 |
|
|
|
101 |
# filter the plugin out by metadata |
102 |
my $plugin_metadata = $plugin->get_metadata; |
103 |
next |
104 |
if $plugin_metadata |
105 |
and %$req_metadata |
106 |
and any { !$plugin_metadata->{$_} || $plugin_metadata->{$_} ne $req_metadata->{$_} } keys %$req_metadata; |
107 |
|
94 |
push @plugins, $plugin; |
108 |
push @plugins, $plugin; |
|
|
109 |
|
95 |
} |
110 |
} |
|
|
111 |
|
96 |
return @plugins; |
112 |
return @plugins; |
97 |
} |
113 |
} |
98 |
|
114 |
|
99 |
- |
|
|