MDL-57432 lib: unify PHP version checks

* Introduce a new php compatible library which can be used
  early in execution, without Moodle dependencies
* Use it where we previously had hardcoded checks

This was originally suggested in MDL-39007.
This commit is contained in:
Dan Poltawski
2017-07-10 09:16:55 +01:00
parent 350700bf8b
commit 64e57937be
5 changed files with 88 additions and 32 deletions
+3 -8
View File
@@ -62,14 +62,9 @@ Example:
\$sudo -u www-data /usr/bin/php admin/cli/install_database.php --lang=cs --adminpass=soMePass123 --agree-license
";
// Check that PHP is of a sufficient version
if (version_compare(phpversion(), "5.6.5") < 0) {
$phpversion = phpversion();
// do NOT localise - lang strings would not work here and we CAN NOT move it after installib
fwrite(STDERR, "Moodle 3.2 or later requires at least PHP 5.6.5 (currently using version $phpversion).\n");
fwrite(STDERR, "Please upgrade your server software or install older Moodle version.\n");
exit(1);
}
// Check that PHP is of a sufficient version as soon as possible.
require_once(__DIR__.'/../../lib/phpminimumversionlib.php');
moodle_require_minimum_php_version();
// Nothing to do if config.php does not exist
$configfile = __DIR__.'/../../config.php';