0d6cfa2412f6663a31c08a4c5da4f930608e5372
[lhc/web/wiklou.git] / maintenance / validateRegistrationFile.php
1 <?php
2
3 require_once __DIR__ . '/Maintenance.php';
4
5 class ValidateRegistrationFile extends Maintenance {
6 public function __construct() {
7 parent::__construct();
8 $this->addArg(
9 'path',
10 'Path or glob pattern to extension.json/skin.json file.',
11 true
12 );
13 }
14 public function execute() {
15 $validator = new ExtensionJsonValidator( function ( $msg ) {
16 $this->fatalError( $msg );
17 } );
18 $validator->checkDependencies();
19 $paths = glob( $this->getArg( 0 ) );
20 foreach ( $paths as $path ) {
21 try {
22 $validator->validate( $path );
23 $this->output( "$path validates against the schema!\n" );
24 } catch ( ExtensionJsonValidationError $e ) {
25 $this->fatalError( $e->getMessage() );
26 }
27 }
28 }
29 }
30
31 $maintClass = ValidateRegistrationFile::class;
32 require_once RUN_MAINTENANCE_IF_MAIN;