MessageCache: Fix isMainCacheable() logic for non-content languages
authorRoan Kattouw <roan.kattouw@gmail.com>
Fri, 19 Jul 2019 23:51:01 +0000 (16:51 -0700)
committerKrinkle <krinklemail@gmail.com>
Sat, 20 Jul 2019 03:41:14 +0000 (03:41 +0000)
commitbcb6b9d0eb0656690af2dbdca0ae67d4bf73147b
tree48684466b4aadadcb5b7202819308d5fb5e23f02
parente745bfed82c41901b1e718ee98bcd396b68ec6ed
MessageCache: Fix isMainCacheable() logic for non-content languages

The way isMainCacheable() was used, it always returned false in
non-content languages, because it would try to find strings like
'hidetoc/fr' in the array of message keys (which contains strings like
'hidetoc').

The consequence of this was that MessageCache would check the database
for a MediaWiki:hidetoc/fr page even if it already knew that that page
didn't exist. This is a substantial performance hit when requesting lots
of messages, like when building version hashes for ResourceLoader's
startup module.

Follows-up 4fc5ba8bf83102b02.

Bug: T228555
Change-Id: I20433175ca919acc1c995f4a9cd50ca53afcdd02
includes/cache/MessageCache.php
tests/phpunit/includes/cache/MessageCacheTest.php