Permalink
Browse files

lib MDL-25532 added dbport option to mysqli driver

  • Loading branch information...
1 parent b876a00 commit feaddca9e91831db3df7d3e8fcad9f44f7e67277 @nebgor nebgor committed Dec 7, 2010
Showing with 6 additions and 1 deletion.
  1. +6 −1 lib/dml/mysqli_native_moodle_database.php
@@ -261,8 +261,13 @@ public function connect($dbhost, $dbuser, $dbpass, $dbname, $prefix, array $dbop
$this->store_settings($dbhost, $dbuser, $dbpass, $dbname, $prefix, $dboptions);
unset($this->dboptions['dbsocket']);
+ if (empty($this->dboptions['dbport'])) {
+ $dbport = ini_get('mysqli.default_port');
+ } else {
+ $dbport = (int)$this->dboptions['dbport'];
+ }
ob_start();
- $this->mysqli = new mysqli($dbhost, $dbuser, $dbpass, $dbname);
+ $this->mysqli = new mysqli($dbhost, $dbuser, $dbpass, $dbname, $dbport);
$dberr = ob_get_contents();
ob_end_clean();
$errorno = @$this->mysqli->connect_errno;

0 comments on commit feaddca

Please sign in to comment.