From: Platonides Date: Thu, 26 May 2011 22:30:35 +0000 (+0000) Subject: Move down interwiki disabling to dumpIterator and make SearchDump work without a db. X-Git-Tag: 1.31.0-rc.0~29916 X-Git-Url: http://git.cyclocoop.org/%27.parametre_url%28%20%20%20generer_action_auteur%28%27charger_plugin%27%2C%20%27update_flux%27%29%2C%27update_flux%27%2C%20%27oui%27%29.%27?a=commitdiff_plain;h=3c102243df6cdd621949a5fce6697da51692c51e;p=lhc%2Fweb%2Fwiklou.git 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 --- 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;