Merge "Ensure the editing textarea is not higher than browser's viewport"
[lhc/web/wiklou.git] / includes / context / DerivativeContext.php
index 836aef9..e77a058 100644 (file)
@@ -18,6 +18,8 @@
  * @author Daniel Friesen
  * @file
  */
+use Liuggio\StatsdClient\Factory\StatsdDataFactory;
+use MediaWiki\MediaWikiServices;
 
 /**
  * An IContextSource implementation which will inherit context from another source
@@ -26,7 +28,7 @@
  *     a different Title instance set on it.
  * @since 1.19
  */
-class DerivativeContext extends ContextSource {
+class DerivativeContext extends ContextSource implements MutableContext {
        /**
         * @var WebRequest
         */
@@ -67,6 +69,11 @@ class DerivativeContext extends ContextSource {
         */
        private $config;
 
+       /**
+        * @var Timing
+        */
+       private $timing;
+
        /**
         * Constructor
         * @param IContextSource $context Context to inherit from
@@ -97,6 +104,30 @@ class DerivativeContext extends ContextSource {
                }
        }
 
+       /**
+        * Get the stats object
+        *
+        * @deprecated since 1.27 use a StatsdDataFactory from MediaWikiServices (preferably injected)
+        *
+        * @return StatsdDataFactory
+        */
+       public function getStats() {
+               return MediaWikiServices::getInstance()->getStatsdDataFactory();
+       }
+
+       /**
+        * Get the timing object
+        *
+        * @return Timing
+        */
+       public function getTiming() {
+               if ( !is_null( $this->timing ) ) {
+                       return $this->timing;
+               } else {
+                       return $this->getContext()->getTiming();
+               }
+       }
+
        /**
         * Set the WebRequest object
         *