Bugzilla – Attachment 146423 Details for
Bug 32539
UI hooks can break the UI
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 32539: Add exception handling to plugin hooks in template plugin
Bug-32539-Add-exception-handling-to-plugin-hooks-i.patch (text/plain), 2.88 KB, created by
Jonathan Druart
on 2023-02-09 10:45:43 UTC
(
hide
)
Description:
Bug 32539: Add exception handling to plugin hooks in template plugin
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2023-02-09 10:45:43 UTC
Size:
2.88 KB
patch
obsolete
>From 2709d3b8225a56e030a3eea7b3cd129df62db0e4 Mon Sep 17 00:00:00 2001 >From: David Cook <dcook@prosentient.com.au> >Date: Mon, 16 Jan 2023 04:41:01 +0000 >Subject: [PATCH] Bug 32539: Add exception handling to plugin hooks in template > plugin > >This change wraps Koha plugin hook calls with exception handling >within the template plugin for Koha plugins. > >Test plan: >0) Apply patch >1) Install a plugin that provides "opac_head", "opac_js", >"intranet_head", and "intranet_js" with Perl errors in them >2) Load an OPAC page >3) Note that the OPAC page loads correctly >4) Load a staff interace page >5) Note that the staff interface page loads correctly > >Signed-off-by: David Nind <david@davidnind.com> > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > Koha/Template/Plugin/KohaPlugins.pm | 44 ++++++++++++++++++++++++++--- > 1 file changed, 40 insertions(+), 4 deletions(-) > >diff --git a/Koha/Template/Plugin/KohaPlugins.pm b/Koha/Template/Plugin/KohaPlugins.pm >index d313f731266..4a6e27c2216 100644 >--- a/Koha/Template/Plugin/KohaPlugins.pm >+++ b/Koha/Template/Plugin/KohaPlugins.pm >@@ -61,7 +61,16 @@ sub get_plugins_opac_head { > } > ); > >- my @data = map { $_->opac_head || q{} } @plugins; >+ my @data = (); >+ foreach my $plugin (@plugins){ >+ try { >+ my $datum = $plugin->opac_head || q{}; >+ push(@data,$datum); >+ } >+ catch { >+ warn "Error calling 'opac_head' on the " . $plugin->{class} . "plugin ($_)"; >+ }; >+ } > > return join( "\n", @data ); > } >@@ -88,7 +97,16 @@ sub get_plugins_opac_js { > } > ); > >- my @data = map { $_->opac_js || q{} } @plugins; >+ my @data = (); >+ foreach my $plugin (@plugins){ >+ try { >+ my $datum = $plugin->opac_js || q{}; >+ push(@data,$datum); >+ } >+ catch { >+ warn "Error calling 'opac_js' on the " . $plugin->{class} . "plugin ($_)"; >+ }; >+ } > > return join( "\n", @data ); > } >@@ -115,7 +133,16 @@ sub get_plugins_intranet_head { > } > ); > >- my @data = map { $_->intranet_head || q{} } @plugins; >+ my @data = (); >+ foreach my $plugin (@plugins){ >+ try { >+ my $datum = $plugin->intranet_head || q{}; >+ push(@data,$datum); >+ } >+ catch { >+ warn "Error calling 'intranet_head' on the " . $plugin->{class} . "plugin ($_)"; >+ }; >+ } > > return join( "\n", @data ); > } >@@ -142,7 +169,16 @@ sub get_plugins_intranet_js { > } > ); > >- my @data = map { $_->intranet_js || q{} } @plugins; >+ my @data = (); >+ foreach my $plugin (@plugins){ >+ try { >+ my $datum = $plugin->intranet_js || q{}; >+ push(@data,$datum); >+ } >+ catch { >+ warn "Error calling 'intranet_js' on the " . $plugin->{class} . "plugin ($_)"; >+ }; >+ } > > return join( "\n", @data ); > } >-- >2.25.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 32539
:
145328
|
145329
|
145366
| 146423 |
146424