Manual talk:Configuration for developers
Add topic| This page used the Structured Discussions extension to give structured discussions. It has since been converted to wikitext, so the content and history here are only an approximation of what was actually displayed at the time these comments were made. |
PhpUnit and $wgConfigRegistry
[edit]The current text in Testing suggests that setMwGlobals should only be used for core and manifest version 1 extensions. However using $wgConfigRegistry in a unittest for a manifest version 2 extension doesn't actually override the configs (phab:T255497) nor is this used by any extension today.
Is $wgConfigRegistry meant to work in phpunit or is the phrasing of the section merely in need of tweaking? André Costa (WMSE) (talk) 12:55, 16 June 2020 (UTC)
- Ping @Samwilson since you added the original text André Costa (WMSE) (talk) 10:14, 18 June 2020 (UTC)
- I suspect it's out of date and needs updating. I'm pretty sure extensions are allowed to use setMwGlobals(); lots certainly do. Sam Wilson 07:18, 24 June 2020 (UTC)
Modifying another extension's config
[edit]What is the correct way for an extension to modify an existing config variable (either in another extension or in core). For example, ProofreadPage adds the Index namespace to $wgTemplateStylesNamespaces, or SpecialNamespaces modifies $wgExtraNamespaces and $wgNamespaceAliases. Currently this is done by modifying the globals.
I'm slightly suspecting that this sort of thing shouldn't be done, and actually where there's a need to change config variables then an actual mechanism should be provided for doing that (e.g. a hook). Sam Wilson 03:20, 19 December 2022 (UTC)
- It should not be done. The extension should create an attribute, and then other extensions can append to that attribute. TemplateStyles already supports this. Legoktm (talk) 05:45, 19 December 2022 (UTC)
- Here's an example of Scribunto using the attribute. Legoktm (talk) 05:50, 19 December 2022 (UTC)
- It sounds like the answer to this is that it should not be done, and that extensions should use attributes for this purpose. Sam Wilson 10:15, 19 December 2022 (UTC)
- @Legoktm: oops, I replied to myself without reloading the page, so didn't see your reply! Sam Wilson 10:15, 19 December 2022 (UTC)
link obsolete to classMediaWikiTestCase.html
[edit]in Section Testing Not Found link for 'MediaWikiTestCase' leading to -> https://doc.wikimedia.org/mediawiki-core/master/php/classMediaWikiTestCase.html
Can someone align please ? Thanks -- Christian 🇫🇷 FR (talk) 13:36, 6 April 2023 (UTC)
A fallback
[edit]Hi. There is nothing here for the case some variable may or may not be defined. For example, depends on whether some extension is installed. Can you elaborate it, please? Thank you. IKhitron (talk) 07:56, 16 December 2025 (UTC)