r88942 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r88941‎ | r88942 | r88943 >
Date:22:30, 26 May 2011
Author:platonides
Status:ok
Tags:
Comment:
Move down interwiki disabling to dumpIterator and make SearchDump work without a db.
Removed stripParameters() which shouldn't have been added to the base class in r88914
Modified paths:
  • /trunk/phase3/maintenance/dumpIterator.php (modified) (history)
  • /trunk/phase3/maintenance/preprocessDump.php (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/dumpIterator.php
@@ -84,12 +84,23 @@
8585 $this->error( "Memory peak usage of " . memory_get_peak_usage() . " bytes\n" );
8686 }
8787
88 - function stripParameters( $text ) {
89 - if ( !$this->stripParametersEnabled ) {
90 - return $text;
 88+ public function finalSetup() {
 89+ parent::finalSetup();
 90+
 91+ if ( $this->getDbType() == Maintenance::DB_NONE ) {
 92+ global $wgUseDatabaseMessages, $wgLocalisationCacheConf, $wgHooks;
 93+ $wgUseDatabaseMessages = false;
 94+ $wgLocalisationCacheConf['storeClass'] = 'LCStore_Null';
 95+ $wgHooks['InterwikiLoadPrefix'][] = 'DumpIterator::disableInterwikis';
9196 }
92 - return preg_replace( '/(<a) [^>]+>/', '$1>', $text );
9397 }
 98+
 99+ static function disableInterwikis( $prefix, &$data ) {
 100+ # Title::newFromText will check on each namespaced article if it's an interwiki.
 101+ # We always answer that it is not.
 102+
 103+ return false;
 104+ }
94105
95106 /**
96107 * Callback function for each revision, child classes should override
@@ -138,6 +149,10 @@
139150 $this->addOption( 'regex', 'Searching regex', true, true );
140151 }
141152
 153+ public function getDbType() {
 154+ return Maintenance::DB_NONE;
 155+ }
 156+
142157 public function processRevision( $rev ) {
143158 if ( preg_match( $this->getOption( 'regex' ), $rev->getText() ) ) {
144159 $this->output( $rev->getTitle() . " matches at edit from " . $rev->getTimestamp() . "\n" );
Index: trunk/phase3/maintenance/preprocessDump.php
@@ -48,22 +48,6 @@
4949 return Maintenance::DB_NONE;
5050 }
5151
52 - public function finalSetup() {
53 - parent::finalSetup();
54 -
55 - global $wgUseDatabaseMessages, $wgLocalisationCacheConf, $wgHooks;
56 - $wgUseDatabaseMessages = false;
57 - $wgLocalisationCacheConf['storeClass'] = 'LCStore_Null';
58 - $wgHooks['InterwikiLoadPrefix'][] = 'PreprocessDump::disableInterwikis';
59 - }
60 -
61 - static function disableInterwikis( $prefix, &$data ) {
62 - # Title::newFromText will check on each namespaced article if it's an interwiki.
63 - # We always answer that it is not.
64 -
65 - return false;
66 - }
67 -
6852 public function checkOptions() {
6953 global $wgParser, $wgParserConf, $wgPreprocessorCacheThreshold;
7054

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r88914Refactor the common code of compareParsers.php and preprocessDump.php into a ...platonides18:49, 26 May 2011

Status & tagging log