Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 30
0.00% covered (danger)
0.00%
0 / 1
CRAP
0.00% covered (danger)
0.00%
0 / 1
NoServicesHookHandler
0.00% covered (danger)
0.00%
0 / 30
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 1
 onLoadExtensionSchemaUpdates
0.00% covered (danger)
0.00%
0 / 30
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2/**
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 * http://www.gnu.org/copyleft/gpl.html
17 *
18 * @file
19 */
20
21namespace MediaWiki\Extension\CentralAuth\Hooks\Handlers;
22
23use MediaWiki\Extension\CentralAuth\Maintenance\MigrateGuSalt;
24use MediaWiki\Installer\DatabaseUpdater;
25use MediaWiki\Installer\Hook\LoadExtensionSchemaUpdatesHook;
26
27/**
28 * This handler is used in hooks which are outside the normal dependency injection scope.
29 * It must not have any service dependencies.
30 */
31class NoServicesHookHandler implements
32    LoadExtensionSchemaUpdatesHook
33{
34
35    /**
36     * @param DatabaseUpdater $updater
37     * @return void
38     */
39    public function onLoadExtensionSchemaUpdates( $updater ) {
40        $baseDir = dirname( __DIR__, 3 );
41        $dbType = $updater->getDB()->getType();
42
43        $updater->addExtensionUpdateOnVirtualDomain( [
44            'virtual-centralauth',
45            'addTable',
46            'globaluser',
47            "$baseDir/schema/$dbType/tables-generated.sql",
48            true
49        ] );
50
51        $updater->addExtensionUpdateOnVirtualDomain( [
52            'virtual-centralauth',
53            'runMaintenance',
54            MigrateGuSalt::class,
55        ] );
56
57        $updater->addExtensionUpdateOnVirtualDomain( [
58            'virtual-centralauth',
59            'addField',
60            'renameuser_queue',
61            'rq_type',
62            "$baseDir/schema/$dbType/patch-rq_type.sql",
63            true
64        ] );
65
66        $updater->addExtensionUpdateOnVirtualDomain( [
67            'virtual-centralauth',
68            'dropField',
69            'globaluser',
70            'gu_salt',
71            "$baseDir/schema/$dbType/patch-drop-gu_salt.sql",
72            true
73        ] );
74    }
75
76}