WordPress.org

Make WordPress Core


Ignore:
Timestamp:
09/11/2012 10:22:20 PM (8 years ago)
Author:
nacin
Message:

Remove ms-files.php rewriting from WordPress multisite. fixes #19235.

Keep existing networks compatible with a ms_files_rewriting network option.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/ms-functions.php

    r21664 r21823  
    11211121 */
    11221122function install_blog($blog_id, $blog_title = '') {
    1123     global $wpdb, $table_prefix, $wp_roles;
    1124     $wpdb->suppress_errors();
     1123    global $wpdb, $wp_roles, $current_site;
    11251124
    11261125    // Cast for security
     
    11301129
    11311130    if ( $wpdb->get_results("SELECT ID FROM $wpdb->posts") )
    1132         die(__('<h1>Already Installed</h1><p>You appear to have already installed WordPress. To reinstall please clear your old database tables first.</p>') . '</body></html>');
    1133 
    1134     $wpdb->suppress_errors(false);
    1135 
    1136     $url = get_blogaddress_by_id($blog_id);
     1131        die( __( '<h1>Already Installed</h1><p>You appear to have already installed WordPress. To reinstall please clear your old database tables first.</p>' ) . '</body></html>' );
     1132
     1133    $url = get_blogaddress_by_id( $blog_id );
    11371134
    11381135    // Set everything up
     
    11431140
    11441141    $url = untrailingslashit( $url );
    1145     // fix url.
    1146     update_option('siteurl', $url);
    1147     update_option('home', $url);
    1148     update_option('fileupload_url', $url . "/files" );
    1149     update_option('upload_path', UPLOADBLOGSDIR . "/$blog_id/files");
    1150     update_option('blogname', stripslashes( $blog_title ) );
    1151     update_option('admin_email', '');
    1152     $wpdb->update( $wpdb->options, array('option_value' => ''), array('option_name' => 'admin_email') );
     1142
     1143    update_option( 'siteurl', $url );
     1144    update_option( 'home', $url );
     1145
     1146    if ( get_site_option( 'ms_files_rewriting' ) )
     1147        update_option( 'upload_path', UPLOADBLOGSDIR . "/$blog_id/files" );
     1148    else
     1149        update_option( 'upload_path', get_blog_option( $current_site->blog_id, 'upload_path' ) );
     1150
     1151    update_option( 'blogname', stripslashes( $blog_title ) );
     1152    update_option( 'admin_email', '' );
    11531153
    11541154    // remove all perms
    1155     $wpdb->delete( $wpdb->usermeta, array( 'meta_key' => $table_prefix.'user_level' ) );
    1156 
    1157     $wpdb->delete( $wpdb->usermeta, array( 'meta_key' => $table_prefix.'capabilities' ) );
    1158 
    1159     $wpdb->suppress_errors( false );
     1155    $table_prefix = $wpdb->get_blog_prefix();
     1156    delete_metadata( 'user', 0, $table_prefix . 'user_level',   null, true ); // delete all
     1157    delete_metadata( 'user', 0, $table_prefix . 'capabilities', null, true ); // delete all
    11601158}
    11611159
Note: See TracChangeset for help on using the changeset viewer.