From 77d38f651fd5bfe3df8056ed607430ca98de52be Mon Sep 17 00:00:00 2001 From: Kunal Mehta Date: Tue, 13 Jan 2015 11:31:45 -0800 Subject: [PATCH] convertExtensionToRegistration: Put some keys (name, version, etc.) on top Bug: T86608 Change-Id: I4b8e48e8d2d23c3b7e3f0b49bfa9c8941b5a3434 --- .../convertExtensionToRegistration.php | 28 ++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/maintenance/convertExtensionToRegistration.php b/maintenance/convertExtensionToRegistration.php index 75500c2418..5807fb6a94 100644 --- a/maintenance/convertExtensionToRegistration.php +++ b/maintenance/convertExtensionToRegistration.php @@ -14,6 +14,22 @@ class ConvertExtensionToRegistration extends Maintenance { '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 @@ class ConvertExtensionToRegistration extends Maintenance { } } + // 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" ); } -- 2.20.1