wiki.techinc.nl/maintenance/validateRegistrationFile.php
Bryan Davis 9e34eeff23 Maintenance: add fatalError() method
Deprecate the second argument to Maintenance::error() in favor of a new
Maintenance::fatalError() method. This is intended to make it easier to
review flow control in maintenance scripts.

Change-Id: I75699008638f7e99b11210c7bb9e2e131fca7c9e
2017-11-21 21:34:16 -07:00

26 lines
717 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';
require_once RUN_MAINTENANCE_IF_MAIN;