Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
|||
GlobalBlockingSchemaHooks | n/a |
0 / 0 |
n/a |
0 / 0 |
2 | n/a |
0 / 0 |
|||
onLoadExtensionSchemaUpdates | n/a |
0 / 0 |
n/a |
0 / 0 |
2 |
1 | <?php |
2 | |
3 | namespace MediaWiki\Extension\GlobalBlocking; |
4 | |
5 | use DatabaseUpdater; |
6 | use MediaWiki\Extension\GlobalBlocking\Maintenance\PopulateCentralId; |
7 | use MediaWiki\Installer\Hook\LoadExtensionSchemaUpdatesHook; |
8 | |
9 | class GlobalBlockingSchemaHooks implements LoadExtensionSchemaUpdatesHook { |
10 | |
11 | /** |
12 | * This is static since LoadExtensionSchemaUpdates does not allow service dependencies |
13 | * @codeCoverageIgnore Tested by updating or installing MediaWiki. |
14 | * @param DatabaseUpdater $updater |
15 | */ |
16 | public function onLoadExtensionSchemaUpdates( $updater ) { |
17 | $base = __DIR__ . '/..'; |
18 | $type = $updater->getDB()->getType(); |
19 | |
20 | $updater->addExtensionTable( |
21 | 'globalblocks', |
22 | "$base/sql/$type/tables-generated-globalblocks.sql" |
23 | ); |
24 | |
25 | $updater->addExtensionTable( |
26 | 'global_block_whitelist', |
27 | "$base/sql/$type/tables-generated-global_block_whitelist.sql" |
28 | ); |
29 | |
30 | // 1.38 |
31 | $updater->addExtensionField( |
32 | 'globalblocks', |
33 | 'gb_by_central_id', |
34 | "$base/sql/$type/patch-add-gb_by_central_id.sql" |
35 | ); |
36 | $updater->addPostDatabaseUpdateMaintenance( PopulateCentralId::class ); |
37 | $updater->modifyExtensionField( |
38 | 'globalblocks', |
39 | 'gb_anon_only', |
40 | "$base/sql/$type/patch-globalblocks-gb_anon_only.sql" |
41 | ); |
42 | |
43 | // 1.39 |
44 | $updater->modifyExtensionField( |
45 | 'globalblocks', |
46 | 'gb_expiry', |
47 | "$base/sql/$type/patch-globalblocks-timestamps.sql" |
48 | ); |
49 | if ( $type === 'postgres' ) { |
50 | $updater->modifyExtensionField( |
51 | 'global_block_whitelist', |
52 | 'gbw_expiry', |
53 | "$base/sql/$type/patch-global_block_whitelist-timestamps.sql" |
54 | ); |
55 | } |
56 | |
57 | // 1.42 |
58 | $updater->addExtensionField( |
59 | 'globalblocks', |
60 | 'gb_target_central_id', |
61 | "$base/sql/$type/patch-add-gb_target_central_id.sql" |
62 | ); |
63 | $updater->addExtensionField( |
64 | 'global_block_whitelist', |
65 | 'gbw_target_central_id', |
66 | "$base/sql/$type/patch-add-gbw_target_central_id.sql" |
67 | ); |
68 | $updater->modifyExtensionField( |
69 | 'globalblocks', |
70 | 'gb_by', |
71 | "$base/sql/$type/patch-modify-gb_by-default.sql" |
72 | ); |
73 | } |
74 | } |