convertExtensionToRegistration: Add --skin option
authorKunal Mehta <legoktm@gmail.com>
Thu, 29 Jan 2015 20:24:49 +0000 (12:24 -0800)
committerKunal Mehta <legoktm@gmail.com>
Thu, 29 Jan 2015 20:24:49 +0000 (12:24 -0800)
To write to skin.json instead of extension.json

Change-Id: I0e7dfbd871b7f80958fe7033d4595a205bb34293

maintenance/convertExtensionToRegistration.php

index 9437ee3..a0dee3c 100644 (file)
@@ -37,6 +37,7 @@ class ConvertExtensionToRegistration extends Maintenance {
                parent::__construct();
                $this->mDescription = 'Converts extension entry points to the new JSON registration format';
                $this->addArg( 'path', 'Location to the PHP entry point you wish to convert', /* $required = */ true );
+               $this->addOption( 'skin', 'Whether to write to skin.json', false, false );
        }
 
        protected function getAllGlobals() {
@@ -87,7 +88,8 @@ class ConvertExtensionToRegistration extends Maintenance {
                }
                $out += $this->json;
 
-               $fname = "{$this->dir}/extension.json";
+               $type = $this->hasOption( 'skin' ) ? 'skin' : 'extension';
+               $fname = "{$this->dir}/$type.json";
                $prettyJSON = FormatJson::encode( $out, "\t", FormatJson::ALL_OK );
                file_put_contents( $fname, $prettyJSON . "\n" );
                $this->output( "Wrote output to $fname.\n" );