Move inline $wgStatsdMetricPrefix default to DefaultSettings.php
authorTimo Tijhof <krinklemail@gmail.com>
Thu, 10 Dec 2015 00:20:11 +0000 (00:20 +0000)
committerTimo Tijhof <krinklemail@gmail.com>
Thu, 10 Dec 2015 00:21:11 +0000 (00:21 +0000)
This allows other code paths to use the variable without hardcoding
the default (e.g. ExtensionDistributor).

Change-Id: Ia43ab5eda70d4b9952b4e0ad3334f884919b4dac

includes/DefaultSettings.php
includes/context/RequestContext.php

index de364a6..a884d0a 100644 (file)
@@ -5698,15 +5698,13 @@ $wgProfileOnly = false;
 $wgStatsdServer = false;
 
 /**
- * Prefix for metric names sent to wgStatsdServer.
- *
- * Defaults to "MediaWiki".
+ * Prefix for metric names sent to $wgStatsdServer.
  *
  * @see RequestContext::getStats
  * @see BufferingStatsdDataFactory
  * @since 1.25
  */
-$wgStatsdMetricPrefix = false;
+$wgStatsdMetricPrefix = 'MediaWiki';
 
 /**
  * InfoAction retrieves a list of transclusion links (both to and from).
index 4f8e65d..dbed585 100644 (file)
@@ -135,10 +135,7 @@ class RequestContext implements IContextSource, MutableContext {
         */
        public function getStats() {
                if ( $this->stats === null ) {
-                       $config = $this->getConfig();
-                       $prefix = $config->get( 'StatsdMetricPrefix' )
-                               ? rtrim( $config->get( 'StatsdMetricPrefix' ), '.' )
-                               : 'MediaWiki';
+                       $prefix = rtrim( $this->getConfig()->get( 'StatsdMetricPrefix' ), '.' );
                        $this->stats = new BufferingStatsdDataFactory( $prefix );
                }
                return $this->stats;