X-Git-Url: https://git.cyclocoop.org/%27.WWW_URL.%27admin/?a=blobdiff_plain;f=includes%2FStatCounter.php;h=102fffd0d90a9cb9a9dd1d58efc145ff06e3063f;hb=2daa1fab7a200ac2045e1e03e17a19fea1792afe;hp=374d5caf07eb151ad1db5eb43cf59bd6427556c5;hpb=939b104dbb55c6045d133322c6bb35908ed6218c;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/StatCounter.php b/includes/StatCounter.php index 374d5caf07..102fffd0d9 100644 --- a/includes/StatCounter.php +++ b/includes/StatCounter.php @@ -36,10 +36,11 @@ * @ingroup StatCounter */ class StatCounter { - /** @var Array */ + /** @var array */ protected $deltas = array(); // (key => count) - protected function __construct() {} + protected function __construct() { + } /** * @return StatCounter @@ -56,7 +57,7 @@ class StatCounter { * Increment a key by delta $count * * @param string $key - * @param integer $count + * @param int $count * @return void */ public function incr( $key, $count = 1 ) { @@ -91,20 +92,20 @@ class StatCounter { * @return void */ protected function sendDeltasUDP( array $deltas ) { - global $wgUDPProfilerHost, $wgUDPProfilerPort, $wgAggregateStatsID; + global $wgUDPProfilerHost, $wgUDPProfilerPort, $wgAggregateStatsID, + $wgStatsFormatString; $id = strlen( $wgAggregateStatsID ) ? $wgAggregateStatsID : wfWikiID(); $lines = array(); foreach ( $deltas as $key => $count ) { - $lines[] = "stats/{$id} - {$count} 1 1 1 1 {$key}\n"; + $lines[] = sprintf( $wgStatsFormatString, $id, $count, $key ); } if ( count( $lines ) ) { static $socket = null; if ( !$socket ) { $socket = socket_create( AF_INET, SOCK_DGRAM, SOL_UDP ); - array_unshift( $lines, "stats/{$id} - 1 1 1 1 1 -total\n" ); } $packet = ''; $packets = array();