MediaWiki  REL1_31
validateRegistrationFile.php
Go to the documentation of this file.
1 <?php
2 
3 require_once __DIR__ . '/Maintenance.php';
4 
6  public function __construct() {
7  parent::__construct();
8  $this->addArg( 'path', 'Path to extension.json/skin.json file.', true );
9  }
10  public function execute() {
11  $validator = new ExtensionJsonValidator( function ( $msg ) {
12  $this->fatalError( $msg );
13  } );
14  $validator->checkDependencies();
15  $path = $this->getArg( 0 );
16  try {
17  $validator->validate( $path );
18  $this->output( "$path validates against the schema!\n" );
19  } catch ( ExtensionJsonValidationError $e ) {
20  $this->fatalError( $e->getMessage() );
21  }
22  }
23 }
24 
26 require_once RUN_MAINTENANCE_IF_MAIN;
ValidateRegistrationFile\execute
execute()
Do the actual work.
Definition: validateRegistrationFile.php:10
ValidateRegistrationFile\__construct
__construct()
Default constructor.
Definition: validateRegistrationFile.php:6
$maintClass
$maintClass
Definition: validateRegistrationFile.php:25
Maintenance\fatalError
fatalError( $msg, $exitCode=1)
Output a message and terminate the current script.
Definition: Maintenance.php:439
RUN_MAINTENANCE_IF_MAIN
require_once RUN_MAINTENANCE_IF_MAIN
Definition: maintenance.txt:50
Maintenance
Abstract maintenance class for quickly writing and churning out maintenance scripts with minimal effo...
Definition: maintenance.txt:39
ExtensionJsonValidator\checkDependencies
checkDependencies()
Definition: ExtensionJsonValidator.php:46
php
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Definition: injection.txt:37
ValidateRegistrationFile
Definition: validateRegistrationFile.php:5
ExtensionJsonValidator
Definition: ExtensionJsonValidator.php:28
Maintenance\addArg
addArg( $arg, $description, $required=true)
Add some args that are needed.
Definition: Maintenance.php:271
$path
$path
Definition: NoLocalSettings.php:25
ExtensionJsonValidationError
Definition: ExtensionJsonValidationError.php:21
Maintenance\output
output( $out, $channel=null)
Throw some output to the user.
Definition: Maintenance.php:388
class
you have access to all of the normal MediaWiki so you can get a DB use the etc For full docs on the Maintenance class
Definition: maintenance.txt:56
Maintenance\getArg
getArg( $argId=0, $default=null)
Get an argument.
Definition: Maintenance.php:310
$e
div flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException' returning false will NOT prevent logging $e
Definition: hooks.txt:2171