aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/db/mysql.php
diff options
context:
space:
mode:
authorOleg Pudeyev <oleg@bsdpower.com>2011-03-09 21:50:45 -0500
committerOleg Pudeyev <oleg@bsdpower.com>2012-12-04 04:40:47 -0500
commit025a95ea909d449e14cb22564983fb005e3f8c06 (patch)
tree947ee8343372097550dc0b622b6ef959be38020d /phpBB/includes/db/mysql.php
parente64c5117b9748208a87df80aff6012f3aae573ad (diff)
downloadforums-025a95ea909d449e14cb22564983fb005e3f8c06.tar
forums-025a95ea909d449e14cb22564983fb005e3f8c06.tar.gz
forums-025a95ea909d449e14cb22564983fb005e3f8c06.tar.bz2
forums-025a95ea909d449e14cb22564983fb005e3f8c06.tar.xz
forums-025a95ea909d449e14cb22564983fb005e3f8c06.zip
[ticket/10205] Account for potentially missing extensions in dbal.
PHPBB3-10205
Diffstat (limited to 'phpBB/includes/db/mysql.php')
-rw-r--r--phpBB/includes/db/mysql.php20
1 files changed, 19 insertions, 1 deletions
diff --git a/phpBB/includes/db/mysql.php b/phpBB/includes/db/mysql.php
index 1ccb785150..ae36fe6425 100644
--- a/phpBB/includes/db/mysql.php
+++ b/phpBB/includes/db/mysql.php
@@ -30,6 +30,7 @@ include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx);
class dbal_mysql extends dbal
{
var $multi_insert = true;
+ var $connect_error = '';
/**
* Connect to server
@@ -44,7 +45,24 @@ class dbal_mysql extends dbal
$this->sql_layer = 'mysql4';
- $this->db_connect_id = ($this->persistency) ? @mysql_pconnect($this->server, $this->user, $sqlpassword) : @mysql_connect($this->server, $this->user, $sqlpassword, $new_link);
+ if ($this->persistency)
+ {
+ if (!function_exists('mysql_pconnect'))
+ {
+ $this->connect_error = 'mysql_pconnect function does not exist, is mysql extension installed?';
+ return $this->sql_error('');
+ }
+ $this->db_connect_id = @mysql_pconnect($this->server, $this->user, $sqlpassword);
+ }
+ else
+ {
+ if (!function_exists('mysql_connect'))
+ {
+ $this->connect_error = 'mysql_connect function does not exist, is mysql extension installed?';
+ return $this->sql_error('');
+ }
+ $this->db_connect_id = @mysql_connect($this->server, $this->user, $sqlpassword, $new_link);
+ }
if ($this->db_connect_id && $this->dbname != '')
{