648 | | if ( $network_id == 1 ) |
649 | | $wpdb->query( $wpdb->prepare( "INSERT INTO ".$wpdb->site." ( id, domain, path ) VALUES ( NULL, %s, %s )", $domain, $path ) ); |
650 | | else |
651 | | $wpdb->query( $wpdb->prepare( "INSERT INTO ".$wpdb->site." ( id, domain, path ) VALUES ( %d, %s, %s )", $network_id, $domain, $path ) ); |
| 648 | if ( 1 == $network_id ) { |
| 649 | $wpdb->insert( $wpdb->site, array( 'domain' => $domain, 'path' => $path ) ); |
| 650 | $network_id = $wpdb->insert_id; |
| 651 | } else { |
| 652 | $wpdb->insert( $wpdb->site, array( 'domain' => $domain, 'path' => $path, 'network_id' => $network_id ) ); |
| 653 | } |
655 | | $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 ) ); |
656 | | $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 ) ); |
657 | | $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 ) ); |
658 | | $wpdb->query( $wpdb->prepare( "INSERT INTO ".$wpdb->sitemeta." (meta_id, site_id, meta_key, meta_value) VALUES (NULL, %d, 'registration', 'none')", $network_id ) ); |
659 | | if ( !is_multisite() ) { |
660 | | $wpdb->query( "INSERT INTO " . $wpdb->sitecategories . " ( cat_ID, cat_name, category_nicename, last_updated ) VALUES (1, 'Uncategorized', 'uncategorized', NOW())" ); |
661 | | $wpdb->query( "INSERT INTO " . $wpdb->sitecategories . " ( cat_ID, cat_name, category_nicename, last_updated ) VALUES (2, 'Blogroll', 'blogroll', NOW())" ); |
662 | | } |
663 | | $wpdb->query( $wpdb->prepare( "INSERT INTO ".$wpdb->sitemeta." (meta_id, site_id, meta_key, meta_value) VALUES (NULL, %d, 'upload_filetypes', 'jpg jpeg png gif mp3 mov avi wmv midi mid pdf' )", $network_id ) ); |
664 | | $wpdb->query( $wpdb->prepare( "INSERT INTO ".$wpdb->sitemeta." (meta_id, site_id, meta_key, meta_value) VALUES (NULL, %d, 'blog_upload_space', '10' )", $network_id ) ); |
665 | | $wpdb->query( $wpdb->prepare( "INSERT INTO ".$wpdb->sitemeta." (meta_id, site_id, meta_key, meta_value) VALUES (NULL, %d, 'fileupload_maxk', '1500' )", $network_id ) ); |
666 | | if ( !is_multisite() ) { |
| 657 | /* translators: Default category slug */ |
| 658 | $cat_slug = sanitize_title( _x( 'Uncategorized', 'Default category slug' ) ); |
| 659 | |
| 660 | $wpdb->insert( $wpdb->sitecategories, array( 'site_id' => $network_id, 'cat_ID' => 1, 'cat_name' => __('Uncategorized'), 'category_nicename' => $cat_slug, 'last_updated' => current_time( 'mysql', true ) ) ); |
| 661 | |
| 662 | /* translators: Default link category slug */ |
| 663 | $cat_slug = sanitize_title( _x( 'Blogroll', 'Default link category slug' ) ); |
| 664 | |
| 665 | $wpdb->insert( $wpdb->sitecategories, array( 'site_id' => $network_id, 'cat_ID' => 2, 'cat_name' => __('Blogroll'), 'category_nicename' => $cat_slug, 'last_updated' => current_time( 'mysql', true ) ) ); |
| 666 | |
678 | | $wpdb->query( $wpdb->prepare( "INSERT INTO ".$wpdb->sitemeta." (meta_id, site_id, meta_key, meta_value) VALUES (NULL, %d, 'site_admins', '" . serialize( $site_admins ) . "' )", $network_id ) ); |
679 | | $wpdb->query( $wpdb->prepare( "INSERT INTO ".$wpdb->sitemeta." (meta_id, site_id, meta_key, meta_value) VALUES (NULL, %d, 'allowedthemes', '" . serialize( $allowed_themes ) . "' )", $network_id ) ); |
680 | | $wpdb->query( $wpdb->prepare( "INSERT INTO ".$wpdb->sitemeta." (meta_id, site_id, meta_key, meta_value) VALUES (NULL, %d, 'illegal_names', '" . serialize( array( "www", "web", "root", "admin", "main", "invite", "administrator" ) ) . "' )", $network_id ) ); |
681 | | $wpdb->query( $wpdb->prepare( "INSERT INTO ".$wpdb->sitemeta." (meta_id, site_id, meta_key, meta_value) VALUES (NULL, %d, 'wpmu_upgrade_site', '{$wp_db_version}')", $network_id ) ); |
682 | | $wpdb->query( $wpdb->prepare( "INSERT INTO ".$wpdb->sitemeta." (meta_id, site_id, meta_key, meta_value) VALUES (NULL, %d, 'welcome_email', 'Dear User, |
695 | | --The Team @ SITE_NAME')", $network_id ) ); |
696 | | $wpdb->query( $wpdb->prepare( "INSERT INTO ".$wpdb->sitemeta." (meta_id, site_id, meta_key, meta_value) VALUES (NULL, %d, 'first_post', 'Welcome to <a href=\"SITE_URL\">SITE_NAME</a>. This is your first post. Edit or delete it, then start blogging!' )", $network_id ) ); |
697 | | //@todo - network admins should have a method of editing the network siteurl (used for cookie hash) |
698 | | $wpdb->query( $wpdb->prepare( "INSERT INTO ".$wpdb->sitemeta." (meta_id, site_id, meta_key, meta_value) VALUES (NULL, %d, 'siteurl', %s)", $network_id, get_option( 'siteurl' ) ) ); |
| 692 | --The Team @ SITE_NAME' ); |
| 694 | $sitemeta = array( |
| 695 | 'site_name' => $site_name, |
| 696 | 'admin_email' => $site_user->user_email, |
| 697 | 'admin_user_id' => $site_user->ID, |
| 698 | 'registration' => 'none', |
| 699 | 'upload_filetypes' => 'jpg jpeg png gif mp3 mov avi wmv midi mid pdf', |
| 700 | 'blog_upload_space' => 10, |
| 701 | 'fileupload_maxk' => 1500, |
| 702 | 'site_admins' => $site_admins, |
| 703 | 'allowedthemes' => $allowed_themes, |
| 704 | 'illegal_names' => array( 'www', 'web', 'root', 'admin', 'main', 'invite', 'administrator' ), |
| 705 | 'wpmu_upgrade_site' => $wp_db_version, |
| 706 | 'welcome_email' => $welcome_email, |
| 707 | 'first_post' => __( 'Welcome to <a href="SITE_URL">SITE_NAME</a>. This is your first post. Edit or delete it, then start blogging!' ), |
| 708 | // @todo - network admins should have a method of editing the network siteurl (used for cookie hash) |
| 709 | 'siteurl' => get_option( 'siteurl' ) |
| 710 | ); |
| 711 | |
| 712 | $insert = ''; |
| 713 | foreach ( $sitemeta as $meta_key => $meta_value ) { |
| 714 | $meta_key = $wpdb->escape( $meta_key ); |
| 715 | if ( is_array( $meta_value ) ) |
| 716 | $meta_value = serialize( $meta_value ); |
| 717 | $meta_value = $wpdb->escape( $meta_value ); |
| 718 | if ( !empty( $insert ) ) |
| 719 | $insert .= ', '; |
| 720 | $insert .= "( $network_id, '$meta_key', '$meta_value')"; |
| 721 | } |
| 722 | $wpdb->query( "INSERT INTO $wpdb->sitemeta ( site_id, meta_key, meta_value ) VALUES " . $insert ); |
| 723 | |
729 | | $msg = "<h2>Warning! Wildcard DNS may not be configured correctly!</h2>"; |
730 | | $msg .= "<p>To use the subdomain feature of WordPress MU you must have a wildcard entry in your dns. The installer attempted to contact a random hostname ($hostname) on your domain but failed. It returned this error message:<br /> <strong>$errstr</strong></p><p>From the README.txt:</p>"; |
731 | | $msg .= "<p><blockquote> If you want to host blogs of the form http://blog.domain.tld/ where domain.tld is the domain name of your machine then you must add a wildcard record to your DNS records.<br /> |
732 | | This usually means adding a '*' hostname record pointing at your webserver in your DNS configuration tool. Matt has a more detailed <a href='http://ma.tt/2003/10/10/wildcard-dns-and-sub-domains/'>explanation</a> on his blog. If you still have problems, these <a href='http://mu.wordpress.org/forums/tags/wildcard'>forum messages</a> may help.</blockquote></p>"; |
733 | | $msg .= "<p>You can still use your site but any subdomain you create may not be accessible. This check is not foolproof so ignore if you know your dns is correct.</p>"; |
| 754 | // @todo Update this to reflect the merge. Also: Multisite readme file, or remove the <blockquote> tags. |
| 755 | $msg = '<h2>' . esc_html__( 'Warning! Wildcard DNS may not be configured correctly!' ) . '</h2>'; |
| 756 | $msg .= '<p>' . __( 'To use the subdomain feature of WordPress MU you must have a wildcard entry in your dns. The installer attempted to contact a random hostname ($hostname) on your domain but failed. It returned this error message:' ) . '<br />'; |
| 757 | $msg .= '<br/><strong>' . $errstr . '</strong></p>'; |
| 758 | $msg .= '<p>' . __( 'From the README.txt:' ) . '</p>'; |
| 759 | $msg .= '<blockquote><p>' . __( "If you want to host blogs of the form http://blog.domain.tld/ where domain.tld is the domain name of your machine then you must add a wildcard record to your DNS records. This usually means adding a '*' hostname record pointing at your webserver in your DNS configuration tool. Matt has a more detailed <a href='http://ma.tt/2003/10/10/wildcard-dns-and-sub-domains/'>explanation</a> on his blog. If you still have problems, these <a href='http://mu.wordpress.org/forums/tags/wildcard'>forum messages</a> may help." ) . '</p></blockquote>'; |
| 760 | $msg .= '<p>' . __( 'You can still use your site but any subdomain you create may not be accessible. This check is not foolproof so ignore if you know your dns is correct.' ) . '</p>'; |