From 2edf6d79ddf473d279786828497d907736cf9dca Mon Sep 17 00:00:00 2001 From: Chad Horohoe Date: Thu, 10 Jul 2008 14:53:00 +0000 Subject: [PATCH] (bug 14778) 'limit' parameter now applies to history feeds as well as history pages --- RELEASE-NOTES | 2 ++ includes/PageHistory.php | 11 +++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index b95022e587..9e6052560d 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -432,6 +432,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 14763) Child classes of Database (DatabasePostgres and DatabaseOracle) had stict standards issues with setFakeSlaveLag() and setFakeMaster(). * (bug 451) Improve the phrase mappings of the Chinese converter arrays. +* (bug 14778) 'limit' parameter now applies to history feeds as well as + history pages === API changes in 1.13 === diff --git a/includes/PageHistory.php b/includes/PageHistory.php index 08194413f8..7cd88919e1 100644 --- a/includes/PageHistory.php +++ b/includes/PageHistory.php @@ -501,7 +501,7 @@ class PageHistory { * @param string $type */ function feed( $type ) { - global $wgFeedClasses; + global $wgFeedClasses, $wgRequest, $wgFeedLimit; if ( !FeedUtils::checkFeedOutput($type) ) { return; } @@ -512,7 +512,14 @@ class PageHistory { wfMsgForContent( 'history-feed-description' ), $this->mTitle->getFullUrl( 'action=history' ) ); - $items = $this->fetchRevisions(10, 0, PageHistory::DIR_NEXT); + // Get a limit on number of feed entries. Provide a sane default + // of 10 if none is defined (but limit to $wgFeedLimit max) + $limit = $wgRequest->getInt( 'limit', 10 ); + if( $limit > $wgFeedLimit ) { + $limit = $wgFeedLimit; + } + $items = $this->fetchRevisions($limit, 0, PageHistory::DIR_NEXT); + $feed->outHeader(); if( $items ) { foreach( $items as $row ) { -- 2.20.1