Skip to content

Commit 3c79baa

Browse files
authored
Merge pull request filbertkm#33 from lucaswerkmeister/autoload
Extension loading improvements
2 parents c69c83b + 69d1f85 commit 3c79baa

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Then go into the WikibaseImport extension directory and run ```composer update``
1919
Then, to enable the extension, add it in your ```LocalSettings.php``` file:
2020

2121
```
22-
require_once "$IP/extensions/WikibaseImport/WikibaseImport.php";
22+
wfLoadExtension( 'WikibaseImport' );
2323
```
2424

2525
The extension requires a new database table to map entity ids from the foreign

WikibaseImport.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
<?php
22

33
if ( function_exists( 'wfLoadExtension' ) ) {
4-
if ( file_exists( __DIR__ . '/vendor/autoload.php' ) ) {
5-
require_once __DIR__ . '/vendor/autoload.php';
6-
}
7-
84
wfLoadExtension( 'WikibaseImport', __DIR__ . '/extension.json' );
5+
// Keep i18n globals so mergeMessageFileList.php doesn't break
6+
$wgMessagesDirs['WikibaseImport'] = __DIR__ . '/i18n';
7+
$wgExtensionMessagesFiles['WikibaseImportAlias'] = __DIR__ . '/WikibaseImport.i18n.alias.php';
8+
wfWarn(
9+
'Deprecated PHP entry point used for WikibaseImport extension. ' .
10+
'Please use wfLoadExtension instead, ' .
11+
'see https://www.mediawiki.org/wiki/Extension_registration for more details.'
12+
);
913
} else {
1014
die( 'WikibaseImport requires MediaWiki 1.25+' );
1115
}

extension.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"load_composer_autoloader": true,
23
"name": "Wikibase Import",
34
"version": "0.1",
45
"author": [

0 commit comments

Comments
 (0)