jenkins-bot has submitted this change and it was merged.
Change subject: Move Config::set() to MutableConfig::set()
......................................................................
Move Config::set() to MutableConfig::set()
Introduces a new interface for Config types
that are mutable. Not all Config instances
should be mutable, like MultiConfig.
Change-Id: I56e193cbbf72b7afdf551f60ea635fc347e14b3e
---
M includes/AutoLoader.php
M includes/config/Config.php
M includes/config/GlobalVarConfig.php
A includes/config/MutableConfig.php
M tests/phpunit/includes/config/GlobalVarConfigTest.php
5 files changed, 44 insertions(+), 10 deletions(-)
Approvals:
Daniel Kinzler: Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/AutoLoader.php b/includes/AutoLoader.php
index 87cd5d5..4c35bfd 100644
--- a/includes/AutoLoader.php
+++ b/includes/AutoLoader.php
@@ -374,6 +374,7 @@
'ConfigException' => 'includes/config/ConfigException.php',
'ConfigFactory' => 'includes/config/ConfigFactory.php',
'GlobalVarConfig' => 'includes/config/GlobalVarConfig.php',
+ 'MutableConfig' => 'includes/config/MutableConfig.php',
# includes/content
'AbstractContent' => 'includes/content/AbstractContent.php',
diff --git a/includes/config/Config.php b/includes/config/Config.php
index 68e90b4..03d2cb9 100644
--- a/includes/config/Config.php
+++ b/includes/config/Config.php
@@ -35,13 +35,4 @@
* @throws ConfigException
*/
public function get( $name );
-
- /**
- * Set a configuration variable such a "Sitename" to something like "My
Wiki"
- *
- * @param string $name Name of configuration option
- * @param mixed $value Value to set
- * @throws ConfigException
- */
- public function set( $name, $value );
}
diff --git a/includes/config/GlobalVarConfig.php
b/includes/config/GlobalVarConfig.php
index 0841a00..1144384 100644
--- a/includes/config/GlobalVarConfig.php
+++ b/includes/config/GlobalVarConfig.php
@@ -53,9 +53,11 @@
}
/**
- * @see Config::set
+ * @see MutableConfig::set
+ * @deprecated since 1.24
*/
public function set( $name, $value ) {
+ wfDeprecated( __METHOD__, '1.24' );
$this->setWithPrefix( $this->prefix, $name, $value );
}
@@ -81,6 +83,7 @@
* @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;
diff --git a/includes/config/MutableConfig.php
b/includes/config/MutableConfig.php
new file mode 100644
index 0000000..e765e3b
--- /dev/null
+++ b/includes/config/MutableConfig.php
@@ -0,0 +1,38 @@
+<?php
+/**
+ * Copyright 2014
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ */
+
+/**
+ * Interface for mutable configuration instances
+ *
+ * @since 1.24
+ */
+interface MutableConfig {
+
+ /**
+ * Set a configuration variable such a "Sitename" to something like "My
Wiki"
+ *
+ * @param string $name Name of configuration option
+ * @param mixed $value Value to set
+ * @throws ConfigException
+ */
+ public function set( $name, $value );
+}
diff --git a/tests/phpunit/includes/config/GlobalVarConfigTest.php
b/tests/phpunit/includes/config/GlobalVarConfigTest.php
index a999081..b15ffa7 100644
--- a/tests/phpunit/includes/config/GlobalVarConfigTest.php
+++ b/tests/phpunit/includes/config/GlobalVarConfigTest.php
@@ -97,6 +97,7 @@
* @covers GlobalVarConfig::setWithPrefix
*/
public function testSet( $name, $prefix, $var ) {
+ $this->hideDeprecated( 'GlobalVarConfig::set' );
$this->maybeStashGlobal( $var );
$config = new GlobalVarConfig( $prefix );
$random = wfRandomString();
--
To view, visit https://gerrit.wikimedia.org/r/159620
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I56e193cbbf72b7afdf551f60ea635fc347e14b3e
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Legoktm <[email protected]>
Gerrit-Reviewer: Chad <[email protected]>
Gerrit-Reviewer: Daniel Kinzler <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: Parent5446 <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits