This class abstract MessageGroup statistics calculation and storing. More...
Static Public Member Functions | |
static | getEmptyStats () |
Returns empty stats array. | |
static | forItem ( $id, $code, $flags=0) |
Returns stats for given group in given language. | |
static | forLanguage ( $code, $flags=0) |
Returns stats for all groups in given language. | |
static | forGroup ( $id, $flags=0) |
Returns stats for all languages in given group. | |
static | forEverything ( $flags=0) |
Returns stats for all group in all languages. | |
static | clear (MessageHandle $handle) |
Recalculate stats for all groups associated with the message. | |
static | clearGroup ( $id, int $flags=0) |
Recalculate stats for given group(s). | |
static | clearLanguage ( $code) |
static | clearAll () |
Purges all cached stats. | |
static | multiAdd (&$a, $b) |
static | getDatabaseIdForGroupId ( $id) |
Public Attributes | |
const | TOTAL = 0 |
Array index. | |
const | TRANSLATED = 1 |
Array index. | |
const | FUZZY = 2 |
Array index. | |
const | PROOFREAD = 3 |
Array index. | |
const | FLAG_CACHE_ONLY = 1 |
If stats are not cached, do not attempt to calculate them on the fly. | |
const | FLAG_NO_CACHE = 2 |
Ignore cached values. Useful for updating stale values. | |
const | FLAG_IMMEDIATE_WRITES = 4 |
Do not defer updates. Meant for jobs like MessageGroupStatsRebuildJob. | |
Static Protected Member Functions | |
static | getUnknownStats () |
Returns empty stats array that indicates stats are incomplete or unknown. | |
static | extractResults ( $res, array $ids, array $stats=[]) |
Use this to extract results returned from selectRowsIdLang. | |
static | extractNumbers ( $row) |
Returns an array of needed database fields. | |
static | forLanguageInternal ( $code, array $stats, $flags) |
static | expandAggregates (AggregateMessageGroup $agg) |
static | forGroupInternal (MessageGroup $group, array $stats, $flags) |
static | selectRowsIdLang (?array $ids, ?array $codes, $flags) |
Fetch rows from the database. | |
static | forItemInternal (&$stats, MessageGroup $group, $code, $flags) |
static | calculateGroup (MessageGroup $group, $code) |
static | queueUpdates ( $flags) |
static | withLock (IDatabase $dbw, $key, $method, $callback) |
Static Protected Attributes | |
static | $updates = [] |
This class abstract MessageGroup statistics calculation and storing.
You can access stats easily per language or per group. Stat array for each item is of format array( total, translate, fuzzy ).
Definition at line 22 of file MessageGroupStats.php.
|
staticprotected |
MessageGroup | $group | |
string | $code | Language code |
Definition at line 541 of file MessageGroupStats.php.
|
static |
Recalculate stats for all groups associated with the message.
Hook: TranslateEventTranslationReview
MessageHandle | $handle |
Definition at line 178 of file MessageGroupStats.php.
|
static |
Purges all cached stats.
Mostly for testing purposes. Calling this in normal operation will cause performance issues.
Definition at line 278 of file MessageGroupStats.php.
|
static |
Recalculate stats for given group(s).
string | string[] | $id | Message group ids. |
int | $flags | Combination of FLAG_* constants. |
Definition at line 193 of file MessageGroupStats.php.
|
static |
Definition at line 263 of file MessageGroupStats.php.
|
staticprotected |
AggregateMessageGroup | $agg |
Definition at line 352 of file MessageGroupStats.php.
|
staticprotected |
Returns an array of needed database fields.
stdClass | $row |
Definition at line 316 of file MessageGroupStats.php.
|
staticprotected |
Use this to extract results returned from selectRowsIdLang.
You must pass the message group ids you want to retrieve. Entries that do not match are not returned.
iterable | $res | Database result object |
string[] | $ids | List of message group ids |
array[] | $stats | Optional array to append results to. |
Definition at line 293 of file MessageGroupStats.php.
|
static |
Returns stats for all group in all languages.
Might be slow, might use lots of memory. Returns two dimensional array indexed by group and language.
int | $flags | Combination of FLAG_* constants. |
Definition at line 160 of file MessageGroupStats.php.
|
static |
Returns stats for all languages in given group.
string | $id | Group id |
int | $flags | Combination of FLAG_* constants. |
Definition at line 134 of file MessageGroupStats.php.
|
staticprotected |
MessageGroup | $group | |
array[] | $stats | |
int | $flags | Combination of FLAG_* constants. |
Definition at line 373 of file MessageGroupStats.php.
|
static |
Returns stats for given group in given language.
string | $id | Group id |
string | $code | Language code |
int | $flags | Combination of FLAG_* constants. |
Definition at line 81 of file MessageGroupStats.php.
|
staticprotected |
array[] | &$stats | |
MessageGroup | $group | |
string | $code | Language code |
int | $flags | Combination of FLAG_* constants. |
Definition at line 432 of file MessageGroupStats.php.
|
static |
Returns stats for all groups in given language.
string | $code | Language code |
int | $flags | Combination of FLAG_* constants. |
Definition at line 105 of file MessageGroupStats.php.
|
staticprotected |
string | $code | Language code |
array[] | $stats | |
int | $flags | Combination of FLAG_* constants. |
Definition at line 331 of file MessageGroupStats.php.
|
static |
Definition at line 655 of file MessageGroupStats.php.
|
static |
Returns empty stats array.
Useful because the number of elements may change.
Definition at line 49 of file MessageGroupStats.php.
|
staticprotected |
Returns empty stats array that indicates stats are incomplete or unknown.
Definition at line 59 of file MessageGroupStats.php.
|
static |
Definition at line 525 of file MessageGroupStats.php.
|
staticprotected |
Definition at line 589 of file MessageGroupStats.php.
|
staticprotected |
Fetch rows from the database.
Use extractResults to process this value.
?string[] | $ids | List of message group ids |
?string[] | $codes | List of language codes |
int | $flags | Combination of FLAG_* constants. |
Definition at line 404 of file MessageGroupStats.php.
|
staticprotected |
Definition at line 639 of file MessageGroupStats.php.
|
staticprotected |
Definition at line 39 of file MessageGroupStats.php.
const MessageGroupStats::FLAG_CACHE_ONLY = 1 |
If stats are not cached, do not attempt to calculate them on the fly.
Definition at line 32 of file MessageGroupStats.php.
const MessageGroupStats::FLAG_IMMEDIATE_WRITES = 4 |
Do not defer updates. Meant for jobs like MessageGroupStatsRebuildJob.
Definition at line 36 of file MessageGroupStats.php.
const MessageGroupStats::FLAG_NO_CACHE = 2 |
Ignore cached values. Useful for updating stale values.
Definition at line 34 of file MessageGroupStats.php.
const MessageGroupStats::FUZZY = 2 |
Array index.
Definition at line 28 of file MessageGroupStats.php.
const MessageGroupStats::PROOFREAD = 3 |
Array index.
Definition at line 29 of file MessageGroupStats.php.
const MessageGroupStats::TOTAL = 0 |
Array index.
Definition at line 26 of file MessageGroupStats.php.
const MessageGroupStats::TRANSLATED = 1 |
Array index.
Definition at line 27 of file MessageGroupStats.php.