* @ingroup Maintenance
*/
-require_once( dirname( __FILE__ ) . '/Maintenance.php' );
+require_once __DIR__ . '/Maintenance.php';
class InitEditCount extends Maintenance {
public function __construct() {
Background mode will be automatically used if the server is MySQL 4.0
(which does not support subqueries) or if multiple servers are listed
-in $wgDBservers, usually indicating a replication environment.' );
+in the load balancer, usually indicating a replication environment.' );
$this->mDescription = "Batch-recalculate user_editcount fields from the revision table";
}
public function execute() {
- global $wgDBservers;
$dbw = wfGetDB( DB_MASTER );
$user = $dbw->tableName( 'user' );
$revision = $dbw->tableName( 'revision' );
$dbver = $dbw->getServerVersion();
// Autodetect mode...
- $backgroundMode = count( $wgDBservers ) > 1 ||
+ $backgroundMode = wfGetLB()->getServerCount() > 1 ||
( $dbw instanceof DatabaseMysql && version_compare( $dbver, '4.1' ) < 0 );
-
+
if ( $this->hasOption( 'background' ) ) {
$backgroundMode = true;
} elseif ( $this->hasOption( 'quick' ) ) {
$delta,
$rate ) );
- wfWaitForSlaves( 10 );
+ wfWaitForSlaves();
}
} else {
// Subselect should work on modern MySQLs etc
}
$maintClass = "InitEditCount";
-require_once( DO_MAINTENANCE );
+require_once RUN_MAINTENANCE_IF_MAIN;