MediaWiki  REL1_19
MessageBlobStore Class Reference

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. More...

List of all members.

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.

Detailed Description

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. http://www.gnu.org/copyleft/gpl.html

Author:
Roan Kattouw
Trevor Parscal 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 consistuent messages or the resource itself is changed.

Definition at line 31 of file MessageBlobStore.php.


Member Function Documentation

static MessageBlobStore::clear ( ) [static]

Definition at line 230 of file MessageBlobStore.php.

References wfGetDB().

Referenced by LocalisationCache\recache().

Here is the call graph for this function:

Here is the caller graph for this function:

static MessageBlobStore::generateMessageBlob ( ResourceLoaderModule module,
lang 
) [static, private]

Generate the message blob for a given module in a given language.

Parameters:
$moduleResourceLoaderModule object
$langString: language code
Returns:
String: JSON object

Definition at line 349 of file MessageBlobStore.php.

References $messages, FormatJson\encode(), ResourceLoaderModule\getMessages(), and wfMsgExt().

Referenced by insertMessageBlob(), and updateModule().

Here is the call graph for this function:

Here is the caller graph for this function:

static MessageBlobStore::get ( ResourceLoader resourceLoader,
modules,
lang 
) [static]

Get the message blobs for a set of modules.

Parameters:
$resourceLoaderResourceLoader object
$modulesarray Array of module objects keyed by module name
$langstring Language code
Returns:
array An array mapping module names to message blobs

Definition at line 41 of file MessageBlobStore.php.

References $blob, $resourceLoader, getFromDB(), insertMessageBlob(), wfProfileIn(), and wfProfileOut().

Referenced by ResourceLoader\makeModuleResponse().

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters:
$resourceLoaderResourceLoader object
$modulesArray of module names
$langString: language code
Returns:
array Array mapping module names to blobs

Definition at line 313 of file MessageBlobStore.php.

References $dbr, $res, $wgCacheEpoch, FormatJson\decode(), ResourceLoader\getModule(), updateModule(), wfGetDB(), and wfTimestamp().

Referenced by get().

Here is the call graph for this function:

Here is the caller graph for this function:

static MessageBlobStore::getUpdatesForMessage ( key,
prevUpdates = null 
) [static, private]

Create an update queue for updateMessage()

Parameters:
$keyString: message key
$prevUpdatesArray: updates queue to refresh or null to build a fresh update queue
Returns:
Array: updates queue

Definition at line 245 of file MessageBlobStore.php.

References $res, and wfGetDB().

Referenced by updateMessage().

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters:
$nameString: module name
$moduleResourceLoaderModule object
$langString: language code
Returns:
mixed Message blob or false if the module has no messages

Definition at line 73 of file MessageBlobStore.php.

References $blob, $rows, $success, generateMessageBlob(), ResourceLoaderModule\getMessages(), and wfGetDB().

Referenced by get().

Here is the call graph for this function:

Here is the caller graph for this function:

static MessageBlobStore::reencodeBlob ( blob,
key,
lang 
) [static, private]

Reencode a message blob with the updated value for a message.

Parameters:
$blobString: message blob (JSON object)
$keyString: message key
$langString: language code
Returns:
Message blob with $key replaced with its new value

Definition at line 297 of file MessageBlobStore.php.

References $blob, FormatJson\decode(), FormatJson\encode(), and wfMsgExt().

Here is the call graph for this function:

static MessageBlobStore::updateMessage ( key) [static]

Update a single message in all message blobs it occurs in.

Parameters:
$keyString: message key

Definition at line 191 of file MessageBlobStore.php.

References $success, getUpdatesForMessage(), and wfGetDB().

Referenced by MessageCache\replace().

Here is the call graph for this function:

Here is the caller graph for this function:

static MessageBlobStore::updateModule ( name,
ResourceLoaderModule module,
lang 
) [static]

Update the message blob for a given module in a given language.

Parameters:
$nameString: module name
$moduleResourceLoaderModule object
$langString: language code
Returns:
String Regenerated message blob, or null if there was no blob for the given module/language pair

Definition at line 127 of file MessageBlobStore.php.

References FormatJson\decode(), generateMessageBlob(), and wfGetDB().

Referenced by getFromDB().

Here is the call graph for this function:

Here is the caller graph for this function:


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