|
Lines 26-33
use Module::Load::Conditional qw(can_load);
Link Here
|
| 26 |
use C4::Context; |
26 |
use C4::Context; |
| 27 |
|
27 |
|
| 28 |
BEGIN { |
28 |
BEGIN { |
| 29 |
push @INC, C4::Context->config("pluginsdir"); |
29 |
my $pluginsdir = C4::Context->config("pluginsdir"); |
| 30 |
pop @INC if $INC[-1] eq '.' ; |
30 |
my @pluginsdir = ref($pluginsdir) eq 'ARRAY' ? @$pluginsdir : $pluginsdir; |
|
|
31 |
push( @INC, @pluginsdir ); |
| 32 |
pop @INC if $INC[-1] eq '.' ; |
| 31 |
} |
33 |
} |
| 32 |
|
34 |
|
| 33 |
=head1 NAME |
35 |
=head1 NAME |
|
Lines 83-90
sub delete {
Link Here
|
| 83 |
return unless ( C4::Context->config("enable_plugins") || $args->{'enable_plugins'} ); |
85 |
return unless ( C4::Context->config("enable_plugins") || $args->{'enable_plugins'} ); |
| 84 |
|
86 |
|
| 85 |
my $plugin_class = $args->{'class'}; |
87 |
my $plugin_class = $args->{'class'}; |
| 86 |
my $plugin_dir = C4::Context->config("pluginsdir"); |
88 |
|
| 87 |
my $plugin_path = "$plugin_dir/" . join( '/', split( '::', $args->{'class'} ) ); |
89 |
my $plugin_path = $plugin_class; |
|
|
90 |
$plugin_path =~ s/::/\//g; # Take class name, transform :: to / to get path |
| 91 |
$plugin_path =~ s/$/.pm/; # Add .pm to the end |
| 92 |
require $plugin_path; # Require the plugin to have it's path listed in INC |
| 93 |
$plugin_path = |
| 94 |
$INC{$plugin_path}; # Get the full true path to the plugin from INC |
| 95 |
$plugin_path =~ s/.pm//; # Remove the .pm from the end |
| 88 |
|
96 |
|
| 89 |
Koha::Plugins::Handler->run({ |
97 |
Koha::Plugins::Handler->run({ |
| 90 |
class => $plugin_class, |
98 |
class => $plugin_class, |