本文整理汇总了PHP中TranslateUtils::messageKeyToGroups方法的典型用法代码示例。如果您正苦于以下问题:PHP TranslateUtils::messageKeyToGroups方法的具体用法?PHP TranslateUtils::messageKeyToGroups怎么用?PHP TranslateUtils::messageKeyToGroups使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TranslateUtils
的用法示例。
在下文中一共展示了TranslateUtils::messageKeyToGroups方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: invalidateCache
public static function invalidateCache(&$article, &$user, $text, $summary, $minoredit, &$watchthis, $sectionanchor, &$flags, $revision, &$status, $baseRevId)
{
$ids = array();
$name = $article->mTitle->getText();
list($key, $lang) = explode($name, 2);
// check if this is a valid language variant
if (Language::getLanguageName($lang) == '') {
return true;
}
// match message to group here
$groups = TranslateUtils::messageKeyToGroups($article->mTitle->getNamespace(), $key);
if (empty($groups)) {
// message does not belong to any recognized group
return true;
}
foreach ($groups as $group) {
/* @var $group MessageGroup */
$ids[] = $group->getId();
}
$conds = array('gs_group' => $ids, 'gs_lang' => $lang);
$dbw = wfGetDB(DB_MASTER);
// @TODO maybe update instaed of delete
$dbw->delete('groupstats', $conds, __METHOD__);
return true;
}
示例2: getGroupIds
public function getGroupIds() {
if ( $this->groupIds === null ) {
$this->groupIds = TranslateUtils::messageKeyToGroups( $this->getTitle()->getNamespace(), $this->getKey() );
}
return $this->groupIds;
}
示例3: indexOf
public function indexOf( $row ) {
// We need to check that there is only one user per day.
if ( $this->opts['count'] === 'users' ) {
$date = $this->formatTimestamp( $row->rc_timestamp );
if ( isset( $this->usercache[$date][$row->rc_user_text] ) ) {
return -1;
} else {
$this->usercache[$date][$row->rc_user_text] = 1;
}
}
// Do not consider language-less pages.
if ( strpos( $row->rc_title, '/' ) === false ) {
return false;
}
// No filters, just one key to track.
if ( !$this->groups && !$this->codes ) {
return 'all';
}
// The key-building needs to be in sync with ::labels().
list( $key, $code ) = TranslateUtils::figureMessage( $row->rc_title );
$groups = array();
$codes = array();
if ( $this->groups ) {
/*
* Get list of keys that the message belongs to, and filter
* out those which are not requested.
*/
$groups = TranslateUtils::messageKeyToGroups( $row->rc_namespace, $key );
$groups = array_intersect( $this->groups, $groups );
}
if ( $this->codes ) {
$codes = array( $code );
}
return $this->combineTwoArrays( $groups, $codes );
}