PopulateContentTables: compute sha1 and length if needed.
authordaniel <dkinzler@wikimedia.org>
Thu, 4 Jul 2019 11:54:20 +0000 (13:54 +0200)
committerdaniel <dkinzler@wikimedia.org>
Fri, 5 Jul 2019 13:39:45 +0000 (15:39 +0200)
commit49a9bca8dde6006f3e744cd20ff2f618ae1a5cda
tree40d43221c7f8213a82610efd629468521832d01f
parent8bc855d71ff995f4c055de9cfec6d7b2c8821ee4
PopulateContentTables: compute sha1 and length if needed.

PopulateContentTables tries to copy rev_sha1 to content_sha1 and rev_len
to content_size, but when updating directly from on old version of
MediaWiki, these fields may be empty or NULL. To ensure that the content
table gets the correct value, we have to compute them on the fly.

Note that PopulateRevisionSha1 runs *after* the normal database updates.
So even though it was introduced in 1.19, it will run after the schema
updates for 1.32, which include PopulateContentTables. This means that
PopulateContentTables can't rely on rev_sha1 to have been filled in
already. But per I0c22286a16d7b, it also means that PopulateRevisionSha1
can make use of the hash in content_sha1 instead of re-calculating.

Bug: T217831
Bug: T200653
Change-Id: I69e91a812ad5f038562220b02c3634589667cdb6
maintenance/populateContentTables.php