From 7aa43e9c8b8b229a5947ca50d4dc04e2a9f89c7d Mon Sep 17 00:00:00 2001 From: nacin Date: Tue, 23 Feb 2010 19:58:53 +0000 Subject: [PATCH] Ensure we have MS global tables defined during network install. See #11644 git-svn-id: http://svn.automattic.com/wordpress/trunk@13337 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/network.php | 4 ++++ wp-includes/wp-db.php | 8 +++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/wp-admin/network.php b/wp-admin/network.php index 66e40c2a52..3e0200c8a4 100644 --- a/wp-admin/network.php +++ b/wp-admin/network.php @@ -16,6 +16,10 @@ require_once( './admin.php' ); if ( ! is_super_admin() ) wp_die( __( 'You do not have sufficient permissions to manage options for this blog.' ) ); +// We need to create references to ms global tables to enable Network. +foreach ( $wpdb->tables( 'ms_global' ) as $table => $prefixed_table ) + $wpdb->$table = $prefixed_table; + $title = __( 'Network Settings' ); $parent_file = 'tools.php'; diff --git a/wp-includes/wp-db.php b/wp-includes/wp-db.php index 02d206c362..db252f5d64 100644 --- a/wp-includes/wp-db.php +++ b/wp-includes/wp-db.php @@ -625,13 +625,12 @@ class wpdb { * @uses wpdb::ms_global_tables * @uses is_multisite() * - * @param string $scope Can be all, global, blog, or old tables. Default all. + * @param string $scope Can be all, global, ms_global, blog, or old tables. Default all. * All returns the blog tables for the queried blog and all global tables. * @param bool $prefix Whether to include table prefixes. Default true. If blog * prefix is requested, then the custom users and usermeta tables will be mapped. * @param int $blog_id The blog_id to prefix. Defaults to main blog. Used only when prefix is requested. - * @return array Table names. When a prefix is requested, the key is the - * unprefixed table name. + * @return array Table names. When a prefix is requested, the key is the unprefixed table name. */ function tables( $scope = 'all', $prefix = true, $blog_id = 0 ) { switch ( $scope ) { @@ -641,6 +640,9 @@ class wpdb { case 'blog' : $tables = $this->tables; break; + case 'ms_global' : + $tables = $this->ms_global_tables; + break; case 'global' : $tables = $this->global_tables; if ( is_multisite() )