/
mariadb_ms_native_moodle_database.php
53 lines (47 loc) · 1.48 KB
/
mariadb_ms_native_moodle_database.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
/**
* Extended copy of native mysqli class for mariadb (representing moodle database interface).
* This class provide simple read/write splitting by substitute mysqli object.
*
* It contains parts from yii2\db\Connection.
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
*
*
* @package core_dml
* @copyright 2016 Dmitriy Kuzevanov
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/mysqli_ms_native_moodle_database.php');
class mariadb_ms_native_moodle_database extends mysqli_ms_native_moodle_database
{
/**
* {@inheritdoc}
*/
public static function get_server_info_static(mysqli $mysqli)
{
$version = $mysqli->server_info;
$matches = null;
if (preg_match('/^5\.5\.5-(10\..+)-MariaDB/i', $version, $matches)) {
// Looks like MariaDB decided to use these weird version numbers for better BC with MySQL...
$version = $matches[1];
}
return array('description' => $mysqli->server_info, 'version' => $version);
}
/**
* It is time to require transactions everywhere.
*
* MyISAM is NOT supported!
*
* @return bool
*/
protected function transactions_supported()
{
if ($this->external) {
return parent::transactions_supported();
}
return true;
}
}