diff options
author | Nils Adermann <naderman@naderman.de> | 2011-07-16 22:18:48 -0400 |
---|---|---|
committer | Nils Adermann <naderman@naderman.de> | 2011-07-16 22:18:48 -0400 |
commit | 825d44fcc2b384729a8eb0c941c5d3509f967e4c (patch) | |
tree | 6cd7d79d1474517d3893703a7741beb341d6327b /phpBB/includes/db | |
parent | 03b1f500e762af811249ba3769e1292b3742f25b (diff) | |
parent | 18fb3d86cdac01c2dd1469982a51526fa1480b42 (diff) | |
download | forums-825d44fcc2b384729a8eb0c941c5d3509f967e4c.tar forums-825d44fcc2b384729a8eb0c941c5d3509f967e4c.tar.gz forums-825d44fcc2b384729a8eb0c941c5d3509f967e4c.tar.bz2 forums-825d44fcc2b384729a8eb0c941c5d3509f967e4c.tar.xz forums-825d44fcc2b384729a8eb0c941c5d3509f967e4c.zip |
Merge remote-tracking branch 'github-rxu/ticket/10226' into develop-olympus
* github-rxu/ticket/10226:
[ticket/10226] Use is_numeric() instead of preg_replace()
[ticket/10226] Allow mysqli connections via local sockets/pipes
Diffstat (limited to 'phpBB/includes/db')
-rw-r--r-- | phpBB/includes/db/mysqli.php | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/phpBB/includes/db/mysqli.php b/phpBB/includes/db/mysqli.php index dcf8727e18..46c2f9210b 100644 --- a/phpBB/includes/db/mysqli.php +++ b/phpBB/includes/db/mysqli.php @@ -43,7 +43,23 @@ class dbal_mysqli extends dbal $this->dbname = $database; $port = (!$port) ? NULL : $port; - $this->db_connect_id = @mysqli_connect($this->server, $this->user, $sqlpassword, $this->dbname, $port); + // If port is set and it is not numeric, most likely mysqli socket is set. + // Try to map it to the $socket parameter. + $socket = NULL; + if ($port) + { + if (is_numeric($port)) + { + $port = (int) $port; + } + else + { + $socket = $port; + $port = NULL; + } + } + + $this->db_connect_id = @mysqli_connect($this->server, $this->user, $sqlpassword, $this->dbname, $port, $socket); if ($this->db_connect_id && $this->dbname != '') { |