filebackend: avoiding computing file SHA-1 hashes unless needed
authorAaron Schulz <aschulz@wikimedia.org>
Fri, 9 Nov 2018 01:13:51 +0000 (17:13 -0800)
committerAaron Schulz <aschulz@wikimedia.org>
Mon, 10 Dec 2018 22:51:26 +0000 (22:51 +0000)
commite1497e3593154f579cf5f6597bbf8b88cf16dce6
tree4ea0e0879d391470ed3d4fd167f805f37621d00d
parent1b53f3f6e222f9108c7b35f47cbfa38d447208ea
filebackend: avoiding computing file SHA-1 hashes unless needed

FileBackendStore already supports stat info not returning SHA-1.
Build on that logic with a "requireSHA1" parameter to getFileStat()
to move some logic from SwiftFileBackend to the parent class and
avoid computing missing SHA-1's for Swift when nothing actually
requested the SHA-1. Only getFileSha1Base36() needs to trigger this
lazy-population logic.

Note that thumbnails only use doQuickOperations(), which does not
need to examine SHA-1s, it only does regular getFileStat() calls.

Also renamed addMissingMetadata() to addMissingHashMetadata().

Bug: T204174
Change-Id: I2a378cb2a34608a6da2f8abe604861ff391ffaa7
includes/libs/filebackend/FileBackendStore.php
includes/libs/filebackend/SwiftFileBackend.php