Bugzilla – Attachment 111346 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: Add error reporting to plugins-home
Bug-25549-Add-error-reporting-to-plugins-home.patch (text/plain), 4.50 KB, created by
Martin Renvoize (ashimema)
on 2020-10-07 15:58:21 UTC
(
hide
)
Description:
Bug 25549: Add error reporting to plugins-home
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2020-10-07 15:58:21 UTC
Size:
4.50 KB
patch
obsolete
>From 891673f6a24f743d1aa0894474b3d5e601c0b49f Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Wed, 7 Oct 2020 16:37:06 +0100 >Subject: [PATCH] Bug 25549: Add error reporting to plugins-home > >This patch adds handling for the newly introduced 'errors' option in >GetPlugins and reports erroroneos plugins to the user. > >To test: >1 - Enable plugins in the koha-conf >2 - Install the kitchen sink plugin >3 - Your staff client should be orange now :-) >4 - The plugin should display as installed in the table at > tools/plugins. >5 - edit the plugin module > /var/lib/koha/kohadev/plugins/Koha/Plugin/Com/ByWaterSolutions/KitchenSink.pm >6 - Add a line to break compilation, like: > this won't compile >7 - Restart all >8 - Your Koha is not broken, but is no longer orange (The plugin is not > loading). >9 - The plugin should display as unable to load in the table at > tools/plugins. > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > Koha/Plugins.pm | 3 +-- > .../prog/en/modules/plugins/plugins-home.tt | 15 +++++++++++++++ > plugins/plugins-home.pl | 11 +++++++---- > 3 files changed, 23 insertions(+), 6 deletions(-) > >diff --git a/Koha/Plugins.pm b/Koha/Plugins.pm >index 77758fba68..36e6090415 100644 >--- a/Koha/Plugins.pm >+++ b/Koha/Plugins.pm >@@ -164,14 +164,13 @@ 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/koha-tmpl/intranet-tmpl/prog/en/modules/plugins/plugins-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/plugins/plugins-home.tt >index 14dc39b9ab..700c8d167b 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/plugins/plugins-home.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/plugins/plugins-home.tt >@@ -116,6 +116,19 @@ > </tr> > > [% FOREACH plugin IN plugins %] >+ [% IF plugin.error %] >+ <tr class="warn"> >+ <td> >+ <strong>[% plugin.name | html %]</strong> >+ <span class="label label-warning">ERRORS</span> >+ </td> >+ [% IF ( CAN_user_plugins_configure || CAN_user_plugins_manage || CAN_user_plugins_report || CAN_user_plugins_tool ) %] >+ <td colspan="7">Error found whilst attempting to load plugin</td> >+ [% ELSE %] >+ <td colspan="6">Error found whilst attempting to load plugin</td> >+ [% END %] >+ </tr> >+ [% ELSE %] > <tr> > <td> > <strong>[% plugin.metadata.name | html %]</strong> >@@ -181,6 +194,8 @@ > </div> > </td> > [% END %] >+ </tr> >+ [% END %] > [% END %] > </table> > [% END %] >diff --git a/plugins/plugins-home.pl b/plugins/plugins-home.pl >index 5757811fce..7d9170c177 100755 >--- a/plugins/plugins-home.pl >+++ b/plugins/plugins-home.pl >@@ -52,10 +52,13 @@ if ($plugins_enabled) { > method => $method, > ); > >- my @plugins = Koha::Plugins->new()->GetPlugins({ >- method => $method, >- all => 1, >- }); >+ my @plugins = Koha::Plugins->new()->GetPlugins( >+ { >+ method => $method, >+ all => 1, >+ errors => 1 >+ } >+ ); > > $template->param( plugins => \@plugins, ); > >-- >2.20.1
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