jenkins-bot has submitted this change and it was merged.

Change subject: registration: Ignore attributes that start with @
......................................................................


registration: Ignore attributes that start with @

Allow these to be used for fake comments or other information
that should not be loaded.

Change-Id: Id79cd8b18988b94db565b2ddbc31ee6f17a89fca
---
M includes/registration/ExtensionProcessor.php
M tests/phpunit/includes/registration/ExtensionProcessorTest.php
2 files changed, 19 insertions(+), 1 deletion(-)

Approvals:
  Manybubbles: Looks good to me, but someone else must approve
  Jforrester: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/registration/ExtensionProcessor.php 
b/includes/registration/ExtensionProcessor.php
index 45bea64..14fc532 100644
--- a/includes/registration/ExtensionProcessor.php
+++ b/includes/registration/ExtensionProcessor.php
@@ -129,7 +129,8 @@
                foreach ( $info as $key => $val ) {
                        if ( in_array( $key, self::$globalSettings ) ) {
                                $this->storeToArray( "wg$key", $val, 
$this->globals );
-                       } elseif ( !in_array( $key, $this->processed ) ) {
+                       // Ignore anything that starts with a @
+                       } elseif ( $key[0] !== '@' && !in_array( $key, 
$this->processed ) ) {
                                $this->storeToArray( $key, $val, 
$this->attributes );
                        }
                }
diff --git a/tests/phpunit/includes/registration/ExtensionProcessorTest.php 
b/tests/phpunit/includes/registration/ExtensionProcessorTest.php
index 221c258..e57c2b3 100644
--- a/tests/phpunit/includes/registration/ExtensionProcessorTest.php
+++ b/tests/phpunit/includes/registration/ExtensionProcessorTest.php
@@ -18,6 +18,23 @@
                'name' => 'FooBar',
        );
 
+       /**
+        * @covers ExtensionProcessor::extractInfo
+        */
+       public function testExtractInfo() {
+               // Test that attributes that begin with @ are ignored
+               $processor = new ExtensionProcessor();
+               $processor->extractInfo( $this->dir, self::$default + array(
+                       '@metadata' => array( 'foobarbaz' ),
+                       'AnAttribute' => array( 'omg' ),
+               ) );
+
+               $extracted = $processor->getExtractedInfo();
+               $attributes = $extracted['attributes'];
+               $this->assertArrayHasKey( 'AnAttribute', $attributes );
+               $this->assertArrayNotHasKey( '@metadata', $attributes );
+       }
+
        public static function provideRegisterHooks() {
                return array(
                        // No hooks

-- 
To view, visit https://gerrit.wikimedia.org/r/184723
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Id79cd8b18988b94db565b2ddbc31ee6f17a89fca
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Legoktm <[email protected]>
Gerrit-Reviewer: Chad <[email protected]>
Gerrit-Reviewer: Jforrester <[email protected]>
Gerrit-Reviewer: Manybubbles <[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

Reply via email to