Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 19 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
SchemaHooks | |
0.00% |
0 / 19 |
|
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 1 |
onLoadExtensionSchemaUpdates | |
0.00% |
0 / 19 |
|
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 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 | * |
17 | * @file |
18 | */ |
19 | |
20 | namespace MediaWiki\Extension\WikimediaEditorTasks; |
21 | |
22 | use MediaWiki\Installer\DatabaseUpdater; |
23 | use MediaWiki\Installer\Hook\LoadExtensionSchemaUpdatesHook; |
24 | use RuntimeException; |
25 | |
26 | /** |
27 | * Schema hooks for WikimediaEditorTasks extension |
28 | */ |
29 | class SchemaHooks implements LoadExtensionSchemaUpdatesHook { |
30 | |
31 | /** |
32 | * @param DatabaseUpdater $updater |
33 | */ |
34 | public function onLoadExtensionSchemaUpdates( $updater ) { |
35 | if ( $updater->getDB()->getType() !== 'mysql' ) { |
36 | // Wikimedia specific extension |
37 | throw new RuntimeException( 'only mysql is supported' ); |
38 | } |
39 | $baseDir = dirname( __DIR__ ) . '/sql'; |
40 | |
41 | $updater->addExtensionTable( 'wikimedia_editor_tasks_keys', "$baseDir/tables-generated.sql" ); |
42 | $updater->addExtensionTable( 'wikimedia_editor_tasks_edit_streak', |
43 | "$baseDir/sql/edit_streak.sql" ); |
44 | $updater->dropExtensionTable( |
45 | 'wikimedia_editor_tasks_entity_description_exists', |
46 | "$baseDir/drop-wikimedia_editor_tasks_entity_description_exists.sql" |
47 | ); |
48 | $updater->dropExtensionTable( |
49 | 'wikimedia_editor_tasks_targets_passed', |
50 | "$baseDir/drop-wikimedia_editor_tasks_targets_passed.sql" |
51 | ); |
52 | $updater->addExtensionField( |
53 | 'wikimedia_editor_tasks_counts', |
54 | 'wetc_revert_count', |
55 | "$baseDir/alter-wikimedia_editor_tasks_counts.sql" |
56 | ); |
57 | } |
58 | |
59 | } |