aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB
diff options
context:
space:
mode:
authorAndreas Fischer <bantu@phpbb.com>2011-06-19 17:58:36 +0200
committerAndreas Fischer <bantu@phpbb.com>2011-06-19 17:58:36 +0200
commitee2d4f627ae5398dadf64288128e928bf05fc7af (patch)
treeb2fdbd16429129ec8457334194913f1b063504a3 /phpBB
parentb43907d69ecb8c63d85c973520209f1050ad8165 (diff)
parent7de078b26e2a0b2672f24efe715b440cca7f5979 (diff)
downloadforums-ee2d4f627ae5398dadf64288128e928bf05fc7af.tar
forums-ee2d4f627ae5398dadf64288128e928bf05fc7af.tar.gz
forums-ee2d4f627ae5398dadf64288128e928bf05fc7af.tar.bz2
forums-ee2d4f627ae5398dadf64288128e928bf05fc7af.tar.xz
forums-ee2d4f627ae5398dadf64288128e928bf05fc7af.zip
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+
Diffstat (limited to 'phpBB')
-rw-r--r--phpBB/includes/db/mysqli.php9
1 files changed, 6 insertions, 3 deletions
diff --git a/phpBB/includes/db/mysqli.php b/phpBB/includes/db/mysqli.php
index 862d62f4ba..dcf8727e18 100644
--- a/phpBB/includes/db/mysqli.php
+++ b/phpBB/includes/db/mysqli.php
@@ -33,13 +33,16 @@ class dbal_mysqli extends dbal
*/
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->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;
$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);
if ($this->db_connect_id && $this->dbname != '')