From ca32f08966f1b51fcb19460f0996bb0c4048e6fe Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Sat, 3 Dec 2011 13:29:22 +0100 Subject: Update to MediaWiki 1.18.0 * also update ArchLinux skin to chagnes in MonoBook * Use only css to hide our menu bar when printing --- maintenance/jsparse.php | 72 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 maintenance/jsparse.php (limited to 'maintenance/jsparse.php') diff --git a/maintenance/jsparse.php b/maintenance/jsparse.php new file mode 100644 index 00000000..ae6f1f1d --- /dev/null +++ b/maintenance/jsparse.php @@ -0,0 +1,72 @@ +mDescription = "Runs parsing/syntax checks on JavaScript files"; + $this->addArg( 'file(s)', 'JavaScript file to test', false ); + } + + public function execute() { + $iterations = $this->getOption( 'i', 100 ); + if ( $this->hasArg() ) { + $files = $this->mArgs; + } else { + $this->maybeHelp( true ); // @fixme this is a lame API :) + exit( 1 ); // it should exit from the above first... + } + + $parser = new JSParser(); + foreach ( $files as $filename ) { + wfSuppressWarnings(); + $js = file_get_contents( $filename ); + wfRestoreWarnings(); + if ($js === false) { + $this->output( "$filename ERROR: could not read file\n" ); + $this->errs++; + continue; + } + + try { + $parser->parse( $js, $filename, 1 ); + } catch (Exception $e) { + $this->errs++; + $this->output( "$filename ERROR: " . $e->getMessage() . "\n" ); + continue; + } + + $this->output( "$filename OK\n" ); + } + + if ($this->errs > 0) { + exit(1); + } + } +} + +$maintClass = "JSParseHelper"; +require_once( RUN_MAINTENANCE_IF_MAIN ); -- cgit v1.2.3-54-g00ecf