resourceloader: Support 'versionCallback' for computed package files
authorTimo Tijhof <krinklemail@gmail.com>
Wed, 12 Jun 2019 00:57:17 +0000 (01:57 +0100)
committerAaron Schulz <aschulz@wikimedia.org>
Fri, 14 Jun 2019 17:05:43 +0000 (17:05 +0000)
commita80d071a2ccf1e96ea0392e20cd048a82c27a0dd
tree401cb89e3d2b3261c73ed8c18ab3cbc5f8839567
parent61544d6eb235342d004a2fefc159167f28c69099
resourceloader: Support 'versionCallback' for computed package files

The use cases we've seen for using computed (or virtual) package files,
involve expensive computations to expand and transform data for the client
that we don't want to evaluate in full just to compute the module's version
hash (e.g. in the StartupModule, where we need to do this for 1000s of
modules).

For such cases, the module can specify a 'versionCallback' of which the
return value will be used to seed the module's version hash. The default
remains the same as before, which is to use the full content to seed the
version hash (via getDefinitionSummary).

Bug: T223260
Change-Id: I76f573239e6bd429287e7adb33a92ffd5e260c20
includes/resourceloader/ResourceLoaderFileModule.php
tests/phpunit/includes/resourceloader/ResourceLoaderFileModuleTest.php