Skip to content
Browse files

Merge branch 'w07_MDL-26307_20_dbport' of git://github.com/skodak/moodle

  • Loading branch information...
2 parents 64c74b8 + 9e9543e commit 0e9fe664b6f777b8e839400ff4f80bef8f13debb @stronk7 stronk7 committed Feb 14, 2011
Showing with 9 additions and 3 deletions.
  1. +9 −3 lib/dml/mysqli_native_moodle_database.php
View
12 lib/dml/mysqli_native_moodle_database.php
@@ -56,17 +56,23 @@ public function create_database($dbhost, $dbuser, $dbpass, $dbname, array $dbopt
throw new dml_exception('dbdriverproblem', $driverstatus);
}
- if (empty($this->dboptions['dbport'])) {
+ if (!empty($dboptions['dbsocket'])
+ and (strpos($dboptions['dbsocket'], '/') !== false or strpos($dboptions['dbsocket'], '\\') !== false)) {
+ $dbsocket = $dboptions['dbsocket'];
+ } else {
+ $dbsocket = ini_get('mysqli.default_socket');
+ }
+ if (empty($dboptions['dbport'])) {
$dbport = (int)ini_get('mysqli.default_port');
} else {
- $dbport = (int)$this->dboptions['dbport'];
+ $dbport = (int)$dboptions['dbport'];
}
// verify ini.get does not return nonsense
if (empty($dbport)) {
$dbport = 3306;
}
ob_start();
- $conn = new mysqli($dbhost, $dbuser, $dbpass, '', $dbport); /// Connect without db
+ $conn = new mysqli($dbhost, $dbuser, $dbpass, '', $dbport, $dbsocket); /// Connect without db
$dberr = ob_get_contents();
ob_end_clean();
$errorno = @$conn->connect_errno;

0 comments on commit 0e9fe66

Please sign in to comment.
Something went wrong with that request. Please try again.