2017-09-12 17:12:29 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
use MediaWiki\MediaWikiServices;
|
2021-01-22 19:51:43 +00:00
|
|
|
use MediaWiki\User\ActorStoreFactory;
|
2017-09-12 17:12:29 +00:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* This is not intended to be a long-term part of MediaWiki; it will be
|
2019-07-23 17:40:52 +00:00
|
|
|
* deprecated and removed once actor migration is complete.
|
2017-09-12 17:12:29 +00:00
|
|
|
*
|
|
|
|
|
* @since 1.31
|
2019-07-23 17:40:52 +00:00
|
|
|
* @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.
|
2017-09-12 17:12:29 +00:00
|
|
|
*/
|
2021-04-22 04:43:09 +00:00
|
|
|
class ActorMigration extends ActorMigrationBase {
|
2018-09-18 18:21:20 +00:00
|
|
|
/**
|
|
|
|
|
* Constant for extensions to feature-test whether $wgActorTableSchemaMigrationStage
|
2019-07-23 17:40:52 +00:00
|
|
|
* (in MW <1.34) expects MIGRATION_* or SCHEMA_COMPAT_*
|
2018-09-18 18:21:20 +00:00
|
|
|
*/
|
2020-05-11 00:48:27 +00:00
|
|
|
public const MIGRATION_STAGE_SCHEMA_COMPAT = 1;
|
2018-09-18 18:21:20 +00:00
|
|
|
|
2017-09-12 17:12:29 +00:00
|
|
|
/**
|
2021-04-22 04:43:09 +00:00
|
|
|
* Field information
|
|
|
|
|
* @see ActorMigrationBase::getFieldInfo()
|
2017-09-12 17:12:29 +00:00
|
|
|
*/
|
2021-04-22 04:43:09 +00:00
|
|
|
public const FIELD_INFOS = [
|
2017-09-12 17:12:29 +00:00
|
|
|
'rev_user' => [
|
2021-04-22 04:43:09 +00:00
|
|
|
'tempTable' => [
|
|
|
|
|
'table' => 'revision_actor_temp',
|
|
|
|
|
'pk' => 'revactor_rev',
|
|
|
|
|
'field' => 'revactor_actor',
|
|
|
|
|
'joinPK' => 'rev_id',
|
|
|
|
|
'extra' => [
|
|
|
|
|
'revactor_timestamp' => 'rev_timestamp',
|
|
|
|
|
'revactor_page' => 'rev_page',
|
|
|
|
|
],
|
|
|
|
|
]
|
2017-09-12 17:12:29 +00:00
|
|
|
],
|
|
|
|
|
|
2021-04-22 04:43:09 +00:00
|
|
|
// Deprecated since 1.34
|
2021-04-22 06:00:25 +00:00
|
|
|
'ar_user' => [
|
|
|
|
|
'deprecatedVersion' => '1.37',
|
|
|
|
|
],
|
2021-04-22 04:43:09 +00:00
|
|
|
// Deprecated since 1.34
|
2021-04-22 06:00:25 +00:00
|
|
|
'img_user' => [
|
|
|
|
|
'deprecatedVersion' => '1.37',
|
|
|
|
|
],
|
2021-04-22 04:43:09 +00:00
|
|
|
// Deprecated since 1.34
|
2021-04-22 06:00:25 +00:00
|
|
|
'oi_user' => [
|
|
|
|
|
'deprecatedVersion' => '1.37',
|
|
|
|
|
],
|
2021-04-22 04:43:09 +00:00
|
|
|
// Deprecated since 1.34
|
2021-04-22 06:00:25 +00:00
|
|
|
'fa_user' => [
|
|
|
|
|
'deprecatedVersion' => '1.37',
|
|
|
|
|
],
|
2021-04-22 04:43:09 +00:00
|
|
|
// Deprecated since 1.34
|
2021-04-22 06:00:25 +00:00
|
|
|
'rc_user' => [
|
|
|
|
|
'deprecatedVersion' => '1.37',
|
|
|
|
|
],
|
2021-04-22 04:43:09 +00:00
|
|
|
// Deprecated since 1.34
|
2021-04-22 06:00:25 +00:00
|
|
|
'log_user' => [
|
|
|
|
|
'deprecatedVersion' => '1.37',
|
|
|
|
|
],
|
2021-04-22 04:43:09 +00:00
|
|
|
// Deprecated since 1.34
|
|
|
|
|
'ipb_by' => [
|
2021-04-22 06:00:25 +00:00
|
|
|
'deprecatedVersion' => '1.37',
|
2021-04-22 04:43:09 +00:00
|
|
|
'textField' => 'ipb_by_text',
|
|
|
|
|
'actorField' => 'ipb_by_actor'
|
|
|
|
|
]
|
2019-07-23 17:40:52 +00:00
|
|
|
];
|
|
|
|
|
|
2017-09-12 17:12:29 +00:00
|
|
|
/**
|
|
|
|
|
* Static constructor
|
2021-02-12 09:33:13 +00:00
|
|
|
* @return self
|
2017-09-12 17:12:29 +00:00
|
|
|
*/
|
|
|
|
|
public static function newMigration() {
|
|
|
|
|
return MediaWikiServices::getInstance()->getActorMigration();
|
|
|
|
|
}
|
|
|
|
|
|
2019-07-23 17:40:52 +00:00
|
|
|
/**
|
2021-04-22 04:43:09 +00:00
|
|
|
* @internal
|
2017-09-12 17:12:29 +00:00
|
|
|
*
|
2021-04-22 04:43:09 +00:00
|
|
|
* @param int $stage
|
|
|
|
|
* @param ActorStoreFactory $actorStoreFactory
|
2017-09-12 17:12:29 +00:00
|
|
|
*/
|
2021-04-22 04:43:09 +00:00
|
|
|
public function __construct(
|
|
|
|
|
$stage,
|
|
|
|
|
ActorStoreFactory $actorStoreFactory
|
|
|
|
|
) {
|
2021-05-03 05:13:41 +00:00
|
|
|
if ( $stage & SCHEMA_COMPAT_OLD ) {
|
|
|
|
|
throw new InvalidArgumentException(
|
|
|
|
|
'The old actor table schema is no longer supported' );
|
|
|
|
|
}
|
2021-04-22 04:43:09 +00:00
|
|
|
parent::__construct(
|
|
|
|
|
self::FIELD_INFOS,
|
|
|
|
|
$stage,
|
|
|
|
|
$actorStoreFactory
|
|
|
|
|
);
|
2017-09-12 17:12:29 +00:00
|
|
|
}
|
|
|
|
|
}
|