From f910ea3bab9fcbc972f55bdbeba84267282bcc4f Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Thu, 5 Mar 2026 10:49:48 +0100 Subject: [PATCH] Bug 41991: Introduce SUSPEND_PLUGIN in Koha::Plugins->call Content-Type: text/plain; charset=utf-8 Test plan: Add a SetEnv for your staff client in Apache to suspend a plugin class. Verify that that specific plugin class was not run. Signed-off-by: Marcel de Rooy --- Koha/Plugins.pm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Koha/Plugins.pm b/Koha/Plugins.pm index 4d0cc82876..6ab13df1ff 100644 --- a/Koha/Plugins.pm +++ b/Koha/Plugins.pm @@ -91,6 +91,7 @@ sub call { my ( $class, $method, @args ) = @_; return unless C4::Context->config('enable_plugins'); + return if $method && $ENV{"SUSPEND_PLUGIN_$method"}; my @responses; my @plugins = $class->get_enabled_plugins( { verbose => 0 } ); @@ -102,6 +103,8 @@ sub call { if $method eq 'after_hold_create' and @plugins; foreach my $plugin (@plugins) { + ( my $class = ref($plugin) ) =~ s/::/_/g; + next if $class && $ENV{"SUSPEND_PLUGIN_$class"}; my $response = eval { $plugin->$method(@args) }; if ($@) { warn sprintf( "Plugin error (%s): %s", $plugin->get_metadata->{name}, $@ ); -- 2.39.5