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.

git-svn-id: http://svn.automattic.com/wordpress/trunk@18540 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
nacin 2011-08-12 01:41:23 +00:00
parent 26c33f2341
commit 3fb35c6739
9 changed files with 20 additions and 83 deletions

View File

@ -1,12 +0,0 @@
<?php
/**
* Redirects to the Atom feed
* This file is deprecated and only exists for backwards compatibility
*
* @package WordPress
*/
require( './wp-load.php' );
wp_redirect( get_bloginfo( 'atom_url' ), 301 );
exit;
?>

View File

@ -1,12 +0,0 @@
<?php
/**
* Redirects to the Comments RSS2 feed
* This file is deprecated and only exists for backwards compatibility
*
* @package WordPress
*/
require( './wp-load.php' );
wp_redirect( get_bloginfo( 'comments_rss2_url' ), 301 );
exit;
?>

View File

@ -1,12 +0,0 @@
<?php
/**
* Redirects to the default feed
* This file is deprecated and only exists for backwards compatibility
*
* @package WordPress
*/
require( './wp-load.php' );
wp_redirect( get_bloginfo( get_default_feed() . '_url' ), 301 );
exit;
?>

View File

@ -218,11 +218,25 @@ function redirect_canonical( $requested_url = null, $do_redirect = true ) {
$addl_path = !empty( $addl_path ) ? trailingslashit($addl_path) : '';
if ( get_query_var( 'withcomments' ) )
$addl_path .= 'comments/';
if ( (in_array( get_default_feed(), array( 'rss', 'rdf' ) ) && 'feed' == get_query_var('feed')) || in_array( get_query_var('feed'), array( 'rss', 'rdf' ) ) )
if ( ( in_array( get_default_feed(), array( 'rss', 'rdf' ) ) && 'feed' == get_query_var('feed') ) || in_array( get_query_var('feed'), array( 'rss', 'rdf' ) ) )
$addl_path .= user_trailingslashit( 'feed/' . ( ( get_default_feed() == 'rss2' ) ? '' : 'rss2' ), 'feed' );
else
$addl_path .= user_trailingslashit( 'feed/' . ( ( get_default_feed() == get_query_var('feed') || 'feed' == get_query_var('feed') ) ? '' : get_query_var('feed') ), 'feed' );
$redirect['query'] = remove_query_arg( 'feed', $redirect['query'] );
} elseif ( is_feed() && 'old' == get_query_var('feed') ) {
$old_feed_files = array(
'wp-atom.php' => 'atom',
'wp-commentsrss2.php' => 'comments_rss2',
'wp-feed.php' => get_default_feed(),
'wp-rdf.php' => 'rss2',
'wp-rss.php' => 'rss2',
'wp-rss2.php' => 'rss2',
);
if ( isset( $old_feed_files[ basename( $redirect['path'] ) ] ) ) {
$redirect_url = get_feed_link( $old_feed_files[ basename( $redirect['path'] ) ] );
wp_redirect( $redirect_url, 301 );
die();
}
}
if ( get_query_var('paged') > 0 ) {

View File

@ -1498,13 +1498,8 @@ class WP_Rewrite {
$home_path = parse_url( home_url() );
$robots_rewrite = ( empty( $home_path['path'] ) || '/' == $home_path['path'] ) ? array( 'robots\.txt$' => $this->index . '?robots=1' ) : array();
// Default Feed rules - These are require to allow for the direct access files to work with permalink structure starting with %category%
$default_feeds = array( '.*wp-atom.php$' => $this->index . '?feed=atom',
'.*wp-rdf.php$' => $this->index . '?feed=rss2',
'.*wp-rss.php$' => $this->index . '?feed=rss2',
'.*wp-rss2.php$' => $this->index . '?feed=rss2',
'.*wp-feed.php$' => $this->index . '?feed=feed',
'.*wp-commentsrss2.php$' => $this->index . '?feed=rss2&withcomments=1');
// Old feed files
$old_feed_files = array( '.*wp-(atom|rdf|rss|rss2|feed|commentsrss2).php$' => $this->index . '?feed=old' );
// Registration rules
$registration_pages = array();
@ -1558,9 +1553,9 @@ class WP_Rewrite {
// Put them together.
if ( $this->use_verbose_page_rules )
$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);
$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);
else
$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);
$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);
do_action_ref_array('generate_rewrite_rules', array(&$this));
$this->rules = apply_filters('rewrite_rules_array', $this->rules);

View File

@ -11,7 +11,7 @@ $wp_version = '3.3-aortic-dissection';
*
* @global int $wp_db_version
*/
$wp_db_version = 18226;
$wp_db_version = 18537;
/**
* Holds the TinyMCE version

View File

@ -1,12 +0,0 @@
<?php
/**
* Redirects to the RDF feed
* This file is deprecated and only exists for backwards compatibility
*
* @package WordPress
*/
require( './wp-load.php' );
wp_redirect( get_bloginfo( 'rdf_url' ), 301 );
exit;
?>

View File

@ -1,12 +0,0 @@
<?php
/**
* Redirects to the RSS feed
* This file is deprecated and only exists for backwards compatibility
*
* @package WordPress
*/
require( './wp-load.php' );
wp_redirect( get_bloginfo( 'rss_url' ), 301 );
exit;
?>

View File

@ -1,12 +0,0 @@
<?php
/**
* Redirects to the RSS2 feed
* This file is deprecated and only exists for backwards compatibility
*
* @package WordPress
*/
require( './wp-load.php' );
wp_redirect( get_bloginfo( 'rss2_url' ), 301 );
exit;
?>