1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-05-06 23:55:26 +02:00

Merge branch 'develop-olympus' into develop

* develop-olympus:
  [ticket/10226] Use is_numeric() instead of preg_replace()
  [ticket/10226] Allow mysqli connections via local sockets/pipes
This commit is contained in:
Nils Adermann 2011-07-16 22:19:02 -04:00
commit aa0c3a0f45

View File

@ -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 != '')
{