From 301dc6dbf0415edbd8a5870fd5fd36c3d115991e Mon Sep 17 00:00:00 2001 From: wpmuguru Date: Wed, 27 Jan 2010 00:20:10 +0000 Subject: [PATCH] allow initial site_id to be assigned by MySQL, fixes #12021 git-svn-id: http://svn.automattic.com/wordpress/trunk@12862 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/schema.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/wp-admin/includes/schema.php b/wp-admin/includes/schema.php index aedd5d3a18..8ae0ef1814 100644 --- a/wp-admin/includes/schema.php +++ b/wp-admin/includes/schema.php @@ -645,11 +645,17 @@ function populate_network( $network_id = 1, $domain = '', $email = '', $site_nam else $allowed_themes = array( $stylesheet => true ); + if ( $network_id == 1 ) + $wpdb->query( $wpdb->prepare( "INSERT INTO ".$wpdb->site." ( id, domain, path ) VALUES ( NULL, %s, %s )", $domain, $path ) ); + else + $wpdb->query( $wpdb->prepare( "INSERT INTO ".$wpdb->site." ( id, domain, path ) VALUES ( %d, %s, %s )", $network_id, $domain, $path ) ); + + $network_id = $wpdb->insert_id; + $wpdb->query( $wpdb->prepare( "INSERT INTO ".$wpdb->sitemeta." (meta_id, site_id, meta_key, meta_value) VALUES (NULL, %d, 'site_name', %s)", $network_id, $site_name ) ); $wpdb->query( $wpdb->prepare( "INSERT INTO ".$wpdb->sitemeta." (meta_id, site_id, meta_key, meta_value) VALUES (NULL, %d, 'admin_email', %s)", $network_id, $site_user->user_email ) ); $wpdb->query( $wpdb->prepare( "INSERT INTO ".$wpdb->sitemeta." (meta_id, site_id, meta_key, meta_value) VALUES (NULL, %d, 'admin_user_id', %d)", $network_id, $site_user->ID ) ); $wpdb->query( $wpdb->prepare( "INSERT INTO ".$wpdb->sitemeta." (meta_id, site_id, meta_key, meta_value) VALUES (NULL, %d, 'registration', 'none')", $network_id ) ); - $wpdb->query( $wpdb->prepare( "INSERT INTO ".$wpdb->site." ( id, domain, path ) VALUES ( %d, %s, %s )", $network_id, $domain, $path ) ); if ( !is_multisite() ) { $wpdb->query( "INSERT INTO " . $wpdb->sitecategories . " ( cat_ID, cat_name, category_nicename, last_updated ) VALUES (1, 'Uncategorized', 'uncategorized', NOW())" ); $wpdb->query( "INSERT INTO " . $wpdb->sitecategories . " ( cat_ID, cat_name, category_nicename, last_updated ) VALUES (2, 'Blogroll', 'blogroll', NOW())" );