This patch does the follow with a few gotchas:
* Properly inject LBFactory service into ObjectCacheFactory to be
used where needed.
* doc: Pull in relevant documentation from ObjectCache class into
the ObjectCacheFactory class and also update docs in the OCF
class to be more accurate with the code.
* This patch also resolves an issue that caused an infinite loop in
SqlBagOStuff making connections to the DB not to be reused within
a request there by crashing the application (when the index.php
entry-point) is accessed directly and every cache type is set to
CACHE_ANYTHING. Meaning in LocalSettings, only `$wgMainCacheType`
is set and its relatives (ParserCache, MessageCache, etc) aren't
set.
NOTES
=====
-> A circular dependency would occur in OCF when injecting LBFactory:
DBLoadBalancerFactory->DBLoadBalancerFactoryConfigBuilder
->LocalServerObjectCache->ObjectCacheFactory->DBLoadBalancerFactory
directly, so in order to resolve this, we'll inject a closure instead
and call that to retrieve the service when needed. The solution above
is already used in other services today in the code. As an example,
you can see SignatureValidatorFactory.
-> In MainConfigSchema.php, the CACHE_ANYTHING key got removed
in https://gerrit.wikimedia.org/r/c/mediawiki/core/+/955771
and this is a change in behavior. So we need to recompute the
value of CACHE_ANYTHING's ID via service wiring for DB operations.
Test plan
=========
This patch is fairly straight forward, all it does is do some DI of
a service into OCF (via a callable). No change in behavior should be
expected in your local wiki.
So if your local wiki is still running smoothly when you hit the
`/index.php` entry-point directly and other cases, then everything
should be working fine.
Bug: T362686
Change-Id: I305ef0c377a023236b8ed9a101762813f32e6cd0