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

Change subject: convertExtensionToRegistration: Put some keys (name, version, 
etc.) on top
......................................................................


convertExtensionToRegistration: Put some keys (name, version, etc.) on top

Bug: T86608
Change-Id: I4b8e48e8d2d23c3b7e3f0b49bfa9c8941b5a3434
---
M maintenance/convertExtensionToRegistration.php
1 file changed, 27 insertions(+), 1 deletion(-)

Approvals:
  Jforrester: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/maintenance/convertExtensionToRegistration.php 
b/maintenance/convertExtensionToRegistration.php
index 75500c2..5807fb6 100644
--- a/maintenance/convertExtensionToRegistration.php
+++ b/maintenance/convertExtensionToRegistration.php
@@ -14,6 +14,22 @@
                'ExtensionFunctions' => 'handleExtensionFunctions',
        );
 
+       /**
+        * Keys that should be put at the top of the generated JSON file 
(T86608)
+        *
+        * @var array
+        */
+       protected $promote = array(
+               'name',
+               'version',
+               'author',
+               'url',
+               'description',
+               'descriptionmsg',
+               'license-name',
+               'type',
+       );
+
        private $json, $dir;
 
        public function __construct() {
@@ -59,8 +75,18 @@
                        }
                }
 
+               // Move some keys to the top
+               $out = array();
+               foreach ( $this->promote as $key ) {
+                       if ( isset( $this->json[$key] ) ) {
+                               $out[$key] = $this->json[$key];
+                               unset( $this->json[$key] );
+                       }
+               }
+               $out += $this->json;
+
                $fname = "{$this->dir}/extension.json";
-               $prettyJSON = FormatJson::encode( $this->json, "\t", 
FormatJson::ALL_OK );
+               $prettyJSON = FormatJson::encode( $out, "\t", 
FormatJson::ALL_OK );
                file_put_contents( $fname, $prettyJSON . "\n" );
                $this->output( "Wrote output to $fname.\n" );
        }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I4b8e48e8d2d23c3b7e3f0b49bfa9c8941b5a3434
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: Parent5446 <[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