This page is a translated version of the page Manual:$wgExtensionFunctions and the translation is 42% complete.
Расширения: $wgExtensionFunctions
Список callback-функций, которые вызываются один раз когда Mediawiki полностью инициализирована.
Введено в версии:1.3.0 (r3583)
Удалено в версии:всё ещё используется
Допустимые значения:не определено
Значение по умолчанию:[]


In general, using this functionality is a hack that suggests that something is going wrong somewhere, whether in MediaWiki core or in the extension. It should be avoided.

Эта переменная - массив функций, которые вызываются когда инициализация MediaWiki почти завершена. Extensions can register callbacks to be executed this way using the ExtensionFunctions of extension.json. At the time these callbacks are called, MediaWikiServices and the main RequestContext are fully initialized.

Note that config variables have been processed already at this point and changing them is unsafe. Extensions that need to dynamically set configuration should use a registration callback instead.

ExtensionFunction callbacks should be used only for initialization code that need to interact with service objects as a final step.

For example, if your extension needs to access database during its initialization:

function initMyExtension() {
      $dbr = MediaWikiServices::getInstance()
      $myExtension = new MyExtension();
      $myExtension->loadSettingsFromDatabase( $dbr );

См. также