*/
use MediaWiki\MediaWikiServices;
-use MediaWiki\Storage\RevisionRecord;
+use MediaWiki\Revision\RevisionRecord;
+use MediaWiki\Storage\NameTableAccessException;
/**
* Query module to enumerate all deleted revisions.
* @return void
*/
protected function run( ApiPageSet $resultPageSet = null ) {
+ global $wgChangeTagsSchemaMigrationStage;
+
// Before doing anything at all, let's check permissions
$this->checkUserRightsAny( 'deletedhistory' );
if ( !is_null( $params[$param] ) ) {
$p = $this->getModulePrefix();
$this->dieWithError(
- [ 'apierror-invalidparammix-cannotusewith', $p.$param, "{$p}user" ],
+ [ 'apierror-invalidparammix-cannotusewith', $p . $param, "{$p}user" ],
'invalidparammix'
);
}
if ( !is_null( $params[$param] ) ) {
$p = $this->getModulePrefix();
$this->dieWithError(
- [ 'apierror-invalidparammix-mustusewith', $p.$param, "{$p}user" ],
+ [ 'apierror-invalidparammix-mustusewith', $p . $param, "{$p}user" ],
'invalidparammix'
);
}
$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 ) {