Factory class for accessing message groups individually by id or all of them as an list.
More...
|
| recache () |
| Immediately update the cache.
|
|
| clearProcessCache () |
| Manually reset the process cache.
|
|
| setCache (WANObjectCache $cache=null) |
| Override cache, for example during tests.
|
|
| getCacheKey () |
| Returns the cache key.
|
|
| getGroups () |
| Get all enabled non-dynamic message groups.
|
|
|
static | appendAutoloader (array &$additions, array &$to) |
| Safely merges first array to second array, throwing warning on duplicates and removing duplicates from the first array.
|
|
Factory class for accessing message groups individually by id or all of them as an list.
- Todo
- Clean up the mixed static/member method interface.
Definition at line 20 of file MessageGroups.php.
◆ appendAutoloader()
static MessageGroups::appendAutoloader |
( |
array & | $additions, |
|
|
array & | $to ) |
|
staticprotected |
Safely merges first array to second array, throwing warning on duplicates and removing duplicates from the first array.
- Parameters
-
array | &$additions | Things to append |
array | &$to | Where to append |
Definition at line 215 of file MessageGroups.php.
◆ clearCache()
static MessageGroups::clearCache |
( |
| ) |
|
|
static |
Manually reset group cache.
Use when automatic dependency tracking fails.
Definition at line 156 of file MessageGroups.php.
◆ clearProcessCache()
MessageGroups::clearProcessCache |
( |
| ) |
|
Manually reset the process cache.
This is helpful for long running scripts where the process cache might get stale even though the global cache is updated.
- Since
- 2016.08
Definition at line 176 of file MessageGroups.php.
◆ exists()
static MessageGroups::exists |
( |
| $id | ) |
|
|
static |
◆ expandWildcards()
static MessageGroups::expandWildcards |
( |
| $ids | ) |
|
|
static |
If the list of message group ids contains wildcards, this function will match them against the list of all supported message groups and return matched message group ids.
- Parameters
-
- Returns
- string[]
- Since
- 2012-02-13
Definition at line 588 of file MessageGroups.php.
◆ getAllGroups()
static MessageGroups::getAllGroups |
( |
| ) |
|
|
static |
◆ getCache()
MessageGroups::getCache |
( |
| ) |
|
|
protected |
◆ getCachedGroupDefinitions()
MessageGroups::getCachedGroupDefinitions |
( |
| $recache = false | ) |
|
|
protected |
- Parameters
-
bool | string | $recache | Either "recache" or false |
- Returns
- array
Definition at line 59 of file MessageGroups.php.
◆ getCacheGroupLoaders()
MessageGroups::getCacheGroupLoaders |
( |
| ) |
|
|
protected |
◆ getCacheKey()
MessageGroups::getCacheKey |
( |
| ) |
|
◆ getDynamicGroups()
static MessageGroups::getDynamicGroups |
( |
| ) |
|
|
static |
Contents on these groups changes on a whim.
- Since
- 2011-12-28
- Returns
- array
Definition at line 623 of file MessageGroups.php.
◆ getGroup()
static MessageGroups::getGroup |
( |
| $id | ) |
|
|
static |
Fetch a message group by id.
- Parameters
-
string | $id | Message group id. |
- Returns
- MessageGroup|null if it doesn't exist.
Definition at line 286 of file MessageGroups.php.
◆ getGroupLoaders()
MessageGroups::getGroupLoaders |
( |
| ) |
|
|
protected |
◆ getGroups()
MessageGroups::getGroups |
( |
| ) |
|
◆ getGroupsById()
static MessageGroups::getGroupsById |
( |
array | $ids, |
|
|
| $skipMeta = false ) |
|
static |
Get message groups for corresponding message group ids.
- Parameters
-
string[] | $ids | Group IDs |
bool | $skipMeta | Skip aggregate message groups |
- Returns
- MessageGroup[]
- Since
- 2012-02-13
Definition at line 561 of file MessageGroups.php.
◆ getGroupsByType()
static MessageGroups::getGroupsByType |
( |
| $type | ) |
|
|
static |
Get only groups of specific type (class).
@phan-template T
- Parameters
-
string | $type | Class name of wanted type @phan-param class-string<T> $type |
- Returns
- MessageGroup[] Map of (group ID => MessageGroupBase) @phan-return array<T&MessageGroup>
- Since
- 2012-04-30
Definition at line 640 of file MessageGroups.php.
◆ getGroupStructure()
static MessageGroups::getGroupStructure |
( |
| ) |
|
|
static |
Returns a tree of message groups.
First group in each subgroup is the aggregate group. Groups can be nested infinitely, though in practice other code might not handle more than two (or even one) nesting levels. One group can exist multiple times in different parts of the tree. In other words: [Group1, Group2, [AggGroup, Group3, Group4]]
- Exceptions
-
MWException | If cyclic structure is detected. |
- Returns
- array Map of (group ID => MessageGroup or recursive array)
Definition at line 662 of file MessageGroups.php.
◆ getParentGroups()
static MessageGroups::getParentGroups |
( |
MessageGroup | $targetGroup | ) |
|
|
static |
Returns a list of parent message groups.
If message group exists in multiple places in the tree, multiple lists are returned.
- Since
- 2012-12-10
- Parameters
-
- Returns
- array[]
Definition at line 465 of file MessageGroups.php.
◆ getPriority()
static MessageGroups::getPriority |
( |
| $group | ) |
|
|
static |
We want to de-emphasize time sensitive groups like news for 2009.
They can still exist in the system, but should not appear in front of translators looking to do some useful work.
- Parameters
-
- Returns
- string Message group priority
- Since
- 2011-12-12
Definition at line 364 of file MessageGroups.php.
◆ getSharedGroups()
static MessageGroups::getSharedGroups |
( |
MessageGroup | $group | ) |
|
|
static |
Returns a list of message groups that share (certain) messages with this group.
- Since
- 2011-12-25; renamed in 2012-12-10 from getParentGroups.
- Parameters
-
- Returns
- string[]
Definition at line 439 of file MessageGroups.php.
◆ groupLabelSort()
static MessageGroups::groupLabelSort |
( |
| $a, |
|
|
| $b ) |
|
static |
Sorts groups by label value.
- Parameters
-
- Returns
- int
Definition at line 725 of file MessageGroups.php.
◆ haveSingleSourceLanguage()
static MessageGroups::haveSingleSourceLanguage |
( |
array | $groups | ) |
|
|
static |
Checks whether all the message groups have the same source language.
- Parameters
-
array | $groups | A list of message groups objects. |
- Returns
- string Language code if the languages are the same, empty string otherwise.
- Since
- 2013.09
Definition at line 795 of file MessageGroups.php.
◆ init()
◆ initGroupsFromDefinitions()
MessageGroups::initGroupsFromDefinitions |
( |
| $groups | ) |
|
|
protected |
Expand process cached groups to objects.
- Parameters
-
array | $groups | Map of (group ID => mixed) |
Definition at line 114 of file MessageGroups.php.
◆ isDynamic()
◆ isTranslatableMessage()
static MessageGroups::isTranslatableMessage |
( |
MessageHandle | $handle, |
|
|
string | $targetLanguage ) |
|
static |
Filters out messages that should not be translated under normal conditions.
- Parameters
-
MessageHandle | $handle | Handle for the translation target. |
string | $targetLanguage | |
- Returns
- bool
- Since
- 2013.10
Definition at line 819 of file MessageGroups.php.
◆ labelExists()
static MessageGroups::labelExists |
( |
| $name | ) |
|
|
static |
Check if a particular aggregate group label exists.
- Parameters
-
- Returns
- bool
Definition at line 339 of file MessageGroups.php.
◆ normalizeId()
static MessageGroups::normalizeId |
( |
| $id | ) |
|
|
static |
Fixes the id and resolves aliases.
- Parameters
-
- Returns
- string
- Since
- 2016.01
Definition at line 311 of file MessageGroups.php.
◆ recache()
MessageGroups::recache |
( |
| ) |
|
◆ setCache()
MessageGroups::setCache |
( |
WANObjectCache | $cache = null | ) |
|
Override cache, for example during tests.
- Parameters
-
WANObjectCache | null | $cache | |
Definition at line 196 of file MessageGroups.php.
◆ setPriority()
static MessageGroups::setPriority |
( |
| $group, |
|
|
| $priority = '' ) |
|
static |
Sets the message group priority.
- Parameters
-
MessageGroup | string | $group | Message group |
string | $priority | Priority (empty string to unset) |
- Since
- 2013-03-01
Definition at line 394 of file MessageGroups.php.
◆ singleton()
static MessageGroups::singleton |
( |
| ) |
|
|
static |
◆ subGroups()
static MessageGroups::subGroups |
( |
AggregateMessageGroup | $parent, |
|
|
array & | $childIds = [], |
|
|
| $fname = 'caller' ) |
|
static |
Like getGroupStructure but start from one root which must be an AggregateMessageGroup.
- Parameters
-
AggregateMessageGroup | $parent | |
string[] | &$childIds | Flat list of child group IDs [returned] |
string | $fname | Calling method name; used to identify recursion [optional] |
- Exceptions
-
- Returns
- array
- Since
- Public since 2012-11-29
Definition at line 743 of file MessageGroups.php.
The documentation for this class was generated from the following file: