MediaWiki master
validateRegistrationFile.php
Go to the documentation of this file.
1<?php
2
5
6// @codeCoverageIgnoreStart
7require_once __DIR__ . '/Maintenance.php';
8// @codeCoverageIgnoreEnd
9
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
Abstract maintenance class for quickly writing and churning out maintenance scripts with minimal effo...
addArg( $arg, $description, $required=true, $multi=false)
Add some args that are needed.
output( $out, $channel=null)
Throw some output to the user.
getArg( $argId=0, $default=null)
Get an argument.
fatalError( $msg, $exitCode=1)
Output a message and terminate the current script.
Validate extension.json files against their JSON schema.