MediaWiki master
MediaWiki\ResourceLoader\MessageBlobStore Class Reference

This class generates message blobs for use by ResourceLoader. More...

Inherits LoggerAwareInterface.

Collaboration diagram for MediaWiki\ResourceLoader\MessageBlobStore:

Public Member Functions

 __construct (ResourceLoader $rl, ?LoggerInterface $logger, ?WANObjectCache $wanObjectCache)
 
 clear ()
 Invalidate cache keys for all known modules.
 
 getBlob (Module $module, $lang)
 Get the message blob for a module.
 
 getBlobs (array $modules, $lang)
 Get the message blobs for a set of modules.
 
 setLogger (LoggerInterface $logger)
 
 updateMessage ( $key)
 Invalidate cache keys for modules using this message key.
 

Static Public Member Functions

static clearGlobalCacheEntry (WANObjectCache $cache)
 Invalidate cache keys for all known modules.
 

Protected Member Functions

 fetchMessage ( $key, $lang)
 
 recacheMessageBlob ( $cacheKey, Module $module, $lang)
 

Protected Attributes

LoggerInterface $logger
 
WANObjectCache $wanCache
 

Detailed Description

This class generates message blobs for use by ResourceLoader.

A message blob is a JSON object containing the interface messages for a certain module in a certain language.

Since
1.17

Definition at line 42 of file MessageBlobStore.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\ResourceLoader\MessageBlobStore::__construct ( ResourceLoader $rl,
?LoggerInterface $logger,
?WANObjectCache $wanObjectCache )
Parameters
ResourceLoader$rl
LoggerInterface | null$logger
WANObjectCache | null$wanObjectCache

Definition at line 57 of file MessageBlobStore.php.

References MediaWiki\ResourceLoader\MessageBlobStore\$logger, and MediaWiki\MediaWikiServices\getInstance().

Member Function Documentation

◆ clear()

MediaWiki\ResourceLoader\MessageBlobStore::clear ( )

Invalidate cache keys for all known modules.

Used by purgeMessageBlobStore.php

Definition at line 205 of file MessageBlobStore.php.

◆ clearGlobalCacheEntry()

static MediaWiki\ResourceLoader\MessageBlobStore::clearGlobalCacheEntry ( WANObjectCache $cache)
static

Invalidate cache keys for all known modules.

Used by LocalisationCache and DatabaseUpdater after regenerating l10n cache.

Parameters
WANObjectCache$cache

Definition at line 216 of file MessageBlobStore.php.

References WANObjectCache\touchCheckKey().

Referenced by MediaWiki\Installer\DatabaseUpdater\purgeCache().

◆ fetchMessage()

MediaWiki\ResourceLoader\MessageBlobStore::fetchMessage ( $key,
$lang )
protected
Since
1.27
Parameters
string$keyMessage key
string$langLanguage code
Returns
string|null

Definition at line 233 of file MessageBlobStore.php.

References wfMessage().

◆ getBlob()

MediaWiki\ResourceLoader\MessageBlobStore::getBlob ( Module $module,
$lang )

Get the message blob for a module.

Since
1.27
Parameters
Module$module
string$langLanguage code
Returns
string JSON

Definition at line 88 of file MessageBlobStore.php.

References MediaWiki\ResourceLoader\MessageBlobStore\getBlobs(), and MediaWiki\ResourceLoader\Module\getName().

◆ getBlobs()

MediaWiki\ResourceLoader\MessageBlobStore::getBlobs ( array $modules,
$lang )

Get the message blobs for a set of modules.

Since
1.27
Parameters
Module[]$modulesArray of module objects keyed by name
string$langLanguage code
Returns
string[] An array mapping module names to message blobs

Definition at line 101 of file MessageBlobStore.php.

References MediaWiki\ResourceLoader\MessageBlobStore\recacheMessageBlob().

Referenced by MediaWiki\ResourceLoader\MessageBlobStore\getBlob().

◆ recacheMessageBlob()

MediaWiki\ResourceLoader\MessageBlobStore::recacheMessageBlob ( $cacheKey,
Module $module,
$lang )
protected
Since
1.27
Parameters
string$cacheKey
Module$module
string$lang
Returns
string JSON blob

Definition at line 173 of file MessageBlobStore.php.

References MediaWiki\ResourceLoader\MessageBlobStore\$wanCache, Wikimedia\Rdbms\Database\getCacheSetOptions(), MediaWiki\MediaWikiServices\getInstance(), and WANObjectCache\set().

Referenced by MediaWiki\ResourceLoader\MessageBlobStore\getBlobs().

◆ setLogger()

MediaWiki\ResourceLoader\MessageBlobStore::setLogger ( LoggerInterface $logger)
Since
1.27
Parameters
LoggerInterface$logger

Definition at line 76 of file MessageBlobStore.php.

References MediaWiki\ResourceLoader\MessageBlobStore\$logger.

◆ updateMessage()

MediaWiki\ResourceLoader\MessageBlobStore::updateMessage ( $key)

Invalidate cache keys for modules using this message key.

Called by MessageCache when a message has changed.

Parameters
string$keyMessage key

Definition at line 191 of file MessageBlobStore.php.

Member Data Documentation

◆ $logger

LoggerInterface MediaWiki\ResourceLoader\MessageBlobStore::$logger
protected

◆ $wanCache

WANObjectCache MediaWiki\ResourceLoader\MessageBlobStore::$wanCache
protected

The documentation for this class was generated from the following file: