From: Brad Jorsch Date: Thu, 7 Sep 2017 20:58:57 +0000 (-0400) Subject: ApiQueryRecentChanges: Fetch comment fields if rctoken is used X-Git-Tag: 1.31.0-rc.0~2184^2~2 X-Git-Url: https://git.cyclocoop.org/%27.%24link.%27?a=commitdiff_plain;h=14e55e80a7b17a2b522193ad94dbf06e1bafdc91;p=lhc%2Fweb%2Fwiklou.git ApiQueryRecentChanges: Fetch comment fields if rctoken is used When the deprecated rctoken parameter is used, the module calls RecentChange::newFromRow(), which now requires that the comment fields be present. Bug: T175307 Change-Id: Ida025f419e43809c34fff386f1a1ee8881393b80 (cherry picked from commit 5ec0132821f4dca98a53b466a3d35b7a2853c616) --- diff --git a/includes/api/ApiQueryRecentChanges.php b/includes/api/ApiQueryRecentChanges.php index 9af4e3e4a2..63e07487da 100644 --- a/includes/api/ApiQueryRecentChanges.php +++ b/includes/api/ApiQueryRecentChanges.php @@ -287,14 +287,6 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase { ); $showRedirects = $this->fld_redirect || isset( $show['redirect'] ) || isset( $show['!redirect'] ); - - if ( $this->fld_comment || $this->fld_parsedcomment ) { - $this->commentStore = new CommentStore( 'rc_comment' ); - $commentQuery = $this->commentStore->getJoin(); - $this->addTables( $commentQuery['tables'] ); - $this->addFields( $commentQuery['fields'] ); - $this->addJoinConds( $commentQuery['joins'] ); - } } $this->addFieldsIf( [ 'rc_this_oldid' ], $resultPageSet && $params['generaterevisions'] ); @@ -360,6 +352,15 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase { } $this->token = $params['token']; + + if ( $this->fld_comment || $this->fld_parsedcomment || $this->token ) { + $this->commentStore = new CommentStore( 'rc_comment' ); + $commentQuery = $this->commentStore->getJoin(); + $this->addTables( $commentQuery['tables'] ); + $this->addFields( $commentQuery['fields'] ); + $this->addJoinConds( $commentQuery['joins'] ); + } + $this->addOption( 'LIMIT', $params['limit'] + 1 ); $hookData = [];