$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( '/(<a) [^>]+>/', '$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;
}
/**
$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" );
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;