Manual:$wgAutoloadClasses
Appearance
| 拡張機能: $wgAutoloadClasses | |
|---|---|
| 自動読み込みのために、クラス名をファイル名にマッピングする配列。 |
|
| 導入されたバージョン: | 1.7.0 (r15031) |
| 除去されたバージョン: | 使用中 |
| 許容される値: | 下記参照 |
| 既定値: | $wgAutoloadClasses ?? [] (1.34+)[] (1.7-1.33) |
| その他の設定: アルファベット順 | 機能順 | |
詳細
This array maps class and interface names to PHP filenames. MediaWiki core's AutoLoader uses it to load those files.
| MediaWiki バージョン: | ≧ 1.25 |
Extensions (and skins) specify this class mapping in the AutoloadClasses key of extension.json (or skin.json), for example from the BoilerPlate extension's extension.json:
{
...
"AutoloadClasses": {
"BoilerPlateHooks": "BoilerPlate.hooks.php",
"SpecialHelloWorld": "specials/SpecialHelloWorld.php"
},
...
}
Example prior to extension.json
Assume the extension NewExtension's files are in the directory extensions/NewExtension.
If NewExtension implements a class called NewClass in the file NewClass.php, then in its initialization file NewExtension/NewExtension.php it should add to $wgAutoloadClasses as follows:
$wgAutoloadClasses['NewClass'] = __DIR__ . '/NewClass.php';
Loading interfaces is done in the same manner as loading classes
関連項目
- $wgAutoloadLocalClasses — For autoloading files included in default MediaWiki.