Merge "Match salt of WatchAction::show() and getWatchToken()"
[lhc/web/wiklou.git] / includes / context / DerivativeContext.php
index 836aef9..09c3939 100644 (file)
@@ -26,7 +26,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 +67,11 @@ class DerivativeContext extends ContextSource {
         */
        private $config;
 
+       /**
+        * @var Stats
+        */
+       private $stats;
+
        /**
         * Constructor
         * @param IContextSource $context Context to inherit from
@@ -97,6 +102,19 @@ class DerivativeContext extends ContextSource {
                }
        }
 
+       /**
+        * Get the stats object
+        *
+        * @return BufferingStatsdDataFactory
+        */
+       public function getStats() {
+               if ( !is_null( $this->stats ) ) {
+                       return $this->stats;
+               } else {
+                       return $this->getContext()->getStats();
+               }
+       }
+
        /**
         * Set the WebRequest object
         *