Merge "context: Use getRawVal instead of getVal for 'uselang' and 'useskin'"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Wed, 31 Jul 2019 23:07:22 +0000 (23:07 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 31 Jul 2019 23:07:22 +0000 (23:07 +0000)
1  2 
includes/context/RequestContext.php
includes/resourceloader/ResourceLoaderContext.php

@@@ -379,12 -379,18 +380,13 @@@ class RequestContext implements IContex
                                // Normalize the key, just in case the hook did something weird.
                                $normalized = Skin::normalizeKey( $skin );
                                $this->skin = $factory->makeSkin( $normalized );
 -                      }
 -
 -                      // 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 ) {
 +                      } else {
 +                              // No hook override, go through normal processing
                                if ( !in_array( 'skin', $this->getConfig()->get( 'HiddenPrefs' ) ) ) {
 -                                      # get the user skin
                                        $userSkin = $this->getUser()->getOption( 'skin' );
-                                       $userSkin = $this->getRequest()->getVal( 'useskin', $userSkin );
+                                       // Optimisation: Avoid slow getVal(), this isn't user-generated content.
+                                       $userSkin = $this->getRequest()->getRawVal( 'useskin', $userSkin );
                                } else {
 -                                      # if we're not allowing users to override, then use the default
                                        $userSkin = $this->getConfig()->get( 'DefaultSkin' );
                                }