Jump to content

Manual:$wgAutoloadClasses/ru

From mediawiki.org
This page is a translated version of the page Manual:$wgAutoloadClasses and the translation is 8% complete.
Расширения: $wgAutoloadClasses
Array mapping class names to filenames, for autoloading.
Введено в версии:1.7.0 (r15031)
Удалено в версии:всё ещё используется
Допустимые значения:see below
Значение по умолчанию:$wgAutoloadClasses ?? [] (1.34+)
[] (1.7-1.33)

Details

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

См. также