Changeset 1322
- Timestamp:
- 06/05/08 17:01:06 (3 months ago)
- Files:
-
- trunk/wp-includes/wp-db.php (modified) (3 diffs)
- trunk/wp-settings.php (modified) (3 diffs)
- trunk/wpmu-settings.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/wp-includes/wp-db.php
r1290 r1322 26 26 var $prefix = ''; 27 27 var $ready = false; 28 29 // Our tables 28 var $blogid = 0; 29 var $siteid = 0; 30 31 // Global tables 32 var $blogs; 33 var $signups; 34 var $site; 35 var $sitemeta; 36 var $users; 37 var $usermeta; 38 var $sitecategories; 39 var $global_tables = array('blogs', 'signups', 'site', 'sitemeta', 'users', 'usermeta', 'sitecategories', 'registration_log', 'blog_versions'); 40 41 // Blog tables 30 42 var $posts; 31 var $users;32 43 var $categories; 33 44 var $post2cat; … … 36 47 var $options; 37 48 var $postmeta; 38 var $usermeta;39 49 var $terms; 40 50 var $term_taxonomy; 41 51 var $term_relationships; 42 var $ tables = array('users', 'usermeta','posts', 'categories', 'post2cat', 'comments', 'links', 'link2cat', 'options',52 var $blog_tables = array('posts', 'categories', 'post2cat', 'comments', 'links', 'link2cat', 'options', 43 53 'postmeta', 'terms', 'term_taxonomy', 'term_relationships'); 54 44 55 var $charset; 45 56 var $collate; 46 var $blog_tables = array('posts', 'categories', 'post2cat', 'comments', 'links', 'link2cat', 'options', 'postmeta', 'terms', 'term_taxonomy', 'term_relationships');47 48 57 49 58 /** … … 107 116 108 117 function set_prefix($prefix) { 109 110 118 if ( preg_match('|[^a-z0-9_]|i', $prefix) ) 111 119 return new WP_Error('invalid_db_prefix', 'Invalid database prefix'); // No gettext here 112 120 113 $old_prefix = $this->prefix; 114 $this->prefix = $prefix; 115 116 foreach ( $this->tables as $table ) 121 $old_prefix = $this->base_prefix; 122 $this->base_prefix = $prefix; 123 foreach ( $this->global_tables as $table ) 124 $this->$table = $prefix . $table; 125 126 if ( empty($this->blogid) ) 127 return $old_prefix; 128 129 $this->prefix = $this->base_prefix . $this->blogid . '_'; 130 131 foreach ( $this->blog_tables as $table ) 117 132 $this->$table = $this->prefix . $table; 118 133 trunk/wp-settings.php
r1297 r1322 202 202 require (ABSPATH . WPINC . '/compat.php'); 203 203 require (ABSPATH . WPINC . '/functions.php'); 204 require (ABSPATH . WPINC . '/classes.php');205 204 206 205 require_wp_db(); 207 206 $wpdb->set_prefix($table_prefix); // set up global tables 208 207 if ( !empty($wpdb->error) ) 209 208 dead_db(); 210 209 211 $prefix = $wpdb->set_prefix($table_prefix); 212 213 if ( is_wp_error($prefix) ) 214 wp_die('<strong>ERROR</strong>: <code>$table_prefix</code> in <code>wp-config.php</code> can only contain numbers, letters, and underscores.'); 215 // Table names. prefix is bare "wp_" 216 $wpdb->blogs = $wpdb->prefix . 'blogs'; 217 $wpdb->site = $wpdb->prefix . 'site'; 218 $wpdb->sitemeta = $wpdb->prefix . 'sitemeta'; 219 $wpdb->sitecategories = $wpdb->prefix . 'sitecategories'; 220 $wpdb->signups = $wpdb->prefix . 'signups'; 221 $wpdb->registration_log = $wpdb->prefix . 'registration_log'; 222 $wpdb->blog_versions = $wpdb->prefix . 'blog_versions'; 210 if ( !defined( 'WP_INSTALLING' ) && file_exists(ABSPATH . 'wp-content/object-cache.php') ) 211 require_once (ABSPATH . 'wp-content/object-cache.php'); 212 else 213 require_once (ABSPATH . WPINC . '/cache.php'); 214 215 wp_cache_init(); 223 216 224 217 if( defined( 'SUNRISE' ) ) … … 226 219 227 220 require_once ( ABSPATH . 'wpmu-settings.php' ); 228 $prefix = $table_prefix; 229 $wpdb->prefix = $table_prefix; // prefix now includes a blog_id 230 $wpdb->posts = $wpdb->prefix . 'posts'; 231 $wpdb->categories = $wpdb->prefix . 'categories'; 232 $wpdb->post2cat = $wpdb->prefix . 'post2cat'; 233 $wpdb->comments = $wpdb->prefix . 'comments'; 234 $wpdb->link2cat = $wpdb->prefix . 'link2cat'; 235 $wpdb->links = $wpdb->prefix . 'links'; 236 $wpdb->linkcategories = $wpdb->prefix . 'linkcategories'; 237 $wpdb->options = $wpdb->prefix . 'options'; 238 $wpdb->postmeta = $wpdb->prefix . 'postmeta'; 239 $wpdb->terms = $wpdb->prefix . 'terms'; 240 $wpdb->term_taxonomy = $wpdb->prefix . 'term_taxonomy'; 241 $wpdb->term_relationships = $wpdb->prefix . 'term_relationships'; 221 $wpdb->blogid = $current_blog->blog_id; 242 222 $wpdb->siteid = $current_blog->site_id; 243 $wpdb->blogid = $current_blog->blog_id; 244 223 $wpdb->set_prefix($table_prefix); // set up blog tables 224 $table_prefix = $table_prefix . $blog_id . '_'; 225 226 wp_cache_init(); // need to init cache again after blog_id is set 245 227 if ( defined('CUSTOM_USER_TABLE') ) 246 228 $wpdb->users = CUSTOM_USER_TABLE; … … 248 230 $wpdb->usermeta = CUSTOM_USER_META_TABLE; 249 231 250 if ( !defined( 'WP_INSTALLING' ) && file_exists(ABSPATH . 'wp-content/object-cache.php') )251 require_once (ABSPATH . 'wp-content/object-cache.php');252 else253 require_once (ABSPATH . WPINC . '/cache.php');254 255 wp_cache_init();256 257 232 if( !defined( "UPLOADS" ) ) 258 233 define( "UPLOADS", "wp-content/blogs.dir/{$wpdb->blogid}/files/" ); 259 234 235 if( defined( "SHORTINIT" ) && constant( "SHORTINIT" ) == true ) // stop most of WP being loaded, we just want the basics 236 return; 237 238 require (ABSPATH . WPINC . '/classes.php'); 260 239 require (ABSPATH . WPINC . '/plugin.php'); 261 240 require (ABSPATH . WPINC . '/default-filters.php'); 262 263 if( defined( "SHORTINIT" ) && constant( "SHORTINIT" ) == true ) // stop most of WP being loaded, we just want the basics264 return;265 266 241 include_once(ABSPATH . WPINC . '/streams.php'); 267 242 include_once(ABSPATH . WPINC . '/gettext.php'); trunk/wpmu-settings.php
r1274 r1322 5 5 // depreciated 6 6 $wpmuBaseTablePrefix = $table_prefix; 7 $wpdb->base_prefix = $table_prefix;8 7 9 8 $domain = addslashes( $_SERVER['HTTP_HOST'] ); … … 209 208 } 210 209 211 $table_prefix = $table_prefix . $blog_id . '_';212 213 210 ?>
