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 (private readonly MessageIndexStore $messageIndexStore, private readonly WANObjectCache $statusCache, private readonly JobQueueGroup $jobQueueGroup, private readonly HookRunner $hookRunner, private readonly LoggerInterface $logger, private readonly BagOStuff $interimCache, private readonly ILockManager $lockManager, ServiceOptions $options) | |
| getGroupIds (MessageHandle $handle) | |
| Retrieves a list of groups given MessageHandle belongs to. | |
| getGroupIdsForBaseDatabaseTitle (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) | |
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 33 of file MessageIndex.php.
| MediaWiki\Extension\Translate\MessageLoading\MessageIndex::__construct | ( | private readonly MessageIndexStore | $messageIndexStore, |
| private readonly WANObjectCache | $statusCache, | ||
| private readonly JobQueueGroup | $jobQueueGroup, | ||
| private readonly HookRunner | $hookRunner, | ||
| private readonly LoggerInterface | $logger, | ||
| private readonly BagOStuff | $interimCache, | ||
| private readonly ILockManager | $lockManager, | ||
| ServiceOptions | $options ) |
Definition at line 44 of file MessageIndex.php.
|
protected |
Definition at line 385 of file MessageIndex.php.
|
protected |
Purge stuff when set of keys have changed.
Definition at line 369 of file MessageIndex.php.
| MediaWiki\Extension\Translate\MessageLoading\MessageIndex::get | ( | string | $key | ) |
Definition at line 127 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 328 of file MessageIndex.php.
| MediaWiki\Extension\Translate\MessageLoading\MessageIndex::getGroupIds | ( | MessageHandle | $handle | ) |
Retrieves a list of groups given MessageHandle belongs to.
Definition at line 70 of file MessageIndex.php.
| MediaWiki\Extension\Translate\MessageLoading\MessageIndex::getGroupIdsForBaseDatabaseTitle | ( | 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 97 of file MessageIndex.php.
| MediaWiki\Extension\Translate\MessageLoading\MessageIndex::getKeys | ( | ) |
Definition at line 132 of file MessageIndex.php.
| MediaWiki\Extension\Translate\MessageLoading\MessageIndex::getPrimaryGroupId | ( | MessageHandle | $handle | ) |
Definition at line 106 of file MessageIndex.php.
| MediaWiki\Extension\Translate\MessageLoading\MessageIndex::getStatusCacheKey | ( | ) |
Definition at line 263 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 153 of file MessageIndex.php.
| MediaWiki\Extension\Translate\MessageLoading\MessageIndex::storeInterim | ( | MessageGroup | $group, |
| array | $newKeys ) |
Definition at line 267 of file MessageIndex.php.
| const MediaWiki\Extension\Translate\MessageLoading\MessageIndex::SERVICE_OPTIONS |
Definition at line 40 of file MessageIndex.php.