Clarified RequestContext doc comment
[lhc/web/wiklou.git] / includes / context / RequestContext.php
index c76e3a9..89a0f3d 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * Request-dependant objects containers.
+ * Container for request-dependant objects and site configuration
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -297,8 +297,8 @@ class RequestContext implements IContextSource {
        /**
         * Get the Language object.
         * Initialization of user or request objects can depend on this.
-        *
         * @return Language
+        * @throws Exception
         * @since 1.19
         */
        public function getLanguage() {
@@ -318,7 +318,10 @@ class RequestContext implements IContextSource {
                                $request = $this->getRequest();
                                $user = $this->getUser();
 
-                               $code = $request->getVal( 'uselang', $user->getOption( 'language' ) );
+                               $code = $request->getVal( 'uselang', 'user' );
+                               if ( $code === 'user' ) {
+                                       $code = $user->getOption( 'language' );
+                               }
                                $code = self::sanitizeLangCode( $code );
 
                                Hooks::run( 'UserGetLanguageObject', array( $user, &$code, $this ) );
@@ -358,7 +361,6 @@ class RequestContext implements IContextSource {
         */
        public function getSkin() {
                if ( $this->skin === null ) {
-                       wfProfileIn( __METHOD__ . '-createskin' );
 
                        $skin = null;
                        Hooks::run( 'RequestContextCreateSkin', array( $this, &$skin ) );
@@ -396,7 +398,6 @@ class RequestContext implements IContextSource {
 
                        // After all that set a context on whatever skin got created
                        $this->skin->setContext( $this );
-                       wfProfileOut( __METHOD__ . '-createskin' );
                }
 
                return $this->skin;