TL;DR: The pre-2011 option of setting a ResourceLoaderModule instance in $wgResourceModules, or calling ResourceLoader->register with an object as second parameter, will be removed in MediaWiki 1.34.0 (release expected in Nov 2019). Change these to an array using the 'class' or 'factory' keys instead. (Examples below.)
This only affects legacy extensions using PHP files to register modules. If your extension already registers its modules via extension.json, then this change does not affect you.
-------
During the experimental release of ResourceLoader in MediaWiki 1.16 (2010), modules had to be registered via $wgResourceModules as an object instance of ResourceLoaderModule.
In MediaWiki 1.17.0 (2011), as part of the first default-on public release of ResourceLoader, this was replaced with the ability to register a declarative array instead. [1] This allowed modules to be lazy-instantiated by ResourceLoader. These arrays can be class-based (this is the default, using the 'class' option), or closure-based (using the 'factory' key).
This option was removed as part of refactoring to make ResourceLoader (more) standalone. I did not want to incur the overhead of maintaining it for another release cycle through deprecation first. It has been undocumented since before the first non-experimental release of ResourceLoader in 1.17.0 (it was kept "temporarily" for compat with 1.17alpha at WMF). No known usage was found in Gerrit-hosted extensions, nor in any of the Codesearch-index repos hosted externally. It also can't affect extensions using extension.json for module registration (since MW 1.25).
Examples of the needed conversion:
``` # Before (no longer supported) $wgResourceModules['ext.Foo'] = new MyModuleSubClass(); $wgResourceModules['ext.Bar'] = new MyModuleSubClass( [ 'xyz' => true, ] ); $wgResourceModules['ext.Baz'] = efComposeSomeComplexObject();
# After (PHP) $wgResourceModules['ext.Foo'] = [ 'class' => MyModuleSubClass::class ]; $wgResourceModules['ext.Bar'] = [ 'class' => MyModuleSubClass::class, 'xyz' => true ]; $wgResourceModules['ext.Baz'] = [ 'factory' => 'efComposeSomeComplexObject' ];
# After (JSON, recommended) "ResourceModules": { "ext.Foo": { "class": "MyModuleSubClass" }, "ext.Bar": { "class": "MyModuleSubClass", "xyz": true }, "ext.Baz": { "factory": "MyExtHooks::composeSomeComplexObject" } ```
-- Timo
[0] https://phabricator.wikimedia.org/T222637 [1] https://gerrit.wikimedia.org/g/mediawiki/core/+/dac5084f6d61b6c45bfae491a2b9... - https://github.com/wikimedia/mediawiki/commit/dac5084f6d