resourceloader: Convert FileModule to use version hashing
authorTimo Tijhof <krinklemail@gmail.com>
Thu, 9 Jul 2015 18:30:53 +0000 (19:30 +0100)
committerOri.livneh <ori@wikimedia.org>
Wed, 5 Aug 2015 19:30:33 +0000 (19:30 +0000)
commit28f6d7fbdeedc5ddb29c8abed1f1654b06f8ac03
treecaa1e86d7cb2ef634a1c37a23dc8d4a7903789ff
parentd4111ed30d2f7a75f6846c008d3c851b4f0e3c0b
resourceloader: Convert FileModule to use version hashing

Enabling the module content versionining is not feasible for FileModule as that
would involve Lessc and CSSJanus just to compute the version hash.

Instead, we can keep the existing logic that exists for the timestamp-based
versioning (which already has a comprehensive grip on tracking all involved
factors that cause a module to change) and convert it to use hashing instead.

This way the version hashes will be deterministic. Currently module versions
tend to be invalidated too often (and sometimes not often enough) due to Git and
other transport mechanisms not preserving file timestamps.

== Research ==

* <https://phabricator.wikimedia.org/T98087#1412712>
  It'd take upto 10 seconds to run startup if FileModule enables build versioning.

* <https://phabricator.wikimedia.org/T104950#1433142>
  Checking all files in resources/** took only ~30m longer in total with
  sha1_file compared to filemtime.

Bug: T104950
Change-Id: I732fa4db32258c634e32b507952f76eac7fc9395
includes/resourceloader/ResourceLoaderFileModule.php
includes/resourceloader/ResourceLoaderModule.php