Pass $name to default Skin constructor for backwards-compatability
authorKunal Mehta <legoktm@gmail.com>
Wed, 13 Aug 2014 20:45:56 +0000 (13:45 -0700)
committerKunal Mehta <legoktm@gmail.com>
Wed, 13 Aug 2014 20:45:56 +0000 (13:45 -0700)
This feature was necessary when it was only possible to specify the
name of the class a skin used, this was the only way for one class to
dynamically serve multiple skins (such as if the skins were purely
template based with no PHP or if one skin had different themes to it).
It also provided an option for other skins to set $this->skinname dynamically.

See code review on I5c442f3c9e.

Change-Id: I7315fadf2e26d164ccc4f47b6d883945fa2570da

includes/Setup.php

index b3e80ea..b2fe7b8 100644 (file)
@@ -268,9 +268,9 @@ if ( $wgSkipSkin ) {
 call_user_func( function() use ( $wgValidSkinNames ) {
        $factory = SkinFactory::getDefaultInstance();
        foreach ( $wgValidSkinNames as $name => $skin ) {
-               $factory->register( $name, $skin, function() use ( $skin ) {
+               $factory->register( $name, $skin, function() use ( $name, $skin ) {
                        $class = "Skin$skin";
-                       return new $class;
+                       return new $class( $name );
                } );
        }
        // Register a hidden "fallback" skin