From c1f9b1f7b1b77776192048005dcc66dcf3df2bfb Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Sat, 27 Dec 2014 15:41:37 +0100 Subject: Update to MediaWiki 1.24.1 --- includes/config/GlobalVarConfig.php | 108 ++++++++++++++++++++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 includes/config/GlobalVarConfig.php (limited to 'includes/config/GlobalVarConfig.php') diff --git a/includes/config/GlobalVarConfig.php b/includes/config/GlobalVarConfig.php new file mode 100644 index 00000000..39d6e8e1 --- /dev/null +++ b/includes/config/GlobalVarConfig.php @@ -0,0 +1,108 @@ +prefix = $prefix; + } + + /** + * @see Config::get + */ + public function get( $name ) { + if ( !$this->has( $name ) ) { + throw new ConfigException( __METHOD__ . ": undefined option: '$name'" ); + } + return $this->getWithPrefix( $this->prefix, $name ); + } + + /** + * @see Config::has + */ + public function has( $name ) { + return $this->hasWithPrefix( $this->prefix, $name ); + } + + /** + * @see MutableConfig::set + * @deprecated since 1.24 + */ + public function set( $name, $value ) { + wfDeprecated( __METHOD__, '1.24' ); + $this->setWithPrefix( $this->prefix, $name, $value ); + } + + /** + * Get a variable with a given prefix, if not the defaults. + * + * @param string $prefix Prefix to use on the variable, if one. + * @param string $name Variable name without prefix + * @return mixed + */ + protected function getWithPrefix( $prefix, $name ) { + return $GLOBALS[$prefix . $name]; + } + + /** + * Check if a variable with a given prefix is set + * + * @param string $prefix Prefix to use on the variable + * @param string $name Variable name without prefix + * @return bool + */ + protected function hasWithPrefix( $prefix, $name ) { + $var = $prefix . $name; + return array_key_exists( $var, $GLOBALS ); + } + + /** + * Get a variable with a given prefix, if not the defaults. + * + * @param string $prefix Prefix to use on the variable + * @param string $name Variable name without prefix + * @param mixed $value Value to set + * @deprecated since 1.24 + */ + protected function setWithPrefix( $prefix, $name, $value ) { + $GLOBALS[$prefix . $name] = $value; + } +} -- cgit v1.2.2