Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
42.86% |
6 / 14 |
|
33.33% |
2 / 6 |
CRAP | |
0.00% |
0 / 1 |
| ActorMigration | |
42.86% |
6 / 14 |
|
33.33% |
2 / 6 |
12.72 | |
0.00% |
0 / 1 |
| newMigration | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| newMigrationForImport | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
2 | |||
| __construct | |
100.00% |
5 / 5 |
|
100.00% |
1 / 1 |
1 | |||
| getJoin | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getWhere | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getInsertValues | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace MediaWiki\User; |
| 4 | |
| 5 | use MediaWiki\MediaWikiServices; |
| 6 | use Wikimedia\Rdbms\IDatabase; |
| 7 | use Wikimedia\Rdbms\IReadableDatabase; |
| 8 | |
| 9 | /** |
| 10 | * This is not intended to be a long-term part of MediaWiki; it will be |
| 11 | * deprecated and removed once actor migration is complete. |
| 12 | * |
| 13 | * @since 1.31 |
| 14 | * @since 1.34 Use with 'ar_user', 'img_user', 'oi_user', 'fa_user', |
| 15 | * 'rc_user', 'log_user', and 'ipb_by' is deprecated. Callers should |
| 16 | * reference the corresponding actor fields directly. |
| 17 | * @deprecated since 1.39 |
| 18 | */ |
| 19 | class ActorMigration extends ActorMigrationBase { |
| 20 | |
| 21 | /** |
| 22 | * Field information |
| 23 | * @see ActorMigrationBase::getFieldInfo() |
| 24 | */ |
| 25 | public const FIELD_INFOS = [ |
| 26 | // Deprecated since 1.39 |
| 27 | 'rev_user' => [], |
| 28 | ]; |
| 29 | |
| 30 | /** |
| 31 | * Static constructor |
| 32 | * @return self |
| 33 | */ |
| 34 | public static function newMigration() { |
| 35 | return MediaWikiServices::getInstance()->getActorMigration(); |
| 36 | } |
| 37 | |
| 38 | /** |
| 39 | * Static constructor |
| 40 | * @return self |
| 41 | */ |
| 42 | public static function newMigrationForImport() { |
| 43 | $migration = new self( |
| 44 | MediaWikiServices::getInstance()->getActorStoreFactory() |
| 45 | ); |
| 46 | $migration->setForImport( true ); |
| 47 | return $migration; |
| 48 | } |
| 49 | |
| 50 | /** |
| 51 | * @internal |
| 52 | * |
| 53 | * @param ActorStoreFactory $actorStoreFactory |
| 54 | */ |
| 55 | public function __construct( ActorStoreFactory $actorStoreFactory ) { |
| 56 | parent::__construct( |
| 57 | self::FIELD_INFOS, |
| 58 | SCHEMA_COMPAT_NEW, |
| 59 | $actorStoreFactory |
| 60 | ); |
| 61 | } |
| 62 | |
| 63 | /** |
| 64 | * @inheritDoc |
| 65 | * @deprecated since 1.39 Use `{table} JOIN actor ON {table_prefix}_actor = actor_id` |
| 66 | * E.g. for key=rev_user, use `revision JOIN actor ON rev_actor = actor_id` |
| 67 | */ |
| 68 | public function getJoin( $key ) { |
| 69 | return parent::getJoin( $key ); |
| 70 | } |
| 71 | |
| 72 | /** |
| 73 | * @inheritDoc |
| 74 | * @deprecated since 1.39 Use `{table_prefix}_actor IN ({list of actor IDs})`. |
| 75 | * E.g. for key=rev_user, use `rev_actor IN ({list of actor IDs})`. |
| 76 | * Use `MediaWikiServices::getInstance()->getActorNormalization() |
| 77 | * ->findActorId( $user, $db )` to get the actor ID for a given user. |
| 78 | */ |
| 79 | public function getWhere( IReadableDatabase $db, $key, $users, $useId = true ) { |
| 80 | return parent::getWhere( $db, $key, $users, $useId ); |
| 81 | } |
| 82 | |
| 83 | /** |
| 84 | * @inheritDoc |
| 85 | * @deprecated since 1.39 Use `[ '{table_prefix}_actor' => MediaWikiServices::getInstance() |
| 86 | * ->getActorNormalization()->acquireActorId( $user, $dbw ) ]` |
| 87 | * E.g. for key=log_user, use `[ 'log_actor' => ... ]` |
| 88 | */ |
| 89 | public function getInsertValues( IDatabase $dbw, $key, UserIdentity $user ) { |
| 90 | return parent::getInsertValues( $dbw, $key, $user ); |
| 91 | } |
| 92 | |
| 93 | } |