|
Lines 26-32
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 |
my @pluginsdir = ref($pluginsdir) eq 'ARRAY' ? @$pluginsdir : $pluginsdir; |
| 31 |
push( @INC, @pluginsdir ); |
| 30 |
} |
32 |
} |
| 31 |
|
33 |
|
| 32 |
=head1 NAME |
34 |
=head1 NAME |
|
Lines 79-86
Deletes a plugin
Link Here
|
| 79 |
sub delete { |
81 |
sub delete { |
| 80 |
my ( $class, $args ) = @_; |
82 |
my ( $class, $args ) = @_; |
| 81 |
my $plugin_class = $args->{'class'}; |
83 |
my $plugin_class = $args->{'class'}; |
| 82 |
my $plugin_dir = C4::Context->config("pluginsdir"); |
84 |
|
| 83 |
my $plugin_path = "$plugin_dir/" . join( '/', split( '::', $args->{'class'} ) ); |
85 |
my $plugin_path = $plugin_class; |
|
|
86 |
$plugin_path =~ s/::/\//g; # Take class name, transform :: to / to get path |
| 87 |
$plugin_path =~ s/$/.pm/; # Add .pm to the end |
| 88 |
require $plugin_path; # Require the plugin to have it's path listed in INC |
| 89 |
$plugin_path = |
| 90 |
$INC{$plugin_path}; # Get the full true path to the plugin from INC |
| 91 |
$plugin_path =~ s/.pm//; # Remove the .pm from the end |
| 84 |
|
92 |
|
| 85 |
Koha::Plugins::Handler->run( { class => $plugin_class, method => 'uninstall' } ); |
93 |
Koha::Plugins::Handler->run( { class => $plugin_class, method => 'uninstall' } ); |
| 86 |
|
94 |
|