MediaWiki REL1_32
|
A localisation cache optimised for loading large amounts of data for many languages. More...
Public Member Functions | |
getItem ( $code, $key) | |
getSubitem ( $code, $key, $subkey) | |
recache ( $code) | |
unload ( $code) | |
Public Member Functions inherited from LocalisationCache | |
__construct ( $conf) | |
For constructor parameters, see the documentation in DefaultSettings.php for $wgLocalisationCacheConf. | |
disableBackend () | |
Disable the storage backend. | |
getCompiledPluralRules ( $code) | |
Get the compiled plural rules for a given language from the XML files. | |
getMessagesDirs () | |
Gets the combined list of messages dirs from core and extensions. | |
getPluralRules ( $code) | |
Get the plural rules for a given language from the XML files. | |
getPluralRuleTypes ( $code) | |
Get the plural rule types for a given language from the XML files. | |
getSubitemList ( $code, $key) | |
Get the list of subitem keys for a given item. | |
initShallowFallback ( $primaryCode, $fallbackCode) | |
Create a fallback from one language to another, without creating a complete persistent cache. | |
isExpired ( $code) | |
Returns true if the cache identified by $code is missing or expired. | |
isMergeableKey ( $key) | |
Returns true if the given key is mergeable, that is, if it is an associative array which can be merged through a fallback sequence. | |
readJSONFile ( $fileName) | |
Read a JSON file containing localisation messages. | |
unloadAll () | |
Unload all data. | |
Protected Member Functions | |
readPHPFile ( $fileName, $fileType) | |
trimCache () | |
Unload cached languages until there are less than $this->maxLoadedLangs. | |
Protected Member Functions inherited from LocalisationCache | |
buildPreload ( $data) | |
Build the preload item from the given pre-cache data. | |
initLanguage ( $code) | |
Initialise a language in this object. | |
loadItem ( $code, $key) | |
Load an item into the cache. | |
loadPluralFile ( $fileName) | |
Load a plural XML file with the given filename, compile the relevant rules, and save the compiled rules in a process-local cache. | |
loadPluralFiles () | |
Load the plural XML files. | |
loadSubitem ( $code, $key, $subkey) | |
Load a subitem into the cache. | |
mergeExtensionItem ( $codeSequence, $key, &$value, $fallbackValue) | |
Given an array mapping language code to localisation value, such as is found in extension *.i18n.php files, iterate through a fallback sequence to merge the given data with an existing primary value. | |
mergeItem ( $key, &$value, $fallbackValue) | |
Merge two localisation values, a primary and a fallback, overwriting the primary value in place. | |
mergeMagicWords (&$value, $fallbackValue) | |
readSourceFilesAndRegisterDeps ( $code, &$deps) | |
Read the data from the source files for a given language, and register the relevant dependencies in the $deps array. | |
Private Attributes | |
$fileCache = [] | |
A cache of the contents of data files. | |
$maxLoadedLangs = 10 | |
Maximum number of languages that may be loaded into $this->data. | |
$mruLangs = [] | |
Most recently used languages. | |
Additional Inherited Members | |
Public Attributes inherited from LocalisationCache | |
const | VERSION = 4 |
Static Public Attributes inherited from LocalisationCache | |
static | $allKeys |
All item keys. | |
static | $magicWordKeys = [ 'magicWords' ] |
Keys for items that are formatted like $magicWords. | |
static | $mergeableAliasListKeys = [ 'specialPageAliases' ] |
Keys for items which contain an array of arrays of equivalent aliases for each subitem. | |
static | $mergeableListKeys = [ 'extraUserToggles' ] |
Keys for items which are a numbered array. | |
static | $mergeableMapKeys |
Keys for items which consist of associative arrays, which may be merged by a fallback sequence. | |
static | $optionalMergeKeys = [ 'bookstoreList' ] |
Keys for items which contain an associative array, and may be merged if the primary value contains the special array key "inherit". | |
static | $preloadedKeys = [ 'dateFormats', 'namespaceNames' ] |
Keys which are loaded automatically by initLanguage() | |
static | $splitKeys = [ 'messages' ] |
Keys for items where the subitems are stored in the backend separately. | |
Protected Attributes inherited from LocalisationCache | |
$data = [] | |
The cache data. | |
A localisation cache optimised for loading large amounts of data for many languages.
Used by rebuildLocalisationCache.php.
Definition at line 25 of file LocalisationCacheBulkLoad.php.
LocalisationCacheBulkLoad::getItem | ( | $code, | |
$key ) |
string | $code | |
string | $key |
Reimplemented from LocalisationCache.
Definition at line 76 of file LocalisationCacheBulkLoad.php.
References $code.
LocalisationCacheBulkLoad::getSubitem | ( | $code, | |
$key, | |||
$subkey ) |
string | $code | |
string | $key | |
string | $subkey |
Reimplemented from LocalisationCache.
Definition at line 89 of file LocalisationCacheBulkLoad.php.
References $code.
|
protected |
string | $fileName | |
string | $fileType |
Reimplemented from LocalisationCache.
Definition at line 50 of file LocalisationCacheBulkLoad.php.
References LocalisationCache\$data, serialize(), and unserialize().
LocalisationCacheBulkLoad::recache | ( | $code | ) |
string | $code |
Reimplemented from LocalisationCache.
Definition at line 99 of file LocalisationCacheBulkLoad.php.
References $code, and trimCache().
|
protected |
LocalisationCacheBulkLoad::unload | ( | $code | ) |
string | $code |
Reimplemented from LocalisationCache.
Definition at line 109 of file LocalisationCacheBulkLoad.php.
References $code.
Referenced by trimCache().
|
private |
A cache of the contents of data files.
Core files are serialized to avoid using ~1GB of RAM during a recache.
Definition at line 31 of file LocalisationCacheBulkLoad.php.
|
private |
Maximum number of languages that may be loaded into $this->data.
Definition at line 43 of file LocalisationCacheBulkLoad.php.
|
private |
Most recently used languages.
Uses the linked-list aspect of PHP hashtables to keep the most recently used language codes at the end of the array, and the language codes that are ready to be deleted at the beginning.
Definition at line 38 of file LocalisationCacheBulkLoad.php.