Skip to content
Snippets Groups Projects
Commit 965596b4 authored by Seamus Lee's avatar Seamus Lee
Browse files

Set minimum install MySQL version to be 5.5 and a recommended minimum of 5.7

Fix to use min install version
parent 17ca7aac
No related branches found
No related tags found
No related merge requests found
......@@ -44,6 +44,20 @@ class CRM_Upgrade_Incremental_General {
*/
const MIN_INSTALL_PHP_VER = '7.1.0';
/**
* The minimum recommended MySQL/MariaDB version.
*
* A site running an earlier version will be told to upgrade.
*/
const MIN_RECOMMENDED_MYSQL_VER = '5.7';
/**
* The minimum MySQL/MariaDB version required to install Civi.
*
* @see install/index.php
*/
const MIN_INSTALL_MYSQL_VER = '5.5';
/**
* Compute any messages which should be displayed before upgrade.
*
......
......@@ -938,12 +938,14 @@ class CRM_Utils_Check_Component_Env extends CRM_Utils_Check_Component {
public function checkMysqlVersion() {
$messages = [];
$version = CRM_Utils_SQL::getDatabaseVersion();
if (version_compare(CRM_Utils_SQL::getDatabaseVersion(), '5.7', '<')) {
$minInstallVersion = CRM_Upgrade_Incremental_General::MIN_INSTALL_MYSQL_VER;
$minRecommendedVersion = CRM_Upgrade_Incremental_General::MIN_RECOMMENDED_MYSQL_VER;
if (version_compare(CRM_Utils_SQL::getDatabaseVersion(), $minInstallVersion, '<')) {
$messages[] = new CRM_Utils_Check_Message(
__FUNCTION__,
ts('This system uses MySQL/MariaDB version %1. To ensure the continued operation of CiviCRM, upgrade your server now. At least MySQL version %2 or MariaDB version %3 is recommended', [
1 => $version,
2 => '5.7',
2 => $minRecommendedVersion,
3 => '10.1',
]),
ts('MySQL Out of date'),
......@@ -951,6 +953,7 @@ class CRM_Utils_Check_Component_Env extends CRM_Utils_Check_Component {
'fa-server'
);
}
return $messages;
}
}
......@@ -291,7 +291,7 @@ class Requirements {
* @return array
*/
public function checkMysqlVersion(array $db_config) {
$min = '5.1';
$min = CRM_Upgrade_Incremental_General::MIN_INSTALL_MYSQL_VER;
$results = [
'title' => 'CiviCRM MySQL Version',
'severity' => $this::REQUIREMENT_OK,
......
......@@ -480,11 +480,11 @@ class InstallRequirements {
)
)
) {
@$this->requireMySQLVersion("5.1",
@$this->requireMySQLVersion(CRM_Upgrade_Incremental_General::MIN_INSTALL_MYSQL_VER,
array(
ts("MySQL %1 Configuration", array(1 => $dbName)),
ts("MySQL version at least %1", array(1 => '5.1')),
ts("MySQL version %1 or higher is required, you are running MySQL %2.", array(1 => '5.1', 2 => mysqli_get_server_info($this->conn))),
ts("MySQL version at least %1", array(1 => CRM_Upgrade_Incremental_General::MIN_INSTALL_MYSQL_VER)),
ts("MySQL version %1 or higher is required, you are running MySQL %2.", array(1 => CRM_Upgrade_Incremental_General::MIN_INSTALL_MYSQL_VER, 2 => mysqli_get_server_info($this->conn))),
ts("MySQL %1", array(1 => mysqli_get_server_info($this->conn))),
)
);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment