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,
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 <a href="%1">the announcement</a>.',
+ 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'
);
}
* @return array<CRM_Utils_Check_Message> an empty array, or a list of warnings
*/
public function checkMysqlTime() {
+ //CRM-19115 - Always set MySQL time before checking it.
+ CRM_Core_Config::singleton()->userSystem->setMySQLTimeZone();
$messages = array();
$phpNow = date('Y-m-d H:i');
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;
+ }
+
}