X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FcleanupTable.inc;h=74073bc5880bd6b8b05d52eeebf70ab74d2e62c9;hb=17be4be4214eb837455c474290c990d4d4df3561;hp=48bb53ebd155460ba8aacd6ae12436c36a812074;hpb=4277fc9f203d1f65d45b49dfcf914448166b0799;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/cleanupTable.inc b/maintenance/cleanupTable.inc index 48bb53ebd1..74073bc588 100644 --- a/maintenance/cleanupTable.inc +++ b/maintenance/cleanupTable.inc @@ -37,7 +37,6 @@ class TableCleanup extends Maintenance { ); protected $dryrun = false; - protected $maxLag = 10; # if slaves are lagged more than 10 secs, wait public $batchSize = 100; public $reportInterval = 100; @@ -50,11 +49,12 @@ class TableCleanup extends Maintenance { public function execute() { global $wgUser; - $wgUser = User::newFromName( 'Conversion script' ); $this->dryrun = $this->hasOption( 'dry-run' ); if ( $this->dryrun ) { + $wgUser = User::newFromName( 'Conversion script' ); $this->output( "Checking for bad titles...\n" ); } else { + $wgUser = User::newSystemUser( 'Conversion script', array( 'steal' => true ) ); $this->output( "Checking and fixing bad titles...\n" ); } $this->runTable( $this->defaultParams ); @@ -109,8 +109,8 @@ class TableCleanup extends Maintenance { $dbr = wfGetDB( DB_SLAVE ); if ( array_diff( array_keys( $params ), - array( 'table', 'conds', 'index', 'callback' ) ) ) - { + array( 'table', 'conds', 'index', 'callback' ) ) + ) { throw new MWException( __METHOD__ . ': Missing parameter ' . implode( ', ', $params ) ); } @@ -120,7 +120,6 @@ class TableCleanup extends Maintenance { $this->init( $count, $table ); $this->output( "Processing $table...\n" ); - $index = (array)$params['index']; $indexConds = array(); $options = array( @@ -173,10 +172,3 @@ class TableCleanup extends Maintenance { return sprintf( "\\x%02x", ord( $matches[1] ) ); } } - -class TableCleanupTest extends TableCleanup { - function processRow( $row ) { - $this->progress( mt_rand( 0, 1 ) ); - } -} -