Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 24
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 / 24
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 / 24
0.00% covered (danger)
0.00%
0 / 1
6
1<?php
2
3namespace Flow;
4
5use Flow\Maintenance\FlowCreateTemplates;
6use Flow\Maintenance\FlowFixLinks;
7use Flow\Maintenance\FlowFixLog;
8use Flow\Maintenance\FlowPopulateLinksTables;
9use Flow\Maintenance\FlowPopulateRefId;
10use Flow\Maintenance\FlowSetUserIp;
11use Flow\Maintenance\FlowUpdateBetaFeaturePreference;
12use Flow\Maintenance\FlowUpdateRecentChanges;
13use Flow\Maintenance\FlowUpdateRevisionTypeId;
14use Flow\Maintenance\FlowUpdateUserWiki;
15use Flow\Maintenance\FlowUpdateWorkflowPageId;
16use MediaWiki\Installer\DatabaseUpdater;
17use MediaWiki\Installer\Hook\LoadExtensionSchemaUpdatesHook;
18
19class SchemaHooks implements LoadExtensionSchemaUpdatesHook {
20
21    /**
22     * Hook: LoadExtensionSchemaUpdates
23     *
24     * @param DatabaseUpdater $updater
25     */
26    public function onLoadExtensionSchemaUpdates( $updater ) {
27        $dir = dirname( __DIR__ ) . '/sql';
28        $dbType = $updater->getDB()->getType();
29        $updater->addExtensionTable( 'flow_revision', "$dir/$dbType/tables-generated.sql" );
30
31        if ( $dbType === 'mysql' ) {
32            // 1.35 (backported to 1.34)
33            $updater->modifyExtensionField( 'flow_wiki_ref', 'ref_src_wiki',
34                "$dir/$dbType/patch-increase-varchar-flow_wiki_ref-ref_src_wiki.sql" );
35            $updater->modifyExtensionField( 'flow_ext_ref', 'ref_src_wiki',
36                "$dir/$dbType/patch-increase-varchar-flow_ext_ref-ref_src_wiki.sql" );
37
38            // 1.39
39            $updater->modifyExtensionField(
40                'flow_revision',
41                'rev_mod_timestamp',
42                "$dir/$dbType/patch-flow_revision-rev_mod_timestamp.sql"
43            );
44        }
45
46        $updater->addPostDatabaseUpdateMaintenance( FlowUpdateRecentChanges::class );
47
48        $updater->addPostDatabaseUpdateMaintenance( FlowSetUserIp::class );
49
50        $updater->addPostDatabaseUpdateMaintenance( FlowUpdateUserWiki::class );
51
52        $updater->addPostDatabaseUpdateMaintenance( FlowUpdateRevisionTypeId::class );
53
54        $updater->addPostDatabaseUpdateMaintenance( FlowPopulateLinksTables::class );
55
56        $updater->addPostDatabaseUpdateMaintenance( FlowFixLog::class );
57
58        $updater->addPostDatabaseUpdateMaintenance( FlowUpdateWorkflowPageId::class );
59
60        $updater->addPostDatabaseUpdateMaintenance( FlowCreateTemplates::class );
61
62        $updater->addPostDatabaseUpdateMaintenance( FlowFixLinks::class );
63
64        $updater->addPostDatabaseUpdateMaintenance( FlowUpdateBetaFeaturePreference::class );
65
66        $updater->addPostDatabaseUpdateMaintenance( FlowPopulateRefId::class );
67    }
68}