X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Fapi%2FApiQueryLogEvents.php;h=3066720d1cd2bc1280b13fc5e9c8f43ecb5aae38;hp=df8a11ee8bcab247b4808a44326013685b64ecf1;hb=3df3b575c6617df64ec98533cc7141bd2314e274;hpb=39fb8a4f531256e122fa4c01d4417d23d168f299 diff --git a/includes/api/ApiQueryLogEvents.php b/includes/api/ApiQueryLogEvents.php index df8a11ee8b..3066720d1c 100644 --- a/includes/api/ApiQueryLogEvents.php +++ b/includes/api/ApiQueryLogEvents.php @@ -31,6 +31,8 @@ */ class ApiQueryLogEvents extends ApiQueryBase { + private $commentStore; + public function __construct( ApiQuery $query, $moduleName ) { parent::__construct( $query, $moduleName, 'le' ); } @@ -43,6 +45,7 @@ class ApiQueryLogEvents extends ApiQueryBase { public function execute() { $params = $this->extractRequestParams(); $db = $this->getDB(); + $this->commentStore = new CommentStore( 'log_comment' ); $this->requireMaxOneParameter( $params, 'title', 'prefix', 'namespace' ); $prop = array_flip( $params['prop'] ); @@ -91,9 +94,15 @@ class ApiQueryLogEvents extends ApiQueryBase { [ 'log_namespace', 'log_title' ], $this->fld_title || $this->fld_parsedcomment ); - $this->addFieldsIf( 'log_comment', $this->fld_comment || $this->fld_parsedcomment ); $this->addFieldsIf( 'log_params', $this->fld_details ); + 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( [ 'tag_summary' => [ 'LEFT JOIN', 'log_id=ts_log_id' ] ] ); @@ -242,7 +251,7 @@ class ApiQueryLogEvents extends ApiQueryBase { /** * @deprecated since 1.25 Use LogFormatter::formatParametersForApi instead * @param ApiResult $result - * @param array $vals + * @param array &$vals * @param string $params * @param string $type * @param string $action @@ -327,18 +336,19 @@ class ApiQueryLogEvents extends ApiQueryBase { $vals['timestamp'] = wfTimestamp( TS_ISO_8601, $row->log_timestamp ); } - if ( ( $this->fld_comment || $this->fld_parsedcomment ) && isset( $row->log_comment ) ) { + if ( $this->fld_comment || $this->fld_parsedcomment ) { if ( LogEventsList::isDeleted( $row, LogPage::DELETED_COMMENT ) ) { $vals['commenthidden'] = true; $anyHidden = true; } if ( LogEventsList::userCan( $row, LogPage::DELETED_COMMENT, $user ) ) { + $comment = $this->commentStore->getComment( $row )->text; if ( $this->fld_comment ) { - $vals['comment'] = $row->log_comment; + $vals['comment'] = $comment; } if ( $this->fld_parsedcomment ) { - $vals['parsedcomment'] = Linker::formatComment( $row->log_comment, $title ); + $vals['parsedcomment'] = Linker::formatComment( $comment, $title ); } } }