summaryrefslogtreecommitdiff
path: root/includes/context/DerivativeContext.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/context/DerivativeContext.php')
-rw-r--r--includes/context/DerivativeContext.php58
1 files changed, 31 insertions, 27 deletions
diff --git a/includes/context/DerivativeContext.php b/includes/context/DerivativeContext.php
index fd9bf963..b8966f0c 100644
--- a/includes/context/DerivativeContext.php
+++ b/includes/context/DerivativeContext.php
@@ -66,6 +66,11 @@ class DerivativeContext extends ContextSource {
private $skin;
/**
+ * @var Config
+ */
+ private $config;
+
+ /**
* Constructor
* @param IContextSource $context Context to inherit from
*/
@@ -74,6 +79,28 @@ class DerivativeContext extends ContextSource {
}
/**
+ * Set the SiteConfiguration object
+ *
+ * @param Config $s
+ */
+ public function setConfig( Config $s ) {
+ $this->config = $s;
+ }
+
+ /**
+ * Get the Config object
+ *
+ * @return Config
+ */
+ public function getConfig() {
+ if ( !is_null( $this->config ) ) {
+ return $this->config;
+ } else {
+ return $this->getContext()->getConfig();
+ }
+ }
+
+ /**
* Set the WebRequest object
*
* @param WebRequest $r
@@ -100,17 +127,14 @@ class DerivativeContext extends ContextSource {
*
* @param Title $t
*/
- public function setTitle( $t ) {
- if ( $t !== null && !$t instanceof Title ) {
- throw new MWException( __METHOD__ . " expects an instance of Title" );
- }
+ public function setTitle( Title $t ) {
$this->title = $t;
}
/**
* Get the Title object
*
- * @return Title
+ * @return Title|null
*/
public function getTitle() {
if ( !is_null( $this->title ) ) {
@@ -212,17 +236,6 @@ class DerivativeContext extends ContextSource {
/**
* Set the Language object
*
- * @deprecated since 1.19 Use setLanguage instead
- * @param Language|string $l Language instance or language code
- */
- public function setLang( $l ) {
- wfDeprecated( __METHOD__, '1.19' );
- $this->setLanguage( $l );
- }
-
- /**
- * Set the Language object
- *
* @param Language|string $l Language instance or language code
* @throws MWException
* @since 1.19
@@ -240,15 +253,6 @@ class DerivativeContext extends ContextSource {
}
/**
- * @deprecated since 1.19 Use getLanguage instead
- * @return Language
- */
- public function getLang() {
- wfDeprecated( __METHOD__, '1.19' );
- $this->getLanguage();
- }
-
- /**
* Get the Language object
*
* @return Language
@@ -292,12 +296,12 @@ class DerivativeContext extends ContextSource {
* it would set only the original context, and not take
* into account any changes.
*
- * @param String Message name
- * @param Variable number of message arguments
+ * @param mixed $args,... Arguments to wfMessage
* @return Message
*/
public function msg() {
$args = func_get_args();
+
return call_user_func_array( 'wfMessage', $args )->setContext( $this );
}
}