View | Details | Raw Unified | Return to bug 16502
Collapse All | Expand All

(-)a/Koha/Plugins/Handler.pm (-1 / +8 lines)
Lines 78-88 Deletes a plugin Link Here
78
78
79
sub delete {
79
sub delete {
80
    my ( $class, $args ) = @_;
80
    my ( $class, $args ) = @_;
81
82
    return unless ( C4::Context->config("enable_plugins") || $args->{'enable_plugins'} );
83
81
    my $plugin_class = $args->{'class'};
84
    my $plugin_class = $args->{'class'};
82
    my $plugin_dir   = C4::Context->config("pluginsdir");
85
    my $plugin_dir   = C4::Context->config("pluginsdir");
83
    my $plugin_path  = "$plugin_dir/" . join( '/', split( '::', $args->{'class'} ) );
86
    my $plugin_path  = "$plugin_dir/" . join( '/', split( '::', $args->{'class'} ) );
84
87
85
    Koha::Plugins::Handler->run( { class => $plugin_class, method => 'uninstall' } );
88
    Koha::Plugins::Handler->run({
89
        class          => $plugin_class,
90
        method         => 'uninstall',
91
        enable_plugins => $args->{enable_plugins},
92
    });
86
93
87
    C4::Context->dbh->do( "DELETE FROM plugin_data WHERE plugin_class = ?", undef, ($plugin_class) );
94
    C4::Context->dbh->do( "DELETE FROM plugin_data WHERE plugin_class = ?", undef, ($plugin_class) );
88
95
(-)a/t/db_dependent/Plugins.t (-4 / +2 lines)
Lines 49-55 SKIP: { Link Here
49
    my $plugins_dir = C4::Context->config("pluginsdir");
49
    my $plugins_dir = C4::Context->config("pluginsdir");
50
    skip "plugindir not set", 3 unless defined $plugins_dir;
50
    skip "plugindir not set", 3 unless defined $plugins_dir;
51
    skip "plugindir not writable", 3 unless -w $plugins_dir;
51
    skip "plugindir not writable", 3 unless -w $plugins_dir;
52
    skip "KitchenSink plugin already installed", 3 if (-f "$plugins_dir/Koha/Plugin/Com/ByWaterSolutions/KitchenSink.pm");
52
    # no need to skip further tests if KitchenSink would already exist
53
53
54
    my $ae = Archive::Extract->new( archive => "$Bin/KitchenSinkPlugin.kpz", type => 'zip' );
54
    my $ae = Archive::Extract->new( archive => "$Bin/KitchenSinkPlugin.kpz", type => 'zip' );
55
    unless ( $ae->extract( to => $plugins_dir ) ) {
55
    unless ( $ae->extract( to => $plugins_dir ) ) {
Lines 59-65 SKIP: { Link Here
59
    $plugin = Koha::Plugin::Com::ByWaterSolutions::KitchenSink->new({ enable_plugins => 1});
59
    $plugin = Koha::Plugin::Com::ByWaterSolutions::KitchenSink->new({ enable_plugins => 1});
60
60
61
    ok( -f $plugins_dir . "/Koha/Plugin/Com/ByWaterSolutions/KitchenSink.pm", "KitchenSink plugin installed successfully" );
61
    ok( -f $plugins_dir . "/Koha/Plugin/Com/ByWaterSolutions/KitchenSink.pm", "KitchenSink plugin installed successfully" );
62
    Koha::Plugins::Handler->delete({ class => "Koha::Plugin::Com::ByWaterSolutions::KitchenSink" });
62
    Koha::Plugins::Handler->delete({ class => "Koha::Plugin::Com::ByWaterSolutions::KitchenSink", enable_plugins => 1 });
63
    ok( !( -f $plugins_dir . "/Koha/Plugin/Com/ByWaterSolutions/KitchenSink.pm" ), "Koha::Plugins::Handler::delete works correctly." );
63
    ok( !( -f $plugins_dir . "/Koha/Plugin/Com/ByWaterSolutions/KitchenSink.pm" ), "Koha::Plugins::Handler::delete works correctly." );
64
}
64
}
65
66
- 

Return to bug 16502