Pass a Config object to QuickTemplate
authorKunal Mehta <legoktm@gmail.com>
Fri, 8 Aug 2014 09:40:04 +0000 (10:40 +0100)
committerKunal Mehta <legoktm@gmail.com>
Fri, 8 Aug 2014 09:40:04 +0000 (10:40 +0100)
Change-Id: I9c2c9fb8e2d0cd1474218b2a49b41d053672fe7b

includes/SkinTemplate.php

index 52e72e8..9ed7fed 100644 (file)
@@ -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;
        }
 
        /**