*/
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.
*
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'),
'fa-server'
);
}
+ return $messages;
}
}
* @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,
)
)
) {
- @$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))),
)
);