mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
[ticket/10226] Allow mysqli connections via local sockets/pipes
PHPBB3-10226
This commit is contained in:
parent
fd7e29131e
commit
578f9dffa6
1 changed files with 17 additions and 1 deletions
|
@ -43,7 +43,23 @@ class dbal_mysqli extends dbal
|
||||||
$this->dbname = $database;
|
$this->dbname = $database;
|
||||||
$port = (!$port) ? NULL : $port;
|
$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 (preg_match('#^[0-9]+$#', $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 != '')
|
if ($this->db_connect_id && $this->dbname != '')
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue