Merge ".mailmap: Correct two contributor names"
[mediawiki.git] / includes / user / ActorMigration.php
blobdd2aceb38bee35fa3465a9cde708ea72a858ce6e
1 <?php
3 namespace MediaWiki\User;
5 use MediaWiki\MediaWikiServices;
6 use Wikimedia\Rdbms\IDatabase;
7 use Wikimedia\Rdbms\IReadableDatabase;
9 /**
10 * This is not intended to be a long-term part of MediaWiki; it will be
11 * deprecated and removed once actor migration is complete.
13 * @since 1.31
14 * @since 1.34 Use with 'ar_user', 'img_user', 'oi_user', 'fa_user',
15 * 'rc_user', 'log_user', and 'ipb_by' is deprecated. Callers should
16 * reference the corresponding actor fields directly.
17 * @deprecated since 1.39
19 class ActorMigration extends ActorMigrationBase {
20 /**
21 * Constant for extensions to feature-test whether $wgActorTableSchemaMigrationStage
22 * (in MW <1.34) expects MIGRATION_* or SCHEMA_COMPAT_*
24 public const MIGRATION_STAGE_SCHEMA_COMPAT = 1;
26 /**
27 * Field information
28 * @see ActorMigrationBase::getFieldInfo()
30 public const FIELD_INFOS = [
31 // Deprecated since 1.39
32 'rev_user' => [],
35 /**
36 * Static constructor
37 * @return self
39 public static function newMigration() {
40 return MediaWikiServices::getInstance()->getActorMigration();
43 /**
44 * Static constructor
45 * @return self
47 public static function newMigrationForImport() {
48 $migration = new self(
49 MediaWikiServices::getInstance()->getActorStoreFactory()
51 $migration->setForImport( true );
52 return $migration;
55 /**
56 * @internal
58 * @param ActorStoreFactory $actorStoreFactory
60 public function __construct( ActorStoreFactory $actorStoreFactory ) {
61 parent::__construct(
62 self::FIELD_INFOS,
63 SCHEMA_COMPAT_NEW,
64 $actorStoreFactory
68 /**
69 * @inheritDoc
70 * @deprecated since 1.39 Use `{table} JOIN actor ON {table_prefix}_actor = actor_id`
71 * E.g. for key=rev_user, use `revision JOIN actor ON rev_actor = actor_id`
73 public function getJoin( $key ) {
74 return parent::getJoin( $key );
77 /**
78 * @inheritDoc
79 * @deprecated since 1.39 Use `{table_prefix}_actor IN ({list of actor IDs})`.
80 * E.g. for key=rev_user, use `rev_actor IN ({list of actor IDs})`.
81 * Use `MediaWikiServices::getInstance()->getActorNormalization()
82 * ->findActorId( $user, $db )` to get the actor ID for a given user.
84 public function getWhere( IReadableDatabase $db, $key, $users, $useId = true ) {
85 return parent::getWhere( $db, $key, $users, $useId );
88 /**
89 * @inheritDoc
90 * @deprecated since 1.39 Use `[ '{table_prefix}_actor' => MediaWikiServices::getInstance()
91 * ->getActorNormalization()->acquireActorId( $user, $dbw ) ]`
92 * E.g. for key=log_user, use `[ 'log_actor' => ... ]`
94 public function getInsertValues( IDatabase $dbw, $key, UserIdentity $user ) {
95 return parent::getInsertValues( $dbw, $key, $user );
100 /** @deprecated class alias since 1.40 */
101 class_alias( ActorMigration::class, 'ActorMigration' );