From 02d4e4929f579a3125203ac2f32ba182469bc1a0 Mon Sep 17 00:00:00 2001 From: Piotr Miazga Date: Mon, 18 Nov 2019 15:54:37 -0500 Subject: [PATCH] Hygiene: remove vectorConfig and use the getConfig The SkinVector implements IContextSource, thus it has to provide the getConfig() method. Vector skin is currently using it's own `vectorConfig` in one place and it passes the VectorConfig to the VectorTemplate class. Sadly the VectorConfig is the same thing what $this->getConfig() provides. There is no need to make this code more complex by handling two different config containers which at the end are the same GlobalVarConfig instances. If we decide to handle VectorConfigs differently, let's thing it through, for now we should simplify code and remove all uncessary logic. Thanks to that, there is also no need to override the setupTemplate(). Change-Id: I89c8a77f7d96f867c8c72e61f9e104e14d9512d9 --- includes/SkinVector.php | 24 ++---------------------- skin.json | 3 --- 2 files changed, 2 insertions(+), 25 deletions(-) diff --git a/includes/SkinVector.php b/includes/SkinVector.php index 0ee7e73..a96a06c 100644 --- a/includes/SkinVector.php +++ b/includes/SkinVector.php @@ -30,17 +30,8 @@ class SkinVector extends SkinTemplate { public $skinname = 'vector'; public $stylename = 'Vector'; public $template = 'VectorTemplate'; - /** - * @var Config - */ - private $vectorConfig; - private $responsiveMode = false; - public function __construct() { - parent::__construct( ...func_get_args() ); - $this->vectorConfig = \MediaWiki\MediaWikiServices::getInstance()->getConfigFactory() - ->makeConfig( 'vector' ); - } + private $responsiveMode = false; /** @inheritDoc */ public function getPageClasses( $title ) { @@ -67,7 +58,7 @@ class SkinVector extends SkinTemplate { public function initPage( OutputPage $out ) { parent::initPage( $out ); - if ( $this->vectorConfig->get( 'VectorResponsive' ) ) { + if ( $this->getConfig()->get( 'VectorResponsive' ) ) { $this->enableResponsiveMode(); } @@ -87,17 +78,6 @@ class SkinVector extends SkinTemplate { ] ); } - /** - * Override to pass our Config instance to it - * @param string $classname - * @param bool|string $repository - * @param bool|string $cache_dir - * @return QuickTemplate - */ - public function setupTemplate( $classname, $repository = false, $cache_dir = false ) { - return new $classname( $this->vectorConfig ); - } - /** * Whether the logo should be preloaded with an HTTP link header or not * @since 1.29 diff --git a/skin.json b/skin.json index ea11099..5d9e56a 100644 --- a/skin.json +++ b/skin.json @@ -13,9 +13,6 @@ "requires": { "MediaWiki": ">= 1.29.0" }, - "ConfigRegistry": { - "vector": "GlobalVarConfig::newInstance" - }, "ValidSkinNames": { "vector": "Vector" },