From 3c102243df6cdd621949a5fce6697da51692c51e Mon Sep 17 00:00:00 2001 From: Platonides Date: Thu, 26 May 2011 22:30:35 +0000 Subject: [PATCH] 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 --- maintenance/dumpIterator.php | 23 +++++++++++++++++++---- maintenance/preprocessDump.php | 16 ---------------- 2 files changed, 19 insertions(+), 20 deletions(-) diff --git a/maintenance/dumpIterator.php b/maintenance/dumpIterator.php index ab28ea4469..11c132ae63 100644 --- a/maintenance/dumpIterator.php +++ b/maintenance/dumpIterator.php @@ -84,11 +84,22 @@ abstract class DumpIterator extends Maintenance { $this->error( "Memory peak usage of " . memory_get_peak_usage() . " bytes\n" ); } - function stripParameters( $text ) { - if ( !$this->stripParametersEnabled ) { - return $text; + public function finalSetup() { + parent::finalSetup(); + + if ( $this->getDbType() == Maintenance::DB_NONE ) { + global $wgUseDatabaseMessages, $wgLocalisationCacheConf, $wgHooks; + $wgUseDatabaseMessages = false; + $wgLocalisationCacheConf['storeClass'] = 'LCStore_Null'; + $wgHooks['InterwikiLoadPrefix'][] = 'DumpIterator::disableInterwikis'; } - return preg_replace( '/(]+>/', '$1>', $text ); + } + + static function disableInterwikis( $prefix, &$data ) { + # Title::newFromText will check on each namespaced article if it's an interwiki. + # We always answer that it is not. + + return false; } /** @@ -138,6 +149,10 @@ class SearchDump extends DumpIterator { $this->addOption( 'regex', 'Searching regex', true, true ); } + public function getDbType() { + return Maintenance::DB_NONE; + } + public function processRevision( $rev ) { if ( preg_match( $this->getOption( 'regex' ), $rev->getText() ) ) { $this->output( $rev->getTitle() . " matches at edit from " . $rev->getTimestamp() . "\n" ); diff --git a/maintenance/preprocessDump.php b/maintenance/preprocessDump.php index a6c3839682..bacc64641b 100644 --- a/maintenance/preprocessDump.php +++ b/maintenance/preprocessDump.php @@ -48,22 +48,6 @@ class PreprocessDump extends DumpIterator { return Maintenance::DB_NONE; } - public function finalSetup() { - parent::finalSetup(); - - global $wgUseDatabaseMessages, $wgLocalisationCacheConf, $wgHooks; - $wgUseDatabaseMessages = false; - $wgLocalisationCacheConf['storeClass'] = 'LCStore_Null'; - $wgHooks['InterwikiLoadPrefix'][] = 'PreprocessDump::disableInterwikis'; - } - - static function disableInterwikis( $prefix, &$data ) { - # Title::newFromText will check on each namespaced article if it's an interwiki. - # We always answer that it is not. - - return false; - } - public function checkOptions() { global $wgParser, $wgParserConf, $wgPreprocessorCacheThreshold; -- 2.20.1