Hello Paladox, Tim Starling, Reedy, Reception123, Florianschmidtwelzow,
Legoktm, jenkins-bot,
I'd like you to do a code review. Please visit
https://gerrit.wikimedia.org/r/373143
to review the following change.
Change subject: Revert "registration: Only allow one extension to set a
specific config setting"
......................................................................
Revert "registration: Only allow one extension to set a specific config setting"
Breaks mergeMessageFileList which means scap can't run in beta.
This reverts commit 50d7546057c1089228a2a6d7d4a49d78d72887e3.
Change-Id: Idb65f1098abce28d49ebbcc8254c0976b6861c59
---
M includes/registration/ExtensionProcessor.php
M tests/phpunit/includes/registration/ExtensionProcessorTest.php
2 files changed, 2 insertions(+), 59 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/43/373143/1
diff --git a/includes/registration/ExtensionProcessor.php
b/includes/registration/ExtensionProcessor.php
index 14d8222..ce262bd 100644
--- a/includes/registration/ExtensionProcessor.php
+++ b/includes/registration/ExtensionProcessor.php
@@ -450,7 +450,7 @@
}
foreach ( $info['config'] as $key => $val ) {
if ( $key[0] !== '@' ) {
- $this->addConfigGlobal( "$prefix$key",
$val );
+ $this->globals["$prefix$key"] = $val;
}
}
}
@@ -478,24 +478,9 @@
if ( isset( $data['path'] ) && $data['path'] ) {
$value = "$dir/$value";
}
- $this->addConfigGlobal( "$prefix$key", $value );
+ $this->globals["$prefix$key"] = $value;
}
}
- }
-
- /**
- * Helper function to set a value to a specific global, if it isn't set
already.
- *
- * @param string $key The config key with the prefix and anything
- * @param mixed $value The value of the config
- */
- private function addConfigGlobal( $key, $value ) {
- if ( array_key_exists( $key, $this->globals ) ) {
- throw new RuntimeException(
- "The configuration setting '$key' was already
set by another extension,"
- . " and cannot be set again." );
- }
- $this->globals[$key] = $value;
}
protected function extractServiceWiringFiles( $dir, array $info ) {
diff --git a/tests/phpunit/includes/registration/ExtensionProcessorTest.php
b/tests/phpunit/includes/registration/ExtensionProcessorTest.php
index 5ef30e8..7b56def 100644
--- a/tests/phpunit/includes/registration/ExtensionProcessorTest.php
+++ b/tests/phpunit/includes/registration/ExtensionProcessorTest.php
@@ -220,48 +220,6 @@
$this->assertEquals( 'somevalue',
$extracted['globals']['egBar'] );
}
- /**
- * @covers ExtensionProcessor::addConfigGlobal()
- * @expectedException RuntimeException
- */
- public function testDuplicateConfigKey1() {
- $processor = new ExtensionProcessor;
- $info = [
- 'config' => [
- 'Bar' => '',
- ]
- ] + self::$default;
- $info2 = [
- 'config' => [
- 'Bar' => 'g',
- ],
- 'name' => 'FooBar2',
- ];
- $processor->extractInfo( $this->dir, $info, 1 );
- $processor->extractInfo( $this->dir, $info2, 1 );
- }
-
- /**
- * @covers ExtensionProcessor::addConfigGlobal()
- * @expectedException RuntimeException
- */
- public function testDuplicateConfigKey2() {
- $processor = new ExtensionProcessor;
- $info = [
- 'config' => [
- 'Bar' => [ 'value' => 'somevalue' ],
- ]
- ] + self::$default;
- $info2 = [
- 'config' => [
- 'Bar' => [ 'value' => 'somevalue' ],
- ],
- 'name' => 'FooBar2',
- ];
- $processor->extractInfo( $this->dir, $info, 2 );
- $processor->extractInfo( $this->dir, $info2, 2 );
- }
-
public static function provideExtractExtensionMessagesFiles() {
$dir = __DIR__ . '/FooBar/';
return [
--
To view, visit https://gerrit.wikimedia.org/r/373143
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Idb65f1098abce28d49ebbcc8254c0976b6861c59
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Thcipriani <[email protected]>
Gerrit-Reviewer: Florianschmidtwelzow <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: Paladox <[email protected]>
Gerrit-Reviewer: Reception123 <[email protected]>
Gerrit-Reviewer: Reedy <[email protected]>
Gerrit-Reviewer: Tim Starling <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits