aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/db
diff options
context:
space:
mode:
authorAndreas Fischer <bantu@phpbb.com>2011-06-19 17:58:44 +0200
committerAndreas Fischer <bantu@phpbb.com>2011-06-19 17:58:44 +0200
commitbd4a781c15724228786309968ff3c79cf6d24569 (patch)
tree33dba7e0a871e3e2d07b2fe1f53f6f9567dc876d /phpBB/includes/db
parentb2f5d5c876aa2115c6f5e8e7ad0630352d65ddda (diff)
parentee2d4f627ae5398dadf64288128e928bf05fc7af (diff)
downloadforums-bd4a781c15724228786309968ff3c79cf6d24569.tar
forums-bd4a781c15724228786309968ff3c79cf6d24569.tar.gz
forums-bd4a781c15724228786309968ff3c79cf6d24569.tar.bz2
forums-bd4a781c15724228786309968ff3c79cf6d24569.tar.xz
forums-bd4a781c15724228786309968ff3c79cf6d24569.zip
Merge branch 'develop-olympus' into develop
* develop-olympus: [ticket/10227] Allow persistent connections for mysqli with PHP 5.3.0+
Diffstat (limited to 'phpBB/includes/db')
-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 7c72fe9f01..cea8d2db0e 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 != '')