From e3d6fa3c0a57e173ad648c43365dd60d6bcc31dc Mon Sep 17 00:00:00 2001 From: Jamie Cameron Date: Tue, 1 Sep 2026 21:20:47 -0700 Subject: [PATCH] When editing a .htaccess file, don't update the file tracking when the master apache config was changed https://github.com/virtualmin/virtualmin-gpl/issues/1276 --- apache/apache-lib.pl | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/apache/apache-lib.pl b/apache/apache-lib.pl index 01a6aabb5..59d3303e0 100755 --- a/apache/apache-lib.pl +++ b/apache/apache-lib.pl @@ -548,11 +548,16 @@ return wantarray ? ($c, $v) : $c; } # get_htaccess_config(file) +# Parses a .htaccess format file into a list of config objects sub get_htaccess_config { -local($lnum, @conf); -&open_readfile(HTACCESS, $_[0]); -@conf = &parse_config_file(HTACCESS, $lnum, $_[0]); +my ($file) = @_; +my ($lnum, @conf); +&open_readfile(HTACCESS, $file); +@conf = &parse_config_file(HTACCESS, $lnum, $file); +foreach my $c (@conf) { + $c->{'htaccess'} = 1; + } close(HTACCESS); return \@conf; } @@ -650,7 +655,9 @@ for($i=0; $i<@old || $i<@{$_[1]}; $i++) { $change = $old[$i]; } } -&update_last_config_change(); +if (!$_[3]->[0]->{'htaccess'}) { + &update_last_config_change(); + } @files = &unique(@files); push(@{$saved_conf_files}, @files); return @files; @@ -745,7 +752,9 @@ elsif (!$olddir && $newdir) { $newdir->{'file'}); } } -&update_last_config_change(); +if (!$conf->[0]->{'htaccess'}) { + &update_last_config_change(); + } } # recursive_set_indent(&directive, indent)