Manual:Extension registration/制限事項

Jump to navigation Jump to search
This page is a translated version of the page Manual:Extension registration/Limitations and the translation is 6% complete.
Other languages:
English • ‎日本語

Extension registration does have known limitations that may make it unsuitable to convert your extension immediately. Some of these are intentional, and others are just waiting for a developer to implement them :) If you find something you can't do, please file a bug for it in the MediaWiki-Configuration Phabricator project.

  • Configuration settings must have a prefix of "wg" resolved, use a magic "_prefix" key: phab:T97186
  • PHP constants are not supported. Such constants can either be used for settings within LocalSettings.php, or simply within the extension's code. If it's the latter, you should use class constants instead; these are superior for the same reason that class variables are better than global variables. If it's the former, you unfortunately cannot use either global constants or class constants: global constants can't be set in extension.json, and class constants will get initialized too late to be used. Instead, you should use raw strings, like 'medium' instead of ANIMATION_SPEED_MEDIUM or AnimationExtension::SPEED_MEDIUM. One advantage to this approach is that, if extensions ever get configured via a configuration database (there is a long-term plan for that to happen), strings will be easier to handle than integer constants.
  • You can't use paths to files in extension.json - phab:T100956
  • Conditional namespaces are not supported: phab:T141604
  • $wgRestrictionLevels is not available.

The workaround for much of this is to use custom registration. If you find something you can't do, create a Phabricator task.