http://www.mediawiki.org/wiki/Special:Code/MediaWiki/89531

Revision: 89531
Author:   reedy
Date:     2011-06-05 20:29:47 +0000 (Sun, 05 Jun 2011)
Log Message:
-----------
Followup r89528, don't use $wgRequest use 
$this->getMain()->getRequest()->response()/$this->getRequest()->response() (the 
latter when we're already in main!)

Also fix up a couple of calls to getMain() when we're already in a main class!?

Modified Paths:
--------------
    trunk/phase3/includes/api/ApiFormatBase.php
    trunk/phase3/includes/api/ApiMain.php

Modified: trunk/phase3/includes/api/ApiFormatBase.php
===================================================================
--- trunk/phase3/includes/api/ApiFormatBase.php 2011-06-05 20:28:03 UTC (rev 
89530)
+++ trunk/phase3/includes/api/ApiFormatBase.php 2011-06-05 20:29:47 UTC (rev 
89531)
@@ -146,8 +146,7 @@
                        return; // skip any initialization
                }
 
-               global $wgRequest;
-               $wgRequest->response()->header( "Content-Type: $mime; 
charset=utf-8" );
+               $this->getMain()->getRequest()->response()->header( 
"Content-Type: $mime; charset=utf-8" );
 
                if ( $isHtml ) {
 ?>

Modified: trunk/phase3/includes/api/ApiMain.php
===================================================================
--- trunk/phase3/includes/api/ApiMain.php       2011-06-05 20:28:03 UTC (rev 
89530)
+++ trunk/phase3/includes/api/ApiMain.php       2011-06-05 20:29:47 UTC (rev 
89531)
@@ -370,8 +370,7 @@
                        // Error results should not be cached
                        $this->setCacheMode( 'private' );
 
-                       global $wgRequest;
-                       $response = $wgRequest->response();
+                       $response = $this->getRequest()->response();
                        $headerStr = 'MediaWiki-API-Error: ' . $errCode;
                        if ( $e->getCode() === 0 ) {
                                $response->header( $headerStr );
@@ -399,8 +398,7 @@
        }
 
        protected function sendCacheHeaders() {
-               global $wgRequest;
-               $response = $wgRequest->response();
+               $response = $this->getRequest()->response();
 
                if ( $this->mCacheMode == 'private' ) {
                        $response->header( 'Cache-Control: private' );
@@ -572,7 +570,7 @@
                                $this->dieUsageMsg( array( 'missingparam', 
'token' ) );
                        } else {
                                global $wgUser;
-                               if ( !$wgUser->matchEditToken( 
$moduleParams['token'], $salt, $this->getMain()->getRequest() ) ) {
+                               if ( !$wgUser->matchEditToken( 
$moduleParams['token'], $salt, $this->getRequest() ) ) {
                                        $this->dieUsageMsg( 'sessionfailure' );
                                }
                        }
@@ -593,8 +591,7 @@
                        $maxLag = $params['maxlag'];
                        list( $host, $lag ) = wfGetLB()->getMaxLag();
                        if ( $lag > $maxLag ) {
-                               global $wgRequest;
-                               $response = $wgRequest->response();
+                               $response = $this->getRequest()->response();
 
                                $response->header( 'Retry-After: ' . max( 
intval( $maxLag ), 5 ) );
                                $response->header( 'X-Database-Lag: ' . intval( 
$lag ) );
@@ -867,7 +864,7 @@
                // Get help text from cache if present
                $key = wfMemcKey( 'apihelp', $this->getModuleName(),
                        SpecialVersion::getVersion( 'nodb' ) .
-                       $this->getMain()->getShowVersions() );
+                       $this->getShowVersions() );
                if ( $wgAPICacheHelpTimeout > 0 ) {
                        $cached = $wgMemc->get( $key );
                        if ( $cached ) {


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to