Bugzilla – Attachment 66561 Details for
Bug 19081
Plack preventing uninstalled plugins from being removed on the plugins list
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19081: Do not list plugins that have been uninstalled
Bug-19081-Do-not-list-plugins-that-have-been-unins.patch (text/plain), 2.07 KB, created by
Jonathan Druart
on 2017-08-28 17:21:01 UTC
(
hide
)
Description:
Bug 19081: Do not list plugins that have been uninstalled
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2017-08-28 17:21:01 UTC
Size:
2.07 KB
patch
obsolete
>From 13739ecfc1120e38f104c95ce0244e1b6b81bca2 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 28 Aug 2017 14:00:28 -0300 >Subject: [PATCH] Bug 19081: Do not list plugins that have been uninstalled > >Under plack, can_load should not check if a package is in cache, but >reload it. Otherwise plugins that have been uninstalled will still get >listed. >The error raised by can_load must only be displayed if the plugin has >been removed. > >Test plan: >1/ Upload a plugin >2/ Note the plugin is listed as installed >3/ Modify the package of the plugin to add a compilation error (use >'Foo' for instance) >4/ Reload the page >5/ The plugin is not listed and a warning appear in the logs >6/ Remove the compilation error and uninstall the plugin >7/ The plugin is no longer listed and no warning appear in the logs >--- > Koha/Plugins.pm | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) > >diff --git a/Koha/Plugins.pm b/Koha/Plugins.pm >index ef1ab2559c..3a2c008ccd 100644 >--- a/Koha/Plugins.pm >+++ b/Koha/Plugins.pm >@@ -74,7 +74,10 @@ sub GetPlugins { > my @plugins; > > foreach my $plugin_class (@plugin_classes) { >- if ( can_load( modules => { $plugin_class => undef } ) ) { >+ my $plugin_file = $plugin_class; >+ $plugin_file =~ s|::|/|g; $plugin_file .= '.pm'; >+ >+ if ( can_load( modules => { $plugin_class => undef }, nocache => 1 ) ) { > next unless $plugin_class->isa('Koha::Plugins::Base'); > > my $plugin = $plugin_class->new({ enable_plugins => $self->{'enable_plugins'} }); >@@ -87,7 +90,9 @@ sub GetPlugins { > and any { !$plugin_metadata->{$_} || $plugin_metadata->{$_} ne $req_metadata->{$_} } keys %$req_metadata; > push @plugins, $plugin; > } else { >- warn $Module::Load::Conditional::ERROR; >+ my $error = $Module::Load::Conditional::ERROR; >+ # Do not warn the error if the plugin has been uninstalled >+ warn $error unless $error =~ m|^Could not find or check module '$plugin_class'|; > } > } > return @plugins; >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 19081
:
66561
|
66566
|
66728
|
66736
|
66737