summaryrefslogtreecommitdiffstats
path: root/wp-inst
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2005-08-15 10:58:02 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2005-08-15 10:58:02 +0000
commit83cb62b69d9052714b384eaa261c48b9d836458f (patch)
tree28d4bd14214f3b9656b737b5135e4a4a36b065e8 /wp-inst
parente6b38d5bb77bd7495b3513ebfd3679ee1dd79996 (diff)
downloadwordpress-mu-83cb62b69d9052714b384eaa261c48b9d836458f.tar.gz
wordpress-mu-83cb62b69d9052714b384eaa261c48b9d836458f.tar.xz
wordpress-mu-83cb62b69d9052714b384eaa261c48b9d836458f.zip
Added vars to make debugging easier in a multi-db env.
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@188 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-inst')
-rw-r--r--wp-inst/wp-includes/wp-db.php8
1 files changed, 8 insertions, 0 deletions
diff --git a/wp-inst/wp-includes/wp-db.php b/wp-inst/wp-includes/wp-db.php
index 46fcde2..38125de 100644
--- a/wp-inst/wp-includes/wp-db.php
+++ b/wp-inst/wp-includes/wp-db.php
@@ -139,12 +139,15 @@ class wpdb {
if( $this->blogs != '' && preg_match("/(" . $this->blogs . "|" . $this->users . "|" . $this->usermeta . "|" . $this->site . "|" . $this->sitemeta . "|" . $this->sitecategories . ")/i",$query) ) {
$action = 'global';
$details = $global_db_list[ mt_rand( 0, count( $global_db_list ) -1 ) ];
+ $this->db_global = $details;
} elseif ( preg_match("/^\\s*(insert|delete|update|replace) /i",$query) ) {
$action = 'write';
$details = $db_list[ 'write' ][ mt_rand( 0, count( $db_list[ 'write' ] ) -1 ) ];
+ $this->db_write = $details;
} else {
$action = '';
$details = $db_list[ 'read' ][ mt_rand( 0, count( $db_list[ 'read' ] ) -1 ) ];
+ $this->db_read = $details;
}
$dbhname = "dbh" . $action;
@@ -184,22 +187,27 @@ class wpdb {
// use $this->dbh for read ops, and $this->dbhwrite for write ops
// use $this->dbhglobal for gloal table ops
+ unset( $dbh );
if( defined( "WP_USE_MULTIPLE_DB" ) && CONSTANT( "WP_USE_MULTIPLE_DB" ) == true ) {
if( $this->blogs != '' && preg_match("/(" . $this->blogs . "|" . $this->users . "|" . $this->usermeta . "|" . $this->site . "|" . $this->sitemeta . "|" . $this->sitecategories . ")/i",$query) ) {
if( false == isset( $this->dbhglobal ) ) {
$this->db_connect( $query );
}
$dbh =& $this->dbhglobal;
+ $this->last_db_used = "global";
} elseif ( preg_match("/^\\s*(alter table|create|insert|delete|update|replace) /i",$query) ) {
if( false == isset( $this->dbhwrite ) ) {
$this->db_connect( $query );
}
$dbh =& $this->dbhwrite;
+ $this->last_db_used = "write";
} else {
$dbh =& $this->dbh;
+ $this->last_db_used = "read";
}
} else {
$dbh =& $this->dbh;
+ $this->last_db_used = "other/read";
}
$this->result = @mysql_query($query, $dbh);