MediaWiki REL1_35
|
This class handles the logic for the actor table migration and should always be used in lieu of directly accessing database tables. More...
Public Member Functions | |
__construct ( $stage) | |
getExistingActorId (IDatabase $db, UserIdentity $user) | |
Get actor ID from UserIdentity, if it exists. | |
getInsertValues (IDatabase $dbw, $key, UserIdentity $user) | |
Get UPDATE fields for the actor. | |
getInsertValuesWithTempTable (IDatabase $dbw, $key, UserIdentity $user) | |
Get UPDATE fields for the actor. | |
getJoin ( $key) | |
Get SELECT fields and joins for the actor key. | |
getNewActorId (IDatabase $dbw, UserIdentity $user) | |
Attempt to assign an actor ID to the given user. | |
getWhere (IDatabase $db, $key, $users, $useId=true) | |
Get WHERE condition for the actor. | |
isAnon ( $field) | |
Return an SQL condition to test if a user field is anonymous. | |
isNotAnon ( $field) | |
Return an SQL condition to test if a user field is non-anonymous. | |
Static Public Member Functions | |
static | newMigration () |
Static constructor. | |
Public Attributes | |
const | MIGRATION_STAGE_SCHEMA_COMPAT = 1 |
Constant for extensions to feature-test whether $wgActorTableSchemaMigrationStage (in MW <1.34) expects MIGRATION_* or SCHEMA_COMPAT_*. | |
Static Private Member Functions | |
static | checkDeprecation ( $key) |
Issue deprecation warning/error as appropriate. | |
static | getFieldNames ( $key) |
Private Attributes | |
array | $joinCache = [] |
Cache for self::getJoin() | |
int | $stage |
Combination of SCHEMA_COMPAT_* constants. | |
Static Private Attributes | |
static string null[] | $deprecated |
Define fields that are deprecated for use with this class. | |
static array | $formerTempTables = [] |
Fields that formerly used $tempTables Key is '$key', value is the MediaWiki version in which it was removed from $tempTables. | |
static string[] | $removed = [] |
Define fields that are removed for use with this class. | |
static array | $specialFields |
Define fields that use non-standard mapping Keys are the user id column name, values are arrays with two elements (the user text column name and the actor id column name) | |
static array | $tempTables |
Define fields that use temporary tables for transitional purposes Keys are '$key', values are arrays with four fields: | |
This class handles the logic for the actor table migration and should always be used in lieu of directly accessing database tables.
This is not intended to be a long-term part of MediaWiki; it will be deprecated and removed once actor migration is complete.
Definition at line 39 of file ActorMigration.php.
ActorMigration::__construct | ( | $stage | ) |
Definition at line 116 of file ActorMigration.php.
References SCHEMA_COMPAT_READ_BOTH, SCHEMA_COMPAT_READ_NEW, SCHEMA_COMPAT_READ_OLD, SCHEMA_COMPAT_WRITE_BOTH, SCHEMA_COMPAT_WRITE_NEW, and SCHEMA_COMPAT_WRITE_OLD.
|
staticprivate |
Issue deprecation warning/error as appropriate.
string | $key |
Definition at line 148 of file ActorMigration.php.
References wfDeprecated().
ActorMigration::getExistingActorId | ( | IDatabase | $db, |
UserIdentity | $user | ||
) |
Get actor ID from UserIdentity, if it exists.
IDatabase | $db | |
UserIdentity | $user |
Definition at line 251 of file ActorMigration.php.
References MediaWiki\User\UserIdentity\getName(), and Wikimedia\Rdbms\IDatabase\selectRow().
Referenced by getInsertValues().
|
staticprivate |
string | $key | A key such as "rev_user" identifying the actor field being fetched. |
Definition at line 182 of file ActorMigration.php.
ActorMigration::getInsertValues | ( | IDatabase | $dbw, |
$key, | |||
UserIdentity | $user | ||
) |
Get UPDATE fields for the actor.
IDatabase | $dbw | Database to use for creating an actor ID, if necessary |
string | $key | A key such as "rev_user" identifying the actor field being fetched. |
UserIdentity | $user | User to set in the update |
$values
to IDatabase->update()
or $a
to IDatabase->insert()
Definition at line 331 of file ActorMigration.php.
References getExistingActorId(), MediaWiki\User\UserIdentity\getId(), MediaWiki\User\UserIdentity\getName(), getNewActorId(), SCHEMA_COMPAT_WRITE_NEW, and SCHEMA_COMPAT_WRITE_OLD.
ActorMigration::getInsertValuesWithTempTable | ( | IDatabase | $dbw, |
$key, | |||
UserIdentity | $user | ||
) |
Get UPDATE fields for the actor.
IDatabase | $dbw | Database to use for creating an actor ID, if necessary |
string | $key | A key such as "rev_user" identifying the actor field being fetched. |
UserIdentity | $user | User to set in the update |
$values
to IDatabase->update()
or $a
to IDatabase->insert()
Definition at line 369 of file ActorMigration.php.
References $t, MediaWiki\User\UserIdentity\getActorId(), MediaWiki\User\UserIdentity\getId(), MediaWiki\User\UserIdentity\getName(), User\newFromAnyId(), SCHEMA_COMPAT_WRITE_NEW, SCHEMA_COMPAT_WRITE_OLD, Wikimedia\Rdbms\IDatabase\upsert(), and wfDeprecated().
ActorMigration::getJoin | ( | $key | ) |
Get SELECT fields and joins for the actor key.
string | $key | A key such as "rev_user" identifying the actor field being fetched. |
$table
to IDatabase->select()
$vars
to IDatabase->select()
$join_conds
to IDatabase->select()
All tables, fields, and joins are aliased, so +
is safe to use. -return array{tables:string[],fields:string[],joins:array} Definition at line 198 of file ActorMigration.php.
References $t, and SCHEMA_COMPAT_READ_OLD.
ActorMigration::getNewActorId | ( | IDatabase | $dbw, |
UserIdentity | $user | ||
) |
Attempt to assign an actor ID to the given user.
If it is already assigned, return the existing ID.
IDatabase | $dbw | |
UserIdentity | $user |
Definition at line 276 of file ActorMigration.php.
References Wikimedia\Rdbms\IDatabase\affectedRows(), MediaWiki\User\UserIdentity\getId(), MediaWiki\User\UserIdentity\getName(), Wikimedia\Rdbms\IDatabase\insert(), Wikimedia\Rdbms\IDatabase\insertId(), and Wikimedia\Rdbms\IDatabase\selectField().
Referenced by getInsertValues().
Get WHERE condition for the actor.
IDatabase | $db | Database to use for quoting and list-making |
string | $key | A key such as "rev_user" identifying the actor field being fetched. |
UserIdentity | UserIdentity[] | null | false | $users | Users to test for. Passing null, false, or the empty array will return 'conds' that never match, and an empty array for 'orconds'. |
bool | $useId | If 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). |
$table
to IDatabase->select()
$cond
to IDatabase->select()
$join_conds
to IDatabase->select()
All tables and joins are aliased, so +
is safe to use. Definition at line 456 of file ActorMigration.php.
References $t, Wikimedia\Rdbms\IDatabase\makeList(), and SCHEMA_COMPAT_READ_NEW.
ActorMigration::isAnon | ( | $field | ) |
Return an SQL condition to test if a user field is anonymous.
string | $field | Field name or SQL fragment |
Definition at line 164 of file ActorMigration.php.
References SCHEMA_COMPAT_READ_NEW.
ActorMigration::isNotAnon | ( | $field | ) |
Return an SQL condition to test if a user field is non-anonymous.
string | $field | Field name or SQL fragment |
Definition at line 173 of file ActorMigration.php.
References SCHEMA_COMPAT_READ_NEW.
|
static |
|
staticprivate |
Define fields that are deprecated for use with this class.
Keys are '$key', value is null for soft deprecation or a string naming the deprecated version for hard deprecation.
Definition at line 80 of file ActorMigration.php.
|
staticprivate |
Fields that formerly used $tempTables Key is '$key', value is the MediaWiki version in which it was removed from $tempTables.
Definition at line 73 of file ActorMigration.php.
|
private |
Cache for self::getJoin()
Definition at line 107 of file ActorMigration.php.
|
staticprivate |
Define fields that are removed for use with this class.
Keys are '$key', value is the MediaWiki version in which use was removed.
Definition at line 95 of file ActorMigration.php.
|
staticprivate |
Define fields that use non-standard mapping Keys are the user id column name, values are arrays with two elements (the user text column name and the actor id column name)
Definition at line 102 of file ActorMigration.php.
|
private |
Combination of SCHEMA_COMPAT_* constants.
Definition at line 110 of file ActorMigration.php.
|
staticprivate |
Define fields that use temporary tables for transitional purposes Keys are '$key', values are arrays with four fields:
Definition at line 55 of file ActorMigration.php.
const 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 45 of file ActorMigration.php.