Add "rel=discussion" attribute to talk page tabs in skin template
[lhc/web/wiklou.git] / includes / context / RequestContext.php
index 89ccd0b..4e790c0 100644 (file)
@@ -1,7 +1,5 @@
 <?php
 /**
- * Request-dependant objects containers.
- *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
@@ -63,6 +61,11 @@ class RequestContext implements IContextSource {
         */
        private $skin;
 
+       /**
+        * @var StatsdDataFactory
+        */
+       private $stats;
+
        /**
         * @var Config
         */
@@ -120,6 +123,22 @@ class RequestContext implements IContextSource {
                return $this->request;
        }
 
+       /**
+        * Get the Stats object
+        *
+        * @return BufferingStatsdDataFactory
+        */
+       public function getStats() {
+               if ( $this->stats === null ) {
+                       $config = $this->getConfig();
+                       $prefix = $config->has( 'StatsdMetricPrefix' )
+                               ? rtrim( $config->get( 'StatsdMetricPrefix' ), '.' )
+                               : 'MediaWiki';
+                       $this->stats = new BufferingStatsdDataFactory( $prefix );
+               }
+               return $this->stats;
+       }
+
        /**
         * Set the Title object
         *