Moved $wgQueryPages stuff out of the global scope and into a function
[lhc/web/wiklou.git] / includes / StatCounter.php
index 23a4e2b..1373f3d 100644 (file)
@@ -26,6 +26,7 @@
  *
  * @file
  * @ingroup StatCounter
+ * @author Aaron Schulz
  */
 
 /**
@@ -85,21 +86,25 @@ class StatCounter {
                $this->deltas = array();
        }
 
+       /**
+        * @param array $deltas
+        * @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();
@@ -128,6 +133,10 @@ class StatCounter {
                }
        }
 
+       /**
+        * @param array $deltas
+        * @return void
+        */
        protected function sendDeltasMemc( array $deltas ) {
                global $wgMemc;