From: MatmaRex Date: Sun, 7 Jul 2013 18:39:53 +0000 (+0200) Subject: Correctly use $wgFeedLimit in page history feed X-Git-Tag: 1.31.0-rc.0~19208^2 X-Git-Url: http://git.cyclocoop.org/%7B%24admin_url%7Dcompta/comptes/journal.php?a=commitdiff_plain;h=0b7ecb1a64e4baac354860ef2d3d094c13e178c4;p=lhc%2Fweb%2Fwiklou.git Correctly use $wgFeedLimit in page history feed The previous behavior enforced a minimal maximum of 10, even if $wgFeedLimit was set to a lower value. Also grepped everything for $wgFeedLimit and fixed all other error-prone (but correct) uses. Bug: 50886 Change-Id: Ia81bbadfcf4270b0f932b543265ca37f364530f3 --- diff --git a/includes/QueryPage.php b/includes/QueryPage.php index a93639afc7..0abeb31e0f 100644 --- a/includes/QueryPage.php +++ b/includes/QueryPage.php @@ -655,17 +655,14 @@ abstract class QueryPage extends SpecialPage { * @return bool */ function doFeed( $class = '', $limit = 50 ) { - global $wgFeed, $wgFeedClasses; + global $wgFeed, $wgFeedClasses, $wgFeedLimit; if ( !$wgFeed ) { $this->getOutput()->addWikiMsg( 'feed-unavailable' ); return false; } - global $wgFeedLimit; - if ( $limit > $wgFeedLimit ) { - $limit = $wgFeedLimit; - } + $limit = min( $limit, $wgFeedLimit ); if ( isset( $wgFeedClasses[$class] ) ) { $feed = new $wgFeedClasses[$class]( diff --git a/includes/actions/HistoryAction.php b/includes/actions/HistoryAction.php index f43736bea5..bdb63d1fc0 100644 --- a/includes/actions/HistoryAction.php +++ b/includes/actions/HistoryAction.php @@ -262,9 +262,8 @@ class HistoryAction extends FormlessAction { // Get a limit on number of feed entries. Provide a sane default // of 10 if none is defined (but limit to $wgFeedLimit max) $limit = $request->getInt( 'limit', 10 ); - if ( $limit > $wgFeedLimit || $limit < 1 ) { - $limit = 10; - } + $limit = min( max( $limit, 1 ), $wgFeedLimit ); + $items = $this->fetchRevisions( $limit, 0, HistoryPage::DIR_NEXT ); // Generate feed elements enclosed between header and footer. diff --git a/includes/api/ApiFeedWatchlist.php b/includes/api/ApiFeedWatchlist.php index 9f6b8b4794..fbb70fbc9b 100644 --- a/includes/api/ApiFeedWatchlist.php +++ b/includes/api/ApiFeedWatchlist.php @@ -76,7 +76,7 @@ class ApiFeedWatchlist extends ApiBase { 'wlprop' => 'title|user|comment|timestamp', 'wldir' => 'older', // reverse order - from newest to oldest 'wlend' => $endTime, // stop at this time - 'wllimit' => ( 50 > $wgFeedLimit ) ? $wgFeedLimit : 50 + 'wllimit' => min( 50, $wgFeedLimit ) ); if ( $params['wlowner'] !== null ) {