X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FUtils%2FCheck%2FComponent%2FEnv.php;h=f2b9bc9773481bc8013e598d0748c945e789caf0;hb=28288426d6db95be9cb065ade606fc7accfa6af3;hp=d7c6063131e76c55781aac8de784b2463d1148d6;hpb=4a0eaf5b01e02c8c3e4504648f5312485d202653;p=civicrm-core.git diff --git a/CRM/Utils/Check/Component/Env.php b/CRM/Utils/Check/Component/Env.php index d7c6063131..f2b9bc9773 100644 --- a/CRM/Utils/Check/Component/Env.php +++ b/CRM/Utils/Check/Component/Env.php @@ -38,13 +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 which meets or exceeds the minimum recommendation of %2.', + array( + 1 => phpversion(), + 2 => CRM_Upgrade_Incremental_General::MIN_RECOMMENDED_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, @@ -54,13 +68,37 @@ 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' + ); + } + + return $messages; + } + + /** + * @return array + */ + public function checkPhpMysqli() { + $messages = array(); + + if (!extension_loaded('mysqli')) { + $messages[] = new CRM_Utils_Check_Message( + __FUNCTION__, + ts('Future versions of CiviCRM may require the PHP extension "%2". To ensure that your system will be compatible, please install it in advance. For more explanation, see the announcement.', + array( + 1 => 'https://civicrm.org/blog/totten/psa-please-verify-php-extension-mysqli', + 2 => 'mysqli', + )), + ts('Forward Compatibility: Enable "mysqli"'), + \Psr\Log\LogLevel::WARNING, 'fa-server' ); } @@ -660,4 +698,23 @@ class CRM_Utils_Check_Component_Env extends CRM_Utils_Check_Component { return $messages; } + /** + * Check for required mbstring extension + * @return array + */ + public function checkMbstring() { + $messages = array(); + + if (!function_exists('mb_substr')) { + $messages[] = new CRM_Utils_Check_Message( + __FUNCTION__, + ts('The required PHP Multibyte String extension is not enabled on your server. Ask your system administrator to install it.'), + ts('Missing mbstring Extension'), + \Psr\Log\LogLevel::ERROR, + 'fa-server' + ); + } + return $messages; + } + }