From: Kunal Mehta Date: Sat, 23 Feb 2019 04:44:10 +0000 (-0800) Subject: validateRegistrationFile: Accept glob patterns X-Git-Tag: 1.34.0-rc.0~2681 X-Git-Url: http://git.cyclocoop.org/%7B%24admin_url%7Dmembres/Category:Foo?a=commitdiff_plain;h=c2bc3209b85160133db9f649b7e584ae1af39639;p=lhc%2Fweb%2Fwiklou.git validateRegistrationFile: Accept glob patterns I've had this locally for a while now - it makes it easier to validate all extension.json files that you might have checked out. The only catch is that you have to escape the glob pattern from your shell. Change-Id: Ic220034574129fab9e850f91c05dbd5e241f556c --- diff --git a/maintenance/validateRegistrationFile.php b/maintenance/validateRegistrationFile.php index 4b07796d2f..0d6cfa2412 100644 --- a/maintenance/validateRegistrationFile.php +++ b/maintenance/validateRegistrationFile.php @@ -5,19 +5,25 @@ require_once __DIR__ . '/Maintenance.php'; class ValidateRegistrationFile extends Maintenance { public function __construct() { parent::__construct(); - $this->addArg( 'path', 'Path to extension.json/skin.json file.', true ); + $this->addArg( + 'path', + 'Path or glob pattern to extension.json/skin.json file.', + true + ); } public function execute() { $validator = new ExtensionJsonValidator( function ( $msg ) { $this->fatalError( $msg ); } ); $validator->checkDependencies(); - $path = $this->getArg( 0 ); - try { - $validator->validate( $path ); - $this->output( "$path validates against the schema!\n" ); - } catch ( ExtensionJsonValidationError $e ) { - $this->fatalError( $e->getMessage() ); + $paths = glob( $this->getArg( 0 ) ); + foreach ( $paths as $path ) { + try { + $validator->validate( $path ); + $this->output( "$path validates against the schema!\n" ); + } catch ( ExtensionJsonValidationError $e ) { + $this->fatalError( $e->getMessage() ); + } } } }