From c2bc3209b85160133db9f649b7e584ae1af39639 Mon Sep 17 00:00:00 2001 From: Kunal Mehta Date: Fri, 22 Feb 2019 20:44:10 -0800 Subject: [PATCH] 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 --- maintenance/validateRegistrationFile.php | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) 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() ); + } } } } -- 2.20.1