Use (int) rather than intval()
[lhc/web/wiklou.git] / includes / api / ApiQueryAllDeletedRevisions.php
index 7b4f15e..8855615 100644 (file)
@@ -43,8 +43,6 @@ class ApiQueryAllDeletedRevisions extends ApiQueryRevisionsBase {
         * @return void
         */
        protected function run( ApiPageSet $resultPageSet = null ) {
-               global $wgChangeTagsSchemaMigrationStage;
-
                // Before doing anything at all, let's check permissions
                $this->checkUserRightsAny( 'deletedhistory' );
 
@@ -127,11 +125,7 @@ class ApiQueryAllDeletedRevisions extends ApiQueryRevisionsBase {
                }
 
                if ( $this->fld_tags ) {
-                       $this->addTables( 'tag_summary' );
-                       $this->addJoinConds(
-                               [ 'tag_summary' => [ 'LEFT JOIN', [ 'ar_rev_id=ts_rev_id' ] ] ]
-                       );
-                       $this->addFields( 'ts_tags' );
+                       $this->addFields( [ 'ts_tags' => ChangeTags::makeTagSummarySubquery( 'archive' ) ] );
                }
 
                if ( !is_null( $params['tag'] ) ) {
@@ -139,16 +133,12 @@ class ApiQueryAllDeletedRevisions extends ApiQueryRevisionsBase {
                        $this->addJoinConds(
                                [ 'change_tag' => [ 'INNER JOIN', [ 'ar_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' );
                        }
                }
 
@@ -268,14 +258,14 @@ class ApiQueryAllDeletedRevisions extends ApiQueryRevisionsBase {
                        $op = ( $dir == 'newer' ? '>' : '<' );
                        if ( $optimizeGenerateTitles ) {
                                $this->dieContinueUsageIf( count( $cont ) != 2 );
-                               $ns = intval( $cont[0] );
+                               $ns = (int)$cont[0];
                                $this->dieContinueUsageIf( strval( $ns ) !== $cont[0] );
                                $title = $db->addQuotes( $cont[1] );
                                $this->addWhere( "ar_namespace $op $ns OR " .
                                        "(ar_namespace = $ns AND ar_title $op= $title)" );
                        } elseif ( $mode == 'all' ) {
                                $this->dieContinueUsageIf( count( $cont ) != 4 );
-                               $ns = intval( $cont[0] );
+                               $ns = (int)$cont[0];
                                $this->dieContinueUsageIf( strval( $ns ) !== $cont[0] );
                                $title = $db->addQuotes( $cont[1] );
                                $ts = $db->addQuotes( $db->timestamp( $cont[2] ) );