X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FcleanupTable.inc;h=f6259e95c8fb6b8f481ccea9490c54e9ca970d4f;hb=d92845c2295d982c80312880c3fae788450676ea;hp=410a55cb23b8192c70b58663531be67dd5207e4b;hpb=0898fa993ca5d51e11adaf4dc57e3ef757bc8c69;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/cleanupTable.inc b/maintenance/cleanupTable.inc index 410a55cb23..f6259e95c8 100644 --- a/maintenance/cleanupTable.inc +++ b/maintenance/cleanupTable.inc @@ -37,10 +37,11 @@ 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; + protected $processed, $updated, $count, $startTime, $table; + public function __construct() { parent::__construct(); $this->addOption( 'dry-run', 'Perform a dry run' ); @@ -66,6 +67,9 @@ class TableCleanup extends Maintenance { $this->table = $table; } + /** + * @param int $updated + */ protected function progress( $updated ) { $this->updated += $updated; $this->processed++; @@ -96,12 +100,16 @@ class TableCleanup extends Maintenance { flush(); } + /** + * @param array $params + * @throws MWException + */ public function runTable( $params ) { $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 ) ); } @@ -111,7 +119,6 @@ class TableCleanup extends Maintenance { $this->init( $count, $table ); $this->output( "Processing $table...\n" ); - $index = (array)$params['index']; $indexConds = array(); $options = array( @@ -156,6 +163,10 @@ class TableCleanup extends Maintenance { $this->output( "Finished $table... $this->updated of $this->processed rows updated\n" ); } + /** + * @param array $matches + * @return string + */ protected function hexChar( $matches ) { return sprintf( "\\x%02x", ord( $matches[1] ) ); }