{"push_id":802820108,"size":1,"distinct_size":1,"ref":"refs/heads/wmf/1.26wmf24","head":"36f661cf4799ec1b7fbe481a54e62afbd46133e0","before":"446f177c6aed4d94894f0783e231ef36893a5abf","commits":[{"sha":"36f661cf4799ec1b7fbe481a54e62afbd46133e0","author":{"email":"6c720b6ece72a4972cc39d6436cb370514e267ec@wikimedia.org","name":"Ori Livneh"},"message":"Improved caching for LESS file compilation\n\nCaching the output of a LESS compiler is tricky, because a LESS file may\ninclude additional LESS files via @imports, in which case the cache needs\nto vary as the contents of those files vary (and not just the contents of\nthe primary LESS file).\n\nTo solve this, we first introduce a utility class, FileContentsHasher. This\nclass is essentially a smart version of md5_file() -- given one or more file\nnames, it computes a hash digest of their contents. It tries to avoid\nre-reading files by caching the hash digest in APC and re-using it as long as\nthe files' mtimes have not changed. This is the same approach I used in\nI5ceb8537c.\n\nNext, we use this class in ResourceLoaderFileModule in the following way:\nwhenever we compile a LESS file, we cache the result as an associative array\nwith the following keys:\n\n* `files` : the list of files whose contents influenced the compiled CSS.\n* `hash`  : a hash digest of the combined contents of those files.\n* `css`   : the CSS output of the compiler itself.\n\nBefore using a cached value, we verify that it is still current by asking\nFileContentHasher for a hash of the combined contents of all referenced files,\nand we compare that against the value of the `hash` key of the cached entry.\n\nBug: T112035\nChange-Id: I1ff61153ddb95ed17e543bd4af7dd13fa3352861","distinct":true,"url":"https://api.github.com/repos/wikimedia/mediawiki/commits/36f661cf4799ec1b7fbe481a54e62afbd46133e0"}]}