mirror of
https://github.com/silverstripe/silverstripe-installer
synced 2024-10-22 17:05:33 +02:00
BUGFIX #4356 Removed string checking of PHP version and replaced with version_compare() in SS installer
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/phpinstaller/branches/2.3@81646 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
64607059e2
commit
8ab9a67c16
34
install.php
34
install.php
@ -351,30 +351,26 @@ class InstallRequirements {
|
||||
function requirePHPVersion($recommendedVersion, $requiredVersion, $testDetails) {
|
||||
$this->testing($testDetails);
|
||||
|
||||
list($recA, $recB, $recC) = explode('.', $recommendedVersion);
|
||||
list($reqA, $reqB, $reqC) = explode('.', $requiredVersion);
|
||||
list($a, $b, $c) = explode('.', phpversion());
|
||||
$c = ereg_replace('-.*$','',$c);
|
||||
$installedVersion = phpversion();
|
||||
|
||||
if($a > $recA || ($a == $recA && $b > $recB) || ($a == $reqA && $b == $reqB && $c >= $reqC)) {
|
||||
$testDetails[2] = "SilverStripe recommends PHP version $recommendedVersion or later, only $a.$b.$c is installed. While SilverStripe should run, you may run into issues, and future versions of SilverStripe may require a later version. Upgrading PHP is recommended.";
|
||||
if(version_compare($installedVersion, $requiredVersion, '<')) {
|
||||
$testDetails[2] = "SilverStripe requires PHP version $requiredVersion or later.\n
|
||||
PHP version $installedVersion is currently installed.\n
|
||||
While SilverStripe requires at least PHP version $requiredVersion, upgrading to $recommendedVersion or later is recommended.\n
|
||||
If you are installing SilverStripe on a shared web server, please ask your web hosting provider to upgrade PHP for you.";
|
||||
$this->error($testDetails);
|
||||
return;
|
||||
}
|
||||
|
||||
if(version_compare($installedVersion, $recommendedVersion, '<')) {
|
||||
$testDetails[2] = "PHP version $installedVersion is currently installed.\n
|
||||
Upgrading to at least PHP version $recommendedVersion is recommended.\n
|
||||
SilverStripe should run, but you may run into issues. Future releases may require a later version of PHP.\n";
|
||||
$this->warning($testDetails);
|
||||
return;
|
||||
}
|
||||
|
||||
if($a > $reqA) return true;
|
||||
if($a == $reqA && $b > $reqB) return true;
|
||||
if($a == $reqA && $b == $reqB && $c >= $reqC) return true;
|
||||
|
||||
if(!$testDetails[2]) {
|
||||
if($a < $reqA) {
|
||||
$testDetails[2] = "You need PHP version $version or later, only $a.$b.$c is installed. Unfortunately PHP$a and PHP$reqA have some incompatabilities, so if you are on a your web-host may need to move you to a different server. Some software doesn't work with PHP5 and so upgrading a shared server could be problematic.";
|
||||
} else {
|
||||
$testDetails[2] = "You need PHP version $requiredVersion or later, only $a.$b.$c is installed. Please upgrade your server, or ask your web-host to do so.";
|
||||
}
|
||||
}
|
||||
|
||||
$this->error($testDetails);
|
||||
return true;
|
||||
}
|
||||
|
||||
function requireFile($filename, $testDetails) {
|
||||
|
Loading…
Reference in New Issue
Block a user