Skip to content

Commit

Permalink
Add check for suitable PHP version in depends function as well
Browse files Browse the repository at this point in the history
  • Loading branch information
jcameron committed May 16, 2021
1 parent 42d7688 commit 88ee7b1
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
2 changes: 1 addition & 1 deletion install-script.pl
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ package virtual_server;
&$first_print("Checking PHP version ..");
$phpver = &setup_php_version($d, $script, $ver, $opts->{'path'});
if (!$phpver) {
&$second_print(".. no PHP version found!");
&$second_print(".. no compatible PHP version found!");
exit(1);
}
else {
Expand Down
4 changes: 3 additions & 1 deletion lang/en
Original file line number Diff line number Diff line change
Expand Up @@ -3986,7 +3986,7 @@ scripts_edep=This script cannot be installed, as this virtual server does not me
scripts_ecommands=This script cannot be installed, as it requires the following commands : <tt>$1</tt>
scripts_eweb=Scripts can only be installed into virtual servers with a home directory and website
scripts_emissing=Script does not exist!
scripts_ephpvers2=This script cannot be installed, as no PHP versions were found
scripts_ephpvers2=This script cannot be installed, as no compatible PHP versions were found
scripts_return=list of scripts
scripts_edownload=Download of $2 failed : $1
scripts_edownload2=Download of $1 is not an archive file - perhaps an error page
Expand Down Expand Up @@ -4119,6 +4119,8 @@ scripts_deleted=Manually deleted
scripts_inophp=Webserver support for PHP is needed
scripts_inocgi=Webserver support for CGI scripts is needed
scripts_iphpneed=PHP is disabled for this virtual server
scripts_iphpfullver=PHP version $1 or later is required, but this virtual server is using version $2
scripts_iphpmaxver=PHP version below $1 is required, but this virtual server is using version $2
scripts_inoapache=Only the Apache webserver is supported
scripts_needpackages=Checking for $1 required packages ..
scripts_epackages=.. package installation is not supported on this system!
Expand Down
18 changes: 17 additions & 1 deletion scripts-lib.pl
Original file line number Diff line number Diff line change
Expand Up @@ -2750,12 +2750,28 @@ sub check_script_depends
local ($script, $d, $ver, $sinfo, $phpver) = @_;
local @rv;

# If the script uses PHP, make sure it's enabled for the domain
if (&indexof("php", @{$script->{'uses'}}) >= 0) {
# If the script uses PHP, make sure it's enabled for the domain
local $mode = &get_domain_php_mode($d);
if ($mode eq "none") {
push(@rv, $text{'scripts_iphpneed'});
}

# Also check the PHP version
my $minfunc = $script->{'php_fullver_func'};
my $maxfunc = $script->{'php_maxver_func'};
if (defined(&$minfunc)) {
my $minver = &$minfunc($d, $ver, $sinfo);
if (&compare_versions($phpver, $minver) < 0) {
return &text('scripts_iphpfullver', $minver, $phpver);
}
}
if (defined(&$maxfunc)) {
my $maxver = &$maxfunc($d, $ver, $sinfo);
if (&compare_versions($phpver, $maxver) < 0) {
return &text('scripts_iphpmaxver', $maxver, $phpver);
}
}
}

# Call script's depends function
Expand Down

0 comments on commit 88ee7b1

Please sign in to comment.