diff --git a/Koha/Plugins.pm b/Koha/Plugins.pm
index 0ffee023f8..88c51a5e6f 100644
--- a/Koha/Plugins.pm
+++ b/Koha/Plugins.pm
@@ -364,19 +364,19 @@ sub RemovePlugins {
sub _restart_after_change {
my ( $class, $params ) = @_;
- if ( C4::Context->psgi_env ) {
- my $parent_pid = getpid();
- my $ppid = getppid(); # Get the parent process ID
+ return unless ( C4::Context->config('plugins_restart') && C4::Context->psgi_env );
- # If the current process is not Plack parent, find the parent process recursively
- while ( $parent_pid != $ppid ) {
- $parent_pid = $ppid;
- $ppid = getppid();
- }
+ my $parent_pid = getpid();
+ my $ppid = getppid(); # Get the parent process ID
- # Send SIGUSR1 signal to Plack parent process for graceful restart
- kill 'HUP', $parent_pid;
+ # 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;
}
1;
diff --git a/debian/templates/koha-conf-site.xml.in b/debian/templates/koha-conf-site.xml.in
index c35b6d8432..b4e3c71ba2 100644
--- a/debian/templates/koha-conf-site.xml.in
+++ b/debian/templates/koha-conf-site.xml.in
@@ -409,6 +409,7 @@ __END_SRU_PUBLICSERVER__
0
0
1
+ 0