* @file
*/
+use MediaWiki\MediaWikiServices;
+use MediaWiki\Storage\NameTableAccessException;
+
/**
* Query action to List the log events, with optional filtering by various parameters.
*
$fld_details = false, $fld_tags = false;
public function execute() {
+ global $wgChangeTagsSchemaMigrationStage;
+
$params = $this->extractRequestParams();
$db = $this->getDB();
$this->commentStore = CommentStore::getStore();
$this->addTables( 'change_tag' );
$this->addJoinConds( [ 'change_tag' => [ 'INNER JOIN',
[ 'log_id=ct_log_id' ] ] ] );
- $this->addWhereFld( 'ct_tag', $params['tag'] );
+ if ( $wgChangeTagsSchemaMigrationStage > MIGRATION_WRITE_BOTH ) {
+ $changeTagDefStore = MediaWikiServices::getInstance()->getChangeTagDefStore();
+ try {
+ $this->addWhereFld( 'ct_tag_id', $changeTagDefStore->getId( $params['tag'] ) );
+ } catch ( NameTableAccessException $exception ) {
+ // Return nothing.
+ $this->addWhere( '1=0' );
+ }
+ } else {
+ $this->addWhereFld( 'ct_tag', $params['tag'] );
+ }
}
if ( !is_null( $params['action'] ) ) {
}
if ( LogEventsList::userCan( $row, LogPage::DELETED_USER, $user ) ) {
if ( $this->fld_user ) {
- $vals['user'] = $row->user_name === null ? $row->log_user_text : $row->user_name;
+ $vals['user'] = $row->user_name ?? $row->log_user_text;
}
if ( $this->fld_userid ) {
$vals['userid'] = intval( $row->log_user );
ApiBase::PARAM_HELP_MSG_PER_VALUE => [],
],
'type' => [
- ApiBase::PARAM_TYPE => $config->get( 'LogTypes' )
+ ApiBase::PARAM_TYPE => LogPage::validTypes(),
],
'action' => [
// validation on request is done in execute()