parent::__construct();
$this->mDescription = 'Remove cache entries for removed ResourceLoader modules from the database';
$this->addOption( 'batchsize', 'Delete rows in batches of this size. Default: 500', false, true );
- $this->addOption(
- 'max-slave-lag',
- 'If the slave lag exceeds this many seconds, wait until it drops below this value. '
- . 'Default: 5',
- false,
- true
- );
}
public function execute() {
$moduleNames = $rl->getModuleNames();
$moduleList = implode( ', ', array_map( array( $dbw, 'addQuotes' ), $moduleNames ) );
$limit = max( 1, intval( $this->getOption( 'batchsize', 500 ) ) );
- $maxlag = intval( $this->getOption( 'max-slave-lag', 5 ) );
$this->output( "Cleaning up module_deps table...\n" );
$i = 1;
$numRows = $dbw->affectedRows();
$this->output( "Batch $i: $numRows rows\n" );
$i++;
- wfWaitForSlaves( $maxlag );
+ wfWaitForSlaves();
} while ( $numRows > 0 );
$this->output( "done\n" );
$numRows = $dbw->affectedRows();
$this->output( "Batch $i: $numRows rows\n" );
$i++;
- wfWaitForSlaves( $maxlag );
+ wfWaitForSlaves();
} while ( $numRows > 0 );
$this->output( "done\n" );
$numRows = $dbw->affectedRows();
$this->output( "Batch $i: $numRows rows\n" );
$i++;
- wfWaitForSlaves( $maxlag );
+ wfWaitForSlaves();
} while ( $numRows > 0 );
$this->output( "done\n" );
}
);
protected $dryrun = false;
- protected $maxLag = 10; # if slaves are lagged more than 10 secs, wait
public $batchSize = 100;
public $reportInterval = 100;
false,
true
);
- $this->addOption(
- 'max-slave-lag',
- 'If slave lag exceeds this many seconds, wait until it drops before continuing. Default: 10',
- false,
- true
- );
$this->addOption(
'throttle',
'Wait this many milliseconds after each category. Default: 0',
public function execute() {
$begin = $this->getOption( 'begin', '' );
- $maxSlaveLag = $this->getOption( 'max-slave-lag', 10 );
$throttle = $this->getOption( 'throttle', 0 );
$force = $this->getOption( 'force', false );
- $this->doPopulateCategory( $begin, $maxSlaveLag, $throttle, $force );
- }
- private function doPopulateCategory( $begin, $maxlag, $throttle, $force ) {
$dbw = wfGetDB( DB_MASTER );
if ( !$force ) {
public function execute() {
$this->dbw = wfGetDB( DB_MASTER );
- $this->maxLag = 10; # if slaves are lagged more than 10 secs, wait
$this->dryrun = $this->hasOption( 'dry-run' );
if ( $this->dryrun ) {
$GLOBALS['wgReadOnly'] = 'Dry run mode, image upgrades are suppressed';
* @author Aryeh Gregor (Simetrical)
*/
-#$optionsWithArgs = array( 'begin', 'max-slave-lag' );
-
require_once __DIR__ . '/Maintenance.php';
/**
<?php
/**
- * Wait until slave lag goes under a certain value.
+ * Wait for the slaves to catch up to the master position.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
require_once __DIR__ . '/Maintenance.php';
/**
- * Maintenance script to wait until slave lag goes under a certain value.
+ * Maintenance script to wait for the slaves to catch up to the master position.
*
* @ingroup Maintenance
*/
class WaitForSlave extends Maintenance {
- public function __construct() {
- parent::__construct();
- $this->addArg( 'maxlag', 'How long to wait for the slaves, default 10 seconds', false );
- }
-
public function execute() {
- wfWaitForSlaves( $this->getArg( 0, 10 ) );
+ wfWaitForSlaves();
}
}