本文整理匯總了PHP中MessageGroups::prioritycache方法的典型用法代碼示例。如果您正苦於以下問題:PHP MessageGroups::prioritycache方法的具體用法?PHP MessageGroups::prioritycache怎麽用?PHP MessageGroups::prioritycache使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類MessageGroups
的用法示例。
在下文中一共展示了MessageGroups::prioritycache方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getPriority
/**
* 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.
*
* @param MessageGroup|string $group Message group ID
* @return string Message group priority
* @since 2011-12-12
*/
public static function getPriority($group)
{
if (!isset(self::$prioritycache)) {
self::$prioritycache = array();
// Abusing this table originally intented for other purposes
$db = wfGetDB(DB_SLAVE);
$table = 'translate_groupreviews';
$fields = array('tgr_group', 'tgr_state');
$conds = array('tgr_lang' => '*priority');
$res = $db->select($table, $fields, $conds, __METHOD__);
foreach ($res as $row) {
self::$prioritycache[$row->tgr_group] = $row->tgr_state;
}
}
if ($group instanceof MessageGroup) {
$id = $group->getId();
} else {
$id = $group;
}
return isset(self::$prioritycache[$id]) ? self::$prioritycache[$id] : '';
}