| 1 | Index: wp-admin/includes/schema.php |
|---|
| 2 | =================================================================== |
|---|
| 3 | --- wp-admin/includes/schema.php (revision 12862) |
|---|
| 4 | +++ wp-admin/includes/schema.php (working copy) |
|---|
| 5 | @@ -630,7 +630,7 @@ |
|---|
| 6 | die( 'You must provide a site name!' ); |
|---|
| 7 | |
|---|
| 8 | // check for network collision |
|---|
| 9 | - $existing_network = $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$wpdb->site} WHERE id = %d", $network_id ) ); |
|---|
| 10 | + $existing_network = $wpdb->get_var( $wpdb->prepare( "SELECT id FROM $wpdb->site WHERE id = %d", $network_id ) ); |
|---|
| 11 | if ( $existing_network == $network_id ) |
|---|
| 12 | die( 'That network already exists!' ); |
|---|
| 13 | |
|---|
| 14 | @@ -645,25 +645,25 @@ |
|---|
| 15 | else |
|---|
| 16 | $allowed_themes = array( $stylesheet => true ); |
|---|
| 17 | |
|---|
| 18 | - if ( $network_id == 1 ) |
|---|
| 19 | - $wpdb->query( $wpdb->prepare( "INSERT INTO ".$wpdb->site." ( id, domain, path ) VALUES ( NULL, %s, %s )", $domain, $path ) ); |
|---|
| 20 | - else |
|---|
| 21 | - $wpdb->query( $wpdb->prepare( "INSERT INTO ".$wpdb->site." ( id, domain, path ) VALUES ( %d, %s, %s )", $network_id, $domain, $path ) ); |
|---|
| 22 | + if ( 1 == $network_id ) { |
|---|
| 23 | + $wpdb->insert( $wpdb->site, array( 'domain' => $domain, 'path' => $path ) ); |
|---|
| 24 | + $network_id = $wpdb->insert_id; |
|---|
| 25 | + } else { |
|---|
| 26 | + $wpdb->insert( $wpdb->site, array( 'domain' => $domain, 'path' => $path, 'network_id' => $network_id ) ); |
|---|
| 27 | + } |
|---|
| 28 | |
|---|
| 29 | - $network_id = $wpdb->insert_id; |
|---|
| 30 | + if ( !is_multisite() ) { |
|---|
| 31 | |
|---|
| 32 | - $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 ) ); |
|---|
| 33 | - $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 ) ); |
|---|
| 34 | - $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 ) ); |
|---|
| 35 | - $wpdb->query( $wpdb->prepare( "INSERT INTO ".$wpdb->sitemeta." (meta_id, site_id, meta_key, meta_value) VALUES (NULL, %d, 'registration', 'none')", $network_id ) ); |
|---|
| 36 | - if ( !is_multisite() ) { |
|---|
| 37 | - $wpdb->query( "INSERT INTO " . $wpdb->sitecategories . " ( cat_ID, cat_name, category_nicename, last_updated ) VALUES (1, 'Uncategorized', 'uncategorized', NOW())" ); |
|---|
| 38 | - $wpdb->query( "INSERT INTO " . $wpdb->sitecategories . " ( cat_ID, cat_name, category_nicename, last_updated ) VALUES (2, 'Blogroll', 'blogroll', NOW())" ); |
|---|
| 39 | - } |
|---|
| 40 | - $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 ) ); |
|---|
| 41 | - $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 ) ); |
|---|
| 42 | - $wpdb->query( $wpdb->prepare( "INSERT INTO ".$wpdb->sitemeta." (meta_id, site_id, meta_key, meta_value) VALUES (NULL, %d, 'fileupload_maxk', '1500' )", $network_id ) ); |
|---|
| 43 | - if ( !is_multisite() ) { |
|---|
| 44 | + /* translators: Default category slug */ |
|---|
| 45 | + $cat_slug = sanitize_title( _x( 'Uncategorized', 'Default category slug' ) ); |
|---|
| 46 | + |
|---|
| 47 | + $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 ) ) ); |
|---|
| 48 | + |
|---|
| 49 | + /* translators: Default link category slug */ |
|---|
| 50 | + $cat_slug = sanitize_title( _x( 'Blogroll', 'Default link category slug' ) ); |
|---|
| 51 | + |
|---|
| 52 | + $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 ) ) ); |
|---|
| 53 | + |
|---|
| 54 | $site_admins = array( $site_user->user_login ); |
|---|
| 55 | $users = get_users_of_blog(); |
|---|
| 56 | if ( $users ) { |
|---|
| 57 | @@ -675,12 +675,9 @@ |
|---|
| 58 | } else { |
|---|
| 59 | $site_admins = get_site_option( 'site_admins' ); |
|---|
| 60 | } |
|---|
| 61 | - $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 ) ); |
|---|
| 62 | - $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 ) ); |
|---|
| 63 | - $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 ) ); |
|---|
| 64 | - $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 ) ); |
|---|
| 65 | - $wpdb->query( $wpdb->prepare( "INSERT INTO ".$wpdb->sitemeta." (meta_id, site_id, meta_key, meta_value) VALUES (NULL, %d, 'welcome_email', 'Dear User, |
|---|
| 66 | |
|---|
| 67 | + $welcome_email = __( 'Dear User, |
|---|
| 68 | + |
|---|
| 69 | Your new SITE_NAME blog has been successfully set up at: |
|---|
| 70 | BLOG_URL |
|---|
| 71 | |
|---|
| 72 | @@ -692,17 +689,45 @@ |
|---|
| 73 | We hope you enjoy your new blog. |
|---|
| 74 | Thanks! |
|---|
| 75 | |
|---|
| 76 | ---The Team @ SITE_NAME')", $network_id ) ); |
|---|
| 77 | - $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 ) ); |
|---|
| 78 | - //@todo - network admins should have a method of editing the network siteurl (used for cookie hash) |
|---|
| 79 | - $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' ) ) ); |
|---|
| 80 | +--The Team @ SITE_NAME' ); |
|---|
| 81 | |
|---|
| 82 | + $sitemeta = array( |
|---|
| 83 | + 'site_name' => $site_name, |
|---|
| 84 | + 'admin_email' => $site_user->user_email, |
|---|
| 85 | + 'admin_user_id' => $site_user->ID, |
|---|
| 86 | + 'registration' => 'none', |
|---|
| 87 | + 'upload_filetypes' => 'jpg jpeg png gif mp3 mov avi wmv midi mid pdf', |
|---|
| 88 | + 'blog_upload_space' => 10, |
|---|
| 89 | + 'fileupload_maxk' => 1500, |
|---|
| 90 | + 'site_admins' => $site_admins, |
|---|
| 91 | + 'allowedthemes' => $allowed_themes, |
|---|
| 92 | + 'illegal_names' => array( 'www', 'web', 'root', 'admin', 'main', 'invite', 'administrator' ), |
|---|
| 93 | + 'wpmu_upgrade_site' => $wp_db_version, |
|---|
| 94 | + 'welcome_email' => $welcome_email, |
|---|
| 95 | + 'first_post' => __( 'Welcome to <a href="SITE_URL">SITE_NAME</a>. This is your first post. Edit or delete it, then start blogging!' ), |
|---|
| 96 | + // @todo - network admins should have a method of editing the network siteurl (used for cookie hash) |
|---|
| 97 | + 'siteurl' => get_option( 'siteurl' ) |
|---|
| 98 | + ); |
|---|
| 99 | + |
|---|
| 100 | + $insert = ''; |
|---|
| 101 | + foreach ( $sitemeta as $meta_key => $meta_value ) { |
|---|
| 102 | + $meta_key = $wpdb->escape( $meta_key ); |
|---|
| 103 | + if ( is_array( $meta_value ) ) |
|---|
| 104 | + $meta_value = serialize( $meta_value ); |
|---|
| 105 | + $meta_value = $wpdb->escape( $meta_value ); |
|---|
| 106 | + if ( !empty( $insert ) ) |
|---|
| 107 | + $insert .= ', '; |
|---|
| 108 | + $insert .= "( $network_id, '$meta_key', '$meta_value')"; |
|---|
| 109 | + } |
|---|
| 110 | + $wpdb->query( "INSERT INTO $wpdb->sitemeta ( site_id, meta_key, meta_value ) VALUES " . $insert ); |
|---|
| 111 | + |
|---|
| 112 | $current_site->domain = $domain; |
|---|
| 113 | $current_site->path = $base; |
|---|
| 114 | $current_site->site_name = ucfirst( $domain ); |
|---|
| 115 | |
|---|
| 116 | if ( !is_multisite() ) { |
|---|
| 117 | - $wpdb->query( $wpdb->prepare( "INSERT INTO {$wpdb->blogs} (site_id, domain, path) VALUES (%s, %s, %s)", $network_id, $domain, $path ) ); |
|---|
| 118 | + $wpdb->insert( $wpdb->blogs, array( 'site_id' => $network_id, 'domain' => $domain, 'path' => $path ) ); |
|---|
| 119 | + |
|---|
| 120 | update_usermeta( $site_user->ID, 'source_domain', $domain ); |
|---|
| 121 | update_usermeta( $site_user->ID, 'primary_blog', 1 ); |
|---|
| 122 | } |
|---|
| 123 | @@ -726,11 +751,13 @@ |
|---|
| 124 | $vhost_ok = true; |
|---|
| 125 | } |
|---|
| 126 | if ( !$vhost_ok ) { |
|---|
| 127 | - $msg = "<h2>Warning! Wildcard DNS may not be configured correctly!</h2>"; |
|---|
| 128 | - $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>"; |
|---|
| 129 | - $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 /> |
|---|
| 130 | -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>"; |
|---|
| 131 | - $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>"; |
|---|
| 132 | + // @todo Update this to reflect the merge. Also: Multisite readme file, or remove the <blockquote> tags. |
|---|
| 133 | + $msg = '<h2>' . esc_html__( 'Warning! Wildcard DNS may not be configured correctly!' ) . '</h2>'; |
|---|
| 134 | + $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 />'; |
|---|
| 135 | + $msg .= '<br/><strong>' . $errstr . '</strong></p>'; |
|---|
| 136 | + $msg .= '<p>' . __( 'From the README.txt:' ) . '</p>'; |
|---|
| 137 | + $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>'; |
|---|
| 138 | + $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>'; |
|---|
| 139 | } |
|---|
| 140 | } |
|---|
| 141 | return $msg; |
|---|
| 142 | Index: wp-includes/load.php |
|---|
| 143 | =================================================================== |
|---|
| 144 | --- wp-includes/load.php (revision 12862) |
|---|
| 145 | +++ wp-includes/load.php (working copy) |
|---|
| 146 | @@ -298,7 +298,10 @@ |
|---|
| 147 | $wpdb->field_types = array( 'post_author' => '%d', 'post_parent' => '%d', 'menu_order' => '%d', 'term_id' => '%d', 'term_group' => '%d', 'term_taxonomy_id' => '%d', |
|---|
| 148 | 'parent' => '%d', 'count' => '%d','object_id' => '%d', 'term_order' => '%d', 'ID' => '%d', 'commment_ID' => '%d', 'comment_post_ID' => '%d', 'comment_parent' => '%d', |
|---|
| 149 | 'user_id' => '%d', 'link_id' => '%d', 'link_owner' => '%d', 'link_rating' => '%d', 'option_id' => '%d', 'blog_id' => '%d', 'meta_id' => '%d', 'post_id' => '%d', |
|---|
| 150 | - 'user_status' => '%d', 'umeta_id' => '%d', 'comment_karma' => '%d', 'comment_count' => '%d' ); |
|---|
| 151 | + 'user_status' => '%d', 'umeta_id' => '%d', 'comment_karma' => '%d', 'comment_count' => '%d', |
|---|
| 152 | + // multisite: |
|---|
| 153 | + 'active' => '%d', 'cat_id' => '%d', 'deleted' => '%d', 'lang_id' => '%d', 'mature' => '%d', 'public' => '%d', 'site_id' => '%d', 'spam' => '%d', |
|---|
| 154 | + ); |
|---|
| 155 | |
|---|
| 156 | $prefix = $wpdb->set_prefix( $table_prefix ); |
|---|
| 157 | |
|---|
| 158 | Index: wp-includes/ms-functions.php |
|---|
| 159 | =================================================================== |
|---|
| 160 | --- wp-includes/ms-functions.php (revision 12862) |
|---|
| 161 | +++ wp-includes/ms-functions.php (working copy) |
|---|
| 162 | @@ -1486,7 +1486,7 @@ |
|---|
| 163 | |
|---|
| 164 | $welcome_email = stripslashes( get_site_option( 'welcome_email' ) ); |
|---|
| 165 | if ( $welcome_email == false ) |
|---|
| 166 | - $welcome_email = stripslashes( __( "Dear User, |
|---|
| 167 | + $welcome_email = stripslashes( __( 'Dear User, |
|---|
| 168 | |
|---|
| 169 | Your new SITE_NAME blog has been successfully set up at: |
|---|
| 170 | BLOG_URL |
|---|
| 171 | @@ -1496,11 +1496,10 @@ |
|---|
| 172 | Password: PASSWORD |
|---|
| 173 | Login Here: BLOG_URLwp-login.php |
|---|
| 174 | |
|---|
| 175 | -We hope you enjoy your new weblog. |
|---|
| 176 | +We hope you enjoy your new blog. |
|---|
| 177 | Thanks! |
|---|
| 178 | |
|---|
| 179 | ---The WordPress Team |
|---|
| 180 | -SITE_NAME" ) ); |
|---|
| 181 | +--The Team @ SITE_NAME' ) ); |
|---|
| 182 | |
|---|
| 183 | $url = get_blogaddress_by_id($blog_id); |
|---|
| 184 | $user = new WP_User($user_id); |
|---|