From 0f8750cbbf212bd2b1106c1d3a435dc7de7272a6 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Thu, 7 Nov 2024 06:53:39 -0500 Subject: [PATCH] Bug 38384: Trigger plugin modules loading as soon as possible in Koha --- C4/Context.pm | 5 +++++ Koha/BackgroundJob.pm | 6 ------ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/C4/Context.pm b/C4/Context.pm index 8d49feda7c4..3f009603fe1 100644 --- a/C4/Context.pm +++ b/C4/Context.pm @@ -21,6 +21,11 @@ use Modern::Perl; use vars qw($AUTOLOAD $context); BEGIN { + # Calling get_enabled_plugins here esnures that all plugin + # modules are loaded before use and will not trigger + # a database connection reset + Koha::Plugins->get_enabled_plugins(); + if ( $ENV{'HTTP_USER_AGENT'} ) { # Only hit when plack is not enabled # Redefine multi_param if cgi version is < 4.08 diff --git a/Koha/BackgroundJob.pm b/Koha/BackgroundJob.pm index 4914971dbfa..a3e8d5dbac4 100644 --- a/Koha/BackgroundJob.pm +++ b/Koha/BackgroundJob.pm @@ -176,12 +176,6 @@ sub process { return {} if ref($self) ne 'Koha::BackgroundJob'; - # Our background jobs are called in forked processes - # to ensure we have all plugin hooks and data we call - # get_enabled_plugins at the star of processing - # to populate the cache - Koha::Plugins->get_enabled_plugins(); - my $derived_class = $self->_derived_class; $args ||= {}; -- 2.39.5 (Apple Git-154)