Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
MDL-43604 add support for future hacky MariaDB versions
This patch also shows the real server version without
normalisation on the environment page, this should
hopefully help people to identify MariaDB...
  • Loading branch information
skodak committed Mar 14, 2014
1 parent c0e8812 commit 1dd74af
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
14 changes: 14 additions & 0 deletions lib/dml/mariadb_native_moodle_database.php
Expand Up @@ -74,6 +74,20 @@ protected function get_dbtype() {
return 'mariadb';
}

/**
* Returns database server info array
* @return array Array containing 'description' and 'version' info
*/
public function get_server_info() {
$version = $this->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'=>$this->mysqli->server_info, 'version'=>$version);
}

/**
* It is time to require transactions everywhere.
*
Expand Down
2 changes: 1 addition & 1 deletion lib/environmentlib.php
Expand Up @@ -984,7 +984,7 @@ function environment_check_database($version, $env_select) {
$result->setLevel($level);
$result->setCurrentVersion($current_version);
$result->setNeededVersion($needed_version);
$result->setInfo($current_vendor);
$result->setInfo($current_vendor . ' (' . $dbinfo['description'] . ')');

/// Do any actions defined in the XML file.
process_environment_result($vendorsxml[$current_vendor], $result);
Expand Down

0 comments on commit 1dd74af

Please sign in to comment.