MDL-23682 improved overriding of MyISAM default engine with something that supports...
authorPetr Skoda <skodak@moodle.org>
Thu, 19 Aug 2010 07:09:14 +0000 (07:09 +0000)
committerPetr Skoda <skodak@moodle.org>
Thu, 19 Aug 2010 07:09:14 +0000 (07:09 +0000)
lib/dml/mysqli_native_moodle_database.php

index 6a0ff48..d76d179 100644 (file)
@@ -165,17 +165,19 @@ class mysqli_native_moodle_database extends moodle_database {
             $this->query_start($sql, NULL, SQL_QUERY_AUX);
             $result = $this->mysqli->query($sql);
             $this->query_end($result);
+            $engines = array();
             while ($res = $result->fetch_assoc()) {
-                if ($res['Engine'] === 'InnoDB' and $res['Support'] === 'YES') {
-                    $engine = 'InnoDB';
-                    break;
-                }
-                if ($res['Engine'] === 'XtraDB' and $res['Support'] === 'YES') {
-                    $engine = 'XtraDB';
-                    break;
+                if ($res['Support'] === 'YES' or $res['Support'] === 'DEFAULT') {
+                    $engines[$res['Engine']] = true;
                 }
             }
             $result->close();
+            if (isset($engines['InnoDB'])) {
+                $engine = 'InnoDB';
+            }
+            if (isset($engines['XtraDB'])) {
+                $engine = 'XtraDB';
+            }
         }
 
         return $engine;