WordPress.org

Make WordPress Core

Changeset 18540


Ignore:
Timestamp:
08/12/2011 01:41:23 AM (7 years ago)
Author:
nacin
Message:

Remove the old root feed files. Bump the db version so rewrite rules can regenerate. Don't add these files to old_files to leave them on existing installs. fixes #18384.

Location:
trunk
Files:
6 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/canonical.php

    r18539 r18540  
    219219                if ( get_query_var( 'withcomments' ) )
    220220                    $addl_path .= 'comments/';
    221                 if ( (in_array( get_default_feed(), array( 'rss', 'rdf' ) ) && 'feed' == get_query_var('feed')) || in_array( get_query_var('feed'), array( 'rss', 'rdf' ) ) )
     221                if ( ( in_array( get_default_feed(), array( 'rss', 'rdf' ) ) && 'feed' == get_query_var('feed') ) || in_array( get_query_var('feed'), array( 'rss', 'rdf' ) ) )
    222222                    $addl_path .= user_trailingslashit( 'feed/' . ( ( get_default_feed() == 'rss2' ) ? '' : 'rss2' ), 'feed' );
    223223                else
    224224                    $addl_path .= user_trailingslashit( 'feed/' . ( ( get_default_feed() ==  get_query_var('feed') || 'feed' == get_query_var('feed') ) ? '' : get_query_var('feed') ), 'feed' );
    225225                $redirect['query'] = remove_query_arg( 'feed', $redirect['query'] );
     226            } elseif ( is_feed() && 'old' == get_query_var('feed') ) {
     227                $old_feed_files = array(
     228                    'wp-atom.php'         => 'atom',
     229                    'wp-commentsrss2.php' => 'comments_rss2',
     230                    'wp-feed.php'         => get_default_feed(),
     231                    'wp-rdf.php'          => 'rss2',
     232                    'wp-rss.php'          => 'rss2',
     233                    'wp-rss2.php'         => 'rss2',
     234                );
     235                if ( isset( $old_feed_files[ basename( $redirect['path'] ) ] ) ) {
     236                    $redirect_url = get_feed_link( $old_feed_files[ basename( $redirect['path'] ) ] );
     237                    wp_redirect( $redirect_url, 301 );
     238                    die();
     239                }
    226240            }
    227241
  • trunk/wp-includes/rewrite.php

    r18538 r18540  
    14991499        $robots_rewrite = ( empty( $home_path['path'] ) || '/' == $home_path['path'] ) ? array( 'robots\.txt$' => $this->index . '?robots=1' ) : array();
    15001500
    1501         // Default Feed rules - These are require to allow for the direct access files to work with permalink structure starting with %category%
    1502         $default_feeds = array( '.*wp-atom.php$'    =>  $this->index . '?feed=atom',
    1503                                 '.*wp-rdf.php$'     =>  $this->index . '?feed=rss2',
    1504                                 '.*wp-rss.php$'     =>  $this->index . '?feed=rss2',
    1505                                 '.*wp-rss2.php$'    =>  $this->index . '?feed=rss2',
    1506                                 '.*wp-feed.php$'    =>  $this->index . '?feed=feed',
    1507                                 '.*wp-commentsrss2.php$'    =>  $this->index . '?feed=rss2&withcomments=1');
     1501        // Old feed files
     1502        $old_feed_files = array( '.*wp-(atom|rdf|rss|rss2|feed|commentsrss2).php$' => $this->index . '?feed=old' );
    15081503
    15091504        // Registration rules
     
    15591554        // Put them together.
    15601555        if ( $this->use_verbose_page_rules )
    1561             $this->rules = array_merge($this->extra_rules_top, $robots_rewrite, $default_feeds, $registration_pages, $page_rewrite, $root_rewrite, $comments_rewrite, $search_rewrite,  $author_rewrite, $date_rewrite, $post_rewrite, $this->extra_rules);
     1556            $this->rules = array_merge($this->extra_rules_top, $robots_rewrite, $old_feed_files, $registration_pages, $page_rewrite, $root_rewrite, $comments_rewrite, $search_rewrite,  $author_rewrite, $date_rewrite, $post_rewrite, $this->extra_rules);
    15621557        else
    1563             $this->rules = array_merge($this->extra_rules_top, $robots_rewrite, $default_feeds, $registration_pages, $root_rewrite, $comments_rewrite, $search_rewrite,  $author_rewrite, $date_rewrite, $post_rewrite, $page_rewrite, $this->extra_rules);
     1558            $this->rules = array_merge($this->extra_rules_top, $robots_rewrite, $old_feed_files, $registration_pages, $root_rewrite, $comments_rewrite, $search_rewrite,  $author_rewrite, $date_rewrite, $post_rewrite, $page_rewrite, $this->extra_rules);
    15641559
    15651560        do_action_ref_array('generate_rewrite_rules', array(&$this));
  • trunk/wp-includes/version.php

    r18400 r18540  
    1212 * @global int $wp_db_version
    1313 */
    14 $wp_db_version = 18226;
     14$wp_db_version = 18537;
    1515
    1616/**
Note: See TracChangeset for help on using the changeset viewer.