25require_once __DIR__ .
'/Maintenance.php';
41 parent::__construct();
43 $this->
addArg(
'file(s)',
'JavaScript files or "-" to read stdin',
true,
true );
49 foreach ( $files as $filename ) {
50 $js = $filename ===
'-'
51 ? stream_get_contents( STDIN )
53 : @file_get_contents( $filename );
54 if ( $js ===
false ) {
55 $this->
output(
"$filename ERROR: could not read file\n" );
61 Peast\Peast::ES2016( $js )->parse();
62 }
catch ( Exception $e ) {
64 $this->
output(
"$filename ERROR: " . get_class( $e ) .
": " . $e->getMessage() .
"\n" );
68 $this->
output(
"$filename OK\n" );
71 if ( $this->errs > 0 ) {
79require_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.