From: Roan Kattouw Date: Tue, 7 May 2019 01:07:49 +0000 (-0700) Subject: Obtain MessageBlobStore instance in a consistent way X-Git-Tag: 1.34.0-rc.0~1781^2 X-Git-Url: https://git.cyclocoop.org/%27.WWW_URL.%27admin/?a=commitdiff_plain;h=a6643499a4143a94de7f41379e5cb7ae45d22519;p=lhc%2Fweb%2Fwiklou.git Obtain MessageBlobStore instance in a consistent way Use MediaWikiServices (not OutputPage) to obtain a ResourceLoader instance, then call ->getMessageBlobStore() to obtain its MessageBlobStore instance (don't construct a new one). Change-Id: I6b8bacac9888b5807328eece01134a6c5747dc72 --- diff --git a/includes/cache/MessageCache.php b/includes/cache/MessageCache.php index fb4c7b6d51..328cc2f8e0 100644 --- a/includes/cache/MessageCache.php +++ b/includes/cache/MessageCache.php @@ -718,8 +718,7 @@ class MessageCache { $this->wanCache->touchCheckKey( $this->getCheckKey( $code ) ); // Purge the messages in the message blob store and fire any hook handlers - $resourceloader = RequestContext::getMain()->getOutput()->getResourceLoader(); - $blobStore = $resourceloader->getMessageBlobStore(); + $blobStore = MediaWikiServices::getInstance()->getResourceLoader()->getMessageBlobStore(); foreach ( $replacements as list( $title, $msg ) ) { $blobStore->updateMessage( $this->contLang->lcfirst( $msg ) ); Hooks::run( 'MessageCacheReplace', [ $title, $newTextByTitle[$title] ] ); diff --git a/includes/cache/localisation/LocalisationCache.php b/includes/cache/localisation/LocalisationCache.php index 8df80138d0..db0f380ab2 100644 --- a/includes/cache/localisation/LocalisationCache.php +++ b/includes/cache/localisation/LocalisationCache.php @@ -1033,9 +1033,7 @@ class LocalisationCache { # HACK: If using a null (i.e. disabled) storage backend, we # can't write to the MessageBlobStore either if ( $purgeBlobs && !$this->store instanceof LCStoreNull ) { - $blobStore = new MessageBlobStore( - MediaWikiServices::getInstance()->getResourceLoader() - ); + $blobStore = MediaWikiServices::getInstance()->getResourceLoader()->getMessageBlobStore(); $blobStore->clear(); } }