Page MenuHomePhabricator

Phase out $wgExtensionFunctions
Open, MediumPublic

Description

$wgExtensionFunctions is an odd special case that behaves like a hook, but not quite. It could easily be deprecated and replaced with a hook. Migration of extensions that currently register ExtensionFunctions would be trivial.

Note that $wgExtensionFunctions are called late in Setup.php, after MediaWikiServices is initialized. There even is a hook called earlier, namely the SetupAfterCache hook. Adding a SetupComplete hook to replace $wgExtensionFunctions would be trivial.

Current uses: all | wikimedia

Event Timeline

Change 656368 had a related patch set uploaded (by Ammarpad; owner: Ammarpad):
[mediawiki/core@master] Add hook replacement for $wgExtensionFunctions

https://gerrit.wikimedia.org/r/656368

Change 656368 abandoned by Ammarpad:

[mediawiki/core@master] Deprecate $wgExtensionFunctions

Reason:

https://gerrit.wikimedia.org/r/656368

I disagree with this task, we shouldn't replace $wgExtensionFunctions with anything, it should just go away. Nearly all uses of $wgExtensionFunctions are to affect global state during setup where either 1) it should just do it at runtime and lazy load, or 2) we're missing a better hook elsewhere, e.g. T200385: Add a hook to modify $wgLogTypes / LogPage::validTypes() at runtime.

Krinkle renamed this task from Replace $wgExtensionFunctions with a hook to Phase out $wgExtensionFunctions.Apr 14 2022, 9:59 PM
Krinkle edited projects, added MediaWiki-General; removed MediaWiki-Core-Hooks.