Merge "auth: Follow up on e907d4328dc3e"
[lhc/web/wiklou.git] / includes / api / ApiQueryRevisions.php
index ac7ee0a..cb2f616 100644 (file)
@@ -84,7 +84,7 @@ class ApiQueryRevisions extends ApiQueryRevisionsBase {
        }
 
        protected function run( ApiPageSet $resultPageSet = null ) {
-               global $wgActorTableSchemaMigrationStage, $wgChangeTagsSchemaMigrationStage;
+               global $wgActorTableSchemaMigrationStage;
 
                $params = $this->extractRequestParams( false );
                $revisionStore = MediaWikiServices::getInstance()->getRevisionStore();
@@ -185,11 +185,7 @@ class ApiQueryRevisions extends ApiQueryRevisionsBase {
                }
 
                if ( $this->fld_tags ) {
-                       $this->addTables( 'tag_summary' );
-                       $this->addJoinConds(
-                               [ 'tag_summary' => [ 'LEFT JOIN', [ 'rev_id=ts_rev_id' ] ] ]
-                       );
-                       $this->addFields( 'ts_tags' );
+                       $this->addFields( [ 'ts_tags' => ChangeTags::makeTagSummarySubquery( 'revision' ) ] );
                }
 
                if ( $params['tag'] !== null ) {
@@ -197,16 +193,12 @@ class ApiQueryRevisions extends ApiQueryRevisionsBase {
                        $this->addJoinConds(
                                [ 'change_tag' => [ 'INNER JOIN', [ 'rev_id=ct_rev_id' ] ] ]
                        );
-                       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'] );
+                       $changeTagDefStore = MediaWikiServices::getInstance()->getChangeTagDefStore();
+                       try {
+                               $this->addWhereFld( 'ct_tag_id', $changeTagDefStore->getId( $params['tag'] ) );
+                       } catch ( NameTableAccessException $exception ) {
+                               // Return nothing.
+                               $this->addWhere( '1=0' );
                        }
                }