From d71e043fc7492e9b26cc15323782fae8f0d57e05 Mon Sep 17 00:00:00 2001 From: Rob Church Date: Thu, 13 Apr 2006 20:01:48 +0000 Subject: [PATCH] (bug 5475) New pages feeds ignore "limit" argument --- RELEASE-NOTES | 1 + includes/GlobalFunctions.php | 8 +++++++- includes/QueryPage.php | 4 ++-- includes/SpecialNewpages.php | 2 +- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 68a458ffc2..38b7534920 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -63,6 +63,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * Reject malformed addresses in X-Forwarded-For entries * (bug 3359) Add hooks on completion of file upload * (bug 5559) Improve detection of ImageMagick [patch: Greg Turnquist] +* (bug 5475) New pages feeds ignore "limit" argument == Compatibility == diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 795883e648..491a09afa9 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -791,7 +791,13 @@ function wfClientAcceptsGzip() { } /** - * Yay, more global functions! + * Obtain the offset and limit values from the request string; + * used in special pages + * + * @param $deflimit Default limit if none supplied + * @param $optionname Name of a user preference to check against + * @return array + * */ function wfCheckLimits( $deflimit = 50, $optionname = 'rclimit' ) { global $wgRequest; diff --git a/includes/QueryPage.php b/includes/QueryPage.php index 9b39ec63ef..1d354d95fe 100644 --- a/includes/QueryPage.php +++ b/includes/QueryPage.php @@ -344,7 +344,7 @@ class QueryPage { /** * Similar to above, but packaging in a syndicated feed instead of a web page */ - function doFeed( $class = '' ) { + function doFeed( $class = '', $limit = 50 ) { global $wgFeedClasses; if( isset($wgFeedClasses[$class]) ) { @@ -356,7 +356,7 @@ class QueryPage { $dbr =& wfGetDB( DB_SLAVE ); $sql = $this->getSQL() . $this->getOrder(); - $sql = $dbr->limitResult( $sql, 50, 0 ); + $sql = $dbr->limitResult( $sql, $limit, 0 ); $res = $dbr->query( $sql, 'QueryPage::doFeed' ); while( $obj = $dbr->fetchObject( $res ) ) { $item = $this->feedResult( $obj ); diff --git a/includes/SpecialNewpages.php b/includes/SpecialNewpages.php index 2a7db0446a..7c7b97e63a 100644 --- a/includes/SpecialNewpages.php +++ b/includes/SpecialNewpages.php @@ -142,7 +142,7 @@ function wfSpecialNewpages($par, $specialPage) { $npp = new NewPagesPage( $namespace ); - if ( ! $npp->doFeed( $wgRequest->getVal( 'feed' ) ) ) + if ( ! $npp->doFeed( $wgRequest->getVal( 'feed' ), $limit ) ) $npp->doQuery( $offset, $limit, $shownavigation ); } -- 2.20.1