Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 8
0.00% covered (danger)
0.00%
0 / 1
CRAP
0.00% covered (danger)
0.00%
0 / 1
SchemaHooks
0.00% covered (danger)
0.00%
0 / 8
0.00% covered (danger)
0.00%
0 / 1
6
0.00% covered (danger)
0.00%
0 / 1
 onLoadExtensionSchemaUpdates
0.00% covered (danger)
0.00%
0 / 8
0.00% covered (danger)
0.00%
0 / 1
6
1<?php
2declare( strict_types=1 );
3/**
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 * http://www.gnu.org/copyleft/gpl.html
18 */
19
20namespace MediaWiki\Extension\AntiSpoof;
21
22use MediaWiki\Installer\Hook\LoadExtensionSchemaUpdatesHook;
23
24class SchemaHooks implements LoadExtensionSchemaUpdatesHook {
25    /** @inheritDoc */
26    public function onLoadExtensionSchemaUpdates( $updater ) {
27        $type = $updater->getDB()->getType();
28        $updater->addExtensionTable( 'spoofuser',
29            __DIR__ . '/../sql/' . $type . '/tables-generated.sql' );
30
31        if ( $type === 'mysql' ) {
32            $updater->renameExtensionIndex( 'spoofuser', 'su_normalized', 'su_normname_idx',
33                __DIR__ . '/../sql/mysql/patch-spoofuser-index-su_normname_idx.sql' );
34        }
35        // MediaWiki 1.41
36        $updater->modifyExtensionTable( 'spoofuser',
37            __DIR__ . '/../sql/' . $type . '/patch-change-spoofuser-binary.sql' );
38    }
39}