Skip to content

Commit 69c0702

Browse files
committed
Allow multiple db instances. Props Nazgul. fixes WordPress#2722
git-svn-id: https://develop.svn.wordpress.org/trunk@6701 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 479e812 commit 69c0702

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

wp-includes/wp-db.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ function __construct($dbuser, $dbpassword, $dbname, $dbhost) {
6464
if ( defined('DB_COLLATE') )
6565
$this->collate = DB_COLLATE;
6666

67-
$this->dbh = @mysql_connect($dbhost, $dbuser, $dbpassword);
67+
$this->dbh = @mysql_connect($dbhost, $dbuser, $dbpassword, true);
6868
if (!$this->dbh) {
6969
$this->bail("
7070
<h1>Error establishing a database connection</h1>
@@ -81,7 +81,7 @@ function __construct($dbuser, $dbpassword, $dbname, $dbhost) {
8181

8282
$this->ready = true;
8383

84-
if ( !empty($this->charset) && version_compare(mysql_get_server_info(), '4.1.0', '>=') )
84+
if ( !empty($this->charset) && version_compare(mysql_get_server_info($this->dbh), '4.1.0', '>=') )
8585
$this->query("SET NAMES '$this->charset'");
8686

8787
$this->select($dbname);
@@ -493,7 +493,7 @@ function check_database_version()
493493
{
494494
global $wp_version;
495495
// Make sure the server has MySQL 4.0
496-
$mysql_version = preg_replace('|[^0-9\.]|', '', @mysql_get_server_info());
496+
$mysql_version = preg_replace('|[^0-9\.]|', '', @mysql_get_server_info($this->dbh));
497497
if ( version_compare($mysql_version, '4.0.0', '<') )
498498
return new WP_Error('database_version',sprintf(__('<strong>ERROR</strong>: WordPress %s requires MySQL 4.0.0 or higher'), $wp_version));
499499
}
@@ -504,7 +504,7 @@ function check_database_version()
504504
*/
505505
function supports_collation()
506506
{
507-
return ( version_compare(mysql_get_server_info(), '4.1.0', '>=') );
507+
return ( version_compare(mysql_get_server_info($this->dbh), '4.1.0', '>=') );
508508
}
509509

510510
/**

0 commit comments

Comments
 (0)