X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiQueryUserContributions.php;h=bb0f335bcb9fda4d015ab2a740ada210deac7b31;hb=5fa4cdf860c79b32ab6ef034c6d9420c2727f695;hp=31a92380015f47944984c9a1f867e8c162d77bd1;hpb=350dcb4cd7990daa4ea8fe4c8335f9353f442605;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiQueryUserContributions.php b/includes/api/ApiQueryUserContributions.php index 31a9238001..bb0f335bcb 100644 --- a/includes/api/ApiQueryUserContributions.php +++ b/includes/api/ApiQueryUserContributions.php @@ -36,7 +36,7 @@ class ApiQueryContributions extends ApiQueryBase { } private $params, $prefixMode, $userprefix, $multiUserMode, $idMode, $usernames, $userids, - $parentLens; + $parentLens, $commentStore; private $fld_ids = false, $fld_title = false, $fld_timestamp = false, $fld_comment = false, $fld_parsedcomment = false, $fld_flags = false, $fld_patrolled = false, $fld_tags = false, $fld_size = false, $fld_sizediff = false; @@ -45,6 +45,8 @@ class ApiQueryContributions extends ApiQueryBase { // Parse some parameters $this->params = $this->extractRequestParams(); + $this->commentStore = new CommentStore( 'rev_comment' ); + $prop = array_flip( $this->params['prop'] ); $this->fld_ids = isset( $prop['ids'] ); $this->fld_title = isset( $prop['title'] ); @@ -341,12 +343,18 @@ class ApiQueryContributions extends ApiQueryBase { $this->addFieldsIf( 'rev_page', $this->fld_ids ); $this->addFieldsIf( 'page_latest', $this->fld_flags ); // $this->addFieldsIf( 'rev_text_id', $this->fld_ids ); // Should this field be exposed? - $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->fld_ids ); $this->addFieldsIf( 'rc_patrolled', $this->fld_patrolled ); + if ( $this->fld_comment || $this->fld_parsedcomment ) { + $commentQuery = $this->commentStore->getJoin(); + $this->addTables( $commentQuery['tables'] ); + $this->addFields( $commentQuery['fields'] ); + $this->addJoinConds( $commentQuery['joins'] ); + } + if ( $this->fld_tags ) { $this->addTables( 'tag_summary' ); $this->addJoinConds( @@ -416,7 +424,7 @@ class ApiQueryContributions extends ApiQueryBase { $vals['top'] = $row->page_latest == $row->rev_id; } - if ( ( $this->fld_comment || $this->fld_parsedcomment ) && isset( $row->rev_comment ) ) { + if ( $this->fld_comment || $this->fld_parsedcomment ) { if ( $row->rev_deleted & Revision::DELETED_COMMENT ) { $vals['commenthidden'] = true; $anyHidden = true; @@ -428,12 +436,13 @@ class ApiQueryContributions extends ApiQueryBase { ); if ( $userCanView ) { + $comment = $this->commentStore->getComment( $row )->text; if ( $this->fld_comment ) { - $vals['comment'] = $row->rev_comment; + $vals['comment'] = $comment; } if ( $this->fld_parsedcomment ) { - $vals['parsedcomment'] = Linker::formatComment( $row->rev_comment, $title ); + $vals['parsedcomment'] = Linker::formatComment( $comment, $title ); } } } @@ -582,6 +591,6 @@ class ApiQueryContributions extends ApiQueryBase { } public function getHelpUrls() { - return 'https://www.mediawiki.org/wiki/API:Usercontribs'; + return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Usercontribs'; } }