WordPress.org

Make WordPress Core

Changeset 12924


Ignore:
Timestamp:
02/02/2010 02:17:33 AM (12 years ago)
Author:
wpmuguru
Message:

internalize uploaded media rewrite rule, see #11742

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-content/blogs.php

    r12859 r12924  
    11<?php
    2 define( 'SHORTINIT', true ); // this prevents most of WP from being loaded
    3 require_once( dirname( dirname( __FILE__) ) . '/wp-load.php' ); // absolute includes are faster
     2if ( !defined( 'MEDIA_FILE' ) ) {
     3    define( 'SHORTINIT', true ); // this prevents most of WP from being loaded
     4    require_once( dirname( dirname( __FILE__) ) . '/wp-load.php' ); // absolute includes are faster
     5}
    46
    57if ( $current_blog->archived == '1' || $current_blog->spam == '1' || $current_blog->deleted == '1' ) {
     
    6567endif;
    6668
    67 
    68 $file = BLOGUPLOADDIR . str_replace( '..', '', $_GET[ 'file' ] );
     69if ( defined( 'MEDIA_FILE' ) )
     70    $file = BLOGUPLOADDIR . str_replace( '..', '', MEDIA_FILE );
     71else
     72    $file = BLOGUPLOADDIR . str_replace( '..', '', $_GET[ 'file' ] );
    6973if ( !is_file( $file ) ) {
    7074    status_header( 404 );
  • trunk/wp-settings.php

    r12921 r12924  
    8383include_once( ABSPATH . WPINC . '/pomo/mo.php' );
    8484
     85// internalize virtual content rewrite rule
     86if ( is_multisite() && !defined( 'SHORTINIT' ) ) {
     87    $media_base = $path . 'files/';
     88    $base_len = strlen( $media_base );
     89    if ( substr( $_SERVER[ 'REQUEST_URI' ], 0, $media_len ) == $media_base && $media_len < strlen( $_SERVER[ 'REQUEST_URI' ] ) ) {
     90        define( 'MEDIA_FILE', substr( $_SERVER[ 'REQUEST_URI' ], $media_len ) );
     91        require_once( WP_CONTENT_DIR . '/blogs.php' );
     92        exit();
     93    }
     94    unset( $media_base, $media_len );
     95}
    8596// Stop most of WordPress from being loaded if we just want the basics.
    8697if ( SHORTINIT )
Note: See TracChangeset for help on using the changeset viewer.