Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 13 |
|
0.00% |
0 / 6 |
CRAP | |
0.00% |
0 / 1 |
BatchCAAntiSpoof | |
0.00% |
0 / 7 |
|
0.00% |
0 / 6 |
42 | |
0.00% |
0 / 1 |
batchRecord | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getDB | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
getTableName | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getPrimaryKey | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getUserColumn | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
makeSpoofUser | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | // Go through all usernames and calculate and record spoof thingies |
3 | |
4 | use MediaWiki\Extension\CentralAuth\CentralAuthServices; |
5 | use MediaWiki\Extension\CentralAuth\User\CentralAuthSpoofUser; |
6 | use Wikimedia\Rdbms\IDatabase; |
7 | |
8 | $IP = getenv( 'MW_INSTALL_PATH' ); |
9 | if ( $IP === false ) { |
10 | $IP = __DIR__ . '/../../..'; |
11 | } |
12 | require_once "$IP/extensions/AntiSpoof/maintenance/BatchAntiSpoofClass.php"; |
13 | |
14 | class BatchCAAntiSpoof extends BatchAntiSpoof { |
15 | |
16 | /** |
17 | * @param array $items |
18 | */ |
19 | protected function batchRecord( $items ) { |
20 | CentralAuthSpoofUser::batchRecord( $this->getDB( DB_PRIMARY ), $items ); |
21 | } |
22 | |
23 | /** |
24 | * @param int $db |
25 | * @param string|string[] $groups |
26 | * @param string|bool $wiki |
27 | * @return IDatabase |
28 | * @suppress PhanParamSignatureMismatch |
29 | */ |
30 | protected function getDB( $db, $groups = [], $wiki = false ) { |
31 | return CentralAuthServices::getDatabaseManager()->getCentralDB( $db ); |
32 | } |
33 | |
34 | /** @inheritDoc */ |
35 | protected function getTableName() { |
36 | return 'globaluser'; |
37 | } |
38 | |
39 | /** @inheritDoc */ |
40 | protected function getPrimaryKey() { |
41 | return 'gu_id'; |
42 | } |
43 | |
44 | /** @inheritDoc */ |
45 | protected function getUserColumn() { |
46 | return 'gu_name'; |
47 | } |
48 | |
49 | /** |
50 | * @param string $name |
51 | * @return CentralAuthSpoofUser |
52 | */ |
53 | protected function makeSpoofUser( $name ) { |
54 | return CentralAuthServices::getAntiSpoofManager()->getSpoofUser( $name ); |
55 | } |
56 | } |
57 | |
58 | $maintClass = BatchCAAntiSpoof::class; |
59 | require_once RUN_MAINTENANCE_IF_MAIN; |