From: Kunal Mehta Date: Fri, 8 Aug 2014 09:25:03 +0000 (+0100) Subject: RequestContext: Use Config instead of globals X-Git-Tag: 1.31.0-rc.0~14522 X-Git-Url: http://git.cyclocoop.org/%24self?a=commitdiff_plain;h=d6e7c6b3f1a9f6c335bbb01778d42d917fcd361a;p=lhc%2Fweb%2Fwiklou.git RequestContext: Use Config instead of globals Change-Id: Id6107d0446f5143e60885d002bc8df80a7dc7c10 --- diff --git a/includes/context/RequestContext.php b/includes/context/RequestContext.php index 2c051baa7a..b847163086 100644 --- a/includes/context/RequestContext.php +++ b/includes/context/RequestContext.php @@ -297,13 +297,12 @@ class RequestContext implements IContextSource { $e = new Exception; wfDebugLog( 'recursion-guard', "Recursion detected:\n" . $e->getTraceAsString() ); - global $wgLanguageCode; - $code = ( $wgLanguageCode ) ? $wgLanguageCode : 'en'; + $code = $this->getConfig()->get( 'LanguageCode' ) ? : 'en'; $this->lang = Language::factory( $code ); } elseif ( $this->lang === null ) { $this->recursion = true; - global $wgLanguageCode, $wgContLang; + global $wgContLang; try { $request = $this->getRequest(); @@ -314,7 +313,7 @@ class RequestContext implements IContextSource { wfRunHooks( 'UserGetLanguageObject', array( $user, &$code, $this ) ); - if ( $code === $wgLanguageCode ) { + if ( $code === $this->getConfig()->get( 'LanguageCode' ) ) { $this->lang = $wgContLang; } else { $obj = Language::factory( $code ); @@ -364,15 +363,13 @@ class RequestContext implements IContextSource { // If this is still null (the hook didn't run or didn't work) // then go through the normal processing to load a skin if ( $this->skin === null ) { - global $wgHiddenPrefs; - if ( !in_array( 'skin', $wgHiddenPrefs ) ) { + if ( !in_array( 'skin', $this->getConfig()->get( 'HiddenPrefs' ) ) ) { # get the user skin $userSkin = $this->getUser()->getOption( 'skin' ); $userSkin = $this->getRequest()->getVal( 'useskin', $userSkin ); } else { # if we're not allowing users to override, then use the default - global $wgDefaultSkin; - $userSkin = $wgDefaultSkin; + $userSkin = $this->getConfig()->get( 'DefaultSkin' ); } $this->skin = Skin::newFromKey( $userSkin );