From e707cad3e9d83276cb3e9412ef605de63606dc5f Mon Sep 17 00:00:00 2001 From: Jamie Cameron Date: Fri, 17 Feb 2023 22:19:28 -0800 Subject: [PATCH] Extra checks that we're not replacing nothing https://forum.virtualmin.com/t/nginx-configuration-failed-restore-of-a-full-rackup/119325 --- virtual_feature.pl | 3 ++- virtualmin-nginx-lib.pl | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/virtual_feature.pl b/virtual_feature.pl index d375b56..bd81596 100644 --- a/virtual_feature.pl +++ b/virtual_feature.pl @@ -2525,7 +2525,8 @@ sub feature_restore } # Fix up home directory if changed -if ($oldd && $d->{'home'} ne $oldd->{'home'}) { +if ($oldd && $d->{'home'} && $oldd->{'home'} && + $d->{'home'} ne $oldd->{'home'}) { &recursive_change_directives( $server, $oldd->{'home'}, $d->{'home'}, 0, 1); } diff --git a/virtualmin-nginx-lib.pl b/virtualmin-nginx-lib.pl index c7852ac..43151ca 100644 --- a/virtualmin-nginx-lib.pl +++ b/virtualmin-nginx-lib.pl @@ -1541,6 +1541,7 @@ sub switch_write_user sub recursive_change_directives { my ($parent, $oldv, $newv, $suffix, $prefix, $infix) = @_; +return if (!$oldv); foreach my $dir (@{$parent->{'members'}}) { my $changed = 0; foreach my $w (@{$dir->{'words'}}) {