Permit use of User::getDefaultOptions() in-process cache in unit tests
authorOri Livneh <ori@wikimedia.org>
Mon, 9 May 2016 07:15:13 +0000 (00:15 -0700)
committerKrinkle <krinklemail@gmail.com>
Thu, 7 Jul 2016 19:50:52 +0000 (19:50 +0000)
commit8edbab99b07e16f3d92995789b218426660913fe
tree1d49ecc29fc962223f46409f4b0d59e882aabfca
parentfa40f8f1451a1b6771718b8fde691fca42c4f9c2
Permit use of User::getDefaultOptions() in-process cache in unit tests

MediaWiki uses an in-process cache to speed up repeat calls to
User::getDefaultOptions() -- except when the unit tests are running, in which
case the process cache is disabled, because otherwise it would be at risk of
becoming stale due to unit tests manipulating $wgContLang. Well, there's a less
aggressive option, which is to keep the cache enabled but use it only if
$wgContLang hasn't changed. Since MediaWiki's test setup code creates default
users for the unit tests, User::getDefaultOptions() ends up getting called
quite a lot, so enabling the process cache is worth the trouble.

Change-Id: I81f3ae42d356939c81e59ab12d7a9e7d1206cb40
includes/user/User.php