$store,
$logger,
[ function () use ( $services ) {
- $services->getResourceLoader()->getMessageBlobStore()->clear();
+ // NOTE: Make sure we use the same cache object that is assigned in the
+ // constructor of the MessageBlobStore class used by ResourceLoader.
+ // T231866: Avoid circular dependency via ResourceLoader.
+ MessageBlobStore::clearGlobalCacheEntry( $services->getMainWANObjectCache() );
} ],
$services->getLanguageNameUtils()
);
public function __construct( ResourceLoader $rl, LoggerInterface $logger = null ) {
$this->resourceloader = $rl;
$this->logger = $logger ?: new NullLogger();
+
+ // NOTE: when changing this assignment, make sure the code in the instantiator for
+ // LocalisationCache which calls MessageBlobStore::clearGlobalCacheEntry() uses the
+ // same cache object.
$this->wanCache = MediaWikiServices::getInstance()->getMainWANObjectCache();
}
/**
* Invalidate cache keys for all known modules.
- * Called by LocalisationCache after cache is regenerated.
*/
public function clear() {
- $cache = $this->wanCache;
+ self::clearGlobalCacheEntry( $this->wanCache );
+ }
+
+ /**
+ * Invalidate cache keys for all known modules.
+ *
+ * Called by LocalisationCache after cache is regenerated.
+ *
+ * @param WANObjectCache $cache
+ */
+ public static function clearGlobalCacheEntry( WANObjectCache $cache ) {
// Disable hold-off because:
// - LocalisationCache is populated by messages on-disk and don't have DB lag,
// thus there is no need for hold off. We only clear it after new localisation