mirror of
https://github.com/WordPress/WordPress.git
synced 2024-09-29 23:57:41 +02:00
In populate_network(), distinguish between upgrading from single to multisite and creating a new network in an existing multisite environment. When creating a new network steps related to setting up the main site must be skipped since the main site is created after populate_network() runs. Further, the global should not be modified since populating a new network does not involve switching to that network and making it current. fixes #22090
git-svn-id: http://core.svn.wordpress.org/trunk@22240 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
5fee0949ac
commit
ba79e04c10
@ -926,25 +926,27 @@ We hope you enjoy your new site. Thanks!
|
|||||||
}
|
}
|
||||||
$wpdb->query( "INSERT INTO $wpdb->sitemeta ( site_id, meta_key, meta_value ) VALUES " . $insert );
|
$wpdb->query( "INSERT INTO $wpdb->sitemeta ( site_id, meta_key, meta_value ) VALUES " . $insert );
|
||||||
|
|
||||||
$current_site = new stdClass;
|
// When upgrading from single to multisite, assume the current site will become the main site of the network.
|
||||||
$current_site->domain = $domain;
|
// When using populate_network() to create another network in an existing multisite environment,
|
||||||
$current_site->path = $path;
|
// skip these steps since the main site of the new network has not yet been created.
|
||||||
$current_site->site_name = ucfirst( $domain );
|
if ( ! is_multisite() ) {
|
||||||
|
$current_site = new stdClass;
|
||||||
if ( !is_multisite() ) {
|
$current_site->domain = $domain;
|
||||||
|
$current_site->path = $path;
|
||||||
|
$current_site->site_name = ucfirst( $domain );
|
||||||
$wpdb->insert( $wpdb->blogs, array( 'site_id' => $network_id, 'domain' => $domain, 'path' => $path, 'registered' => current_time( 'mysql' ) ) );
|
$wpdb->insert( $wpdb->blogs, array( 'site_id' => $network_id, 'domain' => $domain, 'path' => $path, 'registered' => current_time( 'mysql' ) ) );
|
||||||
$blog_id = $wpdb->insert_id;
|
$current_site->blog_id = $blog_id = $wpdb->insert_id;
|
||||||
update_user_meta( $site_user->ID, 'source_domain', $domain );
|
update_user_meta( $site_user->ID, 'source_domain', $domain );
|
||||||
update_user_meta( $site_user->ID, 'primary_blog', $blog_id );
|
update_user_meta( $site_user->ID, 'primary_blog', $blog_id );
|
||||||
|
|
||||||
|
if ( $subdomain_install )
|
||||||
|
$wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' );
|
||||||
|
else
|
||||||
|
$wp_rewrite->set_permalink_structure( '/blog/%year%/%monthnum%/%day%/%postname%/' );
|
||||||
|
|
||||||
|
flush_rewrite_rules();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $subdomain_install )
|
|
||||||
$wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' );
|
|
||||||
else
|
|
||||||
$wp_rewrite->set_permalink_structure( '/blog/%year%/%monthnum%/%day%/%postname%/' );
|
|
||||||
|
|
||||||
flush_rewrite_rules();
|
|
||||||
|
|
||||||
if ( $subdomain_install ) {
|
if ( $subdomain_install ) {
|
||||||
$vhost_ok = false;
|
$vhost_ok = false;
|
||||||
$errstr = '';
|
$errstr = '';
|
||||||
|
Loading…
Reference in New Issue
Block a user