11require_once __DIR__ .
'/Maintenance.php';
27 parent::__construct();
29 $this->
addArg(
'file(s)',
'JavaScript files or "-" to read stdin',
true,
true );
35 foreach ( $files as $filename ) {
36 $js = $filename ===
'-'
37 ? stream_get_contents( STDIN )
39 : @file_get_contents( $filename );
40 if ( $js ===
false ) {
41 $this->
output(
"$filename ERROR: could not read file\n" );
47 Peast\Peast::ES2017( $js )->parse();
48 }
catch ( Exception $e ) {
50 $this->
output(
"$filename ERROR: " . get_class( $e ) .
": " . $e->getMessage() .
"\n" );
54 $this->
output(
"$filename OK\n" );
57 if ( $this->errs > 0 ) {
65require_once RUN_MAINTENANCE_IF_MAIN;
Ad-hoc run ResourceLoader validation for user-supplied JavaScript.
execute()
Do the actual work.
__construct()
Default constructor.
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.
getArgs( $offset=0)
Get arguments.
fatalError( $msg, $exitCode=1)
Output a message and terminate the current script.
addDescription( $text)
Set the description text.