* @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](
// 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.
'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 ) {