Merge branch 'm36_MDL-61702_MariaDB_InnoDB10d3d1_Params_Removed' of https://github.com/scara/moodle

This commit is contained in:
Andrew Nicols 2018-06-06 08:00:23 +08:00 committed by Eloy Lafuente (stronk7)
commit f32a9acadf

View File

@ -293,6 +293,29 @@ class mysqli_native_moodle_database extends moodle_database {
return $collation;
}
/**
* Tests if the Antelope file format is still supported or it has been removed.
* When removed, only Barracuda file format is supported, given the XtraDB/InnoDB engine.
*
* @return bool True if the Antelope file format has been removed; otherwise, false.
*/
protected function is_antelope_file_format_no_more_supported() {
// Breaking change: Antelope file format support has been removed from both MySQL and MariaDB.
// The following InnoDB file format configuration parameters were deprecated and then removed:
// - innodb_file_format
// - innodb_file_format_check
// - innodb_file_format_max
// - innodb_large_prefix
// 1. MySQL: deprecated in 5.7.7 and removed 8.0.0+.
$ismysqlge8d0d0 = ($this->get_dbtype() == 'mysqli') &&
version_compare($this->get_server_info()['version'], '8.0.0', '>=');
// 2. MariaDB: deprecated in 10.2.0 and removed 10.3.1+.
$ismariadbge10d3d1 = ($this->get_dbtype() == 'mariadb') &&
version_compare($this->get_server_info()['version'], '10.3.1', '>=');
return $ismysqlge8d0d0 || $ismariadbge10d3d1;
}
/**
* Get the row format from the database schema.
*
@ -307,9 +330,8 @@ class mysqli_native_moodle_database extends moodle_database {
FROM INFORMATION_SCHEMA.TABLES
WHERE table_schema = DATABASE() AND table_name = '{$this->prefix}$table'";
} else {
if (($this->get_dbtype() == 'mysqli') &&
// Breaking change in MySQL 8.0.0+: antelope file format support has been removed.
version_compare($this->get_server_info()['version'], '8.0.0', '>=')) {
if ($this->is_antelope_file_format_no_more_supported()) {
// Breaking change: Antelope file format support has been removed, only Barracuda.
$dbengine = $this->get_dbengine();
$supporteddbengines = array('InnoDB', 'XtraDB');
if (in_array($dbengine, $supporteddbengines)) {
@ -396,9 +418,8 @@ class mysqli_native_moodle_database extends moodle_database {
* @return bool True if on otherwise false.
*/
public function is_large_prefix_enabled() {
if (($this->get_dbtype() == 'mysqli') &&
// Breaking change since 8.0.0: there is only one file format and 'innodb_large_prefix' has been removed.
version_compare($this->get_server_info()['version'], '8.0.0', '>=')) {
if ($this->is_antelope_file_format_no_more_supported()) {
// Breaking change: Antelope file format support has been removed, only Barracuda.
return true;
}