MediaWiki
REL1_24
|
This class provides access to the resource message blobs storage used by the ResourceLoader. More...
Public Member Functions | |
clear () | |
get (ResourceLoader $resourceLoader, $modules, $lang) | |
Get the message blobs for a set of modules. | |
insertMessageBlob ($name, ResourceLoaderModule $module, $lang) | |
Generate and insert a new message blob. | |
updateMessage ($key) | |
Update a single message in all message blobs it occurs in. | |
updateModule ($name, ResourceLoaderModule $module, $lang) | |
Update the message blob for a given module in a given language. | |
Static Public Member Functions | |
static | getInstance () |
Get the singleton instance. | |
Private Member Functions | |
generateMessageBlob (ResourceLoaderModule $module, $lang) | |
Generate the message blob for a given module in a given language. | |
getFromDB (ResourceLoader $resourceLoader, $modules, $lang) | |
Get the message blobs for a set of modules from the database. | |
getUpdatesForMessage ($key, $prevUpdates=null) | |
Create an update queue for updateMessage() | |
reencodeBlob ($blob, $key, $lang) | |
Reencode a message blob with the updated value for a message. |
This class provides access to the resource message blobs storage used by the ResourceLoader.
A message blob is a JSON object containing the interface messages for a certain resource in a certain language. These message blobs are cached in the msg_resource table and automatically invalidated when one of their constituent messages or the resource itself is changed.
Definition at line 34 of file MessageBlobStore.php.
Definition at line 258 of file MessageBlobStore.php.
MessageBlobStore::generateMessageBlob | ( | ResourceLoaderModule $ | module, |
$ | lang | ||
) | [private] |
Generate the message blob for a given module in a given language.
ResourceLoaderModule | $module | |
string | $lang | Language code |
Definition at line 387 of file MessageBlobStore.php.
References $key, $messages, array(), as, FormatJson\encode(), ResourceLoaderModule\getMessages(), and wfMessage().
Referenced by insertMessageBlob(), and updateModule().
MessageBlobStore::get | ( | ResourceLoader $ | resourceLoader, |
$ | modules, | ||
$ | lang | ||
) |
Get the message blobs for a set of modules.
ResourceLoader | $resourceLoader | |
array | $modules | Array of module objects keyed by module name |
string | $lang | Language code |
Definition at line 58 of file MessageBlobStore.php.
References $blob, $name, $resourceLoader, array(), as, getFromDB(), insertMessageBlob(), wfProfileIn(), and wfProfileOut().
MessageBlobStore::getFromDB | ( | ResourceLoader $ | resourceLoader, |
$ | modules, | ||
$ | lang | ||
) | [private] |
Get the message blobs for a set of modules from the database.
Modules whose blobs are not in the database are silently dropped.
ResourceLoader | $resourceLoader | |
array | $modules | Array of module names |
string | $lang | Language code |
MWException |
Definition at line 347 of file MessageBlobStore.php.
References $dbr, $keys, $res, $retval, array(), as, FormatJson\decode(), ResourceLoader\getConfig(), ResourceLoader\getModule(), updateModule(), wfGetDB(), and wfTimestamp().
Referenced by get().
static MessageBlobStore::getInstance | ( | ) | [static] |
Get the singleton instance.
Definition at line 41 of file MessageBlobStore.php.
MessageBlobStore::getUpdatesForMessage | ( | $ | key, |
$ | prevUpdates = null |
||
) | [private] |
Create an update queue for updateMessage()
string | $key | Message key |
array | $prevUpdates | Updates queue to refresh or null to build a fresh update queue |
Definition at line 278 of file MessageBlobStore.php.
References $key, $res, array(), as, and wfGetDB().
Referenced by updateMessage().
MessageBlobStore::insertMessageBlob | ( | $ | name, |
ResourceLoaderModule $ | module, | ||
$ | lang | ||
) |
Generate and insert a new message blob.
If the blob was already present, it is not regenerated; instead, the preexisting blob is fetched and returned.
string | $name | Module name |
ResourceLoaderModule | $module | |
string | $lang | Language code |
Definition at line 90 of file MessageBlobStore.php.
References $blob, $e, $key, $name, $success, array(), as, generateMessageBlob(), ResourceLoaderModule\getMessages(), wfDebug(), and wfGetDB().
Referenced by get().
MessageBlobStore::reencodeBlob | ( | $ | blob, |
$ | key, | ||
$ | lang | ||
) | [private] |
Reencode a message blob with the updated value for a message.
Definition at line 330 of file MessageBlobStore.php.
References $blob, $key, FormatJson\decode(), FormatJson\encode(), and wfMessage().
MessageBlobStore::updateMessage | ( | $ | key | ) |
MessageBlobStore::updateModule | ( | $ | name, |
ResourceLoaderModule $ | module, | ||
$ | lang | ||
) |
Update the message blob for a given module in a given language.
string | $name | Module name |
ResourceLoaderModule | $module | |
string | $lang | Language code |
Definition at line 148 of file MessageBlobStore.php.
References $e, $name, array(), as, FormatJson\decode(), generateMessageBlob(), wfDebug(), and wfGetDB().
Referenced by getFromDB().