registration: Ignore keys prefixed with @ in "config"
authorKunal Mehta <legoktm@gmail.com>
Tue, 27 Jan 2015 07:00:07 +0000 (23:00 -0800)
committerKunal Mehta <legoktm@gmail.com>
Tue, 27 Jan 2015 07:00:07 +0000 (23:00 -0800)
This will allow for documentation of individual configuration
options.

Change-Id: I180bc742c96985c2a8358aef814d993fca9aba84

includes/registration/ExtensionProcessor.php
tests/phpunit/includes/registration/ExtensionProcessorTest.php

index fe86ca9..25222f6 100644 (file)
@@ -237,7 +237,9 @@ class ExtensionProcessor implements Processor {
        protected function extractConfig( array $info ) {
                if ( isset( $info['config'] ) ) {
                        foreach ( $info['config'] as $key => $val ) {
-                               $this->globals["wg$key"] = $val;
+                               if ( $key[0] !== '@' ) {
+                                       $this->globals["wg$key"] = $val;
+                               }
                        }
                        $this->processed[] = 'config';
                }
index e57c2b3..96df354 100644 (file)
@@ -87,12 +87,14 @@ class ExtensionProcessorTest extends MediaWikiTestCase {
                        'config' => array(
                                'Bar' => 'somevalue',
                                'Foo' => 10,
+                               '@IGNORED' => 'yes',
                        ),
                ) + self::$default;
                $processor->extractInfo( $this->dir, $info );
                $extracted = $processor->getExtractedInfo();
                $this->assertEquals( 'somevalue', $extracted['globals']['wgBar'] );
                $this->assertEquals( 10, $extracted['globals']['wgFoo'] );
+               $this->assertArrayNotHasKey( 'wg@IGNORED', $extracted['globals'] );
        }
 
        public static function provideSetToGlobal() {