Hello,
Sometimes in LocalSettings.php or in extensions settings one want to do simple computations on the namespaces or related to the Git branch in a development environment. Unfortunately this is not (resp. no more) really possible, because LocalSettings.php is loaded before GlobalFunctions.php and Setup.php.
Is it a good practice to do that? If yes, is it possible to either: * "tag" some static functions in some classes to avoid these to include hooks and other global functions and variables (loaded later), and/or * move before (in loading order) some global functions and variables to make them usable (e.g. wfDebugLog, wfRunHooks, $wgCanonicalNamespaceNames) ?
Details for namespaces: $wgCanonicalNamespaceNames is defined in Setup.php, making MWNamespace::getCanonicalNamespaces() and MWNamespace::getValidNamespaces() unusable in LocalSettings.php to e.g. compute namespaces where an extension could be enabled https://github.com/mementoweb/mediawiki/pull/2.
Details for Git version: until two months it worked, but some wfDebugLog was introduced (defined in GlobalFunctions.php), making it unusable in LocalSettings.php.
~ Seb35 [^_^]
On 8/29/14, Seb35 seb35wikipedia@gmail.com wrote:
Hello,
Sometimes in LocalSettings.php or in extensions settings one want to do simple computations on the namespaces or related to the Git branch in a development environment. Unfortunately this is not (resp. no more) really possible, because LocalSettings.php is loaded before GlobalFunctions.php and Setup.php.
Is it a good practice to do that? If yes, is it possible to either:
- "tag" some static functions in some classes to avoid these to include
hooks and other global functions and variables (loaded later), and/or
- move before (in loading order) some global functions and variables to make
them usable (e.g. wfDebugLog, wfRunHooks, $wgCanonicalNamespaceNames) ?
Details for namespaces: $wgCanonicalNamespaceNames is defined in Setup.php, making MWNamespace::getCanonicalNamespaces() and MWNamespace::getValidNamespaces() unusable in LocalSettings.php to e.g. compute namespaces where an extension could be enabled https://github.com/mementoweb/mediawiki/pull/2.
Details for Git version: until two months it worked, but some wfDebugLog was introduced (defined in GlobalFunctions.php), making it unusable in LocalSettings.php.
~ Seb35 [^_^]
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
If you need to do something like that, you should probably make a callback function, and add that to $wgExtensionFunctions.
--bawolff
wikitech-l@lists.wikimedia.org