diff -Nur tmp/mediawiki-1.18.0/includes/parser/LinkHolderArray.php mediawiki-1.18.0/includes/parser/LinkHolderArray.php --- tmp/mediawiki-1.18.0/includes/parser/LinkHolderArray.php 2011-05-29 10:25:20.000000000 -0400 +++ mediawiki-1.18.0/includes/parser/LinkHolderArray.php 2012-01-07 04:19:07.000000000 -0500 @@ -291,8 +291,9 @@ } elseif ( $linkCache->isBadLink( $pdbk ) ) { $colours[$pdbk] = 'new'; } else { + $colours[$pdbk] = ''; # Not in the link cache, add it to the query - $queries[$ns][] = $title->getDBkey(); + #$queries[$ns][] = $title->getDBkey(); } } } diff -Nur tmp/mediawiki-1.18.0/includes/parser/Parser.php mediawiki-1.18.0/includes/parser/Parser.php --- tmp/mediawiki-1.18.0/includes/parser/Parser.php 2011-11-09 12:26:59.000000000 -0500 +++ mediawiki-1.18.0/includes/parser/Parser.php 2012-01-07 04:30:59.000000000 -0500 @@ -3295,14 +3295,14 @@ */ function fetchTemplateAndTitle( $title ) { $templateCb = $this->mOptions->getTemplateCallback(); # Defaults to Parser::statelessFetchTemplate() - $stuff = call_user_func( $templateCb, $title, $this ); - $text = $stuff['text']; - $finalTitle = isset( $stuff['finalTitle'] ) ? $stuff['finalTitle'] : $title; - if ( isset( $stuff['deps'] ) ) { - foreach ( $stuff['deps'] as $dep ) { - $this->mOutput->addTemplate( $dep['title'], $dep['page_id'], $dep['rev_id'] ); - } - } + #$stuff = call_user_func( $templateCb, $title, $this ); + $text = "(Template)"; #$stuff['text']; + $finalTitle = $title; #isset( $stuff['finalTitle'] ) ? $stuff['finalTitle'] : $title; + #if ( isset( $stuff['deps'] ) ) { + # foreach ( $stuff['deps'] as $dep ) { + # $this->mOutput->addTemplate( $dep['title'], $dep['page_id'], $dep['rev_id'] ); + # } + #} return array( $text, $finalTitle ); } diff -Nur tmp/mediawiki-1.18.0/maintenance/dumpIterator.php mediawiki-1.18.0/maintenance/dumpIterator.php --- tmp/mediawiki-1.18.0/maintenance/dumpIterator.php 2011-06-30 22:25:19.000000000 -0400 +++ mediawiki-1.18.0/maintenance/dumpIterator.php 2012-01-07 04:48:20.000000000 -0500 @@ -32,6 +32,10 @@ private $count = 0; private $startTime; + public function getDbType() { + return Maintenance::DB_NONE; + } + public function __construct() { parent::__construct(); $this->mDescription = "Does something with a dump"; @@ -86,7 +90,6 @@ public function finalSetup() { parent::finalSetup(); - if ( $this->getDbType() == Maintenance::DB_NONE ) { global $wgUseDatabaseMessages, $wgLocalisationCacheConf, $wgHooks; $wgUseDatabaseMessages = false; @@ -164,4 +167,4 @@ } $maintClass = "SearchDump"; -require_once( RUN_MAINTENANCE_IF_MAIN ); +#require_once( RUN_MAINTENANCE_IF_MAIN ); diff -Nur tmp/mediawiki-1.18.0/maintenance/Maintenance.php mediawiki-1.18.0/maintenance/Maintenance.php --- tmp/mediawiki-1.18.0/maintenance/Maintenance.php 2011-11-15 12:29:10.000000000 -0500 +++ mediawiki-1.18.0/maintenance/Maintenance.php 2012-01-07 02:56:02.000000000 -0500 @@ -406,7 +406,7 @@ * @return Integer */ public function getDbType() { - return Maintenance::DB_STD; + return Maintenance::DB_NONE; } /** @@ -1340,4 +1340,4 @@ * @return String */ abstract protected function getUpdateKey(); -} \ No newline at end of file +} diff -Nur tmp/mediawiki-1.18.0/maintenance/timeParser.php mediawiki-1.18.0/maintenance/timeParser.php --- tmp/mediawiki-1.18.0/maintenance/timeParser.php 1969-12-31 19:00:00.000000000 -0500 +++ mediawiki-1.18.0/maintenance/timeParser.php 2012-01-07 05:08:44.000000000 -0500 @@ -0,0 +1,140 @@ +saveFailed = false; + $this->mDescription = "Run a file or dump with several parsers"; + $this->addOption( 'parser1', 'The first parser to compare.', true, true ); + $this->addOption( 'tidy', 'Run tidy on the articles.', false, false ); + $this->addOption( 'save-failed', 'Folder in which articles which differ will be stored.', false, true ); + $this->addOption( 'show-diff', 'Show a diff of the two renderings.', false, false ); + $this->addOption( 'diff-bin', 'Binary to use for diffing (can also be provided by DIFF env var).', false, false ); + $this->addOption( 'strip-parameters', 'Remove parameters of html tags to increase readability.', false, false ); + $this->addOption( 'show-parsed-output', 'Show the parsed html if both Parsers give the same output.', false, false ); + } + + public function checkOptions() { + if ( $this->hasOption('save-failed') ) { + $this->saveFailed = $this->getOption('save-failed'); + } + + $this->stripParametersEnabled = $this->hasOption( 'strip-parameters' ); + $this->showParsedOutput = $this->hasOption( 'show-parsed-output' ); + + $this->showDiff = $this->hasOption( 'show-diff' ); + if ( $this->showDiff ) { + $bin = $this->getOption( 'diff-bin', getenv( 'DIFF' ) ); + if ( $bin != '' ) { + global $wgDiff; + $wgDiff = $bin; + } + } + + $user = new User(); + $this->options = ParserOptions::newFromUser( $user ); + + if ( $this->hasOption( 'tidy' ) ) { + global $wgUseTidy; + if ( !$wgUseTidy ) { + $this->error( 'Tidy was requested but $wgUseTidy is not set in LocalSettings.php', true ); + } + $this->options->setTidy( true ); + } + + $this->failed = 0; + } + + public function conclusions() { + $this->error( "{$this->failed} failed revisions out of {$this->count}" ); + if ($this->count > 0) + $this->output( " (" . ( $this->failed / $this->count ) . "%)\n" ); + } + + function stripParameters( $text ) { + if ( !$this->stripParametersEnabled ) { + return $text; + } + return preg_replace( '/(]+>/', '$1>', $text ); + } + + /** + * Callback function for each revision, parse with both parsers and compare + * @param $rev Revision + */ + public function processRevision( $rev ) { + $title = $rev->getTitle(); + + $parser1Name = $this->getOption( 'parser1' ); + #$parser2Name = $this->getOption( 'parser2' ); + + self::checkParserLocally( $parser1Name ); + #self::checkParserLocally( $parser2Name ); + + $parser1 = new $parser1Name(); + #$parser2 = new $parser2Name(); + + + $text = $rev->getText(); + $output1 = $parser1->parse( $text, $title, $this->options ); + + $t1 = microtime(true); + $iter = 100; + for ($i=0; $i < $iter; $i++) + $output1 = $parser1->parse( $text, $title, $this->options ); + $t2 = microtime(true); + + #$output2 = $parser2->parse( $rev->getText(), $title, $this->options ); + + + $this->output( $title->getPrefixedText() . "\tOK\n" ); + if ( $this->showParsedOutput ) { + $this->output( $this->stripParameters( $output1->getText() ) ); + } + $this->output( ($t2-$t1)/$iter ." sec per parse\n"); + } + + private static function checkParserLocally( $parserName ) { + /* Look for the parser in a file appropiately named in the current folder */ + if ( !class_exists( $parserName ) && file_exists( "$parserName.php" ) ) { + global $wgAutoloadClasses; + $wgAutoloadClasses[ $parserName ] = realpath( '.' ) . "/$parserName.php"; + } + } + +} + +$maintClass = "CompareParsers"; +require_once( RUN_MAINTENANCE_IF_MAIN );