Followup r100905, cleanup per CR and fixes the overriding of the main RequestContext
authorJohn Du Hart <johnduhart@users.mediawiki.org>
Thu, 27 Oct 2011 01:13:19 +0000 (01:13 +0000)
committerJohn Du Hart <johnduhart@users.mediawiki.org>
Thu, 27 Oct 2011 01:13:19 +0000 (01:13 +0000)
includes/api/ApiMain.php

index 070460c..982ad2f 100644 (file)
@@ -151,11 +151,14 @@ class ApiMain extends ApiBase {
                        // BC for pre-1.19
                        $request = $context;
                        $context = RequestContext::getMain();
-                       $context->setRequest( $request );
                }
                // We set a derivative context so we can change stuff later
                $this->setContext( new DerivativeContext( $context ) );
 
+               if ( isset( $request ) ) {
+                       $context->setRequest( $request );
+               }
+
                $this->mInternalMode = ( $this->getRequest() instanceof FauxRequest );
 
                // Special handling for the main module: $parent === $this
@@ -187,8 +190,6 @@ class ApiMain extends ApiBase {
                $this->mShowVersions = false;
                $this->mEnableWrite = $enableWrite;
 
-               //$this->mRequest = &$request;
-
                $this->mSquidMaxage = - 1; // flag for executeActionWithErrorHandling()
                $this->mCommit = false;
        }
@@ -201,14 +202,6 @@ class ApiMain extends ApiBase {
                return $this->mInternalMode;
        }
 
-       /**
-        * Return the request object that contains client's request
-        * @return WebRequest
-        */
-       /*public function getRequest() {
-               return $this->mRequest;
-       }*/
-
        /**
         * Get the ApiResult object associated with current request
         *