wiki.techinc.nl/maintenance/validateRegistrationFile.php
Umherirrender ad776c7d5f Use ::class to resolve class names in maintenance scripts
This helps to find renamed or misspelled classes earlier.
Phan will check the class names

Change-Id: I1d4567f47f93eb1436cb98558388e48d35258666
2018-01-23 17:40:16 +00:00

26 lines
722 B
PHP

<?php
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 );
}
public function execute() {
$validator = new ExtensionJsonValidator( function ( $msg ) {
$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->fatalError( $e->getMessage() );
}
}
}
$maintClass = ValidateRegistrationFile::class;
require_once RUN_MAINTENANCE_IF_MAIN;