Bugzilla – Attachment 110896 Details for
Bug 25549
Broken plugins should not break Koha (Install plugin script/method should highlight broken plugins)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25549: Remove plugin methods for broken plugins
Bug-25549-Remove-plugin-methods-for-broken-plugins.patch (text/plain), 3.07 KB, created by
Fridolin Somers
on 2020-09-29 09:22:39 UTC
(
hide
)
Description:
Bug 25549: Remove plugin methods for broken plugins
Filename:
MIME Type:
Creator:
Fridolin Somers
Created:
2020-09-29 09:22:39 UTC
Size:
3.07 KB
patch
obsolete
>From 38fe20b78ffba737f25fbe924798e6a7c4798d45 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Wed, 20 May 2020 11:12:12 +0000 >Subject: [PATCH] Bug 25549: Remove plugin methods for broken plugins > >To test: > 1 - Enable plugins in the koha-conf > 2 - Install the kitchen sink plugin > 3 - Your staff client should be orange now :-) > 4 - edit the plugin module > /var/lib/koha/kohadev/plugins/Koha/Plugin/Com/ByWaterSolutions/KitchenSink.pm > 5 - Add a line to break compilation, like: > this won't compile > 6 - Restart all > 7 - Your koha is now broken > 8 - kshell > 9 - perl misc/devel/install_plugins.pl >10 - Restart all >11 - Koha remains broken >12 - Apply patch >13 - kshell >14 - perl misc/devel/install_plugins.pl >15 - Koha now works! >16 - Koha is not orange because the plugin methods are removed > >Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com> >--- > Koha/Plugins.pm | 3 ++- > misc/devel/install_plugins.pl | 20 ++++++++++---------- > 2 files changed, 12 insertions(+), 11 deletions(-) > >diff --git a/Koha/Plugins.pm b/Koha/Plugins.pm >index 092c5e01b7..27fb40867f 100644 >--- a/Koha/Plugins.pm >+++ b/Koha/Plugins.pm >@@ -161,13 +161,14 @@ sub InstallPlugins { > my @plugin_classes = $self->plugins(); > my @plugins; > >+ # If we can reload the plugin we will add the methods back, if not they should be removed >+ Koha::Plugins::Methods->search()->delete(); > foreach my $plugin_class (@plugin_classes) { > 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'} }); > >- Koha::Plugins::Methods->search({ plugin_class => $plugin_class })->delete(); > > foreach my $method ( @{ Class::Inspector->methods( $plugin_class, 'public' ) } ) { > Koha::Plugins::Method->new( >diff --git a/misc/devel/install_plugins.pl b/misc/devel/install_plugins.pl >index 073ddbbb1c..2b7ec3b233 100755 >--- a/misc/devel/install_plugins.pl >+++ b/misc/devel/install_plugins.pl >@@ -37,16 +37,6 @@ unless ( C4::Context->config("enable_plugins") ) { > exit 1; > } > >- >-my @existing_plugins = Koha::Plugins->new()->GetPlugins({ >- all => 1, >-}); >-my $existing_plugins; >-for my $existing_plugin (@existing_plugins) { >- $existing_plugins->{ $existing_plugin->{metadata}->{name} } = >- $existing_plugin->{metadata}->{version}; >-} >- > my @installed_plugins = Koha::Plugins->new()->InstallPlugins(); > unless (@installed_plugins) { > my $plugins_dir = C4::Context->config("pluginsdir"); >@@ -60,6 +50,16 @@ unless (@installed_plugins) { > exit 0; > } > >+ >+my @existing_plugins = Koha::Plugins->new()->GetPlugins({ >+ all => 1, >+}); >+my $existing_plugins; >+for my $existing_plugin (@existing_plugins) { >+ $existing_plugins->{ $existing_plugin->{metadata}->{name} } = >+ $existing_plugin->{metadata}->{version}; >+} >+ > for my $installed_plugin (@installed_plugins) { > if ( !exists( $existing_plugins->{ $installed_plugin->{metadata}->{name} } ) > ) >-- >2.28.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 25549
:
105143
|
110896
|
111324
|
111335
|
111345
|
111346
|
111375
|
111376
|
111816
|
111817