Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
40.00% covered (danger)
40.00%
6 / 15
33.33% covered (danger)
33.33%
2 / 6
CRAP
0.00% covered (danger)
0.00%
0 / 1
ActorMigration
42.86% covered (danger)
42.86%
6 / 14
33.33% covered (danger)
33.33%
2 / 6
12.72
0.00% covered (danger)
0.00%
0 / 1
 newMigration
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 newMigrationForImport
0.00% covered (danger)
0.00%
0 / 5
0.00% covered (danger)
0.00%
0 / 1
2
 __construct
100.00% covered (success)
100.00%
5 / 5
100.00% covered (success)
100.00%
1 / 1
1
 getJoin
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getWhere
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getInsertValues
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3namespace MediaWiki\User;
4
5use MediaWiki\MediaWikiServices;
6use Wikimedia\Rdbms\IDatabase;
7use 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 */
19class ActorMigration extends ActorMigrationBase {
20    /**
21     * Constant for extensions to feature-test whether $wgActorTableSchemaMigrationStage
22     * (in MW <1.34) expects MIGRATION_* or SCHEMA_COMPAT_*
23     */
24    public const MIGRATION_STAGE_SCHEMA_COMPAT = 1;
25
26    /**
27     * Field information
28     * @see ActorMigrationBase::getFieldInfo()
29     */
30    public const FIELD_INFOS = [
31        // Deprecated since 1.39
32        'rev_user' => [],
33    ];
34
35    /**
36     * Static constructor
37     * @return self
38     */
39    public static function newMigration() {
40        return MediaWikiServices::getInstance()->getActorMigration();
41    }
42
43    /**
44     * Static constructor
45     * @return self
46     */
47    public static function newMigrationForImport() {
48        $migration = new self(
49            MediaWikiServices::getInstance()->getActorStoreFactory()
50        );
51        $migration->setForImport( true );
52        return $migration;
53    }
54
55    /**
56     * @internal
57     *
58     * @param ActorStoreFactory $actorStoreFactory
59     */
60    public function __construct( ActorStoreFactory $actorStoreFactory ) {
61        parent::__construct(
62            self::FIELD_INFOS,
63            SCHEMA_COMPAT_NEW,
64            $actorStoreFactory
65        );
66    }
67
68    /**
69     * @inheritDoc
70     * @deprecated since 1.39 Use `{table} JOIN actor ON {table_prefix}_actor = actor_id`
71     *   E.g. for key=rev_user, use `revision JOIN actor ON rev_actor = actor_id`
72     */
73    public function getJoin( $key ) {
74        return parent::getJoin( $key );
75    }
76
77    /**
78     * @inheritDoc
79     * @deprecated since 1.39 Use `{table_prefix}_actor IN ({list of actor IDs})`.
80     *   E.g. for key=rev_user, use `rev_actor IN ({list of actor IDs})`.
81     *   Use `MediaWikiServices::getInstance()->getActorNormalization()
82     *   ->findActorId( $user, $db )` to get the actor ID for a given user.
83     */
84    public function getWhere( IReadableDatabase $db, $key, $users, $useId = true ) {
85        return parent::getWhere( $db, $key, $users, $useId );
86    }
87
88    /**
89     * @inheritDoc
90     * @deprecated since 1.39 Use `[ '{table_prefix}_actor' => MediaWikiServices::getInstance()
91     *   ->getActorNormalization()->acquireActorId( $user, $dbw ) ]`
92     *   E.g. for key=log_user, use `[ 'log_actor' => ... ]`
93     */
94    public function getInsertValues( IDatabase $dbw, $key, UserIdentity $user ) {
95        return parent::getInsertValues( $dbw, $key, $user );
96    }
97
98}
99
100/** @deprecated class alias since 1.40 */
101class_alias( ActorMigration::class, 'ActorMigration' );