MediaWiki master
validateRegistrationFile.php
Go to the documentation of this file.
1<?php
2
6
7// @codeCoverageIgnoreStart
8require_once __DIR__ . '/Maintenance.php';
9// @codeCoverageIgnoreEnd
10
12 public function __construct() {
13 parent::__construct();
14 $this->addArg(
15 'path',
16 'Path or glob pattern to extension.json/skin.json file.',
17 true
18 );
19 }
20
21 public function execute() {
22 $validator = new ExtensionJsonValidator( function ( $msg ): never {
23 $this->fatalError( $msg );
24 } );
25 $validator->checkDependencies();
26 $paths = glob( $this->getArg( 0 ) );
27 foreach ( $paths as $path ) {
28 try {
29 $validator->validate( $path );
30 $this->output( "$path validates against the schema!\n" );
31 } catch ( ExtensionJsonValidationError $e ) {
32 $this->fatalError( $e->getMessage() );
33 }
34 }
35 }
36}
37
38// @codeCoverageIgnoreStart
39$maintClass = ValidateRegistrationFile::class;
40require_once RUN_MAINTENANCE_IF_MAIN;
41// @codeCoverageIgnoreEnd
$maintClass
Validate extension.json files against their JSON schema.