Introduce a new schema migration stage in which rev_actor is used
directly and the revision_actor_temp table is no longer needed. This
becomes the new "new" stage whereas the previous situation is now
termed SCHEMA_COMPAT_TEMP.
Introduce migrateRevisionActorTemp which copies data from
revision_actor_temp to rev_actor. The code is similar to
migrateImageCommentTemp.php except that it doesn't delete from the old
table.
Partial revert of c29909e59f. That change removed direct
references to $wgActorTableSchemaMigrationStage and made queries
involving revision_actor_temp be unconditional. Such changes need to be
reverted to make the use of revision_actor_temp be conditional again.
In ActorMigrationTest, I compacted provideGetJoin() and
provideGetWhere(), removing most of the duplication between expected
values. I gave all the stages a short name, and mostly used the name in
providers.
Bug: T275246
Change-Id: I7498107dd6433ab7de5bf2e7b3fe2aa5e10e345d
100 lines
2.2 KiB
PHP
100 lines
2.2 KiB
PHP
<?php
|
|
|
|
use MediaWiki\MediaWikiServices;
|
|
use MediaWiki\User\ActorStoreFactory;
|
|
|
|
/**
|
|
* This is not intended to be a long-term part of MediaWiki; it will be
|
|
* deprecated and removed once actor migration is complete.
|
|
*
|
|
* @since 1.31
|
|
* @since 1.34 Use with 'ar_user', 'img_user', 'oi_user', 'fa_user',
|
|
* 'rc_user', 'log_user', and 'ipb_by' is deprecated. Callers should
|
|
* reference the corresponding actor fields directly.
|
|
*/
|
|
class ActorMigration extends ActorMigrationBase {
|
|
/**
|
|
* Constant for extensions to feature-test whether $wgActorTableSchemaMigrationStage
|
|
* (in MW <1.34) expects MIGRATION_* or SCHEMA_COMPAT_*
|
|
*/
|
|
public const MIGRATION_STAGE_SCHEMA_COMPAT = 1;
|
|
|
|
/**
|
|
* Field information
|
|
* @see ActorMigrationBase::getFieldInfo()
|
|
*/
|
|
public const FIELD_INFOS = [
|
|
'rev_user' => [
|
|
'tempTable' => [
|
|
'table' => 'revision_actor_temp',
|
|
'pk' => 'revactor_rev',
|
|
'field' => 'revactor_actor',
|
|
'joinPK' => 'rev_id',
|
|
'extra' => [
|
|
'revactor_timestamp' => 'rev_timestamp',
|
|
'revactor_page' => 'rev_page',
|
|
],
|
|
]
|
|
],
|
|
|
|
// Deprecated since 1.34
|
|
'ar_user' => [
|
|
'deprecatedVersion' => '1.37',
|
|
],
|
|
// Deprecated since 1.34
|
|
'img_user' => [
|
|
'deprecatedVersion' => '1.37',
|
|
],
|
|
// Deprecated since 1.34
|
|
'oi_user' => [
|
|
'deprecatedVersion' => '1.37',
|
|
],
|
|
// Deprecated since 1.34
|
|
'fa_user' => [
|
|
'deprecatedVersion' => '1.37',
|
|
],
|
|
// Deprecated since 1.34
|
|
'rc_user' => [
|
|
'deprecatedVersion' => '1.37',
|
|
],
|
|
// Deprecated since 1.34
|
|
'log_user' => [
|
|
'deprecatedVersion' => '1.37',
|
|
],
|
|
// Deprecated since 1.34
|
|
'ipb_by' => [
|
|
'deprecatedVersion' => '1.37',
|
|
'textField' => 'ipb_by_text',
|
|
'actorField' => 'ipb_by_actor'
|
|
]
|
|
];
|
|
|
|
/**
|
|
* Static constructor
|
|
* @return self
|
|
*/
|
|
public static function newMigration() {
|
|
return MediaWikiServices::getInstance()->getActorMigration();
|
|
}
|
|
|
|
/**
|
|
* @internal
|
|
*
|
|
* @param int $stage
|
|
* @param ActorStoreFactory $actorStoreFactory
|
|
*/
|
|
public function __construct(
|
|
$stage,
|
|
ActorStoreFactory $actorStoreFactory
|
|
) {
|
|
if ( $stage & SCHEMA_COMPAT_OLD ) {
|
|
throw new InvalidArgumentException(
|
|
'The old actor table schema is no longer supported' );
|
|
}
|
|
parent::__construct(
|
|
self::FIELD_INFOS,
|
|
$stage,
|
|
$actorStoreFactory
|
|
);
|
|
}
|
|
}
|