First step of providing configuration without relying on globals.
You can use this in your code now as follows:
$myvar = $context->getConfig()->get( 'wgMyVar' )
Change-Id: I23194d1ba747a9e0d925154ae065cbd612b4f591
$this->context = $context;
}
+ /**
+ * Get the SiteConfiguration object
+ *
+ * @since 1.23
+ * @return SiteConfiguration
+ */
+ public function getConfig() {
+ return $this->getContext()->getConfig();
+ }
+
/**
* Get the WebRequest object
*
*/
private $skin;
+ /**
+ * @var SiteConfiguration
+ */
+ private $config;
+
/**
* Constructor
* @param IContextSource $context Context to inherit from
$this->setContext( $context );
}
+ /**
+ * Set the SiteConfiguration object
+ *
+ * @param SiteConfiguration $c
+ */
+ public function setConfig( SiteConfiguration $s ) {
+ $this->config = $s;
+ }
+
+ /**
+ * Get the SiteConfiguration object
+ *
+ * @return SiteConfiguration
+ */
+ public function getConfig() {
+ if ( !is_null( $this->config ) ) {
+ return $this->config;
+ } else {
+ return $this->getContext()->getConfig();
+ }
+ }
+
/**
* Set the WebRequest object
*
*/
public function getSkin();
+ /**
+ * Get the site configuration
+ *
+ * @since 1.23
+ * @return SiteConfiguration
+ */
+ public function getConfig();
+
/**
* Get a Message object with context set
*
*/
private $skin;
+ /**
+ * @var SiteConfiguration
+ */
+ private $config;
+
+ /**
+ * Set the SiteConfiguration object
+ *
+ * @param SiteConfiguration $c
+ */
+ public function setConfig( SiteConfiguration $c ) {
+ $this->config = $c;
+ }
+
+ /**
+ * Get the SiteConfiguration object
+ *
+ * @return SiteConfiguration
+ */
+ public function getConfig() {
+ if ( $this->config === null ) {
+ global $wgConf;
+ $this->config = $wgConf;
+ }
+ return $this->config;
+ }
+
/**
* Set the WebRequest object
*