From 12d7d7b90fe1b585bab97fb418665022769ef623 Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Sun, 10 Apr 2011 21:52:34 +0000 Subject: [PATCH] * (bug 26873) API: Add 'toponly' filter in usercontribs module --- RELEASE-NOTES | 1 + includes/api/ApiQueryRecentChanges.php | 2 +- includes/api/ApiQueryUserContributions.php | 7 +++++++ includes/specials/SpecialContributions.php | 2 +- 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index fcea1f6705..84997ba054 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -333,6 +333,7 @@ PHP if you have not done so prior to upgrading MediaWiki. PARAM_TYPE is not set * (bug 27712) add parent_id to list=deletedrevs * (bug 28455) Add 'toponly' to recentchanges API module +* (bug 26873) API: Add 'toponly' filter in usercontribs module === Languages updated in 1.18 === diff --git a/includes/api/ApiQueryRecentChanges.php b/includes/api/ApiQueryRecentChanges.php index b808185a15..324b12f7c1 100644 --- a/includes/api/ApiQueryRecentChanges.php +++ b/includes/api/ApiQueryRecentChanges.php @@ -620,7 +620,7 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase { 'type' => 'Which types of changes to show', 'limit' => 'How many total changes to return', 'tag' => 'Only list changes tagged with this tag', - 'toponly' => 'Only list changes which are the latest revision' + 'toponly' => 'Only list changes which are the latest revision', ); } diff --git a/includes/api/ApiQueryUserContributions.php b/includes/api/ApiQueryUserContributions.php index 1e94bb117a..5c863f95d4 100644 --- a/includes/api/ApiQueryUserContributions.php +++ b/includes/api/ApiQueryUserContributions.php @@ -81,6 +81,7 @@ class ApiQueryContributions extends ApiQueryBase { $this->prefixMode = false; $this->multiUserMode = ( count( $this->params['user'] ) > 1 ); } + $this->prepareQuery(); // Do the actual query. @@ -264,6 +265,10 @@ class ApiQueryContributions extends ApiQueryBase { $index['change_tag'] = $wgOldChangeTagsIndex ? 'ct_tag' : 'change_tag_tag_id'; } + if ( $this->params['toponly'] ) { + $this->addWhere( 'rev_id = page_latest' ); + } + $this->addOption( 'USE INDEX', $index ); } @@ -409,6 +414,7 @@ class ApiQueryContributions extends ApiQueryBase { ) ), 'tag' => null, + 'toponly' => false, ); } @@ -439,6 +445,7 @@ class ApiQueryContributions extends ApiQueryBase { 'show' => array( "Show only items that meet this criteria, e.g. non minor edits only: {$p}show=!minor", "NOTE: if {$p}show=patrolled or {$p}show=!patrolled is set, revisions older than $wgRCMaxAge won\'t be shown", ), 'tag' => 'Only list revisions tagged with this tag', + 'toponly' => 'Only list changes which are the latest revision', ); } diff --git a/includes/specials/SpecialContributions.php b/includes/specials/SpecialContributions.php index 4823af6e35..73af493311 100644 --- a/includes/specials/SpecialContributions.php +++ b/includes/specials/SpecialContributions.php @@ -758,7 +758,7 @@ class ContribsPager extends ReverseChronologicalPager { /** * Get the Database object in use * - * @return Database + * @return DatabaseBase */ public function getDatabase() { return $this->mDb; -- 2.20.1