WordPress.org

Make WordPress Core

Ticket #12496: 12496.diff

File 12496.diff, 3.2 KB (added by Denis-de-Bernardy, 8 years ago)
  • wp-includes/ms-default-constants.php

     
    1818        if ( !defined( 'UPLOADBLOGSDIR' ) )
    1919                define( 'UPLOADBLOGSDIR', 'wp-content/blogs.dir' );
    2020
     21        $bloginfo = get_blog_details( $wpdb->blogid, false );
     22        $file_path = rtrim($bloginfo->domain . $bloginfo->path, '/');
     23       
    2124        /** @since 3.0.0 */
    2225        if ( !defined( 'UPLOADS' ) )
    23                 define( 'UPLOADS', UPLOADBLOGSDIR . "/{$wpdb->blogid}/files/" );
     26                define( 'UPLOADS', UPLOADBLOGSDIR . "/$file_path/files/" );
    2427
    2528        /** @since 3.0.0 */
    2629        if ( !defined( 'BLOGUPLOADDIR' ) )
    27                 define( 'BLOGUPLOADDIR', WP_CONTENT_DIR . "/blogs.dir/{$wpdb->blogid}/files/" );
     30                define( 'BLOGUPLOADDIR', WP_CONTENT_DIR . "/blogs.dir/$file_path/files/" );
    2831}
    2932
    3033/**
  • wp-includes/ms-functions.php

     
    926926        $wpdb->suppress_errors(false);
    927927
    928928        $url = get_blogaddress_by_id($blog_id);
    929 
     929        $bloginfo = get_blog_details( $blog_id, false );
     930        $file_path = rtrim($bloginfo->domain . $bloginfo->path, '/');
     931       
    930932        // Set everything up
    931933        make_db_current_silent();
    932934        populate_options();
     
    937939        update_option('siteurl', $url);
    938940        update_option('home', $url);
    939941        update_option('fileupload_url', $url . "files" );
    940         update_option('upload_path', "wp-content/blogs.dir/" . $blog_id . "/files");
     942        update_option('upload_path', "wp-content/blogs.dir/" . $file_path . "/files");
    941943        update_option('blogname', stripslashes( $blog_title ) );
    942944        update_option('admin_email', '');
    943945        $wpdb->update( $wpdb->options, array('option_value' => ''), array('option_name' => 'admin_email') );
  • wp-admin/includes/htaccess.ms

     
    22RewriteBase BASE/
    33
    44#uploaded files
    5 RewriteRule ^(.*/)?files/$ index.php [L]
    6 RewriteCond %{REQUEST_URI} !.*wp-content/plugins.*
    7 RewriteRule ^(.*/)?files/(.*) wp-includes/ms-files.php?file=$2 [L]
     5RewriteCond %{REQUEST_URI} !\bwp-content/
     6RewriteRule (^|/)files/ wp-content/blogs.dir/%{HTTP_HOST}%{REQUEST_URI} [L]
    87
    98# add a trailing slash to /wp-admin
    109RewriteCond %{REQUEST_URI} ^.*/wp-admin$
  • wp-admin/includes/ms.php

     
    7676                        $wpdb->query( "DROP TABLE IF EXISTS ". current( $drop_table ) ."" );
    7777                }
    7878                $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->blogs WHERE blog_id = %d", $blog_id) );
    79                 $dir = apply_filters( 'wpmu_delete_blog_upload_dir', WP_CONTENT_DIR . "/blogs.dir/{$blog_id}/files/", $blog_id );
     79               
     80                $bloginfo = get_blog_details( $blog_id, false );
     81                $file_path = rtrim($bloginfo->domain . $bloginfo->path, '/');
     82               
     83                $dir = apply_filters( 'wpmu_delete_blog_upload_dir', WP_CONTENT_DIR . "/blogs.dir/$file_path/files/", $blog_id );
    8084                $dir = rtrim($dir, DIRECTORY_SEPARATOR);
    8185                $top_dir = $dir;
    8286                $stack = array($dir);