MediaWiki  master
ActorMigration.php
Go to the documentation of this file.
1 <?php
2 
3 namespace MediaWiki\User;
4 
5 use InvalidArgumentException;
9 
26 
31  public const FIELD_INFOS = [
32  // Deprecated since 1.39
33  'rev_user' => [
34  'tempTable' => [
35  'table' => 'revision_actor_temp',
36  'pk' => 'revactor_rev',
37  'field' => 'revactor_actor',
38  'joinPK' => 'rev_id',
39  'extra' => [
40  'revactor_timestamp' => 'rev_timestamp',
41  'revactor_page' => 'rev_page',
42  ],
43  ],
44  ],
45 
46  // Deprecated since 1.34
47  'ar_user' => [
48  'deprecatedVersion' => '1.37',
49  ],
50  // Deprecated since 1.34
51  'img_user' => [
52  'deprecatedVersion' => '1.37',
53  ],
54  // Deprecated since 1.34
55  'oi_user' => [
56  'deprecatedVersion' => '1.37',
57  ],
58  // Deprecated since 1.34
59  'fa_user' => [
60  'deprecatedVersion' => '1.37',
61  ],
62  // Deprecated since 1.34
63  'rc_user' => [
64  'deprecatedVersion' => '1.37',
65  ],
66  // Deprecated since 1.34
67  'log_user' => [
68  'deprecatedVersion' => '1.37',
69  ],
70  // Deprecated since 1.34
71  'ipb_by' => [
72  'deprecatedVersion' => '1.37',
73  'textField' => 'ipb_by_text',
74  'actorField' => 'ipb_by_actor',
75  ],
76  ];
77 
82  public static function newMigration() {
83  return MediaWikiServices::getInstance()->getActorMigration();
84  }
85 
92  public function __construct(
93  $stage,
94  ActorStoreFactory $actorStoreFactory
95  ) {
96  if ( $stage & SCHEMA_COMPAT_OLD ) {
97  throw new InvalidArgumentException(
98  'The old actor table schema is no longer supported'
99  );
100  }
101  parent::__construct(
102  self::FIELD_INFOS,
103  $stage,
104  $actorStoreFactory
105  );
106  }
107 
113  public function getJoin( $key ) {
114  return parent::getJoin( $key );
115  }
116 
124  public function getWhere( IReadableDatabase $db, $key, $users, $useId = true ) {
125  return parent::getWhere( $db, $key, $users, $useId );
126  }
127 
134  public function getInsertValues( IDatabase $dbw, $key, UserIdentity $user ) {
135  return parent::getInsertValues( $dbw, $key, $user );
136  }
137 
142  public function getInsertValuesWithTempTable( IDatabase $dbw, $key, UserIdentity $user ) {
143  return parent::getInsertValuesWithTempTable( $dbw, $key, $user );
144  }
145 
146 }
147 
148 class_alias( ActorMigration::class, 'ActorMigration' );
const SCHEMA_COMPAT_OLD
Definition: Defines.php:277
Service locator for MediaWiki core services.
static getInstance()
Returns the global default instance of the top level service locator.
This abstract base class helps migrate core and extension code to use the actor table.
This is not intended to be a long-term part of MediaWiki; it will be deprecated and removed once acto...
const FIELD_INFOS
Field information.
getWhere(IReadableDatabase $db, $key, $users, $useId=true)
Get WHERE condition for the actor.Database to use for quoting and list-making A key such as "rev_user...
const MIGRATION_STAGE_SCHEMA_COMPAT
Constant for extensions to feature-test whether $wgActorTableSchemaMigrationStage (in MW <1....
getInsertValuesWithTempTable(IDatabase $dbw, $key, UserIdentity $user)
Get UPDATE fields for the actor.Database to use for creating an actor ID, if necessary A key such as ...
__construct( $stage, ActorStoreFactory $actorStoreFactory)
static newMigration()
Static constructor.
getJoin( $key)
Get SELECT fields and joins for the actor key.A key such as "rev_user" identifying the actor field be...
getInsertValues(IDatabase $dbw, $key, UserIdentity $user)
Get UPDATE fields for the actor.Database to use for creating an actor ID, if necessary A key such as ...
Interface for objects representing user identity.
Basic database interface for live and lazy-loaded relation database handles.
Definition: IDatabase.php:36
A database connection without write operations.