Per comments on r88145: unlink file if it is broken
[lhc/web/wiklou.git] / includes / RequestContext.php
index 4fd7222..3ea0835 100644 (file)
@@ -2,18 +2,44 @@
 /**
  * Group all the pieces relevant to the context of a request into one instance
  *
+ * @since 1.18
+ *
  * @author IAlex
  * @author Daniel Friesen
  * @file
  */
 
 class RequestContext {
-       private $mRequest; // / WebRequest object
-       private $mTitle;   // / Title object
-       private $mOutput;  // / OutputPage object
-       private $mUser;    // / User object
-       private $mLang;    // / Language object
-       private $mSkin;    // / Skin object
+
+       /**
+        * @var WebRequest
+        */
+       private $mRequest;
+
+       /**
+        * @var Title
+        */
+       private $mTitle;
+
+       /**
+        * @var OutputPage
+        */
+       private $mOutput;
+
+       /**
+        * @var User
+        */
+       private $mUser;
+
+       /**
+        * @var Language
+        */
+       private $mLang;
+
+       /**
+        * @var Skin
+        */
+       private $mSkin;
 
        /**
         * Set the WebRequest object
@@ -59,6 +85,13 @@ class RequestContext {
                return $this->mTitle;
        }
 
+       /**
+        * @param $o OutputPage
+        */
+       public function setOutput( OutputPage $o ) {
+               $this->mOutput = $o;
+       }
+
        /**
         * Get the OutputPage object
         *
@@ -66,8 +99,7 @@ class RequestContext {
         */
        public function getOutput() {
                if ( !isset( $this->mOutput ) ) {
-                       $this->mOutput = new OutputPage;
-                       $this->mOutput->setContext( $this );
+                       $this->mOutput = new OutputPage( $this );
                }
                return $this->mOutput;
        }
@@ -188,8 +220,13 @@ class RequestContext {
         * Make these C#-style accessors, so you can do $context->user->getName() which is
         * internally mapped to $context->__get('user')->getName() which is mapped to
         * $context->getUser()->getName()
+        *
+        * @param $name string
+        *
+        * @return string
         */
        public function __get( $name ) {
+               wfDeprecated( 'RequestContext::__get() is deprecated; use $context->getFoo() instead' );
                if ( in_array( $name, array( 'request', 'title', 'output', 'user', 'lang', 'skin' ) ) ) {
                        $fname = 'get' . ucfirst( $name );
                        return $this->$fname();
@@ -197,7 +234,13 @@ class RequestContext {
                trigger_error( "Undefined property {$name}", E_NOTICE );
        }
 
+       /**
+        * @param $name string
+        * @param $value
+        * @return string
+        */
        public function __set( $name, $value ) {
+               wfDeprecated( 'RequestContext::__set() is deprecated; use $context->setFoo() instead' );
                if ( in_array( $name, array( 'request', 'title', 'output', 'user', 'lang', 'skin' ) ) ) {
                        $fname = 'set' . ucfirst( $name );
                        return $this->$fname( $value );