Skip to content

Commit

Permalink
Recover from case where no CGI mode is set #841
Browse files Browse the repository at this point in the history
  • Loading branch information
jcameron committed Jun 29, 2024
1 parent f54f4b7 commit 45ede46
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
8 changes: 7 additions & 1 deletion postinstall.pl
Original file line number Diff line number Diff line change
Expand Up @@ -302,17 +302,23 @@ sub module_install
my %cannums = map { $mmap->{$_}, 1 } @supp;
if ($tmpl->{'web_php_suexec'} ne '' &&
!$cannums{int($tmpl->{'web_php_suexec'})} && @supp) {
# Default mode cannot be used .. change to first that can
# Default PHP mode cannot be used .. change to first that can
my @goodsupp = grep { $_ ne 'none' } @supp;
@goodsupp = @supp if (!@goodsupp);
$tmpl->{'web_php_suexec'} = $mmap->{$goodsupp[0]};
&save_template($tmpl);
}
if ($tmpl->{'web_cgimode'} &&
&indexof($tmpl->{'web_cgimode'}, @cgimodes) < 0) {
# Default CGI mode cannot be used
$tmpl->{'web_cgimode'} = $cgimodes[0];
&save_template($tmpl);
}
elsif (!defined($tmpl->{'web_cgimode'}) && @cgimodes) {
# No CGI mode set at all and it wasn't disabled, so use the first on
$tmpl->{'web_cgimode'} = $cgimodes[0];
&save_template($tmpl);
}
}

# Cache current PHP modes and error log files
Expand Down
1 change: 1 addition & 0 deletions virtual-server-lib-funcs.pl
Original file line number Diff line number Diff line change
Expand Up @@ -9786,6 +9786,7 @@ sub list_templates
$tmpl->{'resellers'} = '*' if (!defined($tmpl->{'resellers'}));
$tmpl->{'owners'} = '*' if (!defined($tmpl->{'owners'}));
if (!defined($tmpl->{'web_cgimode'})) {
# Switch from the old CGI mode field to the new one
my @cgimodes = &has_cgi_support();
$tmpl->{'web_cgimode'} = $tmpl->{'web_fcgiwrap'} ?
'fcgiwrap' : $cgimodes[0];
Expand Down

0 comments on commit 45ede46

Please sign in to comment.