Skip to content

Commit

Permalink
Set minimum install MySQL version to be 5.5 and a recommended minimum…
Browse files Browse the repository at this point in the history
… of 5.7

Fix to use min install version
  • Loading branch information
seamuslee001 committed May 14, 2020
1 parent 17ca7aa commit 965596b
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 6 deletions.
14 changes: 14 additions & 0 deletions CRM/Upgrade/Incremental/General.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down
7 changes: 5 additions & 2 deletions CRM/Utils/Check/Component/Env.php
Original file line number Diff line number Diff line change
Expand Up @@ -938,19 +938,22 @@ public function checkMysqlUtf8mb4() {
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'),
\Psr\Log\LogLevel::WARNING,
'fa-server'
);
}
return $messages;
}

}
2 changes: 1 addition & 1 deletion Civi/Install/Requirements.php
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ public function checkMysqlConnection(array $db_config) {
* @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,
Expand Down
6 changes: 3 additions & 3 deletions install/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -480,11 +480,11 @@ public function checkdatabase($databaseConfig, $dbName) {
)
)
) {
@$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))),
)
);
Expand Down

0 comments on commit 965596b

Please sign in to comment.