From e9054cde63921a0cbbdc475d433f8757bc308a28 Mon Sep 17 00:00:00 2001 From: Kunal Mehta Date: Fri, 8 Aug 2014 10:40:04 +0100 Subject: [PATCH] Pass a Config object to QuickTemplate Change-Id: I9c2c9fb8e2d0cd1474218b2a49b41d053672fe7b --- includes/SkinTemplate.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/includes/SkinTemplate.php b/includes/SkinTemplate.php index 52e72e87de..9ed7fed77e 100644 --- a/includes/SkinTemplate.php +++ b/includes/SkinTemplate.php @@ -105,7 +105,7 @@ class SkinTemplate extends Skin { * @private */ function setupTemplate( $classname, $repository = false, $cache_dir = false ) { - return new $classname(); + return new $classname( $this->getConfig() ); } /** @@ -1371,12 +1371,20 @@ class SkinTemplate extends Skin { * @ingroup Skins */ abstract class QuickTemplate { + + /** @var Config $config */ + protected $config; /** - * Constructor + * @var Config $config */ - function __construct() { + function __construct( Config $config = null ) { $this->data = array(); $this->translator = new MediaWikiI18N(); + if ( $config === null ) { + wfDebug( __METHOD__ . ' was called with no Config instance passed to it' ); + $config = ConfigFactory::getDefaultInstance()->makeConfig( 'main' ); + } + $this->config = $config; } /** -- 2.20.1