示例#1
0
 function showStatus()
 {
     global $wgMemc, $wgAbuseFilterConditionLimit, $wgOut, $wgLang;
     $overflow_count = (int) $wgMemc->get(AbuseFilter::filterLimitReachedKey());
     $match_count = (int) $wgMemc->get(AbuseFilter::filterMatchesKey());
     $total_count = (int) $wgMemc->get(AbuseFilter::filterUsedKey());
     if ($total_count > 0) {
         $overflow_percent = sprintf("%.2f", 100 * $overflow_count / $total_count);
         $match_percent = sprintf("%.2f", 100 * $match_count / $total_count);
         $status = wfMsgExt('abusefilter-status', array('parseinline'), $wgLang->formatNum($total_count), $wgLang->formatNum($overflow_count), $wgLang->formatNum($overflow_percent), $wgLang->formatNum($wgAbuseFilterConditionLimit), $wgLang->formatNum($match_count), $wgLang->formatNum($match_percent));
         $status = Xml::tags('div', array('class' => 'mw-abusefilter-status'), $status);
         $wgOut->addHTML($status);
     }
 }
 function showStatus()
 {
     global $wgMemc, $wgAbuseFilterConditionLimit, $wgAbuseFilterValidGroups;
     $overflow_count = (int) $wgMemc->get(AbuseFilter::filterLimitReachedKey());
     $match_count = (int) $wgMemc->get(AbuseFilter::filterMatchesKey());
     $total_count = 0;
     foreach ($wgAbuseFilterValidGroups as $group) {
         $total_count += (int) $wgMemc->get(AbuseFilter::filterUsedKey($group));
     }
     if ($total_count > 0) {
         $overflow_percent = sprintf("%.2f", 100 * $overflow_count / $total_count);
         $match_percent = sprintf("%.2f", 100 * $match_count / $total_count);
         $status = $this->msg('abusefilter-status')->numParams($total_count, $overflow_count, $overflow_percent, $wgAbuseFilterConditionLimit, $match_count, $match_percent)->parse();
         $status = Xml::tags('div', array('class' => 'mw-abusefilter-status'), $status);
         $this->getOutput()->addHTML($status);
     }
 }