resourceloader: Tidy up RL to simplify ResourceLoaderEditToolbarModule
authorOri Livneh <ori@wikimedia.org>
Fri, 25 Sep 2015 17:57:35 +0000 (10:57 -0700)
committerTimo Tijhof <krinklemail@gmail.com>
Mon, 28 Sep 2015 19:18:12 +0000 (12:18 -0700)
commit3f1e9fa268cdc9850dd1df2b271dbd814d957488
tree2e97bdfeb813827e7024bedbc871ef7bc7b0755e
parent2712fc2913e696625451cc3be364b977b13f7443
resourceloader: Tidy up RL to simplify ResourceLoaderEditToolbarModule

* Remove ResourceLoaderFileModule::getLessCompiler(). There is no reason for a
  module to need to get a compiler in a different manner than
  ResourceLoader::getLessCompiler().
* Add ResourceLoaderModule::getLessVars(). This method provides a means for
  subclasses to easily inject custom LESS variables. The default implementation
  simply returns an empty array.
* Make the $context parameter for ResourceLoaderFileModule::readStyleFiles()
  non-optional (via graceful deprecation). The only callers I found were either
  already calling it with a ResourceLoader context, or had a perfectly usable
  ResourceLoaderContext in local scope.
* Make ResourceLoaderFileModule::{readStyleFile,getLessCompiler} require a
  context. These methods are protected, so I didn't bother with a deprecation.
* Call ksort() on the LESS variables array in the only place it matters -- when
  hashing its serialized representation to construct a cache lookup key. This
  relieves getLessVars() subclasses from having to remember to re-sort the
  variables array if they modify it.
* These changes make it possible to substantially simplify
  ResourceLoaderEditToolbarModule, because the only thing it needs to do now is
  implement its own getLessVars() method.
* This also allows it to be versioned like any other ResourceLoaderFileModule,
  rather than having to use enableModuleContentVersion().

Change-Id: Ic3eab71691e502bfe19bdf4eb6f82cc679a7782f
RELEASE-NOTES-1.26
includes/installer/WebInstallerOutput.php
includes/resourceloader/ResourceLoader.php
includes/resourceloader/ResourceLoaderEditToolbarModule.php
includes/resourceloader/ResourceLoaderFileModule.php
includes/resourceloader/ResourceLoaderModule.php
tests/phpunit/LessFileCompilationTest.php
tests/phpunit/structure/ResourcesTest.php