Deprecate PHP < 7.1.3 (#9645)

* Added validation and support for users on PHP < 7.1.3

* Branch name php56
This commit is contained in:
Neil Lathwood
2019-02-07 19:23:30 +00:00
committed by Tony Murray
parent 80f31b4831
commit 6fdafd137c
3 changed files with 25 additions and 6 deletions

View File

@@ -70,7 +70,12 @@ class Updates extends BaseValidation
if ($versions['local_branch'] == 'php53') {
$validator->warn(
"You are on the PHP 5.3 support branch, this will prevent automatic updates.",
"Update to PHP 5.6.4 or newer (PHP 7.1 recommended) to continue to receive updates."
"Update to PHP 5.6.4 or newer (PHP 7.2 recommended) to continue to receive updates."
);
} elseif ($versions['local_branch'] == 'php56') {
$validator->warn(
"You are on the PHP 5.6/7.0 support branch, this will prevent automatic updates.",
"Update to PHP 7.1.3 or newer (PHP 7.2 recommended) to continue to receive updates."
);
} else {
$validator->warn(

View File

@@ -160,9 +160,16 @@ if ($options['f'] === 'handle_notifiable') {
// if update is not set to false and version is min or newer
if (Config::get('update') && $options['r']) {
if ($options['r'] === 'php53') {
$phpver = '5.6.4';
$eol_date = 'January 10th, 2018';
} else {
$phpver = '7.1.3';
$eol_date = 'February 1st, 2019';
}
new_notification(
$error_title,
'PHP version 5.6.4 is the minimum supported version as of January 10, 2018. We recommend you update to PHP a supported version of PHP (7.1 suggested) to continue to receive updates. If you do not update PHP, LibreNMS will continue to function but stop receiving bug fixes and updates.',
"PHP version $phpver is the minimum supported version as of $eol_date. We recommend you update to PHP a supported version of PHP (7.2 suggested) to continue to receive updates. If you do not update PHP, LibreNMS will continue to function but stop receiving bug fixes and updates.",
2,
'daily.sh'
);

View File

@@ -126,16 +126,23 @@ set_notifiable_result() {
#######################################
check_php_ver() {
local branch=$(git rev-parse --abbrev-ref HEAD)
local ver_res=$(php -r "echo (int)version_compare(PHP_VERSION, '5.6.4', '<');")
if [[ "$branch" == "php53" ]] && [[ "$ver_res" == "0" ]]; then
local ver_56=$(php -r "echo (int)version_compare(PHP_VERSION, '5.6.4', '<');")
local ver_71=$(php -r "echo (int)version_compare(PHP_VERSION, '7.1.3', '<');")
if [[ "$branch" == "php53" ]] && [[ "$ver_56" == "0" ]]; then
status_run "Supported PHP version, switched back to master branch." 'git checkout master'
branch="master"
elif [[ "$branch" != "php53" ]] && [[ "$ver_res" == "1" ]]; then
elif [[ "$branch" == "php56" ]] && [[ "$ver_71" == "0" ]]; then
status_run "Supported PHP version, switched back to master branch." 'git checkout master'
branch="master"
elif [[ "$branch" != "php53" ]] && [[ "$ver_56" == "1" ]]; then
status_run "Unsupported PHP version, switched to php53 branch." 'git checkout php53'
branch="php53"
elif [[ "$branch" != "php56" ]] && [[ "$ver_71" == "1" ]]; then
status_run "Unsupported PHP version, switched to php56 branch." 'git checkout php56'
branch="php56"
fi
set_notifiable_result phpver ${ver_res}
set_notifiable_result phpver ${branch}
return ${ver_res};
}