From: Mormegil Date: Sat, 9 Jun 2012 21:30:46 +0000 (+0200) Subject: (bug 15853) Wrong entries in history feed X-Git-Tag: 1.31.0-rc.0~23311^2 X-Git-Url: http://git.cyclocoop.org/%24action?a=commitdiff_plain;h=0be8b842999c4f537267eba89be1e45734bde82d;p=lhc%2Fweb%2Fwiklou.git (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 --- 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 ) {