Change PHP version check to use a configuration constant, rather than a hardcoded version in the code.

(As it seems this hardcoded version number is easy to forget about, and then it doesn't actually get updated..)
This commit is contained in:
jgen 2017-03-11 18:34:36 -08:00
parent ab9dc0c511
commit 2691a6bbdc
2 changed files with 10 additions and 7 deletions

View File

@ -41,7 +41,7 @@ _d("TIMEZONE", null); // string timezone
_d("CORE_EXTS", "bbcode,user,mail,upload,image,view,handle_pixel,ext_manager,setup,upgrade,handle_404,comment,tag_list,index,tag_edit,alias_editor"); // extensions to always enable
_d("EXTRA_EXTS", ""); // string optional extra extensions
_d("BASE_URL", null); // string force a specific base URL (default is auto-detect)
_d("MIN_PHP_VERSION", '5.6');// string minium supported PHP version
/*
* Calculated settings - you should never need to change these

View File

@ -1600,14 +1600,17 @@ function score_assert_handler($file, $line, $code, $desc = null) {
/** @privatesection */
function _version_check() {
$min_version = "5.4.8";
if(version_compare(PHP_VERSION, $min_version) == -1) {
print "
Currently SCore Engine doesn't support versions of PHP lower than $min_version --
if your web host is running an older version, they are dangerously out of
if(MIN_PHP_VERSION)
{
if(version_compare(phpversion(), MIN_PHP_VERSION, ">=") == FALSE) {
print "
Shimmie (SCore Engine) does not support versions of PHP lower than ".MIN_PHP_VERSION."
(PHP reports that it is version ".phpversion().")
If your web host is running an older version, they are dangerously out of
date and you should plan on moving elsewhere.
";
exit;
exit;
}
}
}