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