MDL-42931 fix hardcoded PHP version tests for 2.7

This commit is contained in:
Petr Škoda 2013-12-10 08:46:27 +08:00
parent d1a628e5fd
commit dbe0203ba8
5 changed files with 11 additions and 16 deletions

View File

@ -142,10 +142,10 @@ define('PHPUNIT_TEST', false);
define('IGNORE_COMPONENT_CACHE', true);
// Check that PHP is of a sufficient version
if (version_compare(phpversion(), "5.3.3") < 0) {
if (version_compare(phpversion(), "5.4.4") < 0) {
$phpversion = phpversion();
// do NOT localise - lang strings would not work here and we CAN NOT move it after installib
fwrite(STDERR, "Moodle 2.5 or later requires at least PHP 5.3.3 (currently using version $phpversion).\n");
fwrite(STDERR, "Moodle 2.7 or later requires at least PHP 5.4.4 (currently using version $phpversion).\n");
fwrite(STDERR, "Please upgrade your server software or install older Moodle version.\n");
exit(1);
}

View File

@ -62,10 +62,10 @@ Example:
";
// Check that PHP is of a sufficient version
if (version_compare(phpversion(), "5.3.3") < 0) {
if (version_compare(phpversion(), "5.4.4") < 0) {
$phpversion = phpversion();
// do NOT localise - lang strings would not work here and we CAN NOT move it after installib
fwrite(STDERR, "Moodle 2.5 or later requires at least PHP 5.3.3 (currently using version $phpversion).\n");
fwrite(STDERR, "Moodle 2.7 or later requires at least PHP 5.4.4 (currently using version $phpversion).\n");
fwrite(STDERR, "Please upgrade your server software or install older Moodle version.\n");
exit(1);
}

View File

@ -30,10 +30,10 @@ if (!file_exists('../config.php')) {
}
// Check that PHP is of a sufficient version as soon as possible
if (version_compare(phpversion(), '5.3.3') < 0) {
if (version_compare(phpversion(), '5.4.4') < 0) {
$phpversion = phpversion();
// do NOT localise - lang strings would not work here and we CAN NOT move it to later place
echo "Moodle 2.5 or later requires at least PHP 5.3.3 (currently using version $phpversion).<br />";
echo "Moodle 2.7 or later requires at least PHP 5.4.4 (currently using version $phpversion).<br />";
echo "Please upgrade your server software or install older Moodle version.";
die();
}

View File

@ -60,10 +60,10 @@ if (function_exists('date_default_timezone_set') and function_exists('date_defau
@ini_set('display_errors', '1');
// Check that PHP is of a sufficient version.
if (version_compare(phpversion(), '5.3.3') < 0) {
if (version_compare(phpversion(), '5.4.4') < 0) {
$phpversion = phpversion();
// do NOT localise - lang strings would not work here and we CAN not move it after installib
echo "Moodle 2.5 or later requires at least PHP 5.3.3 (currently using version $phpversion).<br />";
echo "Moodle 2.7 or later requires at least PHP 5.4.4 (currently using version $phpversion).<br />";
echo "Please upgrade your server software or install older Moodle version.";
die;
}
@ -530,11 +530,10 @@ if ($config->stage == INSTALL_DATABASETYPE) {
if ($config->stage == INSTALL_ENVIRONMENT or $config->stage == INSTALL_PATHS) {
$version_fail = (version_compare(phpversion(), "5.3.3") < 0);
$curl_fail = ($lang !== 'en' and !extension_loaded('curl')); // needed for lang pack download
$zip_fail = ($lang !== 'en' and !extension_loaded('zip')); // needed for lang pack download
if ($version_fail or $curl_fail or $zip_fail) {
if ($curl_fail or $zip_fail) {
$config->stage = INSTALL_ENVIRONMENT;
install_print_header($config, get_string('environmenthead', 'install'),
@ -542,10 +541,6 @@ if ($config->stage == INSTALL_ENVIRONMENT or $config->stage == INSTALL_PATHS) {
get_string('environmentsub2', 'install'));
echo '<div id="envresult"><dl>';
if ($version_fail) {
$a = (object)array('needed'=>'5.3.3', 'current'=>phpversion());
echo '<dt>'.get_string('phpversion', 'install').'</dt><dd>'.get_string('environmentrequireversion', 'admin', $a).'</dd>';
}
if ($curl_fail) {
echo '<dt>'.get_string('phpextension', 'install', 'cURL').'</dt><dd>'.get_string('environmentrequireinstall', 'admin').'</dd>';
}

View File

@ -334,10 +334,10 @@ if (file_exists("$CFG->dataroot/climaintenance.html")) {
if (CLI_SCRIPT) {
// sometimes people use different PHP binary for web and CLI, make 100% sure they have the supported PHP version
if (version_compare(phpversion(), '5.3.3') < 0) {
if (version_compare(phpversion(), '5.4.4') < 0) {
$phpversion = phpversion();
// do NOT localise - lang strings would not work here and we CAN NOT move it to later place
echo "Moodle 2.5 or later requires at least PHP 5.3.3 (currently using version $phpversion).\n";
echo "Moodle 2.7 or later requires at least PHP 5.4.4 (currently using version $phpversion).\n";
echo "Some servers may have multiple PHP versions installed, are you using the correct executable?\n";
exit(1);
}