Bugzilla – Attachment 105697 Details for
Bug 24031
Add plugin hook after_hold_create
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24031: Add safety checks in Koha::Plugins::call
Bug-24031-Add-safety-checks-in-KohaPluginscall.patch (text/plain), 1.23 KB, created by
Kyle M Hall (khall)
on 2020-06-10 13:55:43 UTC
(
hide
)
Description:
Bug 24031: Add safety checks in Koha::Plugins::call
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2020-06-10 13:55:43 UTC
Size:
1.23 KB
patch
obsolete
>From be5e2c81f818513dcd881cc4651046c203b61456 Mon Sep 17 00:00:00 2001 >From: Julian Maurice <julian.maurice@biblibre.com> >Date: Fri, 22 May 2020 12:29:11 +0200 >Subject: [PATCH] Bug 24031: Add safety checks in Koha::Plugins::call > >- Check that the plugin has the method before calling it >- Call the method in an eval block to prevent fatal errors > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > Koha/Plugins.pm | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > >diff --git a/Koha/Plugins.pm b/Koha/Plugins.pm >index ae2f2c5c22..41974e54ac 100644 >--- a/Koha/Plugins.pm >+++ b/Koha/Plugins.pm >@@ -66,8 +66,14 @@ sub call { > if (C4::Context->config('enable_plugins')) { > my @plugins = $class->new({ enable_plugins => 1 })->GetPlugins({ method => $method }); > my @responses; >+ @plugins = grep { $_->can($method) } @plugins; > foreach my $plugin (@plugins) { >- my $response = $plugin->$method(@args); >+ my $response = eval { $plugin->$method(@args) }; >+ if ($@) { >+ warn sprintf("Plugin error (%s): %s", $plugin->get_metadata->{name}, $@); >+ next; >+ } >+ > push @responses, $response; > } > >-- >2.24.1 (Apple Git-126)
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 24031
:
95358
|
95657
|
95658
|
98788
|
98789
|
105256
|
105257
|
105693
|
105694
|
105695
|
105696
| 105697 |
107042
|
107365