Creates a database of keys in all groups, so that namespace and key can be used to get the groups they belong to. More...
Public Member Functions | |
| __construct (MessageIndexStore $store, WANObjectCache $statusCache, JobQueueGroup $jobQueueGroup, HookRunner $hookRunner, LoggerInterface $logger, BagOStuff $interimCache, IConnectionProvider $dbProvider, ServiceOptions $options) | |
| getGroupIds (MessageHandle $handle) | |
| Retrieves a list of groups given MessageHandle belongs to. | |
| getGroupIdsForDatabaseTitle (int $namespace, string $title) | |
| Fast-path to retrieve groups for database titles. | |
| getPrimaryGroupId (MessageHandle $handle) | |
| get (string $key) | |
| getKeys () | |
| rebuild (?float $timestamp=null) | |
| Creates the index from scratch. | |
| getStatusCacheKey () | |
| storeInterim (MessageGroup $group, array $newKeys) | |
| getArrayDiff (array $old, array $new) | |
| Compares two associative arrays. | |
Public Attributes | |
| const | SERVICE_OPTIONS |
Protected Member Functions | |
| clearMessageGroupStats (array $diff) | |
| Purge stuff when set of keys have changed. | |
| checkAndAdd (array &$hugeArray, MessageGroup $g, bool $ignore=false) | |
Protected Attributes | |
| BagOStuff | $interimCache |
Creates a database of keys in all groups, so that namespace and key can be used to get the groups they belong to.
This is used as a fallback when loadgroup parameter is not provided in the request, which happens if someone reaches a messages from somewhere else than Special:Translate. Also used by Special:TranslationStats and alike which need to map lots of titles to message groups.
Definition at line 32 of file MessageIndex.php.
| MediaWiki\Extension\Translate\MessageLoading\MessageIndex::__construct | ( | MessageIndexStore | $store, |
| WANObjectCache | $statusCache, | ||
| JobQueueGroup | $jobQueueGroup, | ||
| HookRunner | $hookRunner, | ||
| LoggerInterface | $logger, | ||
| BagOStuff | $interimCache, | ||
| IConnectionProvider | $dbProvider, | ||
| ServiceOptions | $options ) |
Definition at line 49 of file MessageIndex.php.
|
protected |
Definition at line 406 of file MessageIndex.php.
|
protected |
Purge stuff when set of keys have changed.
Definition at line 390 of file MessageIndex.php.
| MediaWiki\Extension\Translate\MessageLoading\MessageIndex::get | ( | string | $key | ) |
Definition at line 139 of file MessageIndex.php.
| MediaWiki\Extension\Translate\MessageLoading\MessageIndex::getArrayDiff | ( | array | $old, |
| array | $new ) |
Compares two associative arrays.
Values must be a string or list of strings. Returns an array of added, deleted and modified keys as well as value changes (you can think values as categories and keys as pages). Each of the keys ('add', 'del', 'mod' respectively) maps to an array whose keys are the changed keys of the original arrays and values are lists where first element contains the old value and the second element the new value.
| array | $old | |
| array | $new |
Definition at line 349 of file MessageIndex.php.
| MediaWiki\Extension\Translate\MessageLoading\MessageIndex::getGroupIds | ( | MessageHandle | $handle | ) |
Retrieves a list of groups given MessageHandle belongs to.
Definition at line 82 of file MessageIndex.php.
| MediaWiki\Extension\Translate\MessageLoading\MessageIndex::getGroupIdsForDatabaseTitle | ( | int | $namespace, |
| string | $title ) |
Fast-path to retrieve groups for database titles.
Performance is critical for stats that need to check groups for many rows. Do not include the language code subpage!
Definition at line 109 of file MessageIndex.php.
| MediaWiki\Extension\Translate\MessageLoading\MessageIndex::getKeys | ( | ) |
Definition at line 144 of file MessageIndex.php.
| MediaWiki\Extension\Translate\MessageLoading\MessageIndex::getPrimaryGroupId | ( | MessageHandle | $handle | ) |
Definition at line 118 of file MessageIndex.php.
| MediaWiki\Extension\Translate\MessageLoading\MessageIndex::getStatusCacheKey | ( | ) |
Definition at line 280 of file MessageIndex.php.
| MediaWiki\Extension\Translate\MessageLoading\MessageIndex::rebuild | ( | ?float | $timestamp = null | ) |
Creates the index from scratch.
| float | null | $timestamp | Purge interim caches older than this timestamp. |
| Exception |
Definition at line 180 of file MessageIndex.php.
| MediaWiki\Extension\Translate\MessageLoading\MessageIndex::storeInterim | ( | MessageGroup | $group, |
| array | $newKeys ) |
Definition at line 288 of file MessageIndex.php.
|
protected |
Definition at line 38 of file MessageIndex.php.
| const MediaWiki\Extension\Translate\MessageLoading\MessageIndex::SERVICE_OPTIONS |
Definition at line 45 of file MessageIndex.php.