From d2edb58930ea03e835ee8361159a21ff989851d4 Mon Sep 17 00:00:00 2001 From: Bill Pirkle Date: Wed, 24 Apr 2019 16:46:12 -0500 Subject: [PATCH] Remove references to db field ar_text_id Field ar_text_id is being removed as part of MCR schema changes. Remove references to this field. These references were already unnecessary due to commit 07842be3. Bug: T198341 Change-Id: I3dbf12abf3f67fa0ea07c535e830c9d40b46fdc3 --- includes/api/ApiQueryAllDeletedRevisions.php | 8 +---- includes/api/ApiQueryDeletedRevisions.php | 8 +---- includes/api/ApiQueryDeletedrevs.php | 37 +++++--------------- 3 files changed, 10 insertions(+), 43 deletions(-) diff --git a/includes/api/ApiQueryAllDeletedRevisions.php b/includes/api/ApiQueryAllDeletedRevisions.php index beaad4336f..85ca6480f1 100644 --- a/includes/api/ApiQueryAllDeletedRevisions.php +++ b/includes/api/ApiQueryAllDeletedRevisions.php @@ -143,14 +143,8 @@ class ApiQueryAllDeletedRevisions extends ApiQueryRevisionsBase { } } + // This means stricter restrictions if ( $this->fetchContent ) { - $this->addTables( 'text' ); - $this->addJoinConds( - [ 'text' => [ 'LEFT JOIN', [ 'ar_text_id=old_id' ] ] ] - ); - $this->addFields( [ 'old_text', 'old_flags' ] ); - - // This also means stricter restrictions $this->checkUserRightsAny( [ 'deletedtext', 'undelete' ] ); } diff --git a/includes/api/ApiQueryDeletedRevisions.php b/includes/api/ApiQueryDeletedRevisions.php index b266ecfe2e..bbb987f760 100644 --- a/includes/api/ApiQueryDeletedRevisions.php +++ b/includes/api/ApiQueryDeletedRevisions.php @@ -94,14 +94,8 @@ class ApiQueryDeletedRevisions extends ApiQueryRevisionsBase { } } + // This means stricter restrictions if ( $this->fetchContent ) { - $this->addTables( 'text' ); - $this->addJoinConds( - [ 'text' => [ 'LEFT JOIN', [ 'ar_text_id=old_id' ] ] ] - ); - $this->addFields( [ 'old_text', 'old_flags' ] ); - - // This also means stricter restrictions $this->checkUserRightsAny( [ 'deletedtext', 'undelete' ] ); } diff --git a/includes/api/ApiQueryDeletedrevs.php b/includes/api/ApiQueryDeletedrevs.php index 91d86b9ff7..4fbc1575b3 100644 --- a/includes/api/ApiQueryDeletedrevs.php +++ b/includes/api/ApiQueryDeletedrevs.php @@ -104,27 +104,12 @@ class ApiQueryDeletedrevs extends ApiQueryBase { $this->dieWithError( 'user and excludeuser cannot be used together', 'badparams' ); } - $this->addTables( 'archive' ); - $this->addFields( [ 'ar_title', 'ar_namespace', 'ar_timestamp', 'ar_deleted', 'ar_id' ] ); - - $this->addFieldsIf( 'ar_parent_id', $fld_parentid ); - $this->addFieldsIf( 'ar_rev_id', $fld_revid ); - if ( $fld_user || $fld_userid ) { - $actorQuery = ActorMigration::newMigration()->getJoin( 'ar_user' ); - $this->addTables( $actorQuery['tables'] ); - $this->addFields( $actorQuery['fields'] ); - $this->addJoinConds( $actorQuery['joins'] ); - } - $this->addFieldsIf( 'ar_minor_edit', $fld_minor ); - $this->addFieldsIf( 'ar_len', $fld_len ); - $this->addFieldsIf( 'ar_sha1', $fld_sha1 ); - - if ( $fld_comment || $fld_parsedcomment ) { - $commentQuery = $commentStore->getJoin( 'ar_comment' ); - $this->addTables( $commentQuery['tables'] ); - $this->addFields( $commentQuery['fields'] ); - $this->addJoinConds( $commentQuery['joins'] ); - } + $revisionStore = MediaWikiServices::getInstance()->getRevisionStore(); + $arQuery = $revisionStore->getArchiveQueryInfo(); + $this->addTables( $arQuery['tables'] ); + $this->addFields( $arQuery['fields'] ); + $this->addJoinConds( $arQuery['joins'] ); + $this->addFields( [ 'ar_title', 'ar_namespace' ] ); if ( $fld_tags ) { $this->addFields( [ 'ts_tags' => ChangeTags::makeTagSummarySubquery( 'archive' ) ] ); @@ -144,14 +129,8 @@ class ApiQueryDeletedrevs extends ApiQueryBase { } } + // This means stricter restrictions if ( $fld_content ) { - $this->addTables( 'text' ); - $this->addJoinConds( - [ 'text' => [ 'LEFT JOIN', [ 'ar_text_id=old_id' ] ] ] - ); - $this->addFields( [ 'ar_text_id', 'old_text', 'old_flags' ] ); - - // This also means stricter restrictions $this->checkUserRightsAny( [ 'deletedtext', 'undelete' ] ); } // Check limits @@ -365,7 +344,7 @@ class ApiQueryDeletedrevs extends ApiQueryBase { $anyHidden = true; } if ( Revision::userCanBitfield( $row->ar_deleted, Revision::DELETED_TEXT, $user ) ) { - ApiResult::setContentValue( $rev, 'text', Revision::getRevisionText( $row ) ); + ApiResult::setContentValue( $rev, 'text', Revision::getRevisionText( $row, 'ar_' ) ); } } -- 2.20.1