<?php
/**
- *
- *
- * Created on Oct 16, 2006
- *
* Copyright © 2006 Yuri Astrakhan "<Firstname><Lastname>@gmail.com"
*
* This program is free software; you can redistribute it and/or modify
*/
class ApiQueryLogEvents extends ApiQueryBase {
+ private $commentStore;
+
public function __construct( ApiQuery $query, $moduleName ) {
parent::__construct( $query, $moduleName, 'le' );
}
public function execute() {
$params = $this->extractRequestParams();
$db = $this->getDB();
+ $this->commentStore = CommentStore::getStore();
$this->requireMaxOneParameter( $params, 'title', 'prefix', 'namespace' );
$prop = array_flip( $params['prop'] );
[ '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( 'log_comment' );
+ $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' ] ] );
/**
* @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
$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( 'log_comment', $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 );
}
}
}