Add option to show only creations in Special:Contribs, API
[lhc/web/wiklou.git] / includes / api / ApiFeedContributions.php
index bf69410..2cdc875 100644 (file)
@@ -78,6 +78,7 @@ class ApiFeedContributions extends ApiBase {
                        'tagFilter' => $params['tagfilter'],
                        'deletedOnly' => $params['deletedonly'],
                        'topOnly' => $params['toponly'],
+                       'newOnly' => $params['newonly'],
                        'showSizeDiff' => $params['showsizediff'],
                ) );
 
@@ -87,7 +88,13 @@ class ApiFeedContributions extends ApiBase {
 
                $feedItems = array();
                if ( $pager->getNumRows() > 0 ) {
+                       $count = 0;
+                       $limit = $pager->getLimit();
                        foreach ( $pager->mResult as $row ) {
+                               // ContribsPager selects one more row for navigation, skip that row
+                               if ( ++$count > $limit ) {
+                                       break;
+                               }
                                $feedItems[] = $this->feedItem( $row );
                        }
                }
@@ -180,6 +187,7 @@ class ApiFeedContributions extends ApiBase {
                        ),
                        'deletedonly' => false,
                        'toponly' => false,
+                       'newonly' => false,
                        'showsizediff' => false,
                );
        }
@@ -194,6 +202,7 @@ class ApiFeedContributions extends ApiBase {
                        'tagfilter' => 'Filter contributions that have these tags',
                        'deletedonly' => 'Show only deleted contributions',
                        'toponly' => 'Only show edits that are latest revisions',
+                       'newonly' => 'Only show edits that are page creations',
                        'showsizediff' => 'Show the size difference between revisions. Disabled in Miser Mode',
                );
        }