From 57ee369e90cfe8f79cfa1e1829074225e28367ea Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Thu, 11 Apr 2024 07:52:53 +0200 Subject: [PATCH] Bug 30897: Limit to plack environments I had a feeling we'd want to do this when I submitted the proof of concept, though I hadn't appreciated the wider issues that have now been highlighted.. it makes a lot of sense to limit to the plack scope. Signed-off-by: Nick Clemens Signed-off-by: Katrin Fischer --- Koha/Plugins.pm | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/Koha/Plugins.pm b/Koha/Plugins.pm index cea8a5f9ec..0ffee023f8 100644 --- a/Koha/Plugins.pm +++ b/Koha/Plugins.pm @@ -364,17 +364,19 @@ sub RemovePlugins { sub _restart_after_change { my ( $class, $params ) = @_; - my $parent_pid = getpid(); - my $ppid = getppid(); # Get the parent process ID + if ( C4::Context->psgi_env ) { + my $parent_pid = getpid(); + my $ppid = getppid(); # Get the parent process ID + + # If the current process is not Plack parent, find the parent process recursively + while ( $parent_pid != $ppid ) { + $parent_pid = $ppid; + $ppid = getppid(); + } - # If the current process is not Plack parent, find the parent process recursively - while ($parent_pid != $ppid) { - $parent_pid = $ppid; - $ppid = getppid(); + # Send SIGUSR1 signal to Plack parent process for graceful restart + kill 'HUP', $parent_pid; } - - # Send SIGUSR1 signal to Plack parent process for graceful restart - kill 'HUP', $parent_pid; } 1; -- 2.39.5