From 67dc654a9f1edc50f7fde941d2e819318953ccf1 Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Sun, 13 Mar 2011 17:41:47 +0000 Subject: [PATCH] * (bug 27203) add fato param to list=filearchive Cleanup some whitespace also --- RELEASE-NOTES | 1 + includes/api/ApiQueryFilearchive.php | 11 ++++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 7a01d9c8a6..b7a98933fd 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -250,6 +250,7 @@ PHP if you have not done so prior to upgrading MediaWiki. * (bug 27183) API: Add filter by customisation state for meta=allmessages * (bug 27340) API: Allow listing of "small" categories * (bug 27342) Add audir param to list=allusers +* (bug 27203) add fato param to list=filearchive === Languages updated in 1.18 === diff --git a/includes/api/ApiQueryFilearchive.php b/includes/api/ApiQueryFilearchive.php index 4fc6d44e21..22ca7cf415 100644 --- a/includes/api/ApiQueryFilearchive.php +++ b/includes/api/ApiQueryFilearchive.php @@ -91,11 +91,12 @@ class ApiQueryFilearchive extends ApiQueryBase { // Image filters $dir = ( $params['dir'] == 'descending' ? 'older' : 'newer' ); $from = ( is_null( $params['from'] ) ? null : $this->titlePartToKey( $params['from'] ) ); - $this->addWhereRange( 'fa_name', $dir, $from, null ); + $to = ( is_null( $params['to'] ) ? null : $this->titlePartToKey( $params['to'] ) ); + $this->addWhereRange( 'fa_name', $dir, $from, $to ); if ( isset( $params['prefix'] ) ) { $this->addWhere( 'fa_name' . $db->buildLike( $this->titlePartToKey( $params['prefix'] ), $db->anyString() ) ); } - + if ( !$wgUser->isAllowed( 'suppressrevision' ) ) { // Filter out revisions that the user is not allowed to see. There // is no way to indicate that we have skipped stuff because the @@ -106,8 +107,6 @@ class ApiQueryFilearchive extends ApiQueryBase { $this->addWhereFld( 'fa_deleted', 0 ); } - - $limit = $params['limit']; $this->addOption( 'LIMIT', $limit + 1 ); $this->addOption( 'ORDER BY', 'fa_name' . @@ -189,6 +188,7 @@ class ApiQueryFilearchive extends ApiQueryBase { public function getAllowedParams() { return array ( 'from' => null, + 'to' => null, 'prefix' => null, 'limit' => array( ApiBase::PARAM_DFLT => 10, @@ -225,9 +225,10 @@ class ApiQueryFilearchive extends ApiQueryBase { public function getParamDescription() { return array( 'from' => 'The image title to start enumerating from', + 'to' => 'The image title to stop enumerating at', 'prefix' => 'Search for all image titles that begin with this value', 'dir' => 'The direction in which to list', - 'limit' => 'How many total images to return', + 'limit' => 'How many images to return in total', 'prop' => array( 'What image information to get:', ' sha1 - Adds SHA-1 hash for the image', -- 2.20.1