MediaWiki  master
MediaWiki\User\ActorMigration Class Reference

This is not intended to be a long-term part of MediaWiki; it will be deprecated and removed once actor migration is complete. More...

Inheritance diagram for MediaWiki\User\ActorMigration:
Collaboration diagram for MediaWiki\User\ActorMigration:

Public Member Functions

 __construct ( $stage, ActorStoreFactory $actorStoreFactory)
 
 getInsertValues (IDatabase $dbw, $key, UserIdentity $user)
 Get UPDATE fields for the actor.
Parameters
IDatabase$dbwDatabase to use for creating an actor ID, if necessary
string$keyA key such as "rev_user" identifying the actor field being fetched.
UserIdentity$userUser to set in the update
Returns
array to merge into $values to IDatabase->update() or $a to IDatabase->insert()
More...
 
 getInsertValuesWithTempTable (IDatabase $dbw, $key, UserIdentity $user)
 Get UPDATE fields for the actor.
Parameters
IDatabase$dbwDatabase to use for creating an actor ID, if necessary
string$keyA key such as "rev_user" identifying the actor field being fetched.
UserIdentity$userUser to set in the update
Returns
array with two values:
  • array to merge into $values to IDatabase->update() or $a to IDatabase->insert()
  • callback to call with the primary key for the main table insert and extra fields needed for the temp table.
More...
 
 getJoin ( $key)
 Get SELECT fields and joins for the actor key.
Parameters
string$keyA key such as "rev_user" identifying the actor field being fetched.
Returns
array[] With three keys:
More...
 
 getWhere (IReadableDatabase $db, $key, $users, $useId=true)
 Get WHERE condition for the actor.
Parameters
IReadableDatabase$dbDatabase to use for quoting and list-making
string$keyA key such as "rev_user" identifying the actor field being fetched.
UserIdentity | UserIdentity[] | null | false$usersUsers to test for. Passing null, false, or the empty array will return 'conds' that never match, and an empty array for 'orconds'.
bool$useIdIf false, don't try to query by the user ID. Intended for use with rc_user since it has an index on (rc_user_text,rc_timestamp) but not (rc_user,rc_timestamp).
Returns
array With four keys:
  • tables: (string[]) to include in the $table to IDatabase->select() or SelectQueryBuilder::tables
  • conds: (string) to include in the $cond to IDatabase->select() or SelectQueryBuilder::conds
  • orconds: (array[]) array of alternatives in case a union of multiple queries would be more efficient than a query with OR. May have keys 'actor', 'userid', 'username'. Since 1.32, this is guaranteed to contain just one alternative if $users contains a single user.
  • joins: (array) to include in the $join_conds to IDatabase->select() or SelectQueryBuilder::joinConds All tables and joins are aliased, so + is safe to use.
More...
 
- Public Member Functions inherited from MediaWiki\User\ActorMigrationBase
 __construct ( $fieldInfos, $stage, ActorStoreFactory $actorStoreFactory, $options=[])
 
 isAnon ( $field)
 Return an SQL condition to test if a user field is anonymous. More...
 
 isNotAnon ( $field)
 Return an SQL condition to test if a user field is non-anonymous. More...
 

Static Public Member Functions

static newMigration ()
 Static constructor. More...
 

Public Attributes

const FIELD_INFOS
 Field information. More...
 
const MIGRATION_STAGE_SCHEMA_COMPAT = 1
 Constant for extensions to feature-test whether $wgActorTableSchemaMigrationStage (in MW <1.34) expects MIGRATION_* or SCHEMA_COMPAT_*. More...
 

Additional Inherited Members

- Protected Member Functions inherited from MediaWiki\User\ActorMigrationBase
 checkDeprecation ( $key)
 Issue deprecation warning/error as appropriate. More...
 
 getFieldInfo ( $key)
 Get config information about a field. More...
 
 getInstanceName ()
 Get a name for this instance to use in error messages. More...
 

Detailed Description

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
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.
Deprecated:
since 1.39

Definition at line 20 of file ActorMigration.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\User\ActorMigration::__construct (   $stage,
ActorStoreFactory  $actorStoreFactory 
)
Access: internal
Parameters
int$stage
ActorStoreFactory$actorStoreFactory

Definition at line 92 of file ActorMigration.php.

References SCHEMA_COMPAT_OLD.

Member Function Documentation

◆ getInsertValues()

MediaWiki\User\ActorMigration::getInsertValues ( IDatabase  $dbw,
  $key,
UserIdentity  $user 
)

Get UPDATE fields for the actor.

Parameters
IDatabase$dbwDatabase to use for creating an actor ID, if necessary
string$keyA key such as "rev_user" identifying the actor field being fetched.
UserIdentity$userUser to set in the update
Returns
array to merge into $values to IDatabase->update() or $a to IDatabase->insert()

Deprecated:
since 1.39 Use ‘[ ’{table_prefix}_actor' => MediaWikiServices::getInstance() ->getActorNormalization()->acquireActorId( $user, $dbw ) ] E.g.

for key=log_user, use[ 'log_actor' => ... ]`

Reimplemented from MediaWiki\User\ActorMigrationBase.

Definition at line 134 of file ActorMigration.php.

◆ getInsertValuesWithTempTable()

MediaWiki\User\ActorMigration::getInsertValuesWithTempTable ( IDatabase  $dbw,
  $key,
UserIdentity  $user 
)

Get UPDATE fields for the actor.

Parameters
IDatabase$dbwDatabase to use for creating an actor ID, if necessary
string$keyA key such as "rev_user" identifying the actor field being fetched.
UserIdentity$userUser to set in the update
Returns
array with two values:
  • array to merge into $values to IDatabase->update() or $a to IDatabase->insert()
  • callback to call with the primary key for the main table insert and extra fields needed for the temp table.

Deprecated:
since 1.39 Use same replacement as getInsertValues().

Reimplemented from MediaWiki\User\ActorMigrationBase.

Definition at line 142 of file ActorMigration.php.

◆ getJoin()

MediaWiki\User\ActorMigration::getJoin (   $key)

Get SELECT fields and joins for the actor key.

Parameters
string$keyA key such as "rev_user" identifying the actor field being fetched.
Returns
array[] With three keys:

Deprecated:
since 1.39 Use {table} JOIN actor ON {table_prefix}_actor = actor_id E.g.

for key=rev_user, use revision JOIN actor ON rev_actor = actor_id

Reimplemented from MediaWiki\User\ActorMigrationBase.

Definition at line 113 of file ActorMigration.php.

◆ getWhere()

MediaWiki\User\ActorMigration::getWhere ( IReadableDatabase  $db,
  $key,
  $users,
  $useId = true 
)

Get WHERE condition for the actor.

Parameters
IReadableDatabase$dbDatabase to use for quoting and list-making
string$keyA key such as "rev_user" identifying the actor field being fetched.
UserIdentity | UserIdentity[] | null | false$usersUsers to test for. Passing null, false, or the empty array will return 'conds' that never match, and an empty array for 'orconds'.
bool$useIdIf false, don't try to query by the user ID. Intended for use with rc_user since it has an index on (rc_user_text,rc_timestamp) but not (rc_user,rc_timestamp).
Returns
array With four keys:
  • tables: (string[]) to include in the $table to IDatabase->select() or SelectQueryBuilder::tables
  • conds: (string) to include in the $cond to IDatabase->select() or SelectQueryBuilder::conds
  • orconds: (array[]) array of alternatives in case a union of multiple queries would be more efficient than a query with OR. May have keys 'actor', 'userid', 'username'. Since 1.32, this is guaranteed to contain just one alternative if $users contains a single user.
  • joins: (array) to include in the $join_conds to IDatabase->select() or SelectQueryBuilder::joinConds All tables and joins are aliased, so + is safe to use.

Deprecated:
since 1.39 Use {table_prefix}_actor IN ({list of actor IDs}).

E.g. for key=rev_user, use rev_actor IN ({list of actor IDs}). Use MediaWikiServices::getInstance()->getActorNormalization() ->findActorId( $user, $db ) to get the actor ID for a given user.

Reimplemented from MediaWiki\User\ActorMigrationBase.

Definition at line 124 of file ActorMigration.php.

◆ newMigration()

static MediaWiki\User\ActorMigration::newMigration ( )
static

Static constructor.

Returns
self

Definition at line 82 of file ActorMigration.php.

References MediaWiki\MediaWikiServices\getInstance().

Member Data Documentation

◆ FIELD_INFOS

const MediaWiki\User\ActorMigration::FIELD_INFOS

Field information.

See also
ActorMigrationBase::getFieldInfo()

Definition at line 31 of file ActorMigration.php.

◆ MIGRATION_STAGE_SCHEMA_COMPAT

const MediaWiki\User\ActorMigration::MIGRATION_STAGE_SCHEMA_COMPAT = 1

Constant for extensions to feature-test whether $wgActorTableSchemaMigrationStage (in MW <1.34) expects MIGRATION_* or SCHEMA_COMPAT_*.

Definition at line 25 of file ActorMigration.php.


The documentation for this class was generated from the following file: