Manual:$wgExtensionFunctions/ko
Appearance
| Extensions: $wgExtensionFunctions | |
|---|---|
| A list of callback functions which are called once MediaWiki is fully initialised. |
|
| 이 변수가 소개된 버전: | 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.
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 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 needs to interact with service objects as a final step.
For example, if your extension needs to access the database during its initialization:
function initMyExtension() {
$dbr = MediaWikiServices::getInstance()
->getConnectionProvider->getReplicaDatabase();
$myExtension = new MyExtension();
$myExtension->loadSettingsFromDatabase( $dbr );
}