Requests for comment/Extension registration

Extensions currently need to "register" information about themselves. This includes autoloading classes, hook functions, and much more. This is typically done in filescope by adding to global variables.

As a consequence, it is not possible to figure out what an extension is going to register without including the file, which would enable the extension regardless. In addition, we are planning to move away from configuring things in global scope.

Things to "register"
This is a list of items that most extensions will typically register. There are probably more that could be listed by looking at DefaultSettings.php.


 * classes - $wgAutoloadClasses
 * hooks - $wgHooks
 * API modules - $wgAPIModules, $wgAPIFormatModules, $wgAPIMetaModules, $wgAPIPropModules, $wgAPIListModules
 * special pages - $wgSpecialPages
 * configuration globals - $wgExtensionFoo
 * namespaces, NS_CONSTANTs - this is a mess
 * ResourceLoader - $wgResourceModules
 * permissions - $wgGroupPermissions, $wgAvailableRights
 * $wgExtensionFunctions
 * credits - $wgExtensionCredits

Proposal
Store all of this in a JSON file in the extension directory, which Setup.php will load, right before LocalSettings.php is processed. We would put this file at.

Here's an example of what it would look like for the MassMessage extension.

In reality, not much has changed except for the format these options are stored in. For most extensions, this will completely eliminate the ExtName.php loader file.