Movatterモバイル変換


[0]ホーム

URL:


Jump to content
MediaWiki
Search

Manual:$wgExtensionFunctions

From mediawiki.org
Translate this page
Languages:
Extensions: $wgExtensionFunctions
A list of callback functions which are called once MediaWiki is fully initialised.
Introduced in version:1.3.0 (r3583)
Removed in version:Still in use
Allowed values:Unspecified
Default value:[]
Other settings:Alphabetical |By function

Details

[edit]
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.

This variable is an array that stores callbacks to be executed after most of MediaWiki initialization is complete.Extensions can register callbacks to be executed this way using theExtensionFunctions 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 registrationcallback 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:

functioninitMyExtension(){$dbr=MediaWikiServices::getInstance()->getConnectionProvider->getReplicaDatabase();$myExtension=newMyExtension();$myExtension->loadSettingsFromDatabase($dbr);}

See also

[edit]
Retrieved from "https://www.mediawiki.org/w/index.php?title=Manual:$wgExtensionFunctions&oldid=6418420"
Categories:

[8]ページ先頭

©2009-2025 Movatter.jp