Krinkle has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/274298

Change subject: Use RequestContext instead of $wgLang
......................................................................

Use RequestContext instead of $wgLang

Follows-up 62d7fe4 (for $wgRequest).

Change-Id: I03d0f918b7e39fdd69b0bdab2722ef23202789c8
---
M gateway_common/GatewayPage.php
M gateway_common/WmfFramework.mediawiki.php
M tests/DonationInterfaceTestCase.php
3 files changed, 3 insertions(+), 21 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/DonationInterface 
refs/changes/98/274298/1

diff --git a/gateway_common/GatewayPage.php b/gateway_common/GatewayPage.php
index 4b4f6e3..4c8917a 100644
--- a/gateway_common/GatewayPage.php
+++ b/gateway_common/GatewayPage.php
@@ -66,8 +66,6 @@
                $language = $this->getRequest()->getVal( 'language' );
                if ( $language ) {
                        $this->getContext()->setLanguage( $language );
-                       global $wgLang;
-                       $wgLang = $this->getContext()->getLanguage();
                }
 
                if ( $this->adapter->getGlobal( 'Enabled' ) !== true ) {
diff --git a/gateway_common/WmfFramework.mediawiki.php 
b/gateway_common/WmfFramework.mediawiki.php
index 85b5332..8d2838a 100644
--- a/gateway_common/WmfFramework.mediawiki.php
+++ b/gateway_common/WmfFramework.mediawiki.php
@@ -24,8 +24,8 @@
        }
 
        static function getLanguageCode() {
-               global $wgLang;
-               return $wgLang->getCode();
+               global $lang = RequestContext::getMain()->getLanguage();
+               return $lang->getCode();
        }
 
        static function isUseSquid() {
diff --git a/tests/DonationInterfaceTestCase.php 
b/tests/DonationInterfaceTestCase.php
index 446adad..6cd5bd3 100644
--- a/tests/DonationInterfaceTestCase.php
+++ b/tests/DonationInterfaceTestCase.php
@@ -509,6 +509,7 @@
                $mainContext->setRequest( $newRequest );
                $mainContext->setOutput( $newOutput );
                $mainContext->setTitle( $newTitle );
+               $mainContext->setLanguage( $initial_vars['language'] );
 
                $globals = array (
                        'wgTitle' => $newTitle,
@@ -516,8 +517,6 @@
                );
 
                $this->setMwGlobals( $globals );
-
-               $this->setLanguage( $initial_vars['language'] );
 
                ob_start();
                $formpage = new $special_page_class();
@@ -662,21 +661,6 @@
                        }
                }
                return $return;
-       }
-
-       /**
-        * Set global language for the duration of the test
-        *
-        * @param string $language language code to force
-        */
-       protected function setLanguage( $language ) {
-               $newLang = new TestingLanguage();
-               //this should be more robust, but... might have to work for now.
-               $newLang->forceLang( $language );
-
-               $this->setMwGlobals( array (
-                       'wgLang' => $newLang,
-               ) );
        }
 
        static function getInnerHTML( $node ) {

-- 
To view, visit https://gerrit.wikimedia.org/r/274298
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I03d0f918b7e39fdd69b0bdab2722ef23202789c8
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/DonationInterface
Gerrit-Branch: master
Gerrit-Owner: Krinkle <krinklem...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to