From bbd49c9533732bc9257d9e0b968f81f2294a65cd Mon Sep 17 00:00:00 2001 From: Daniel Ziegenberg Date: Sun, 22 May 2022 17:55:28 +0200 Subject: [PATCH] MDL-73017 env: Moodle 3.9.x, 3.11.x and 4.0.x do not support PHP 8.1 This commit adds an additional environment check for the unsupported PHP 8.1 version to Moodle 3.9.x, 3.11.x and 4.0.x. It also updates the lang string for unsupported PHP version. Signed-off-by: Daniel Ziegenberg --- admin/environment.xml | 2 ++ lang/en/admin.php | 13 +++++++------ lib/environmentlib.php | 11 +++++++++++ 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/admin/environment.xml b/admin/environment.xml index a376761816d..fbd9df62b43 100644 --- a/admin/environment.xml +++ b/admin/environment.xml @@ -3371,6 +3371,7 @@ + @@ -3557,6 +3558,7 @@ + diff --git a/lang/en/admin.php b/lang/en/admin.php index 145aa335233..17be3b3dfda 100644 --- a/lang/en/admin.php +++ b/lang/en/admin.php @@ -1437,12 +1437,13 @@ $string['unsupporteddbfilepertable'] = 'For full support of UTF-8 both MySQL and $string['unsupporteddblargeprefix'] = 'For full support of UTF-8 both MySQL and MariaDB require you to change your MySQL setting \'innodb_large_prefix\' to \'ON\'. See the documentation for further details.'; $string['unsupporteddbstorageengine'] = 'The database storage engine being used is no longer supported.'; $string['unsupporteddbtablerowformat'] = 'Your database has tables using Antelope as the file format. You are recommended to convert the tables to the Barracuda file format. See the documentation Administration via command line for details of a tool for converting InnoDB tables to Barracuda.'; -$string['unsupportedphpversion7'] = 'PHP version 7 is not supported.'; -$string['unsupportedphpversion71'] = 'PHP version 7.1 is not supported.'; -$string['unsupportedphpversion72'] = 'PHP version 7.2 is not supported.'; -$string['unsupportedphpversion73'] = 'PHP version 7.3 is not supported.'; -$string['unsupportedphpversion74'] = 'PHP version 7.4 is not supported.'; -$string['unsupportedphpversion80'] = 'PHP version 8.0 is not supported.'; +$string['unsupportedphpversion7'] = 'PHP version 7 and higher are not supported.'; +$string['unsupportedphpversion71'] = 'PHP version 7.1 and higher are not supported.'; +$string['unsupportedphpversion72'] = 'PHP version 7.2 and higher are not supported.'; +$string['unsupportedphpversion73'] = 'PHP version 7.3 and higher are not supported.'; +$string['unsupportedphpversion74'] = 'PHP version 7.4 and higher are not supported.'; +$string['unsupportedphpversion80'] = 'PHP version 8.0 and higher are not supported.'; +$string['unsupportedphpversion81'] = 'PHP version 8.1 and higher are not supported.'; $string['unsuspenduser'] = 'Activate user account'; $string['updateaccounts'] = 'Update existing accounts'; $string['updatecomponent'] = 'Update component'; diff --git a/lib/environmentlib.php b/lib/environmentlib.php index 5068d85cb07..5ace1322278 100644 --- a/lib/environmentlib.php +++ b/lib/environmentlib.php @@ -1664,3 +1664,14 @@ function restrict_php_version_74(&$result) { function restrict_php_version_80($result) { return restrict_php_version($result, '8.0'); } + +/** + * Check if the current PHP version is greater than or equal to + * PHP version 8.1 + * + * @param object $result an environment_results instance + * @return bool result of version check + */ +function restrict_php_version_81($result) { + return restrict_php_version($result, '8.1'); +}