Ticket #12028: 12028.3.diff
File 12028.3.diff, 13.4 KB (added by , 13 years ago) |
---|
-
wp-includes/l10n.php
382 382 383 383 load_textdomain( 'default', WP_LANG_DIR . "/$locale.mo" ); 384 384 385 if ( is_multisite() || ( defined( 'WP_ NETWORK_ADMIN_PAGE' ) && WP_NETWORK_ADMIN_PAGE) ) {385 if ( is_multisite() || ( defined( 'WP_INSTALLING_NETWORK' ) && WP_INSTALLING_NETWORK ) ) { 386 386 load_textdomain( 'default', WP_LANG_DIR . "/ms-$locale.mo" ); 387 387 } 388 388 } -
wp-includes/ms-functions.php
1172 1172 $url = get_blogaddress_by_id($blog_id); 1173 1173 1174 1174 // Set everything up 1175 make_db_current_silent( );1175 make_db_current_silent( 'blog' ); 1176 1176 populate_options(); 1177 1177 populate_roles(); 1178 1178 $wp_roles->_init(); -
wp-admin/network.php
10 10 * @subpackage Administration 11 11 */ 12 12 13 define( 'WP_ NETWORK_ADMIN_PAGE', true );13 define( 'WP_INSTALLING_NETWORK', true ); 14 14 15 15 /** WordPress Administration Bootstrap */ 16 16 require_once( './admin.php' ); -
wp-admin/includes/upgrade.php
1424 1424 * @param unknown_type $execute 1425 1425 * @return unknown 1426 1426 */ 1427 function dbDelta( $queries, $execute = true) {1427 function dbDelta( $queries = '', $execute = true ) { 1428 1428 global $wpdb; 1429 1429 1430 if ( empty( $queries ) ) 1431 $queries = wp_get_db_schema( 'all' ); 1432 elseif ( 'all' == $queries ) 1433 $queries = wp_get_db_schema( 'all' ); 1434 elseif ( 'blog' == $queries ) 1435 $queries = wp_get_db_schema( 'blog' ); 1436 elseif ( 'global' == $queries ) 1437 $queries = wp_get_db_schema( 'global' ); 1438 elseif ( 'ms' == $queries ) 1439 $queries = wp_get_db_schema( 'ms' ); 1440 1430 1441 // Separate individual queries into an array 1431 1442 if ( !is_array($queries) ) { 1432 1443 $queries = explode( ';', $queries ); … … 1631 1642 * 1632 1643 * @since 1.5.0 1633 1644 */ 1634 function make_db_current() { 1635 global $wp_queries; 1636 1637 $alterations = dbDelta($wp_queries); 1645 function make_db_current( $tables = 'all' ) { 1646 $alterations = dbDelta( $tables ); 1638 1647 echo "<ol>\n"; 1639 1648 foreach($alterations as $alteration) echo "<li>$alteration</li>\n"; 1640 1649 echo "</ol>\n"; … … 1647 1656 * 1648 1657 * @since 1.5.0 1649 1658 */ 1650 function make_db_current_silent() { 1651 global $wp_queries; 1652 1653 $alterations = dbDelta($wp_queries); 1659 function make_db_current_silent( $tables = 'all' ) { 1660 $alterations = dbDelta( $tables ); 1654 1661 } 1655 1662 1656 1663 /** … … 1933 1940 } 1934 1941 1935 1942 /** 1936 * Install Network.1937 *1938 * @since 3.0.01939 *1940 */1941 if ( !function_exists( 'install_network' ) ) :1942 function install_network() {1943 global $wpdb, $charset_collate;1944 $ms_queries = "1945 CREATE TABLE $wpdb->users (1946 ID bigint(20) unsigned NOT NULL auto_increment,1947 user_login varchar(60) NOT NULL default '',1948 user_pass varchar(64) NOT NULL default '',1949 user_nicename varchar(50) NOT NULL default '',1950 user_email varchar(100) NOT NULL default '',1951 user_url varchar(100) NOT NULL default '',1952 user_registered datetime NOT NULL default '0000-00-00 00:00:00',1953 user_activation_key varchar(60) NOT NULL default '',1954 user_status int(11) NOT NULL default '0',1955 display_name varchar(250) NOT NULL default '',1956 spam tinyint(2) NOT NULL default '0',1957 deleted tinyint(2) NOT NULL default '0',1958 PRIMARY KEY (ID),1959 KEY user_login_key (user_login),1960 KEY user_nicename (user_nicename)1961 ) $charset_collate;1962 CREATE TABLE $wpdb->blogs (1963 blog_id bigint(20) NOT NULL auto_increment,1964 site_id bigint(20) NOT NULL default '0',1965 domain varchar(200) NOT NULL default '',1966 path varchar(100) NOT NULL default '',1967 registered datetime NOT NULL default '0000-00-00 00:00:00',1968 last_updated datetime NOT NULL default '0000-00-00 00:00:00',1969 public tinyint(2) NOT NULL default '1',1970 archived enum('0','1') NOT NULL default '0',1971 mature tinyint(2) NOT NULL default '0',1972 spam tinyint(2) NOT NULL default '0',1973 deleted tinyint(2) NOT NULL default '0',1974 lang_id int(11) NOT NULL default '0',1975 PRIMARY KEY (blog_id),1976 KEY domain (domain(50),path(5)),1977 KEY lang_id (lang_id)1978 ) $charset_collate;1979 CREATE TABLE $wpdb->blog_versions (1980 blog_id bigint(20) NOT NULL default '0',1981 db_version varchar(20) NOT NULL default '',1982 last_updated datetime NOT NULL default '0000-00-00 00:00:00',1983 PRIMARY KEY (blog_id),1984 KEY db_version (db_version)1985 ) $charset_collate;1986 CREATE TABLE $wpdb->registration_log (1987 ID bigint(20) NOT NULL auto_increment,1988 email varchar(255) NOT NULL default '',1989 IP varchar(30) NOT NULL default '',1990 blog_id bigint(20) NOT NULL default '0',1991 date_registered datetime NOT NULL default '0000-00-00 00:00:00',1992 PRIMARY KEY (ID),1993 KEY IP (IP)1994 ) $charset_collate;1995 CREATE TABLE $wpdb->site (1996 id bigint(20) NOT NULL auto_increment,1997 domain varchar(200) NOT NULL default '',1998 path varchar(100) NOT NULL default '',1999 PRIMARY KEY (id),2000 KEY domain (domain,path)2001 ) $charset_collate;2002 CREATE TABLE $wpdb->sitemeta (2003 meta_id bigint(20) NOT NULL auto_increment,2004 site_id bigint(20) NOT NULL default '0',2005 meta_key varchar(255) default NULL,2006 meta_value longtext,2007 PRIMARY KEY (meta_id),2008 KEY meta_key (meta_key),2009 KEY site_id (site_id)2010 ) $charset_collate;2011 CREATE TABLE $wpdb->signups (2012 domain varchar(200) NOT NULL default '',2013 path varchar(100) NOT NULL default '',2014 title longtext NOT NULL,2015 user_login varchar(60) NOT NULL default '',2016 user_email varchar(100) NOT NULL default '',2017 registered datetime NOT NULL default '0000-00-00 00:00:00',2018 activated datetime NOT NULL default '0000-00-00 00:00:00',2019 active tinyint(1) NOT NULL default '0',2020 activation_key varchar(50) NOT NULL default '',2021 meta longtext,2022 KEY activation_key (activation_key),2023 KEY domain (domain)2024 ) $charset_collate;2025 ";2026 // now create tables2027 dbDelta( $ms_queries );2028 }2029 endif;2030 2031 /**2032 1943 * Install global terms. 2033 1944 * 2034 1945 * @since 3.0.0 -
wp-admin/includes/schema.php
8 8 * @subpackage Administration 9 9 */ 10 10 11 // Declare these as global in case schema.php is included from a function. 12 global $wpdb, $wp_queries; 13 11 14 /** 12 * The database character collate. 13 * @var string 14 * @global string 15 * @name $charset_collate 15 * Retrieve the SQL for creating database tables. 16 * 17 * @since 3.3.0 18 * 19 * @param string $scope Optional. The tables for which to retrieve SQL. Can be all, global, ms_global, or blog tables. Defaults to all. 20 * @param int $blog_id Optional. The blog ID for which to retrieve SQL. Default is the current blog ID. 21 * @return string The SQL needed to create the requested tables. 16 22 */ 17 $charset_collate = ''; 23 function wp_get_db_schema( $scope = 'all', $blog_id = null ) { 24 global $wpdb; 18 25 19 // Declare these as global in case schema.php is included from a function. 20 global $wpdb, $wp_queries; 26 if ( ! empty($wpdb->charset) ) 27 $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset"; 28 if ( ! empty($wpdb->collate) ) 29 $charset_collate .= " COLLATE $wpdb->collate"; 21 30 22 if ( ! empty($wpdb->charset) ) 23 $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset"; 24 if ( ! empty($wpdb->collate) ) 25 $charset_collate .= " COLLATE $wpdb->collate"; 31 if ( $blog_id && $blog_id != $wpdb->blogid ) 32 $old_blog_id = $wpdb->set_blog_id( $blog_id ); 26 33 27 /** Create WordPress database tables SQL */ 28 $wp_queries = "CREATE TABLE $wpdb->terms ( 34 // Engage multisite if in the middle of turning it on from network.php. 35 $is_multisite = is_multisite() || ( defined( 'WP_INSTALLING_NETWORK' ) && WP_INSTALLING_NETWORK ); 36 37 // Blog specific tables. 38 $blog_tables = "CREATE TABLE $wpdb->terms ( 29 39 term_id bigint(20) unsigned NOT NULL auto_increment, 30 40 name varchar(200) NOT NULL default '', 31 41 slug varchar(200) NOT NULL default '', … … 148 158 KEY type_status_date (post_type,post_status,post_date,ID), 149 159 KEY post_parent (post_parent), 150 160 KEY post_author (post_author) 151 ) $charset_collate; 152 CREATE TABLE $wpdb->users ( 161 ) $charset_collate;\n"; 162 163 // Single site users table. The multisite flavor of the users table is handled below. 164 $users_single_table = "CREATE TABLE $wpdb->users ( 153 165 ID bigint(20) unsigned NOT NULL auto_increment, 154 166 user_login varchar(60) NOT NULL default '', 155 167 user_pass varchar(64) NOT NULL default '', … … 163 175 PRIMARY KEY (ID), 164 176 KEY user_login_key (user_login), 165 177 KEY user_nicename (user_nicename) 166 ) $charset_collate; 167 CREATE TABLE $wpdb->usermeta ( 178 ) $charset_collate;\n"; 179 180 // Multisite users table 181 $users_multi_table = "CREATE TABLE $wpdb->users ( 182 ID bigint(20) unsigned NOT NULL auto_increment, 183 user_login varchar(60) NOT NULL default '', 184 user_pass varchar(64) NOT NULL default '', 185 user_nicename varchar(50) NOT NULL default '', 186 user_email varchar(100) NOT NULL default '', 187 user_url varchar(100) NOT NULL default '', 188 user_registered datetime NOT NULL default '0000-00-00 00:00:00', 189 user_activation_key varchar(60) NOT NULL default '', 190 user_status int(11) NOT NULL default '0', 191 display_name varchar(250) NOT NULL default '', 192 spam tinyint(2) NOT NULL default '0', 193 deleted tinyint(2) NOT NULL default '0', 194 PRIMARY KEY (ID), 195 KEY user_login_key (user_login), 196 KEY user_nicename (user_nicename) 197 ) $charset_collate;\n"; 198 199 // usermeta 200 $usermeta_table = "CREATE TABLE $wpdb->usermeta ( 168 201 umeta_id bigint(20) unsigned NOT NULL auto_increment, 169 202 user_id bigint(20) unsigned NOT NULL default '0', 170 203 meta_key varchar(255) default NULL, … … 172 205 PRIMARY KEY (umeta_id), 173 206 KEY user_id (user_id), 174 207 KEY meta_key (meta_key) 208 ) $charset_collate;\n"; 209 210 // Global tables 211 if ( $is_multisite ) 212 $global_tables = $users_multi_table . $usermeta_table; 213 else 214 $global_tables = $users_single_table . $usermeta_table; 215 216 // Multisite global tables. 217 $ms_global_tables = "CREATE TABLE $wpdb->blogs ( 218 blog_id bigint(20) NOT NULL auto_increment, 219 site_id bigint(20) NOT NULL default '0', 220 domain varchar(200) NOT NULL default '', 221 path varchar(100) NOT NULL default '', 222 registered datetime NOT NULL default '0000-00-00 00:00:00', 223 last_updated datetime NOT NULL default '0000-00-00 00:00:00', 224 public tinyint(2) NOT NULL default '1', 225 archived enum('0','1') NOT NULL default '0', 226 mature tinyint(2) NOT NULL default '0', 227 spam tinyint(2) NOT NULL default '0', 228 deleted tinyint(2) NOT NULL default '0', 229 lang_id int(11) NOT NULL default '0', 230 PRIMARY KEY (blog_id), 231 KEY domain (domain(50),path(5)), 232 KEY lang_id (lang_id) 233 ) $charset_collate; 234 CREATE TABLE $wpdb->blog_versions ( 235 blog_id bigint(20) NOT NULL default '0', 236 db_version varchar(20) NOT NULL default '', 237 last_updated datetime NOT NULL default '0000-00-00 00:00:00', 238 PRIMARY KEY (blog_id), 239 KEY db_version (db_version) 240 ) $charset_collate; 241 CREATE TABLE $wpdb->registration_log ( 242 ID bigint(20) NOT NULL auto_increment, 243 email varchar(255) NOT NULL default '', 244 IP varchar(30) NOT NULL default '', 245 blog_id bigint(20) NOT NULL default '0', 246 date_registered datetime NOT NULL default '0000-00-00 00:00:00', 247 PRIMARY KEY (ID), 248 KEY IP (IP) 249 ) $charset_collate; 250 CREATE TABLE $wpdb->site ( 251 id bigint(20) NOT NULL auto_increment, 252 domain varchar(200) NOT NULL default '', 253 path varchar(100) NOT NULL default '', 254 PRIMARY KEY (id), 255 KEY domain (domain,path) 256 ) $charset_collate; 257 CREATE TABLE $wpdb->sitemeta ( 258 meta_id bigint(20) NOT NULL auto_increment, 259 site_id bigint(20) NOT NULL default '0', 260 meta_key varchar(255) default NULL, 261 meta_value longtext, 262 PRIMARY KEY (meta_id), 263 KEY meta_key (meta_key), 264 KEY site_id (site_id) 265 ) $charset_collate; 266 CREATE TABLE $wpdb->signups ( 267 domain varchar(200) NOT NULL default '', 268 path varchar(100) NOT NULL default '', 269 title longtext NOT NULL, 270 user_login varchar(60) NOT NULL default '', 271 user_email varchar(100) NOT NULL default '', 272 registered datetime NOT NULL default '0000-00-00 00:00:00', 273 activated datetime NOT NULL default '0000-00-00 00:00:00', 274 active tinyint(1) NOT NULL default '0', 275 activation_key varchar(50) NOT NULL default '', 276 meta longtext, 277 KEY activation_key (activation_key), 278 KEY domain (domain) 175 279 ) $charset_collate;"; 176 280 281 switch ( $scope ) { 282 case 'blog' : 283 $queries = $blog_tables; 284 break; 285 case 'global' : 286 $queries = $global_tables; 287 if ( $is_multisite ) 288 $queries .= $ms_global_tables; 289 break; 290 case 'ms_global' : 291 $queries = $ms_global_tables; 292 break; 293 default: 294 case 'all' : 295 $queries = $global_tables . $blog_tables; 296 if ( $is_multisite ) 297 $queries .= $ms_global_tables; 298 break; 299 } 300 301 if ( isset( $old_blog_id ) ) 302 $wpdb->set_blog_id( $old_blog_id ); 303 304 return $queries; 305 } 306 307 // Populate for back compat. 308 $wp_queries = wp_get_db_schema( 'all' ); 309 177 310 /** 178 311 * Create WordPress options and set the default values. 179 312 * … … 624 757 } 625 758 626 759 /** 760 * Install Network. 761 * 762 * @since 3.0.0 763 * 764 */ 765 if ( !function_exists( 'install_network' ) ) : 766 function install_network() { 767 if ( ! defined( 'WP_INSTALLING_NETWORK' ) ) 768 define( 'WP_INSTALLING_NETWORK', true ); 769 770 dbDelta( wp_get_db_schema( 'global' ) ); 771 } 772 endif; 773 774 /** 627 775 * populate network settings 628 776 * 629 777 * @since 3.0.0