* (bug 26873) API: Add 'toponly' filter in usercontribs module
authorSam Reed <reedy@users.mediawiki.org>
Sun, 10 Apr 2011 21:52:34 +0000 (21:52 +0000)
committerSam Reed <reedy@users.mediawiki.org>
Sun, 10 Apr 2011 21:52:34 +0000 (21:52 +0000)
RELEASE-NOTES
includes/api/ApiQueryRecentChanges.php
includes/api/ApiQueryUserContributions.php
includes/specials/SpecialContributions.php

index fcea1f6..84997ba 100644 (file)
@@ -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 ===
 
index b808185..324b12f 100644 (file)
@@ -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',
                );
        }
 
index 1e94bb1..5c863f9 100644 (file)
@@ -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',
                );
        }
 
index 4823af6..73af493 100644 (file)
@@ -758,7 +758,7 @@ class ContribsPager extends ReverseChronologicalPager {
        /**
         * Get the Database object in use
         *
-        * @return Database
+        * @return DatabaseBase
         */
        public function getDatabase() {
                return $this->mDb;