From: skodak Date: Mon, 9 Feb 2009 17:51:01 +0000 (+0000) Subject: MDL-18194 detect if driver install before trying to create db X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=797ffad0c778c2c3e687bbf849e5a0827e0cdc36;p=moodle.git MDL-18194 detect if driver install before trying to create db --- diff --git a/lib/dml/mysqli_native_moodle_database.php b/lib/dml/mysqli_native_moodle_database.php index 64517fdb42..09189025f9 100644 --- a/lib/dml/mysqli_native_moodle_database.php +++ b/lib/dml/mysqli_native_moodle_database.php @@ -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();