From 0be8b842999c4f537267eba89be1e45734bde82d Mon Sep 17 00:00:00 2001 From: Mormegil Date: Sat, 9 Jun 2012 23:30:46 +0200 Subject: [PATCH] (bug 15853) Wrong entries in history feed 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 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/includes/actions/HistoryAction.php b/includes/actions/HistoryAction.php index 94bf50ce94..50d210f6e2 100644 --- a/includes/actions/HistoryAction.php +++ b/includes/actions/HistoryAction.php @@ -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 ) { -- 2.20.1