summaryrefslogtreecommitdiffstats
path: root/wp-inst/wp-includes/wp-db.php
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2005-07-28 10:50:22 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2005-07-28 10:50:22 +0000
commit08faf4ef353fb54bdc14e1f76303f936db044c62 (patch)
treeae3d464ecf1b12fe552271f15d9c3e7857f65018 /wp-inst/wp-includes/wp-db.php
parent270edeef3812203262052eb70a544a9956f4f9fb (diff)
Separate requests to global and blog tables.
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@82 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-inst/wp-includes/wp-db.php')
-rw-r--r--wp-inst/wp-includes/wp-db.php11
1 files changed, 9 insertions, 2 deletions
diff --git a/wp-inst/wp-includes/wp-db.php b/wp-inst/wp-includes/wp-db.php
index b380562..c23b90c 100644
--- a/wp-inst/wp-includes/wp-db.php
+++ b/wp-inst/wp-includes/wp-db.php
@@ -139,7 +139,10 @@ class wpdb {
if( is_array( $db_list ) == false )
return true;
- if ( preg_match("/^\\s*(insert|delete|update|replace) /i",$query) ) {
+ if ( preg_match("/^\\s*(" . $wpdb->blogs . "|" . $wpdb->users . "|" . $wpdb->usermeta . "|" . $wpdb->site . "|" . $wpdb->sitemeta . "|" . $wpdb->sitecategories . ") /i",$query) ) {
+ $action = 'global';
+ $details = $global_db_list[ mt_rand( 0, count( $global_db_list ) -1 ) ];
+ } elseif ( preg_match("/^\\s*(insert|delete|update|replace) /i",$query) ) {
$action = 'write';
$details = $db_list[ 'write' ][ mt_rand( 0, count( $db_list[ 'write' ] ) -1 ) ];
} else {
@@ -183,8 +186,12 @@ class wpdb {
$this->timer_start();
// use $this->dbh for read ops, and $this->dbhwrite for write ops
+ // use $this->dbhglobal for gloal table ops
if( defined( "WP_USE_MULTIPLE_DB" ) && CONSTANT( "WP_USE_MULTIPLE_DB" ) == true ) {
- if ( preg_match("/^\\s*(insert|delete|update|replace) /i",$query) ) {
+ if ( preg_match("/^\\s*(" . $wpdb->blogs . "|" . $wpdb->users . "|" . $wpdb->usermeta . "|" . $wpdb->site . "|" . $wpdb->sitemeta . "|" . $wpdb->sitecategories . ") /i",$query) ) {
+ $this->db_connect( $query );
+ $dbh =& $this->dbhglobal;
+ } elseif ( preg_match("/^\\s*(insert|delete|update|replace) /i",$query) ) {
$this->db_connect( $query );
$dbh =& $this->dbhwrite;
} else {