*/
use MediaWiki\MediaWikiServices;
+use MediaWiki\Storage\NameTableAccessException;
use MediaWiki\Storage\RevisionRecord;
/**
* @return void
*/
protected function run( ApiPageSet $resultPageSet = null ) {
+ global $wgChangeTagsSchemaMigrationStage;
+
// Before doing anything at all, let's check permissions
$this->checkUserRightsAny( 'deletedhistory' );
$this->addJoinConds(
[ 'change_tag' => [ 'INNER JOIN', [ 'ar_rev_id=ct_rev_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 ( $this->fetchContent ) {
*/
use MediaWiki\MediaWikiServices;
+use MediaWiki\Storage\NameTableAccessException;
use MediaWiki\Storage\RevisionRecord;
/**
}
protected function run( ApiPageSet $resultPageSet = null ) {
+ global $wgChangeTagsSchemaMigrationStage;
+
$user = $this->getUser();
// Before doing anything at all, let's check permissions
$this->checkUserRightsAny( 'deletedhistory' );
$this->addJoinConds(
[ 'change_tag' => [ 'INNER JOIN', [ 'ar_rev_id=ct_rev_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 ( $this->fetchContent ) {
* @file
*/
+use MediaWiki\MediaWikiServices;
+use MediaWiki\Storage\NameTableAccessException;
+
/**
* Query module to enumerate all deleted revisions.
*
}
public function execute() {
+ global $wgChangeTagsSchemaMigrationStage;
+
// Before doing anything at all, let's check permissions
$this->checkUserRightsAny( 'deletedhistory' );
$this->addJoinConds(
[ 'change_tag' => [ 'INNER JOIN', [ 'ar_rev_id=ct_rev_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 ( $fld_content ) {
* @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'] ) ) {
* @file
*/
+use MediaWiki\MediaWikiServices;
+use MediaWiki\Storage\NameTableAccessException;
use MediaWiki\Storage\RevisionRecord;
/**
* @param ApiPageSet|null $resultPageSet
*/
public function run( $resultPageSet = null ) {
+ global $wgChangeTagsSchemaMigrationStage;
+
$user = $this->getUser();
/* Get the parameters of the request. */
$params = $this->extractRequestParams();
if ( !is_null( $params['tag'] ) ) {
$this->addTables( 'change_tag' );
$this->addJoinConds( [ 'change_tag' => [ 'INNER JOIN', [ 'rc_id=ct_rc_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'] );
+ }
}
// Paranoia: avoid brute force searches (T19342)
*/
use MediaWiki\MediaWikiServices;
+use MediaWiki\Storage\NameTableAccessException;
use MediaWiki\Storage\RevisionRecord;
/**
}
protected function run( ApiPageSet $resultPageSet = null ) {
+ global $wgChangeTagsSchemaMigrationStage;
+
$params = $this->extractRequestParams( false );
$revisionStore = MediaWikiServices::getInstance()->getRevisionStore();
$this->addJoinConds(
[ 'change_tag' => [ 'INNER JOIN', [ 'rev_id=ct_rev_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 ( $resultPageSet === null && $this->fetchContent ) {
*/
use MediaWiki\MediaWikiServices;
+use MediaWiki\Storage\NameTableAccessException;
use MediaWiki\Storage\RevisionRecord;
/**
* @return bool
*/
private function prepareQuery( array $users, $limit, $which ) {
- global $wgActorTableSchemaMigrationStage;
+ global $wgActorTableSchemaMigrationStage, $wgChangeTagsSchemaMigrationStage;
$this->resetQueryParams();
$db = $this->getDB();
$this->addJoinConds(
[ 'change_tag' => [ 'INNER JOIN', [ $idField . ' = ct_rev_id' ] ] ]
);
- $this->addWhereFld( 'ct_tag', $this->params['tag'] );
+ if ( $wgChangeTagsSchemaMigrationStage > MIGRATION_WRITE_BOTH ) {
+ $changeTagDefStore = MediaWikiServices::getInstance()->getChangeTagDefStore();
+ try {
+ $this->addWhereFld( 'ct_tag_id', $changeTagDefStore->getId( $this->params['tag'] ) );
+ } catch ( NameTableAccessException $exception ) {
+ // Return nothing.
+ $this->addWhere( '1=0' );
+ }
+ } else {
+ $this->addWhereFld( 'ct_tag', $this->params['tag'] );
+ }
}
return true;