diff options
Diffstat (limited to 'includes/api/ApiQueryUserContributions.php')
-rw-r--r-- | includes/api/ApiQueryUserContributions.php | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/includes/api/ApiQueryUserContributions.php b/includes/api/ApiQueryUserContributions.php index f30b1325..9a9be7b2 100644 --- a/includes/api/ApiQueryUserContributions.php +++ b/includes/api/ApiQueryUserContributions.php @@ -48,7 +48,7 @@ class ApiQueryContributions extends ApiQueryBase { $this->fld_ids = isset( $prop['ids'] ); $this->fld_title = isset( $prop['title'] ); $this->fld_comment = isset( $prop['comment'] ); - $this->fld_parsedcomment = isset ( $prop['parsedcomment'] ); + $this->fld_parsedcomment = isset( $prop['parsedcomment'] ); $this->fld_size = isset( $prop['size'] ); $this->fld_sizediff = isset( $prop['sizediff'] ); $this->fld_flags = isset( $prop['flags'] ); @@ -83,10 +83,10 @@ class ApiQueryContributions extends ApiQueryBase { // Do the actual query. $res = $this->select( __METHOD__ ); - if( $this->fld_sizediff ) { + if ( $this->fld_sizediff ) { $revIds = array(); foreach ( $res as $row ) { - if( $row->rev_parent_id ) { + if ( $row->rev_parent_id ) { $revIds[] = $row->rev_parent_id; } } @@ -160,10 +160,7 @@ class ApiQueryContributions extends ApiQueryBase { // Handle continue parameter if ( $this->multiUserMode && !is_null( $this->params['continue'] ) ) { $continue = explode( '|', $this->params['continue'] ); - if ( count( $continue ) != 2 ) { - $this->dieUsage( 'Invalid continue param. You should pass the original ' . - 'value returned by the previous query', '_badcontinue' ); - } + $this->dieContinueUsageIf( count( $continue ) != 2 ); $db = $this->getDB(); $encUser = $db->addQuotes( $continue[0] ); $encTS = $db->addQuotes( $db->timestamp( $continue[1] ) ); @@ -223,7 +220,7 @@ class ApiQueryContributions extends ApiQueryBase { ) ); if ( isset( $show['patrolled'] ) || isset( $show['!patrolled'] ) || - $this->fld_patrolled ) { + $this->fld_patrolled ) { if ( !$user->useRCPatrol() && !$user->useNPPatrol() ) { $this->dieUsage( 'You need the patrol right to request the patrolled flag', 'permissiondenied' ); } @@ -258,7 +255,7 @@ class ApiQueryContributions extends ApiQueryBase { $this->addFieldsIf( 'rev_comment', $this->fld_comment || $this->fld_parsedcomment ); $this->addFieldsIf( 'rev_len', $this->fld_size || $this->fld_sizediff ); $this->addFieldsIf( 'rev_minor_edit', $this->fld_flags ); - $this->addFieldsIf( 'rev_parent_id', $this->fld_flags || $this->fld_sizediff ); + $this->addFieldsIf( 'rev_parent_id', $this->fld_flags || $this->fld_sizediff || $this->fld_ids ); $this->addFieldsIf( 'rc_patrolled', $this->fld_patrolled ); if ( $this->fld_tags ) { @@ -271,8 +268,7 @@ class ApiQueryContributions extends ApiQueryBase { $this->addTables( 'change_tag' ); $this->addJoinConds( array( 'change_tag' => array( 'INNER JOIN', array( 'rev_id=ct_rev_id' ) ) ) ); $this->addWhereFld( 'ct_tag', $this->params['tag'] ); - global $wgOldChangeTagsIndex; - $index['change_tag'] = $wgOldChangeTagsIndex ? 'ct_tag' : 'change_tag_tag_id'; + $index['change_tag'] = 'change_tag_tag_id'; } if ( $this->params['toponly'] ) { @@ -300,6 +296,10 @@ class ApiQueryContributions extends ApiQueryBase { $vals['pageid'] = intval( $row->rev_page ); $vals['revid'] = intval( $row->rev_id ); // $vals['textid'] = intval( $row->rev_text_id ); // todo: Should this field be exposed? + + if ( !is_null( $row->rev_parent_id ) ) { + $vals['parentid'] = intval( $row->rev_parent_id ); + } } $title = Title::makeTitle( $row->page_namespace, $row->page_title ); @@ -445,7 +445,7 @@ class ApiQueryContributions extends ApiQueryBase { 'end' => 'The end timestamp to return to', 'continue' => 'When more results are available, use this to continue', 'user' => 'The users to retrieve contributions for', - 'userprefix' => "Retrieve contibutions for all users whose names begin with this value. Overrides {$p}user", + 'userprefix' => "Retrieve contributions for all users whose names begin with this value. Overrides {$p}user", 'dir' => $this->getDirectionDescription( $p ), 'namespace' => 'Only list contributions in these namespaces', 'prop' => array( @@ -477,7 +477,11 @@ class ApiQueryContributions extends ApiQueryBase { ), 'ids' => array( 'pageid' => 'integer', - 'revid' => 'integer' + 'revid' => 'integer', + 'parentid' => array( + ApiBase::PROP_TYPE => 'integer', + ApiBase::PROP_NULLABLE => true + ) ), 'title' => array( 'ns' => 'namespace', @@ -546,8 +550,4 @@ class ApiQueryContributions extends ApiQueryBase { public function getHelpUrls() { return 'https://www.mediawiki.org/wiki/API:Usercontribs'; } - - public function getVersion() { - return __CLASS__ . ': $Id$'; - } } |