From: Chad Horohoe Date: Tue, 15 Jul 2008 16:00:22 +0000 (+0000) Subject: (bug 14778) 'limit' parameter now applies to history feeds as well as history pages... X-Git-Tag: 1.31.0-rc.0~46502 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/password.php?a=commitdiff_plain;h=930e055fb0cd53fcdc07a6962999357ff55a8b40;p=lhc%2Fweb%2Fwiklou.git (bug 14778) 'limit' parameter now applies to history feeds as well as history pages (and now doesn't break if the limit is negative) --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 1a7119506c..38113b95a7 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -444,6 +444,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 451) Improve the phrase mappings of the Chinese converter arrays. * (bug 12487) Rights log is not fully internationalized * (bug 10837) Language variants no longer override other languages than base +* (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 6d8a7c2165..1433f3f1b9 100644 --- a/includes/PageHistory.php +++ b/includes/PageHistory.php @@ -494,7 +494,7 @@ class PageHistory { * @param string $type */ function feed( $type ) { - global $wgFeedClasses; + global $wgFeedClasses, $wgRequest, $wgFeedLimit; if ( !FeedUtils::checkFeedOutput($type) ) { return; } @@ -505,7 +505,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 < 1 ) { + $limit = 10; + } + $items = $this->fetchRevisions($limit, 0, PageHistory::DIR_NEXT); + $feed->outHeader(); if( $items ) { foreach( $items as $row ) {