MediaWiki
master
|
This abstract base class helps migrate core and extension code to use the actor table. More...
Public Member Functions | |
__construct ( $fieldInfos, $stage, ActorStoreFactory $actorStoreFactory, $options=[]) | |
getInsertValues (IDatabase $dbw, $key, UserIdentity $user) | |
Get UPDATE fields for the actor. More... | |
getInsertValuesWithTempTable (IDatabase $dbw, $key, UserIdentity $user) | |
Get UPDATE fields for the actor. More... | |
getJoin ( $key) | |
Get SELECT fields and joins for the actor key. More... | |
getWhere (IReadableDatabase $db, $key, $users, $useId=true) | |
Get WHERE condition for the actor. More... | |
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... | |
Protected Member Functions | |
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... | |
This abstract base class helps migrate core and extension code to use the actor table.
Definition at line 38 of file ActorMigrationBase.php.
MediaWiki\User\ActorMigrationBase::__construct | ( | $fieldInfos, | |
$stage, | |||
ActorStoreFactory | $actorStoreFactory, | ||
$options = [] |
|||
) |
array | $fieldInfos | An array of associative arrays, giving configuration information about fields which are being migrated. Subkeys are:
|
int | $stage | The migration stage. This is a combination of SCHEMA_COMPAT_* flags:
|
ActorStoreFactory | $actorStoreFactory | |
array | $options | Array of other options. May contain:
|
Definition at line 100 of file ActorMigrationBase.php.
References SCHEMA_COMPAT_READ_MASK, SCHEMA_COMPAT_READ_NEW, SCHEMA_COMPAT_READ_OLD, SCHEMA_COMPAT_READ_TEMP, SCHEMA_COMPAT_WRITE_MASK, SCHEMA_COMPAT_WRITE_NEW, SCHEMA_COMPAT_WRITE_OLD, and SCHEMA_COMPAT_WRITE_TEMP.
|
protected |
Issue deprecation warning/error as appropriate.
string | $key |
Definition at line 179 of file ActorMigrationBase.php.
References MediaWiki\User\ActorMigrationBase\getFieldInfo(), and wfDeprecated().
Referenced by MediaWiki\User\ActorMigrationBase\getInsertValues(), MediaWiki\User\ActorMigrationBase\getInsertValuesWithTempTable(), MediaWiki\User\ActorMigrationBase\getJoin(), and MediaWiki\User\ActorMigrationBase\getWhere().
|
protected |
Get config information about a field.
string | $key |
Definition at line 145 of file ActorMigrationBase.php.
References MediaWiki\User\ActorMigrationBase\getInstanceName().
Referenced by MediaWiki\User\ActorMigrationBase\checkDeprecation(), and MediaWiki\User\ActorMigrationBase\getInsertValuesWithTempTable().
MediaWiki\User\ActorMigrationBase::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()
Reimplemented in MediaWiki\User\ActorMigration.
Definition at line 312 of file ActorMigrationBase.php.
References MediaWiki\User\ActorMigrationBase\checkDeprecation(), Wikimedia\Rdbms\IReadableDatabase\getDomainID(), MediaWiki\User\UserIdentity\getId(), MediaWiki\User\UserIdentity\getName(), SCHEMA_COMPAT_WRITE_NEW, SCHEMA_COMPAT_WRITE_OLD, and SCHEMA_COMPAT_WRITE_TEMP.
MediaWiki\User\ActorMigrationBase::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()
Reimplemented in MediaWiki\User\ActorMigration.
Definition at line 344 of file ActorMigrationBase.php.
References MediaWiki\User\ActorMigrationBase\checkDeprecation(), Wikimedia\Rdbms\IReadableDatabase\getDomainID(), MediaWiki\User\ActorMigrationBase\getFieldInfo(), MediaWiki\User\UserIdentity\getId(), MediaWiki\User\UserIdentity\getName(), SCHEMA_COMPAT_WRITE_NEW, SCHEMA_COMPAT_WRITE_OLD, SCHEMA_COMPAT_WRITE_TEMP, Wikimedia\Rdbms\IDatabase\upsert(), and wfDeprecated().
|
protected |
Get a name for this instance to use in error messages.
Definition at line 163 of file ActorMigrationBase.php.
Referenced by MediaWiki\User\ActorMigrationBase\getFieldInfo().
MediaWiki\User\ActorMigrationBase::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()
or SelectQueryBuilder::tables
$vars
to IDatabase->select()
or SelectQueryBuilder::fields
$join_conds
to IDatabase->select()
or SelectQueryBuilder::joinConds
All tables, fields, and joins are aliased, so +
is safe to use. Reimplemented in MediaWiki\User\ActorMigration.
Definition at line 248 of file ActorMigrationBase.php.
References MediaWiki\User\ActorMigrationBase\checkDeprecation(), SCHEMA_COMPAT_READ_OLD, and SCHEMA_COMPAT_READ_TEMP.
MediaWiki\User\ActorMigrationBase::getWhere | ( | IReadableDatabase | $db, |
$key, | |||
$users, | |||
$useId = true |
|||
) |
Get WHERE condition for the actor.
IReadableDatabase | $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()
or SelectQueryBuilder::tables
$cond
to IDatabase->select()
or SelectQueryBuilder::conds
$join_conds
to IDatabase->select()
or SelectQueryBuilder::joinConds
All tables and joins are aliased, so +
is safe to use. Reimplemented in MediaWiki\User\ActorMigration.
Definition at line 443 of file ActorMigrationBase.php.
References MediaWiki\User\ActorMigrationBase\checkDeprecation(), Wikimedia\Rdbms\IReadableDatabase\getDomainID(), LIST_AND, LIST_OR, Wikimedia\Rdbms\Platform\ISQLPlatform\makeList(), SCHEMA_COMPAT_READ_NEW, and SCHEMA_COMPAT_READ_TEMP.
MediaWiki\User\ActorMigrationBase::isAnon | ( | $field | ) |
Return an SQL condition to test if a user field is anonymous.
string | $field | Field name or SQL fragment |
Definition at line 200 of file ActorMigrationBase.php.
References SCHEMA_COMPAT_READ_TEMP.
MediaWiki\User\ActorMigrationBase::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 209 of file ActorMigrationBase.php.
References SCHEMA_COMPAT_READ_TEMP.