mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
Merge remote-tracking branch 'rxu/ticket/10227' into develop-olympus
* rxu/ticket/10227: [ticket/10227] Allow persistent connections for mysqli with PHP 5.3.0+
This commit is contained in:
commit
ee2d4f627a
1 changed files with 6 additions and 3 deletions
|
@ -33,13 +33,16 @@ class dbal_mysqli extends dbal
|
||||||
*/
|
*/
|
||||||
function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false , $new_link = false)
|
function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false , $new_link = false)
|
||||||
{
|
{
|
||||||
$this->persistency = $persistency;
|
// Mysqli extension supports persistent connection since PHP 5.3.0
|
||||||
|
$this->persistency = (version_compare(PHP_VERSION, '5.3.0', '>=')) ? $persistency : false;
|
||||||
$this->user = $sqluser;
|
$this->user = $sqluser;
|
||||||
$this->server = $sqlserver;
|
|
||||||
|
// If persistent connection, set dbhost to localhost when empty and prepend it with 'p:' prefix
|
||||||
|
$this->server = ($this->persistency) ? 'p:' . (($sqlserver) ? $sqlserver : 'localhost') : $sqlserver;
|
||||||
|
|
||||||
$this->dbname = $database;
|
$this->dbname = $database;
|
||||||
$port = (!$port) ? NULL : $port;
|
$port = (!$port) ? NULL : $port;
|
||||||
|
|
||||||
// Persistant connections not supported by the mysqli extension?
|
|
||||||
$this->db_connect_id = @mysqli_connect($this->server, $this->user, $sqlpassword, $this->dbname, $port);
|
$this->db_connect_id = @mysqli_connect($this->server, $this->user, $sqlpassword, $this->dbname, $port);
|
||||||
|
|
||||||
if ($this->db_connect_id && $this->dbname != '')
|
if ($this->db_connect_id && $this->dbname != '')
|
||||||
|
|
Loading…
Add table
Reference in a new issue