Skip to content

Instantly share code, notes, and snippets.

@emyb
Created June 28, 2022 21:53
Show Gist options
  • Save emyb/acef8bc8ad3a27041ad3451ad0ea76f3 to your computer and use it in GitHub Desktop.
Save emyb/acef8bc8ad3a27041ad3451ad0ea76f3 to your computer and use it in GitHub Desktop.
A patch for mariadb to be able to work on moodles that have an azure one.
diff --git a/lib/dml/mariadb_native_moodle_database.php b/lib/dml/mariadb_native_moodle_database.php
old mode 100644
new mode 100755
index 358a493647..c6f21e736e
--- a/lib/dml/mariadb_native_moodle_database.php
+++ b/lib/dml/mariadb_native_moodle_database.php
@@ -79,13 +79,10 @@ class mariadb_native_moodle_database extends mysqli_native_moodle_database {
* @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);
+ $res = $this->mysqli->query("SELECT VERSION() AS VERSION;");
+ $res->data_seek(0);
+ $data = $res->fetch_array();
+ return array('description'=>$data["VERSION"], 'version'=>$data["VERSION"]);
}
protected function has_breaking_change_quoted_defaults() {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment