From: Kunal Mehta Date: Tue, 13 Jan 2015 19:31:45 +0000 (-0800) Subject: convertExtensionToRegistration: Put some keys (name, version, etc.) on top X-Git-Tag: 1.31.0-rc.0~12625^2 X-Git-Url: https://git.cyclocoop.org/admin/?a=commitdiff_plain;h=77d38f651fd5bfe3df8056ed607430ca98de52be;p=lhc%2Fweb%2Fwiklou.git convertExtensionToRegistration: Put some keys (name, version, etc.) on top Bug: T86608 Change-Id: I4b8e48e8d2d23c3b7e3f0b49bfa9c8941b5a3434 --- 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" ); }