* @author Happy-melon
* @file
*/
+use Liuggio\StatsdClient\Factory\StatsdDataFactory;
+use MediaWiki\MediaWikiServices;
/**
* The simplest way of implementing IContextSource is to hold a RequestContext as a
*/
public function getContext() {
if ( $this->context === null ) {
- $class = get_class( $this );
+ $class = static::class;
wfDebug( __METHOD__ . " ($class): called and \$context is null. " .
"Using RequestContext::getMain() for sanity\n" );
$this->context = RequestContext::getMain();
/**
* Get the Stats object
*
+ * @deprecated since 1.27 use a StatsdDataFactory from MediaWikiServices (preferably injected)
+ *
* @since 1.25
- * @return BufferingStatsdDataFactory
+ * @return StatsdDataFactory
*/
public function getStats() {
- return $this->getContext()->getStats();
+ return MediaWikiServices::getInstance()->getStatsdDataFactory();
}
/**
public function msg( /* $args */ ) {
$args = func_get_args();
- return call_user_func_array( array( $this->getContext(), 'msg' ), $args );
+ return call_user_func_array( [ $this->getContext(), 'msg' ], $args );
}
/**