From 3fb35c6739fe41db9b22eecc6762e115576b6cc8 Mon Sep 17 00:00:00 2001 From: nacin Date: Fri, 12 Aug 2011 01:41:23 +0000 Subject: [PATCH] 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 --- wp-atom.php | 12 ------------ wp-commentsrss2.php | 12 ------------ wp-feed.php | 12 ------------ wp-includes/canonical.php | 16 +++++++++++++++- wp-includes/rewrite.php | 13 ++++--------- wp-includes/version.php | 2 +- wp-rdf.php | 12 ------------ wp-rss.php | 12 ------------ wp-rss2.php | 12 ------------ 9 files changed, 20 insertions(+), 83 deletions(-) delete mode 100644 wp-atom.php delete mode 100644 wp-commentsrss2.php delete mode 100644 wp-feed.php delete mode 100644 wp-rdf.php delete mode 100644 wp-rss.php delete mode 100644 wp-rss2.php diff --git a/wp-atom.php b/wp-atom.php deleted file mode 100644 index a83ac7db1..000000000 --- a/wp-atom.php +++ /dev/null @@ -1,12 +0,0 @@ - diff --git a/wp-commentsrss2.php b/wp-commentsrss2.php deleted file mode 100644 index 280766ed4..000000000 --- a/wp-commentsrss2.php +++ /dev/null @@ -1,12 +0,0 @@ - diff --git a/wp-feed.php b/wp-feed.php deleted file mode 100644 index afce8cd4c..000000000 --- a/wp-feed.php +++ /dev/null @@ -1,12 +0,0 @@ - diff --git a/wp-includes/canonical.php b/wp-includes/canonical.php index ca2eec30c..26b6ed091 100644 --- a/wp-includes/canonical.php +++ b/wp-includes/canonical.php @@ -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 ) { diff --git a/wp-includes/rewrite.php b/wp-includes/rewrite.php index 841a99396..c7879ad53 100644 --- a/wp-includes/rewrite.php +++ b/wp-includes/rewrite.php @@ -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); diff --git a/wp-includes/version.php b/wp-includes/version.php index f07f6f660..9dd3082e2 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -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 diff --git a/wp-rdf.php b/wp-rdf.php deleted file mode 100644 index cc94ad067..000000000 --- a/wp-rdf.php +++ /dev/null @@ -1,12 +0,0 @@ - diff --git a/wp-rss.php b/wp-rss.php deleted file mode 100644 index af2427ad5..000000000 --- a/wp-rss.php +++ /dev/null @@ -1,12 +0,0 @@ - diff --git a/wp-rss2.php b/wp-rss2.php deleted file mode 100644 index de75c2398..000000000 --- a/wp-rss2.php +++ /dev/null @@ -1,12 +0,0 @@ -