summaryrefslogtreecommitdiffstats
path: root/wp-includes
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2008-06-05 17:01:06 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2008-06-05 17:01:06 +0000
commitea7e2672ca23b81d1f79f60e077929433fe9ae77 (patch)
tree7f8b75d36ff75301d0cb28ad361b38a2ea1fb746 /wp-includes
parent166dbfef77ed975acc7b722279be0c0c96e2d039 (diff)
downloadwordpress-mu-ea7e2672ca23b81d1f79f60e077929433fe9ae77.tar.gz
wordpress-mu-ea7e2672ca23b81d1f79f60e077929433fe9ae77.tar.xz
wordpress-mu-ea7e2672ca23b81d1f79f60e077929433fe9ae77.zip
Cleanup init process
Initialize the object cache sooner so sunrise.php can use it. git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@1322 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-includes')
-rw-r--r--wp-includes/wp-db.php35
1 files changed, 25 insertions, 10 deletions
diff --git a/wp-includes/wp-db.php b/wp-includes/wp-db.php
index bbef0cf..b7fb414 100644
--- a/wp-includes/wp-db.php
+++ b/wp-includes/wp-db.php
@@ -25,26 +25,35 @@ class wpdb {
var $queries;
var $prefix = '';
var $ready = false;
+ var $blogid = 0;
+ var $siteid = 0;
+
+ // Global tables
+ var $blogs;
+ var $signups;
+ var $site;
+ var $sitemeta;
+ var $users;
+ var $usermeta;
+ var $sitecategories;
+ var $global_tables = array('blogs', 'signups', 'site', 'sitemeta', 'users', 'usermeta', 'sitecategories', 'registration_log', 'blog_versions');
- // Our tables
+ // Blog tables
var $posts;
- var $users;
var $categories;
var $post2cat;
var $comments;
var $links;
var $options;
var $postmeta;
- var $usermeta;
var $terms;
var $term_taxonomy;
var $term_relationships;
- var $tables = array('users', 'usermeta', 'posts', 'categories', 'post2cat', 'comments', 'links', 'link2cat', 'options',
+ var $blog_tables = array('posts', 'categories', 'post2cat', 'comments', 'links', 'link2cat', 'options',
'postmeta', 'terms', 'term_taxonomy', 'term_relationships');
+
var $charset;
var $collate;
- var $blog_tables = array('posts', 'categories', 'post2cat', 'comments', 'links', 'link2cat', 'options', 'postmeta', 'terms', 'term_taxonomy', 'term_relationships');
-
/**
* Connects to the database server and selects a database
@@ -106,14 +115,20 @@ class wpdb {
}
function set_prefix($prefix) {
-
if ( preg_match('|[^a-z0-9_]|i', $prefix) )
return new WP_Error('invalid_db_prefix', 'Invalid database prefix'); // No gettext here
- $old_prefix = $this->prefix;
- $this->prefix = $prefix;
+ $old_prefix = $this->base_prefix;
+ $this->base_prefix = $prefix;
+ foreach ( $this->global_tables as $table )
+ $this->$table = $prefix . $table;
+
+ if ( empty($this->blogid) )
+ return $old_prefix;
- foreach ( $this->tables as $table )
+ $this->prefix = $this->base_prefix . $this->blogid . '_';
+
+ foreach ( $this->blog_tables as $table )
$this->$table = $this->prefix . $table;
if ( defined('CUSTOM_USER_TABLE') )