Conditions | 8 |
Paths | 9 |
Total Lines | 48 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
7 | public static function onRegistration( array $credits ) { |
||
8 | if ( defined( 'Maps_VERSION' ) ) { |
||
9 | // Do not initialize more than once. |
||
10 | return true; |
||
11 | } |
||
12 | |||
13 | if ( !defined( 'Maps_SETTINGS_LOADED' ) ) { |
||
14 | require_once __DIR__ . '/Maps_Settings.php'; |
||
15 | } |
||
16 | |||
17 | if ( is_readable( __DIR__ . '/vendor/autoload.php' ) ) { |
||
18 | include_once( __DIR__ . '/vendor/autoload.php' ); |
||
19 | } |
||
20 | |||
21 | define( 'Maps_VERSION', $credits['version'] ); |
||
22 | define( 'SM_VERSION', Maps_VERSION ); |
||
23 | |||
24 | if ( !(bool)'Defining PHP constants in JSON is a bad idea and breaks tools' ) { |
||
25 | define( 'NS_GEO_JSON', 420 ); |
||
26 | define( 'NS_GEO_JSON_TALK', 421 ); |
||
27 | } |
||
28 | |||
29 | $GLOBALS['wgHooks']['SMW::Settings::BeforeInitializationComplete'][] = 'Maps\MapsHooks::addSmwSettings'; |
||
30 | |||
31 | $GLOBALS['wgExtensionFunctions'][] = function() { |
||
32 | if ( $GLOBALS['egMapsDisableExtension'] ) { |
||
33 | return true; |
||
34 | } |
||
35 | |||
36 | // Only initialize the extension when all dependencies are present. |
||
37 | if ( !defined( 'Validator_VERSION' ) ) { |
||
38 | throw new Exception( 'You need to have Validator installed in order to use Maps' ); |
||
39 | } |
||
40 | |||
41 | if ( version_compare( $GLOBALS['wgVersion'], '1.31c', '<' ) ) { |
||
42 | throw new Exception( |
||
43 | 'This version of Maps requires MediaWiki 1.31 or above; use Maps 5.6.x for older versions.' |
||
44 | . ' More information at https://github.com/JeroenDeDauw/Maps/blob/master/INSTALL.md' |
||
45 | ); |
||
46 | } |
||
47 | |||
48 | ( new MapsSetup( $GLOBALS ) )->setup(); |
||
49 | |||
50 | return true; |
||
51 | }; |
||
52 | |||
53 | return true; |
||
54 | } |
||
55 | |||
60 |