From cf321014c845bc421b96be63a170f164b469ec18 Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Thu, 10 Dec 2015 00:20:11 +0000 Subject: [PATCH] Move inline $wgStatsdMetricPrefix default to DefaultSettings.php This allows other code paths to use the variable without hardcoding the default (e.g. ExtensionDistributor). Change-Id: Ia43ab5eda70d4b9952b4e0ad3334f884919b4dac --- includes/DefaultSettings.php | 6 ++---- includes/context/RequestContext.php | 5 +---- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index de364a67e0..a884d0a4b4 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -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). diff --git a/includes/context/RequestContext.php b/includes/context/RequestContext.php index 4f8e65d01b..dbed585e9c 100644 --- a/includes/context/RequestContext.php +++ b/includes/context/RequestContext.php @@ -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; -- 2.20.1