(bug 15853) Wrong entries in history feed
authorMormegil <mormegil@centrum.cz>
Sat, 9 Jun 2012 21:30:46 +0000 (23:30 +0200)
committerMormegil <mormegil@centrum.cz>
Sat, 9 Jun 2012 21:30:46 +0000 (23:30 +0200)
The history feed for a non-existing page fetched revisions for
rev_page=0. Even though there should be none in the database,
there obviously are, which means such feeds are full of spurious
entries.

Added an existence check, fetchRevisions now returns an empty result
for non-existent pages, which is (and has always been) handled
gracefully in feed() by emitting feedEmpty().

Change-Id: Iae892d900239030bc249c829faecb1bcb3672db2

includes/actions/HistoryAction.php

index 94bf50c..50d210f 100644 (file)
@@ -204,6 +204,11 @@ class HistoryAction extends FormlessAction {
         * @return ResultWrapper
         */
        function fetchRevisions( $limit, $offset, $direction ) {
+               // Fail if article doesn't exist.
+               if( !$this->getTitle()->exists() ) {
+                       return new FakeResultWrapper( array() );
+               }
+
                $dbr = wfGetDB( DB_SLAVE );
 
                if ( $direction == HistoryPage::DIR_PREV ) {