resourceloader: Instantiate main class via ServiceWiring
authorTimo Tijhof <krinklemail@gmail.com>
Sat, 16 Feb 2019 23:16:09 +0000 (23:16 +0000)
committerAaron Schulz <aschulz@wikimedia.org>
Mon, 18 Feb 2019 17:55:09 +0000 (17:55 +0000)
commita186dc62fd5ac334488f9566748f6fd65bdcea35
tree607e847ebbbcb21ccf745f0a7e80ce810821a559
parente7790e579307c560558fb6f17362267789d0302b
resourceloader: Instantiate main class via ServiceWiring

It also removes some code duplication which is nice.

This unlocks various future changes, including:

* Making the `$config` parameter mandatory for the ResourceLoader class
  constructor, which currently falls back to global state.
  This should be deprecated and removed.

* Making it possible to instantiate the ResourceLoader class
  without all the default MW modules being registered from
  global state. E.g. move MW module registration from main class
  constructor to ServiceWiring, and remove the 'EmptyResourceLoader'
  class hack from unit tests, and use regular 'new ResourceLoader'
  instead.

* Making ResourceLoader a standalone library (some day),
  e.g. allowing it to be instantiated from a basic PHP script,
  in a way that is still useful and perhaps able to serve
  (most) RL modules without MW itself.

Bug: T32956
Change-Id: I4939f296c705b268e9cf8de635e923a739410470
includes/MediaWikiServices.php
includes/OutputPage.php
includes/ServiceWiring.php
includes/cache/MessageBlobStore.php
includes/installer/WebInstallerOutput.php
includes/resourceloader/ResourceLoader.php
includes/resourceloader/ResourceLoaderContext.php
load.php
maintenance/cleanupRemovedModules.php
tests/phpunit/structure/ResourcesTest.php
tests/phpunit/suites/LessTestSuite.php