MDL-18194 detect if driver install before trying to create db
authorskodak <skodak>
Mon, 9 Feb 2009 17:51:01 +0000 (17:51 +0000)
committerskodak <skodak>
Mon, 9 Feb 2009 17:51:01 +0000 (17:51 +0000)
lib/dml/mysqli_native_moodle_database.php

index 64517fdb42b8158c39e5126de5ab42ddc22beceb..09189025f91b6f23ad2b4465e8ffb87197771fb1 100644 (file)
@@ -22,6 +22,12 @@ class mysqli_native_moodle_database extends moodle_database {
      */
     /// TODO: Decide if this method should go to DDL instead of being here
     public function create_database($dbhost, $dbuser, $dbpass, $dbname, array $dboptions=null) {
+        $driverstatus = $this->driver_installed();
+
+        if ($driverstatus !== true) {
+            throw new dml_exception('dbdriverproblem', $driverstatus);
+        }
+
         ob_start();
         $conn = new mysqli($dbhost, $dbuser, $dbpass); /// Connect without db
         $dberr = ob_get_contents();