X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;ds=sidebyside;f=maintenance%2FvalidateRegistrationFile.php;h=a704d61a9361a34fbbd8cc178e89292af18d5b4a;hb=8bc855d71ff995f4c055de9cfec6d7b2c8821ee4;hp=aa1f668d3ba30227a4e8298277f2e550fbdf3044;hpb=db920e6cf1d23638c2fece1bbeb9d17bdae6de10;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/validateRegistrationFile.php b/maintenance/validateRegistrationFile.php index aa1f668d3b..a704d61a93 100644 --- a/maintenance/validateRegistrationFile.php +++ b/maintenance/validateRegistrationFile.php @@ -5,22 +5,29 @@ 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->error( $msg, 1 ); + $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->error( $e->getMessage(), 1 ); + $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() ); + } } } } -$maintClass = 'ValidateRegistrationFile'; +$maintClass = ValidateRegistrationFile::class; require_once RUN_MAINTENANCE_IF_MAIN;