Use enableModuleContentVersion() for Wikibase\lib\SitesModule (take 2)
Remove the need to maintain two separate code paths, one to compute the script, and one to compute the module version hash. Instead, let ResourceLoader do the module versioning based on the content of the script. When setting enableModuleContentVersion(), then module->getVersionHash() will call getScript() instead of getDefinitionSummary().
- Update the tests accordingly.
For the Worker class testGetDefinitionSummary_caching becomes testGetSpecialSiteLinkGroups_caching.
For the Module class, testGetDefinitionSummary was moved to it from the WorkerTest suite, as testGetVersionHash.
Difference from original attempt:
I orignally introduced the getWithSet caching call in
computeSiteDetails() which was a mistake, because that's for
each individual site object, not for the combined script of all
known MW sites. As such, it was caching the first iteration of
the for-loop, and then re-using it for all other sites.
I've updated the test case to actually create a mock with
more than 1 site, so that this bug is exposed.
The original patch would have failed with this new test.
I also fixed another bug in the original code, which is that
it did not vary the cache by language code, despite the code
using that to make decisions.