From d0c1e96f9728aa8e2e66b901f038771c6e71c6c4 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Sat, 24 Sep 2016 13:13:17 -0400 Subject: [PATCH] CRM-19404 - Re-allow installation on 5.3.4, but include warning. --- CRM/Upgrade/Incremental/General.php | 19 ++++++++++++++++++- CRM/Utils/Check/Component/Env.php | 26 ++++++++++++++++++++------ install/index.php | 3 ++- 3 files changed, 40 insertions(+), 8 deletions(-) diff --git a/CRM/Upgrade/Incremental/General.php b/CRM/Upgrade/Incremental/General.php index 28a6955d07..2efad44880 100644 --- a/CRM/Upgrade/Incremental/General.php +++ b/CRM/Upgrade/Incremental/General.php @@ -37,8 +37,25 @@ * This class contains generic upgrade logic which runs regardless of version. */ class CRM_Upgrade_Incremental_General { + + /** + * The recommended PHP version. + */ const MIN_RECOMMENDED_PHP_VER = '5.5'; - const BARE_MIN_PHP_VER = '5.3.23'; + + /** + * The minimum PHP version required to install Civi. + * + * @see install/index.php + */ + const MIN_INSTALL_PHP_VER = '5.3.4'; + + /** + * The minimum PHP version required to avoid known + * limits or defects. + */ + const MIN_DEFECT_PHP_VER = '5.3.23'; + /** * Compute any messages which should be displayed before upgrade. * diff --git a/CRM/Utils/Check/Component/Env.php b/CRM/Utils/Check/Component/Env.php index 10465791d4..2a370562eb 100644 --- a/CRM/Utils/Check/Component/Env.php +++ b/CRM/Utils/Check/Component/Env.php @@ -38,14 +38,27 @@ class CRM_Utils_Check_Component_Env extends CRM_Utils_Check_Component { public function checkPhpVersion() { $messages = array(); - if (version_compare(phpversion(), CRM_Upgrade_Incremental_General::MIN_RECOMMENDED_PHP_VER) < 0) { + if (version_compare(phpversion(), CRM_Upgrade_Incremental_General::MIN_RECOMMENDED_PHP_VER) >= 0) { $messages[] = new CRM_Utils_Check_Message( __FUNCTION__, - ts('This system uses PHP version %1. While this meets the minimum requirements for CiviCRM to function, upgrading to PHP version %2 or newer is recommended for maximum compatibility. The bare minimum php version is %3', + ts('This system uses PHP version %1 which meets or exceeds the minimum recommendation of %2.', array( 1 => phpversion(), 2 => CRM_Upgrade_Incremental_General::MIN_RECOMMENDED_PHP_VER, - 3 => CRM_Upgrade_Incremental_General::BARE_MIN_PHP_VER, + )), + ts('PHP Up-to-Date'), + \Psr\Log\LogLevel::INFO, + 'fa-server' + ); + } + elseif (version_compare(phpversion(), CRM_Upgrade_Incremental_General::MIN_DEFECT_PHP_VER) >= 0) { + $messages[] = new CRM_Utils_Check_Message( + __FUNCTION__, + ts('This system uses PHP version %1. While this meets the minimum requirements for CiviCRM to function, upgrading to PHP version %2 or newer is recommended for maximum compatibility.', + array( + 1 => phpversion(), + 2 => CRM_Upgrade_Incremental_General::MIN_RECOMMENDED_PHP_VER, + 3 => CRM_Upgrade_Incremental_General::MIN_DEFECT_PHP_VER, )), ts('PHP Out-of-Date'), \Psr\Log\LogLevel::NOTICE, @@ -55,13 +68,14 @@ class CRM_Utils_Check_Component_Env extends CRM_Utils_Check_Component { else { $messages[] = new CRM_Utils_Check_Message( __FUNCTION__, - ts('This system uses PHP version %1 which meets or exceeds the minimum recommendation of %2.', + ts('This system uses PHP version %1. CiviCRM can be installed on this version, but some specific features are known to fail or degrade. Version %3 is the bare minimum to avoid known issues, and version %2 is recommended.', array( 1 => phpversion(), 2 => CRM_Upgrade_Incremental_General::MIN_RECOMMENDED_PHP_VER, + 3 => CRM_Upgrade_Incremental_General::MIN_DEFECT_PHP_VER, )), - ts('PHP Up-to-Date'), - \Psr\Log\LogLevel::INFO, + ts('PHP Out-of-Date'), + \Psr\Log\LogLevel::WARNING, 'fa-server' ); } diff --git a/install/index.php b/install/index.php index 381d59c8b1..a98269e903 100644 --- a/install/index.php +++ b/install/index.php @@ -557,7 +557,8 @@ class InstallRequirements { $this->errors = NULL; - $this->requirePHPVersion('5.3.23', array( + // See also: CRM_Upgrade_Incremental_General::MIN_INSTALL_PHP_VER + $this->requirePHPVersion('5.3.4', array( ts("PHP Configuration"), ts("PHP5 installed"), NULL, -- 2.25.1