New infrastructure for actions, as discussed on wikitech-l. Fairly huge commit.
[lhc/web/wiklou.git] / includes / StubObject.php
index 299bfce..1c5460b 100644 (file)
@@ -62,7 +62,7 @@ class StubObject {
         * Create a new object to replace this stub object.
         */
        function _newObject() {
-               return wfCreateObject( $this->mClass, $this->mParams );
+               return MWFunction::newObj( $this->mClass, $this->mParams );
        }
 
        /**
@@ -146,22 +146,6 @@ class StubUserLang extends StubObject {
        }
 
        function _newObject() {
-               global $wgLanguageCode, $wgRequest, $wgUser, $wgContLang;
-               $code = $wgRequest->getVal( 'uselang', $wgUser->getOption( 'language' ) );
-               // BCP 47 - letter case MUST NOT carry meaning
-               $code = strtolower( $code );
-
-               # Validate $code
-               if( empty( $code ) || !preg_match( '/^[a-z-]+$/', $code ) || ( $code === 'qqq' ) ) {
-                       wfDebug( "Invalid user language code\n" );
-                       $code = $wgLanguageCode;
-               }
-
-               if( $code === $wgLanguageCode ) {
-                       return $wgContLang;
-               } else {
-                       $obj = Language::factory( $code );
-                       return $obj;
-               }
+               return RequestContext::getMain()->lang;
        }
 }