MediaWiki REL1_37
|
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. | |
getInsertValuesWithTempTable (IDatabase $dbw, $key, UserIdentity $user) | |
Get UPDATE fields for the actor. | |
getJoin ( $key) | |
Get SELECT fields and joins for the actor key. | |
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. | |
Protected Member Functions | |
checkDeprecation ( $key) | |
Issue deprecation warning/error as appropriate. | |
getFieldInfo ( $key) | |
Get config information about a field. | |
getInstanceName () | |
Get a name for this instance to use in error messages. | |
Private Member Functions | |
getFieldNames ( $key) | |
getTempTableInfo ( $key) | |
Convenience function for getting temp table config. | |
Private Attributes | |
ActorStoreFactory | $actorStoreFactory |
bool | $allowUnknown |
array | $fieldInfos |
array[] | $joinCache = [] |
Cache for self::getJoin() | |
int | $readStage |
One of the SCHEMA_COMPAT_READ_* values. | |
int | $writeStage |
A combination of the SCHEMA_COMPAT_WRITE_* flags. | |
This abstract base class helps migrate core and extension code to use the actor table.
Definition at line 35 of file ActorMigrationBase.php.
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 97 of file ActorMigrationBase.php.
References $actorStoreFactory, $fieldInfos, $readStage, $writeStage, 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 176 of file ActorMigrationBase.php.
References getFieldInfo(), and wfDeprecated().
Referenced by getInsertValues(), getInsertValuesWithTempTable(), getJoin(), and getWhere().
|
protected |
Get config information about a field.
string | $key |
Definition at line 142 of file ActorMigrationBase.php.
References getInstanceName().
Referenced by checkDeprecation(), getFieldNames(), getInsertValuesWithTempTable(), and getTempTableInfo().
|
private |
string | $key | A key such as "rev_user" identifying the actor field being fetched. |
Definition at line 215 of file ActorMigrationBase.php.
References getFieldInfo().
Referenced by getInsertValues(), getInsertValuesWithTempTable(), getJoin(), and getWhere().
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()
Definition at line 307 of file ActorMigrationBase.php.
References checkDeprecation(), Wikimedia\Rdbms\IDatabase\getDomainID(), getFieldNames(), MediaWiki\User\UserIdentity\getId(), MediaWiki\User\UserIdentity\getName(), getTempTableInfo(), SCHEMA_COMPAT_WRITE_NEW, SCHEMA_COMPAT_WRITE_OLD, and SCHEMA_COMPAT_WRITE_TEMP.
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()
Definition at line 342 of file ActorMigrationBase.php.
References checkDeprecation(), Wikimedia\Rdbms\IDatabase\getDomainID(), getFieldInfo(), getFieldNames(), 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.
ReflectionException |
Definition at line 160 of file ActorMigrationBase.php.
Referenced by getFieldInfo().
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()
$vars
to IDatabase->select()
$join_conds
to IDatabase->select()
All tables, fields, and joins are aliased, so +
is safe to use. Definition at line 245 of file ActorMigrationBase.php.
References checkDeprecation(), getFieldNames(), getTempTableInfo(), SCHEMA_COMPAT_READ_OLD, and SCHEMA_COMPAT_READ_TEMP.
|
private |
Convenience function for getting temp table config.
string | $key |
Definition at line 228 of file ActorMigrationBase.php.
References getFieldInfo().
Referenced by getInsertValues(), getJoin(), and getWhere().
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 438 of file ActorMigrationBase.php.
References checkDeprecation(), Wikimedia\Rdbms\IDatabase\getDomainID(), getFieldNames(), getTempTableInfo(), Wikimedia\Rdbms\IDatabase\makeList(), SCHEMA_COMPAT_READ_NEW, and SCHEMA_COMPAT_READ_TEMP.
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 197 of file ActorMigrationBase.php.
References SCHEMA_COMPAT_READ_TEMP.
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 206 of file ActorMigrationBase.php.
References SCHEMA_COMPAT_READ_TEMP.
|
private |
Definition at line 46 of file ActorMigrationBase.php.
Referenced by __construct().
|
private |
Definition at line 52 of file ActorMigrationBase.php.
|
private |
Definition at line 49 of file ActorMigrationBase.php.
Referenced by __construct().
|
private |
Cache for self::getJoin()
Definition at line 37 of file ActorMigrationBase.php.
|
private |
One of the SCHEMA_COMPAT_READ_* values.
Definition at line 40 of file ActorMigrationBase.php.
Referenced by __construct().
|
private |
A combination of the SCHEMA_COMPAT_WRITE_* flags.
Definition at line 43 of file ActorMigrationBase.php.
Referenced by __construct().