MediaWiki REL1_40
LocalisationCacheBulkLoad Class Reference

LocalisationCache optimised for loading many languages at once. More...

Inherits LocalisationCache.

Collaboration diagram for LocalisationCacheBulkLoad:

Public Member Functions

 getItem ( $code, $key)
 
 getSubitem ( $code, $key, $subkey)
 
 recache ( $code)
 
 unload ( $code)
 
- Public Member Functions inherited from LocalisationCache
 __construct (ServiceOptions $options, LCStore $store, LoggerInterface $logger, array $clearStoreCallbacks, LanguageNameUtils $langNameUtils, HookContainer $hookContainer)
 For constructor parameters, \MediaWiki\MainConfigSchema::LocalisationCacheConf.
 
 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.
 
 getSubitemWithSource ( $code, $key, $subkey)
 Get a subitem with its source language.
 
 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.
 
 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.
 

Additional Inherited Members

- Static Public Member Functions inherited from LocalisationCache
static getStoreFromConf (array $conf, $fallbackCacheDir)
 Return a suitable LCStore as specified by the given configuration.
 
- Public Attributes inherited from LocalisationCache
const CONSTRUCTOR_OPTIONS
 
const VERSION = 5
 
- 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 = []
 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 $sourcePrefixKeys = [ 'messages' ]
 Keys for items that will be prefixed with its source language code, which should be stripped out when loading from cache.
 
static $splitKeys = [ 'messages' ]
 Keys for items where the subitems are stored in the backend separately.
 
- Protected Attributes inherited from LocalisationCache
 $data = []
 The cache data.
 
 $sourceLanguage = []
 The source language of cached data items.
 
const SOURCEPREFIX_SEPARATOR = ':'
 Separator for the source language prefix.
 

Detailed Description

LocalisationCache optimised for loading many languages at once.

Used by maintenance/rebuildLocalisationCache.php.

Definition at line 28 of file LocalisationCacheBulkLoad.php.

Member Function Documentation

◆ getItem()

LocalisationCacheBulkLoad::getItem ( $code,
$key )
Parameters
string$code
string$key
Returns
mixed

Reimplemented from LocalisationCache.

Definition at line 79 of file LocalisationCacheBulkLoad.php.

◆ getSubitem()

LocalisationCacheBulkLoad::getSubitem ( $code,
$key,
$subkey )
Parameters
string$code
string$key
string$subkey
Returns
mixed

Reimplemented from LocalisationCache.

Definition at line 92 of file LocalisationCacheBulkLoad.php.

◆ readPHPFile()

LocalisationCacheBulkLoad::readPHPFile ( $fileName,
$fileType )
protected
Parameters
string$fileName
string$fileType
Returns
array|mixed

Reimplemented from LocalisationCache.

Definition at line 53 of file LocalisationCacheBulkLoad.php.

References LocalisationCache\$data.

◆ recache()

LocalisationCacheBulkLoad::recache ( $code)
Parameters
string$code

Reimplemented from LocalisationCache.

Definition at line 102 of file LocalisationCacheBulkLoad.php.

References trimCache().

◆ trimCache()

LocalisationCacheBulkLoad::trimCache ( )
protected

Unload cached languages until there are less than $this->maxLoadedLangs.

Definition at line 120 of file LocalisationCacheBulkLoad.php.

References unload(), and wfDebug().

Referenced by recache().

◆ unload()

LocalisationCacheBulkLoad::unload ( $code)
Parameters
string$code

Reimplemented from LocalisationCache.

Definition at line 112 of file LocalisationCacheBulkLoad.php.

Referenced by trimCache().


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