Manual:wg変数

This page is a translated version of the page Manual:Wg variable and the translation is 67% complete.

wg は、MediaWiki 内で使用される、定数ではないプログラミング上の重要な要素を指し、「Wikipedia Global」の略です (ネーミングはウィキペディアを越えて MediaWiki が広がる前からあります)。

一般に、ソフトウェアの範囲内でグローバル変数 (グローバルなスコープを持つ変数) はプログラミングをしているときに簡単に識別しやすくする接頭辞を持ちます。 しかしながら、普通のハッカーは includes/DefaultSettings.php ファイルや LocalSettings.php ファイルでこのような変数を見かけます。それらのファイルがさまざまな方法でソフトウェアの挙動を制御する変数を定義します。

DefaultSettings.php ファイルには既定の値が保存されているため編集してはいけませんLocalSettings ファイルは特定のサイトに対してこれらの値を上書きするために使用されます — 特定の変数が LocalSettings ファイルで指定されない場合、DefaultSettings からエントリをコピーして必要に応じて修正してください。

Confusingly, MediaWiki code (mainly in OutputPage.php) and extensions set a different (though overlapping) set of configuration variables in browser JavaScript, and many of these variables also have a wg prefix (without PHP's $ sign). 一覧については Manual:Interface/JavaScript#mw.config を参照してください。

Starting with the introduction of the Config class in MediaWiki 1.23, the "wg" prefix for PHP global variables is being phased out as configuration settings are moving away from global scope.

関連項目