X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Fregistration%2FExtensionProcessor.php;h=5dc0b400fb9f763f7faff7797326dcabb46e917f;hp=ffc7a7e08e3b5605d26f8e7672e70e3f67d78e96;hb=5fa4cdf860c79b32ab6ef034c6d9420c2727f695;hpb=e73b63dd3b977eb3a1606d88f374a47ac0ae102c;ds=sidebyside diff --git a/includes/registration/ExtensionProcessor.php b/includes/registration/ExtensionProcessor.php index ffc7a7e08e..5dc0b400fb 100644 --- a/includes/registration/ExtensionProcessor.php +++ b/includes/registration/ExtensionProcessor.php @@ -450,7 +450,7 @@ class ExtensionProcessor implements Processor { } foreach ( $info['config'] as $key => $val ) { if ( $key[0] !== '@' ) { - $this->globals["$prefix$key"] = $val; + $this->addConfigGlobal( "$prefix$key", $val ); } } } @@ -478,11 +478,26 @@ class ExtensionProcessor implements Processor { if ( isset( $data['path'] ) && $data['path'] ) { $value = "$dir/$value"; } - $this->globals["$prefix$key"] = $value; + $this->addConfigGlobal( "$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 ) { if ( isset( $info['ServiceWiringFiles'] ) ) { foreach ( $info['ServiceWiringFiles'] as $path ) {