X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;ds=sidebyside;f=maintenance%2FinitEditCount.php;h=0f136450fe81cc8e1d6aac3c014fe26c67ded503;hb=5fd4059ac17a9cf09579d2dd2743ab7400a0dd85;hp=02eb623bab79ac5dd423aae4f0fbd1ee3f6382a0;hpb=1af741ee27bd7dfb2a9cb730b034fc49ebe94d3e;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/initEditCount.php b/maintenance/initEditCount.php index 02eb623bab..0f136450fe 100644 --- a/maintenance/initEditCount.php +++ b/maintenance/initEditCount.php @@ -1,5 +1,8 @@ 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' ); @@ -43,9 +46,9 @@ in $wgDBservers, usually indicating a replication environment.' ); $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' ) ) { @@ -80,7 +83,6 @@ in $wgDBservers, usually indicating a replication environment.' ); __METHOD__ ); ++$migrated; } - $dbr->freeResult( $result ); $delta = microtime( true ) - $start; $rate = ( $delta == 0.0 ) ? 0.0 : $migrated / $delta; @@ -91,7 +93,7 @@ in $wgDBservers, usually indicating a replication environment.' ); $delta, $rate ) ); - wfWaitForSlaves( 10 ); + wfWaitForSlaves(); } } else { // Subselect should work on modern MySQLs etc @@ -105,4 +107,4 @@ in $wgDBservers, usually indicating a replication environment.' ); } $maintClass = "InitEditCount"; -require_once( DO_MAINTENANCE ); +require_once( RUN_MAINTENANCE_IF_MAIN );