From 6793fe0bf4ab37d8af90b323be76b8fb33f1dc73 Mon Sep 17 00:00:00 2001 From: Brian Wolff Date: Tue, 23 Apr 2013 18:01:32 -0300 Subject: [PATCH] Add parentid to output of list=usercontribs This makes it consistent with prop=revisions. Was requested on irc by Betacommand. Change-Id: Idfbee9b4f089738ab70825c11945faf8dd3da66d --- RELEASE-NOTES-1.22 | 1 + includes/api/ApiQueryUserContributions.php | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/RELEASE-NOTES-1.22 b/RELEASE-NOTES-1.22 index ade430f338..eda1e7cb74 100644 --- a/RELEASE-NOTES-1.22 +++ b/RELEASE-NOTES-1.22 @@ -72,6 +72,7 @@ production. longer be), and will no longer choke on booleans. * action=opensearch no longer silently ignores the format parameter. * action=opensearch now supports format=jsonfm. +* list=usercontribs&ucprop=ids will now include the parent revision id. === Languages updated in 1.22=== diff --git a/includes/api/ApiQueryUserContributions.php b/includes/api/ApiQueryUserContributions.php index 6d20d66506..df278c2d77 100644 --- a/includes/api/ApiQueryUserContributions.php +++ b/includes/api/ApiQueryUserContributions.php @@ -255,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 ) { @@ -297,6 +297,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 ); @@ -474,7 +478,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', -- 2.20.1