X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiQueryLogEvents.php;h=39be2c17fd412c5b4ff16819c7449f0b54e15837;hb=4df0c71911500466a6330b8fe29c623ef5b51e41;hp=a6b97dd8957bb8262545231f1cc2783f6e9b35cb;hpb=7cd7c534f7c86fff63bbd372dc081816df7d65ca;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiQueryLogEvents.php b/includes/api/ApiQueryLogEvents.php index a6b97dd895..39be2c17fd 100644 --- a/includes/api/ApiQueryLogEvents.php +++ b/includes/api/ApiQueryLogEvents.php @@ -20,6 +20,9 @@ * @file */ +use MediaWiki\MediaWikiServices; +use MediaWiki\Storage\NameTableAccessException; + /** * Query action to List the log events, with optional filtering by various parameters. * @@ -39,6 +42,8 @@ class ApiQueryLogEvents extends ApiQueryBase { $fld_details = false, $fld_tags = false; public function execute() { + global $wgChangeTagsSchemaMigrationStage; + $params = $this->extractRequestParams(); $db = $this->getDB(); $this->commentStore = CommentStore::getStore(); @@ -113,7 +118,17 @@ class ApiQueryLogEvents extends ApiQueryBase { $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'] ) ) {