Normalize key before creating a Skin object
Bug: 69566 Change-Id: Id0af543cf206f47a3577019313597388ebc63b6a
This commit is contained in:
parent
c2de24efcd
commit
fa46ef3f0c
1 changed files with 9 additions and 12 deletions
|
|
@ -352,19 +352,15 @@ class RequestContext implements IContextSource {
|
|||
|
||||
$skin = null;
|
||||
wfRunHooks( 'RequestContextCreateSkin', array( $this, &$skin ) );
|
||||
$fallback = $this->getConfig()->get( 'FallbackSkin' );
|
||||
$factory = SkinFactory::getDefaultInstance();
|
||||
|
||||
// If the hook worked try to set a skin from it
|
||||
if ( $skin instanceof Skin ) {
|
||||
$this->skin = $skin;
|
||||
} elseif ( is_string( $skin ) ) {
|
||||
try {
|
||||
$this->skin = $factory->makeSkin( $skin );
|
||||
} catch ( SkinException $e ) {
|
||||
$this->skin = $factory->makeSkin( $fallback );
|
||||
}
|
||||
|
||||
// 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)
|
||||
|
|
@ -379,12 +375,13 @@ class RequestContext implements IContextSource {
|
|||
$userSkin = $this->getConfig()->get( 'DefaultSkin' );
|
||||
}
|
||||
|
||||
try {
|
||||
$this->skin = $factory->makeSkin( $userSkin );
|
||||
} catch ( SkinException $e ) {
|
||||
$this->skin = $factory->makeSkin( $fallback );
|
||||
}
|
||||
// Normalize the key in case the user is passing gibberish
|
||||
// or has old preferences (bug 69566).
|
||||
$normalized = Skin::normalizeKey( $userSkin );
|
||||
|
||||
// Skin::normalizeKey will also validate it, so
|
||||
// this won't throw an exception
|
||||
$this->skin = $factory->makeSkin( $normalized );
|
||||
}
|
||||
|
||||
// After all that set a context on whatever skin got created
|
||||
|
|
|
|||
Loading…
Reference in a new issue