Increase minimum version to PHP 8.1 (#14378)

This commit is contained in:
Tony Murray 2022-09-26 08:52:15 -05:00 committed by GitHub
parent e990dfcb35
commit 66790e7e8f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 15 deletions

View File

@ -173,14 +173,10 @@ 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';
} elseif ($options['r'] === 'php56' || $options['r'] === 'php71' || $options['r'] === 'php72') {
if (preg_match('/^php\d{2}/', $options['r'])) {
$phpver = Php::PHP_MIN_VERSION;
$eol_date = Php::PHP_MIN_VERSION_DATE;
}
if (isset($phpver)) {
Notifications::create($error_title,
"PHP version $phpver is the minimum supported version as of $eol_date. We recommend you update to PHP a supported version of PHP (" . Php::PHP_RECOMMENDED_VERSION . ' suggested) to continue to receive updates. If you do not update PHP, LibreNMS will continue to function but stop receiving bug fixes and updates.',
'daily.sh',

View File

@ -130,28 +130,23 @@ set_notifiable_result() {
# Exit-Code: 0 >= min ver, 1 < min ver
#######################################
check_dependencies() {
local branch ver_56 ver_71 ver_72 ver_73 python3 python_deps phpver pythonver old_branches msg
local branch ver_71 ver_72 ver_73 ver_81 python3 python_deps phpver pythonver old_branches msg
branch=$(git rev-parse --abbrev-ref HEAD)
scripts/check_requirements.py > /dev/null 2>&1 || pip3 install -r requirements.txt > /dev/null 2>&1
ver_56=$(php -r "echo (int)version_compare(PHP_VERSION, '5.6.4', '<');")
ver_71=$(php -r "echo (int)version_compare(PHP_VERSION, '7.1.3', '<');")
ver_72=$(php -r "echo (int)version_compare(PHP_VERSION, '7.2.5', '<');")
ver_73=$(php -r "echo (int)version_compare(PHP_VERSION, '7.3', '<');")
ver_81=$(php -r "echo (int)version_compare(PHP_VERSION, '8.1', '<');")
python3=$(python3 -c "import sys;print(int(sys.version_info < (3, 4)))" 2> /dev/null)
python_deps=$("${LIBRENMS_DIR}/scripts/check_requirements.py" > /dev/null 2>&1; echo $?)
phpver="master"
pythonver="master"
old_branches="^(php53|php56|php71-python2|php72)$"
if [[ $branch =~ $old_branches ]] && [[ "$ver_73" == "0" && "$python3" == "0" && "$python_deps" == "0" ]]; then
old_branches="^(php53|php56|php71-python2|php72|php73)$"
if [[ $branch =~ $old_branches ]] && [[ "$ver_81" == "0" && "$python3" == "0" && "$python_deps" == "0" ]]; then
status_run "Supported PHP and Python version, switched back to master branch." 'git checkout master'
elif [[ "$ver_56" != "0" ]]; then
phpver="php53"
if [[ "$branch" != "php53" ]]; then
status_run "Unsupported PHP version, switched to php53 branch." 'git checkout php53'
fi
elif [[ "$ver_71" != "0" ]]; then
phpver="php56"
if [[ "$branch" != "php56" ]]; then
@ -179,6 +174,11 @@ check_dependencies() {
if [[ "$branch" != "php72" ]]; then
status_run "Unsupported PHP version, switched to php72 branch." 'git checkout php72'
fi
elif [[ "$ver_81" != "0" ]]; then
phpver="php73"
if [[ "$branch" != "php73" ]]; then
status_run "Unsupported PHP version, switched to php73 branch." 'git checkout php73'
fi
fi
set_notifiable_result phpver ${phpver}