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
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 3 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
14 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
15 */
16
17namespace ORES\Hooks;
18
19use DatabaseUpdater;
20use MediaWiki\Installer\Hook\LoadExtensionSchemaUpdatesHook;
21
22class SchemaHooks implements LoadExtensionSchemaUpdatesHook {
23
24    /**
25     * @param DatabaseUpdater $updater
26     */
27    public function onLoadExtensionSchemaUpdates( $updater ) {
28        $type = $updater->getDB()->getType();
29        $sqlPath = __DIR__ . '/../../sql/' . $type . '/';
30        $updater->addExtensionTable( 'ores_classification', $sqlPath . 'tables-generated.sql' );
31
32        if ( $type === 'mysql' ) {
33            // 1.31
34            $updater->addExtensionIndex( 'ores_classification', 'oresc_model_class_prob',
35                $sqlPath . 'patch-ores-classification-model-class-prob-index.sql' );
36            $updater->dropExtensionIndex( 'ores_classification', 'oresc_rev_predicted_model',
37                $sqlPath . 'patch-ores-classification-indexes-part-ii.sql' );
38        }
39    }
40
41}