MediaWiki
REL1_22
|
This class provides access to the resource message blobs storage used by the ResourceLoader. More...
Static Public Member Functions | |
static | clear () |
static | get (ResourceLoader $resourceLoader, $modules, $lang) |
Get the message blobs for a set of modules. | |
static | insertMessageBlob ($name, ResourceLoaderModule $module, $lang) |
Generate and insert a new message blob. | |
static | updateMessage ($key) |
Update a single message in all message blobs it occurs in. | |
static | updateModule ($name, ResourceLoaderModule $module, $lang) |
Update the message blob for a given module in a given language. | |
Static Private Member Functions | |
static | generateMessageBlob (ResourceLoaderModule $module, $lang) |
Generate the message blob for a given module in a given language. | |
static | getFromDB (ResourceLoader $resourceLoader, $modules, $lang) |
Get the message blobs for a set of modules from the database. | |
static | getUpdatesForMessage ($key, $prevUpdates=null) |
Create an update queue for updateMessage() | |
static | 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.
static MessageBlobStore::clear | ( | ) | [static] |
Definition at line 243 of file MessageBlobStore.php.
static MessageBlobStore::generateMessageBlob | ( | ResourceLoaderModule $ | module, |
$ | lang | ||
) | [static, private] |
Generate the message blob for a given module in a given language.
$module | ResourceLoaderModule object | |
string | $lang | language code |
Definition at line 367 of file MessageBlobStore.php.
References $key, $messages, array(), as, FormatJson\encode(), ResourceLoaderModule\getMessages(), and wfMessage().
Referenced by insertMessageBlob(), and updateModule().
static MessageBlobStore::get | ( | ResourceLoader $ | resourceLoader, |
$ | modules, | ||
$ | lang | ||
) | [static] |
Get the message blobs for a set of modules.
$resourceLoader | ResourceLoader object | |
array | $modules | Array of module objects keyed by module name |
string | $lang | Language code |
Definition at line 44 of file MessageBlobStore.php.
References $blob, $name, $resourceLoader, array(), as, getFromDB(), insertMessageBlob(), wfProfileIn(), and wfProfileOut().
static MessageBlobStore::getFromDB | ( | ResourceLoader $ | resourceLoader, |
$ | modules, | ||
$ | lang | ||
) | [static, 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 object | |
array | $modules | of module names |
string | $lang | language code |
MWException |
Definition at line 331 of file MessageBlobStore.php.
References $dbr, $res, $retval, array(), as, FormatJson\decode(), ResourceLoader\getModule(), global, updateModule(), wfGetDB(), and wfTimestamp().
Referenced by get().
static MessageBlobStore::getUpdatesForMessage | ( | $ | key, |
$ | prevUpdates = null |
||
) | [static, 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 262 of file MessageBlobStore.php.
References $key, $res, array(), as, and wfGetDB().
Referenced by updateMessage().
static MessageBlobStore::insertMessageBlob | ( | $ | name, |
ResourceLoaderModule $ | module, | ||
$ | lang | ||
) | [static] |
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 |
$module | ResourceLoaderModule object | |
string | $lang | language code |
Definition at line 76 of file MessageBlobStore.php.
References $blob, $key, $name, $success, array(), as, generateMessageBlob(), ResourceLoaderModule\getMessages(), wfDebug(), and wfGetDB().
Referenced by get().
static MessageBlobStore::reencodeBlob | ( | $ | blob, |
$ | key, | ||
$ | lang | ||
) | [static, private] |
Reencode a message blob with the updated value for a message.
string | $blob | message blob (JSON object) |
string | $key | message key |
string | $lang | language code |
Definition at line 314 of file MessageBlobStore.php.
References $blob, $key, FormatJson\decode(), FormatJson\encode(), and wfMessage().
static MessageBlobStore::updateMessage | ( | $ | key | ) | [static] |
Update a single message in all message blobs it occurs in.
string | $key | message key |
Definition at line 200 of file MessageBlobStore.php.
References $key, $success, array(), as, getUpdatesForMessage(), wfDebug(), and wfGetDB().
static MessageBlobStore::updateModule | ( | $ | name, |
ResourceLoaderModule $ | module, | ||
$ | lang | ||
) | [static] |
Update the message blob for a given module in a given language.
string | $name | module name |
$module | ResourceLoaderModule object | |
string | $lang | language code |
Definition at line 133 of file MessageBlobStore.php.
References $name, array(), as, FormatJson\decode(), generateMessageBlob(), wfDebug(), and wfGetDB().
Referenced by getFromDB().