Haikalizz has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/394537 )

Change subject: Replace usage of wfWaitForSlaves.
......................................................................

Replace usage of wfWaitForSlaves.

Fixes #T181673

Change-Id: I21adcc6076487356d1edd07c1b41c646b9363b62
---
M maintenance/archives/upgradeLogging.php
M maintenance/cleanupEmptyCategories.php
M maintenance/cleanupInvalidDbKeys.php
M maintenance/cleanupUploadStash.php
M maintenance/cleanupUsersWithNoId.php
M maintenance/convertUserOptions.php
M maintenance/deleteBatch.php
M maintenance/deleteDefaultMessages.php
M maintenance/deleteEqualMessages.php
M maintenance/deleteSelfExternals.php
M maintenance/fixDefaultJsonContentPages.php
M maintenance/fixExtLinksProtocolRelative.php
M maintenance/fixUserRegistration.php
M maintenance/importDump.php
M maintenance/importImages.php
M maintenance/initEditCount.php
M maintenance/makeTestEdits.php
M maintenance/migrateComments.php
M maintenance/migrateUserGroup.php
M maintenance/moveBatch.php
M maintenance/namespaceDupes.php
M maintenance/populateBacklinkNamespace.php
M maintenance/populateCategory.php
M maintenance/populateContentModel.php
M maintenance/populateFilearchiveSha1.php
M maintenance/populateImageSha1.php
M maintenance/populateLogSearch.php
M maintenance/populateLogUsertext.php
M maintenance/populateParentId.php
M maintenance/populateRecentChangesSource.php
M maintenance/populateRevisionLength.php
M maintenance/populateRevisionSha1.php
M maintenance/refreshImageMetadata.php
M maintenance/refreshLinks.php
M maintenance/removeInvalidEmails.php
M maintenance/resetUserTokens.php
M maintenance/runBatchedQuery.php
M maintenance/sql.php
M maintenance/storage/compressOld.php
M maintenance/storage/fixT22757.php
M maintenance/storage/moveToExternal.php
M maintenance/storage/resolveStubs.php
M maintenance/storage/trackBlobs.php
M maintenance/tidyUpBug37714.php
M maintenance/update.php
M maintenance/updateCollation.php
M maintenance/updateRestrictions.php
M maintenance/updateSpecialPages.php
48 files changed, 69 insertions(+), 69 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/37/394537/1

diff --git a/maintenance/archives/upgradeLogging.php 
b/maintenance/archives/upgradeLogging.php
index 13362e0..af2d866 100644
--- a/maintenance/archives/upgradeLogging.php
+++ b/maintenance/archives/upgradeLogging.php
@@ -175,7 +175,7 @@
                        $this->dbw->insert( $dstTable, $batch, __METHOD__ );
                        $numRowsCopied += count( $batch );
 
-                       wfWaitForSlaves();
+                       wfGetLBFactory()->waitForReplication();
                }
                echo "Copied $numRowsCopied rows\n";
        }
diff --git a/maintenance/cleanupEmptyCategories.php 
b/maintenance/cleanupEmptyCategories.php
index 2d22704..4a052a2 100644
--- a/maintenance/cleanupEmptyCategories.php
+++ b/maintenance/cleanupEmptyCategories.php
@@ -134,7 +134,7 @@
                                }
                                $this->output( "--mode=$mode --begin=$name\n" );
 
-                               wfWaitForSlaves();
+                               wfGetLBFactory()->waitForReplication();
                                usleep( $throttle * 1000 );
                        }
 
@@ -188,7 +188,7 @@
 
                                $this->output( "--mode=remove --begin=$name\n" 
);
 
-                               wfWaitForSlaves();
+                               wfGetLBFactory()->waitForReplication();
                                usleep( $throttle * 1000 );
                        }
                }
diff --git a/maintenance/cleanupInvalidDbKeys.php 
b/maintenance/cleanupInvalidDbKeys.php
index 569fd2b..47e7550 100644
--- a/maintenance/cleanupInvalidDbKeys.php
+++ b/maintenance/cleanupInvalidDbKeys.php
@@ -235,7 +235,7 @@
                                                __METHOD__ );
                                        $affectedRowCount += 
$dbw->affectedRows();
                                }
-                               wfWaitForSlaves();
+                               wfGetLBFactory()->waitForReplication();
                                $this->outputStatus( "Updated $affectedRowCount 
rows on $table.\n" );
 
                                break;
@@ -248,7 +248,7 @@
                                // recently, so we can just remove these rows.
                                $this->outputStatus( "Deleting invalid $table 
rows...\n" );
                                $dbw->delete( $table, [ $idField => $ids ], 
__METHOD__ );
-                               wfWaitForSlaves();
+                               wfGetLBFactory()->waitForReplication();
                                $this->outputStatus( 'Deleted ' . 
$dbw->affectedRows() . " rows from $table.\n" );
                                break;
 
@@ -264,7 +264,7 @@
                                                __METHOD__ );
                                        $affectedRowCount += 
$dbw->affectedRows();
                                }
-                               wfWaitForSlaves();
+                               wfGetLBFactory()->waitForReplication();
                                $this->outputStatus( "Deleted $affectedRowCount 
rows from $table.\n" );
                                break;
 
@@ -286,7 +286,7 @@
                                                        __METHOD__ );
                                        }
                                }
-                               wfWaitForSlaves();
+                               wfGetLBFactory()->waitForReplication();
                                $this->outputStatus( "Link update jobs have 
been added to the job queue.\n" );
                                break;
                }
diff --git a/maintenance/cleanupUploadStash.php 
b/maintenance/cleanupUploadStash.php
index aeaf150..37ec26a 100644
--- a/maintenance/cleanupUploadStash.php
+++ b/maintenance/cleanupUploadStash.php
@@ -87,7 +87,7 @@
                                        $this->output( "Failed removing stashed 
upload with key: $key ($type)\n" );
                                }
                                if ( $i % 100 == 0 ) {
-                                       wfWaitForSlaves();
+                                       wfGetLBFactory()->waitForReplication();
                                        $this->output( "$i\n" );
                                }
                        }
diff --git a/maintenance/cleanupUsersWithNoId.php 
b/maintenance/cleanupUsersWithNoId.php
index 74167d1..9b6bf82 100644
--- a/maintenance/cleanupUsersWithNoId.php
+++ b/maintenance/cleanupUsersWithNoId.php
@@ -199,7 +199,7 @@
 
                        list( $next, $display ) = $this->makeNextCond( $dbw, 
$orderby, $row );
                        $this->output( "... $display\n" );
-                       wfWaitForSlaves();
+                       wfGetLBFactory()->waitForReplication();
                }
 
                $this->output(
diff --git a/maintenance/convertUserOptions.php 
b/maintenance/convertUserOptions.php
index 501f045..c42440b 100644
--- a/maintenance/convertUserOptions.php
+++ b/maintenance/convertUserOptions.php
@@ -66,7 +66,7 @@
                        );
                        $id = $this->convertOptionBatch( $res, $dbw );
 
-                       wfWaitForSlaves();
+                       wfGetLBFactory()->waitForReplication();
 
                        if ( $id ) {
                                $this->output( "--Converted to ID $id\n" );
diff --git a/maintenance/deleteBatch.php b/maintenance/deleteBatch.php
index eceadc1..0e85060 100644
--- a/maintenance/deleteBatch.php
+++ b/maintenance/deleteBatch.php
@@ -119,7 +119,7 @@
                        if ( $interval ) {
                                sleep( $interval );
                        }
-                       wfWaitForSlaves();
+                       wfGetLBFactory()->waitForReplication();
                }
        }
 }
diff --git a/maintenance/deleteDefaultMessages.php 
b/maintenance/deleteDefaultMessages.php
index 417aa03..e0f4983 100644
--- a/maintenance/deleteDefaultMessages.php
+++ b/maintenance/deleteDefaultMessages.php
@@ -82,7 +82,7 @@
                $dbw = $this->getDB( DB_MASTER );
 
                foreach ( $res as $row ) {
-                       wfWaitForSlaves();
+                       wfGetLBFactory()->waitForReplication();
                        $dbw->ping();
                        $title = Title::makeTitle( $row->page_namespace, 
$row->page_title );
                        $page = WikiPage::factory( $title );
diff --git a/maintenance/deleteEqualMessages.php 
b/maintenance/deleteEqualMessages.php
index 2a1fe22..6adef38 100644
--- a/maintenance/deleteEqualMessages.php
+++ b/maintenance/deleteEqualMessages.php
@@ -176,7 +176,7 @@
                $this->output( "\n...deleting equal messages (this may take a 
long time!)..." );
                $dbw = $this->getDB( DB_MASTER );
                foreach ( $messageInfo['results'] as $result ) {
-                       wfWaitForSlaves();
+                       wfGetLBFactory()->waitForReplication();
                        $dbw->ping();
                        $title = Title::makeTitle( NS_MEDIAWIKI, 
$result['title'] );
                        $this->output( "\n* [[$title]]" );
diff --git a/maintenance/deleteSelfExternals.php 
b/maintenance/deleteSelfExternals.php
index ab25784..7523889 100644
--- a/maintenance/deleteSelfExternals.php
+++ b/maintenance/deleteSelfExternals.php
@@ -41,7 +41,7 @@
                $this->output( "Deleting self externals from $wgServer\n" );
                $db = $this->getDB( DB_MASTER );
                while ( 1 ) {
-                       wfWaitForSlaves();
+                       wfGetLBFactory()->waitForReplication();
                        $this->commitTransaction( $db, __METHOD__ );
                        $q = $db->limitResult( "DELETE /* deleteSelfExternals 
*/ FROM externallinks WHERE el_to"
                                . $db->buildLike( $wgServer . '/', 
$db->anyString() ), $this->getBatchSize() );
diff --git a/maintenance/fixDefaultJsonContentPages.php 
b/maintenance/fixDefaultJsonContentPages.php
index 7262770..9fea62a 100644
--- a/maintenance/fixDefaultJsonContentPages.php
+++ b/maintenance/fixDefaultJsonContentPages.php
@@ -94,7 +94,7 @@
                                        __METHOD__
                                );
                                $this->output( "done.\n" );
-                               wfWaitForSlaves();
+                               wfGetLBFactory()->waitForReplication();
                        } else {
                                // Not JSON...force it to wikitext. We need to 
update the
                                // revision table so that these revisions are 
always processed
@@ -114,7 +114,7 @@
                                                [ 'rev_content_model' => 
CONTENT_MODEL_WIKITEXT ],
                                                [ 'rev_page' => $row->page_id, 
'rev_id' => $chunk ]
                                        );
-                                       wfWaitForSlaves();
+                                       wfGetLBFactory()->waitForReplication();
                                }
                                $this->output( "done.\n" );
                        }
diff --git a/maintenance/fixExtLinksProtocolRelative.php 
b/maintenance/fixExtLinksProtocolRelative.php
index 97cd37e..9770446 100644
--- a/maintenance/fixExtLinksProtocolRelative.php
+++ b/maintenance/fixExtLinksProtocolRelative.php
@@ -63,7 +63,7 @@
                        $count++;
                        if ( $count % 100 == 0 ) {
                                $this->output( $count . "\n" );
-                               wfWaitForSlaves();
+                               wfGetLBFactory()->waitForReplication();
                        }
                        $db->insert( 'externallinks',
                                [
diff --git a/maintenance/fixUserRegistration.php 
b/maintenance/fixUserRegistration.php
index 30364c6..0b95ea8 100644
--- a/maintenance/fixUserRegistration.php
+++ b/maintenance/fixUserRegistration.php
@@ -81,7 +81,7 @@
                                }
                        }
                        $this->output( "Waiting for replica DBs..." );
-                       wfWaitForSlaves();
+                       wfGetLBFactory()->waitForReplication();
                        $this->output( " done.\n" );
                } while ( $res->numRows() >= $this->getBatchSize() );
        }
diff --git a/maintenance/importDump.php b/maintenance/importDump.php
index b6bbc2a..5a59c7e 100644
--- a/maintenance/importDump.php
+++ b/maintenance/importDump.php
@@ -256,7 +256,7 @@
                                $this->progress( "$this->revCount ($revrate 
revs/sec)" );
                        }
                }
-               wfWaitForSlaves();
+               wfGetLBFactory()->waitForReplication();
        }
 
        function progress( $string ) {
diff --git a/maintenance/importImages.php b/maintenance/importImages.php
index d3aa280..8170f55 100644
--- a/maintenance/importImages.php
+++ b/maintenance/importImages.php
@@ -355,7 +355,7 @@
                                                $this->output( "\nWaiting for 
replica DBs...\n" );
                                                // Wait for replica DBs.
                                                sleep( 2.0 ); # Why this sleep?
-                                               wfWaitForSlaves();
+                                               
wfGetLBFactory()->waitForReplication();
 
                                                $this->output( "\nSetting image 
restrictions ... " );
 
diff --git a/maintenance/initEditCount.php b/maintenance/initEditCount.php
index 96aea03..4e82423 100644
--- a/maintenance/initEditCount.php
+++ b/maintenance/initEditCount.php
@@ -89,7 +89,7 @@
                                        $delta,
                                        $rate ) );
 
-                               wfWaitForSlaves();
+                               wfGetLBFactory()->waitForReplication();
                        }
                } else {
                        $this->output( "Using single-query mode...\n" );
diff --git a/maintenance/makeTestEdits.php b/maintenance/makeTestEdits.php
index cfd5fc2..711ac73 100644
--- a/maintenance/makeTestEdits.php
+++ b/maintenance/makeTestEdits.php
@@ -56,7 +56,7 @@
 
                        $this->output( "Edited $title\n" );
                        if ( $i && ( $i % $this->getBatchSize() ) == 0 ) {
-                               wfWaitForSlaves();
+                               wfGetLBFactory()->waitForReplication();
                        }
                }
 
diff --git a/maintenance/migrateComments.php b/maintenance/migrateComments.php
index c000871..d48bfc9 100644
--- a/maintenance/migrateComments.php
+++ b/maintenance/migrateComments.php
@@ -144,7 +144,7 @@
                $primaryKey = (array)$primaryKey;
                $pkFilter = array_flip( $primaryKey );
                $this->output( "Beginning migration of $table.$oldField to 
$table.$newField\n" );
-               wfWaitForSlaves();
+               wfGetLBFactory()->waitForReplication();
 
                $dbw = $this->getDB( DB_MASTER );
                $next = '1=1';
@@ -207,7 +207,7 @@
                        }
                        $prompt = join( ' ', array_reverse( $prompt ) );
                        $this->output( "... $prompt\n" );
-                       wfWaitForSlaves();
+                       wfGetLBFactory()->waitForReplication();
                }
 
                $this->output(
@@ -233,7 +233,7 @@
        protected function migrateToTemp( $table, $primaryKey, $oldField, 
$newPrimaryKey, $newField ) {
                $newTable = $table . '_comment_temp';
                $this->output( "Beginning migration of $table.$oldField to 
$newTable.$newField\n" );
-               wfWaitForSlaves();
+               wfGetLBFactory()->waitForReplication();
 
                $dbw = $this->getDB( DB_MASTER );
                $next = [];
@@ -282,7 +282,7 @@
                        // Calculate the "next" condition
                        $next = [ $primaryKey . ' > ' . $dbw->addQuotes( 
$row->$primaryKey ) ];
                        $this->output( "... {$row->$primaryKey}\n" );
-                       wfWaitForSlaves();
+                       wfGetLBFactory()->waitForReplication();
                }
 
                $this->output(
diff --git a/maintenance/migrateUserGroup.php b/maintenance/migrateUserGroup.php
index 81c2353..229cb21 100644
--- a/maintenance/migrateUserGroup.php
+++ b/maintenance/migrateUserGroup.php
@@ -100,7 +100,7 @@
                        $count += $affected;
                        $blockStart += $batchSize;
                        $blockEnd += $batchSize;
-                       wfWaitForSlaves();
+                       wfGetLBFactory()->waitForReplication();
                }
                $this->output( "Done! $count users in group '$oldGroup' are now 
in '$newGroup' instead.\n" );
        }
diff --git a/maintenance/moveBatch.php b/maintenance/moveBatch.php
index fa25a06..31db654 100644
--- a/maintenance/moveBatch.php
+++ b/maintenance/moveBatch.php
@@ -118,7 +118,7 @@
                        if ( $interval ) {
                                sleep( $interval );
                        }
-                       wfWaitForSlaves();
+                       wfGetLBFactory()->waitForReplication();
                }
        }
 }
diff --git a/maintenance/namespaceDupes.php b/maintenance/namespaceDupes.php
index 84d4533..cd83b71 100644
--- a/maintenance/namespaceDupes.php
+++ b/maintenance/namespaceDupes.php
@@ -407,7 +407,7 @@
                                "$titleField > $encLastTitle " .
                                "OR ($titleField = $encLastTitle AND $fromField 
> $encLastFrom)" ];
 
-                       wfWaitForSlaves();
+                       wfGetLBFactory()->waitForReplication();
                }
        }
 
diff --git a/maintenance/populateBacklinkNamespace.php 
b/maintenance/populateBacklinkNamespace.php
index eb82806..52d2cb4 100644
--- a/maintenance/populateBacklinkNamespace.php
+++ b/maintenance/populateBacklinkNamespace.php
@@ -88,7 +88,7 @@
                        }
                        $blockStart += $batchSize - 1;
                        $blockEnd += $batchSize - 1;
-                       wfWaitForSlaves();
+                       wfGetLBFactory()->waitForReplication();
                }
                return true;
        }
diff --git a/maintenance/populateCategory.php b/maintenance/populateCategory.php
index 5dccdd6..ec854b8 100644
--- a/maintenance/populateCategory.php
+++ b/maintenance/populateCategory.php
@@ -128,7 +128,7 @@
                        ++$i;
                        if ( !( $i % self::REPORTING_INTERVAL ) ) {
                                $this->output( "$name\n" );
-                               wfWaitForSlaves();
+                               wfGetLBFactory()->waitForReplication();
                        }
                        usleep( $throttle * 1000 );
                }
diff --git a/maintenance/populateContentModel.php 
b/maintenance/populateContentModel.php
index a4fac05..9331986 100644
--- a/maintenance/populateContentModel.php
+++ b/maintenance/populateContentModel.php
@@ -89,7 +89,7 @@
                        [ 'page_id' => $pageIds ],
                        __METHOD__
                );
-               wfWaitForSlaves();
+               wfGetLBFactory()->waitForReplication();
                $this->output( "done.\n" );
        }
 
@@ -227,7 +227,7 @@
                                                        [ $key => $id ],
                                                        __METHOD__
                                                );
-                                               wfWaitForSlaves();
+                                               
wfGetLBFactory()->waitForReplication();
                                                $this->clearCache( 
$row->{$page_id_column}, $row->{$rev_id_column} );
                                                $this->output( "done.\n" );
                                                continue;
diff --git a/maintenance/populateFilearchiveSha1.php 
b/maintenance/populateFilearchiveSha1.php
index cbd969d..a5a7ff1 100644
--- a/maintenance/populateFilearchiveSha1.php
+++ b/maintenance/populateFilearchiveSha1.php
@@ -94,7 +94,7 @@
                        // print status and let replica DBs catch up
                        $this->output( sprintf(
                                "id %d done (up to %d), %5.3f%%  \r", $lastId, 
$endId, $lastId / $endId * 100 ) );
-                       wfWaitForSlaves();
+                       wfGetLBFactory()->waitForReplication();
                } while ( true );
 
                $processingTime = microtime( true ) - $startTime;
diff --git a/maintenance/populateImageSha1.php 
b/maintenance/populateImageSha1.php
index 84b65ee..7c32a9b 100644
--- a/maintenance/populateImageSha1.php
+++ b/maintenance/populateImageSha1.php
@@ -120,7 +120,7 @@
                        if ( $i % $this->getBatchSize() == 0 ) {
                                $this->output( sprintf(
                                        "Done %d of %d, %5.3f%%  \r", $i, 
$numRows, $i / $numRows * 100 ) );
-                               wfWaitForSlaves();
+                               wfGetLBFactory()->waitForReplication();
                        }
 
                        $file = wfLocalFile( $row->img_name );
diff --git a/maintenance/populateLogSearch.php 
b/maintenance/populateLogSearch.php
index 113cc63..4e35610 100644
--- a/maintenance/populateLogSearch.php
+++ b/maintenance/populateLogSearch.php
@@ -161,7 +161,7 @@
                        }
                        $blockStart += $batchSize;
                        $blockEnd += $batchSize;
-                       wfWaitForSlaves();
+                       wfGetLBFactory()->waitForReplication();
                }
                $this->output( "Done populating log_search table.\n" );
 
diff --git a/maintenance/populateLogUsertext.php 
b/maintenance/populateLogUsertext.php
index c5c079a..13ca76d 100644
--- a/maintenance/populateLogUsertext.php
+++ b/maintenance/populateLogUsertext.php
@@ -76,7 +76,7 @@
                        $this->commitTransaction( $db, __METHOD__ );
                        $blockStart += $batchSize;
                        $blockEnd += $batchSize;
-                       wfWaitForSlaves();
+                       wfGetLBFactory()->waitForReplication();
                }
                $this->output( "Done populating log_user_text field.\n" );
 
diff --git a/maintenance/populateParentId.php b/maintenance/populateParentId.php
index 99c2b23..ef600db 100644
--- a/maintenance/populateParentId.php
+++ b/maintenance/populateParentId.php
@@ -119,7 +119,7 @@
                        }
                        $blockStart += $batchSize;
                        $blockEnd += $batchSize;
-                       wfWaitForSlaves();
+                       wfGetLBFactory()->waitForReplication();
                }
                $this->output( "rev_parent_id population complete ... {$count} 
rows [{$changed} changed]\n" );
 
diff --git a/maintenance/populateRecentChangesSource.php 
b/maintenance/populateRecentChangesSource.php
index 04ad255..65c1cf8 100644
--- a/maintenance/populateRecentChangesSource.php
+++ b/maintenance/populateRecentChangesSource.php
@@ -71,7 +71,7 @@
                        );
 
                        $this->output( "." );
-                       wfWaitForSlaves();
+                       wfGetLBFactory()->waitForReplication();
 
                        $blockStart += $batchSize;
                        $blockEnd += $batchSize;
diff --git a/maintenance/populateRevisionLength.php 
b/maintenance/populateRevisionLength.php
index cc1a9f1..757ba77 100644
--- a/maintenance/populateRevisionLength.php
+++ b/maintenance/populateRevisionLength.php
@@ -117,7 +117,7 @@
 
                        $blockStart += $batchSize;
                        $blockEnd += $batchSize;
-                       wfWaitForSlaves();
+                       wfGetLBFactory()->waitForReplication();
                }
 
                return $count;
diff --git a/maintenance/populateRevisionSha1.php 
b/maintenance/populateRevisionSha1.php
index f3506ec..4b0bbc3 100644
--- a/maintenance/populateRevisionSha1.php
+++ b/maintenance/populateRevisionSha1.php
@@ -109,7 +109,7 @@
 
                        $blockStart += $batchSize;
                        $blockEnd += $batchSize;
-                       wfWaitForSlaves();
+                       wfGetLBFactory()->waitForReplication();
                }
 
                return $count;
@@ -135,7 +135,7 @@
                                $updateSize = 0;
                                $this->commitTransaction( $db, __METHOD__ );
                                $this->output( "Commited row with 
ar_timestamp={$row->ar_timestamp}\n" );
-                               wfWaitForSlaves();
+                               wfGetLBFactory()->waitForReplication();
                                $this->beginTransaction( $db, __METHOD__ );
                        }
                }
diff --git a/maintenance/refreshImageMetadata.php 
b/maintenance/refreshImageMetadata.php
index dcfed11..53e8736 100644
--- a/maintenance/refreshImageMetadata.php
+++ b/maintenance/refreshImageMetadata.php
@@ -194,7 +194,7 @@
                                }
                        }
                        $conds2 = [ 'img_name > ' . $dbw->addQuotes( 
$row->img_name ) ];
-                       wfWaitForSlaves();
+                       wfGetLBFactory()->waitForReplication();
                } while ( $res->numRows() === $batchSize );
 
                $total = $upgraded + $leftAlone;
diff --git a/maintenance/refreshLinks.php b/maintenance/refreshLinks.php
index 4fab146..5035389 100644
--- a/maintenance/refreshLinks.php
+++ b/maintenance/refreshLinks.php
@@ -139,7 +139,7 @@
                        foreach ( $res as $row ) {
                                if ( !( ++$i % self::REPORTING_INTERVAL ) ) {
                                        $this->output( "$i\n" );
-                                       wfWaitForSlaves();
+                                       wfGetLBFactory()->waitForReplication();
                                }
                                $this->fixRedirect( $row->page_id );
                        }
@@ -160,7 +160,7 @@
                        foreach ( $res as $row ) {
                                if ( !( ++$i % self::REPORTING_INTERVAL ) ) {
                                        $this->output( "$i\n" );
-                                       wfWaitForSlaves();
+                                       wfGetLBFactory()->waitForReplication();
                                }
                                if ( $redirectsOnly ) {
                                        $this->fixRedirect( $row->page_id );
@@ -180,7 +180,7 @@
                        for ( $id = $start; $id <= $end; $id++ ) {
                                if ( !( $id % self::REPORTING_INTERVAL ) ) {
                                        $this->output( "$id\n" );
-                                       wfWaitForSlaves();
+                                       wfGetLBFactory()->waitForReplication();
                                }
                                $this->fixRedirect( $id );
                        }
@@ -192,7 +192,7 @@
                                for ( $id = $start; $id <= $end; $id++ ) {
                                        if ( !( $id % self::REPORTING_INTERVAL 
) ) {
                                                $this->output( "$id\n" );
-                                               wfWaitForSlaves();
+                                               
wfGetLBFactory()->waitForReplication();
                                        }
                                        self::fixLinksFromArticle( $id, 
$this->namespace );
                                }
@@ -294,7 +294,7 @@
        private function deleteLinksFromNonexistent( $start = null, $end = 
null, $batchSize = 100,
                $chunkSize = 100000
        ) {
-               wfWaitForSlaves();
+               wfGetLBFactory()->waitForReplication();
                $this->output( "Deleting illegal entries from the links 
tables...\n" );
                $dbr = $this->getDB( DB_REPLICA, [ 'vslow' ] );
                do {
@@ -374,7 +374,7 @@
                                        $dbw->delete( $table, [ $field => $ids 
], __METHOD__ );
                                        $this->output( ", $counter" );
                                        $tableStart = $ids[$numIds - 1] + 1;
-                                       wfWaitForSlaves();
+                                       wfGetLBFactory()->waitForReplication();
                                }
 
                        } while ( $numIds >= $batchSize && ( $end === null || 
$tableStart <= $end ) );
@@ -463,7 +463,7 @@
                        foreach ( $res as $row ) {
                                if ( !( ++$i % self::REPORTING_INTERVAL ) ) {
                                        $this->output( "$i\n" );
-                                       wfWaitForSlaves();
+                                       wfGetLBFactory()->waitForReplication();
                                }
                                $lastId = $row->page_id;
                                $timestamp = $row->cl_timestamp;
diff --git a/maintenance/removeInvalidEmails.php 
b/maintenance/removeInvalidEmails.php
index 91025bf..29b152b 100644
--- a/maintenance/removeInvalidEmails.php
+++ b/maintenance/removeInvalidEmails.php
@@ -63,7 +63,7 @@
                                        foreach ( $badIds as $badId ) {
                                                User::newFromId( $badId 
)->invalidateCache();
                                        }
-                                       wfWaitForSlaves();
+                                       wfGetLBFactory()->waitForReplication();
                                } else {
                                        $this->output( "Would have removed 
$badCount emails from the database.\n" );
 
diff --git a/maintenance/resetUserTokens.php b/maintenance/resetUserTokens.php
index 710198b..19f4903 100644
--- a/maintenance/resetUserTokens.php
+++ b/maintenance/resetUserTokens.php
@@ -101,7 +101,7 @@
                        $min = $max;
                        $max = $min + $this->getBatchSize();
 
-                       wfWaitForSlaves();
+                       wfGetLBFactory()->waitForReplication();
                } while ( $min <= $maxid );
        }
 
diff --git a/maintenance/runBatchedQuery.php b/maintenance/runBatchedQuery.php
index b0a2b92..a6783bf 100644
--- a/maintenance/runBatchedQuery.php
+++ b/maintenance/runBatchedQuery.php
@@ -102,7 +102,7 @@
 
                        $affected = $dbw->affectedRows();
                        $this->output( "$affected rows affected\n" );
-                       wfWaitForSlaves();
+                       wfGetLBFactory()->waitForReplication();
                } while ( $res->numRows() );
        }
 
diff --git a/maintenance/sql.php b/maintenance/sql.php
index 8e276e7..6c0fa38 100644
--- a/maintenance/sql.php
+++ b/maintenance/sql.php
@@ -106,7 +106,7 @@
                if ( $this->hasOption( 'query' ) ) {
                        $query = $this->getOption( 'query' );
                        $this->sqlDoQuery( $db, $query, /* dieOnError */ true );
-                       wfWaitForSlaves();
+                       wfGetLBFactory()->waitForReplication();
                        return;
                }
 
@@ -149,7 +149,7 @@
                        $prompt = $newPrompt;
                        $wholeLine = '';
                }
-               wfWaitForSlaves();
+               wfGetLBFactory()->waitForReplication();
        }
 
        protected function sqlDoQuery( IDatabase $db, $line, $dieOnError ) {
diff --git a/maintenance/storage/compressOld.php 
b/maintenance/storage/compressOld.php
index 0ae46ae..789556b 100644
--- a/maintenance/storage/compressOld.php
+++ b/maintenance/storage/compressOld.php
@@ -305,7 +305,7 @@
                # $conds[] = 'page_id=rev_page AND rev_id != page_latest';
 
                for ( $pageId = $startId; $pageId <= $maxPageId; $pageId++ ) {
-                       wfWaitForSlaves();
+                       wfGetLBFactory()->waitForReplication();
 
                        # Wake up
                        $dbr->ping();
@@ -463,7 +463,7 @@
                                $this->output( "/" );
                                $this->commitTransaction( $dbw, __METHOD__ );
                                $i += $thisChunkSize;
-                               wfWaitForSlaves();
+                               wfGetLBFactory()->waitForReplication();
                        }
                        $this->output( "\n" );
                }
diff --git a/maintenance/storage/fixT22757.php 
b/maintenance/storage/fixT22757.php
index e8bd23d..12778f6 100644
--- a/maintenance/storage/fixT22757.php
+++ b/maintenance/storage/fixT22757.php
@@ -258,7 +258,7 @@
                static $iteration = 0;
                ++$iteration;
                if ( ++$iteration > 50 == 0 ) {
-                       wfWaitForSlaves();
+                       wfGetLBFactory()->waitForReplication();
                        $iteration = 0;
                }
        }
diff --git a/maintenance/storage/moveToExternal.php 
b/maintenance/storage/moveToExternal.php
index e117992..90f1c0d 100644
--- a/maintenance/storage/moveToExternal.php
+++ b/maintenance/storage/moveToExternal.php
@@ -66,7 +66,7 @@
 
                if ( !( $block % REPORTING_INTERVAL ) ) {
                        print "oldid=$blockStart, moved=$numMoved\n";
-                       wfWaitForSlaves();
+                       wfGetLBFactory()->waitForReplication();
                }
 
                $res = $dbr->select( 'text', [ 'old_id', 'old_flags', 
'old_text' ],
diff --git a/maintenance/storage/resolveStubs.php 
b/maintenance/storage/resolveStubs.php
index 8ca8bb2..812f63a 100644
--- a/maintenance/storage/resolveStubs.php
+++ b/maintenance/storage/resolveStubs.php
@@ -43,7 +43,7 @@
        $numBlocks = intval( $maxID / $blockSize ) + 1;
 
        for ( $b = 0; $b < $numBlocks; $b++ ) {
-               wfWaitForSlaves();
+               wfGetLBFactory()->waitForReplication();
 
                printf( "%5.2f%%\n", $b / $numBlocks * 100 );
                $start = intval( $maxID / $numBlocks ) * $b + 1;
diff --git a/maintenance/storage/trackBlobs.php 
b/maintenance/storage/trackBlobs.php
index b4514ec..a5a9c29 100644
--- a/maintenance/storage/trackBlobs.php
+++ b/maintenance/storage/trackBlobs.php
@@ -19,7 +19,7 @@
  *
  * @file
  * @ingroup Maintenance
- * @see wfWaitForSlaves()
+ * @see wfGetLBFactory()->waitForReplication();
  */
 
 use Wikimedia\Rdbms\DBConnectionError;
@@ -209,7 +209,7 @@
                        if ( $batchesDone >= $this->reportingInterval ) {
                                $batchesDone = 0;
                                echo "$startId / $endId\n";
-                               wfWaitForSlaves();
+                               wfGetLBFactory()->waitForReplication();
                        }
                }
                echo "Found $rowsInserted revisions\n";
@@ -293,7 +293,7 @@
                        if ( $batchesDone >= $this->reportingInterval ) {
                                $batchesDone = 0;
                                echo "$startId / $endId\n";
-                               wfWaitForSlaves();
+                               wfGetLBFactory()->waitForReplication();
                        }
                }
                echo "Found $rowsInserted orphan text rows\n";
diff --git a/maintenance/tidyUpBug37714.php b/maintenance/tidyUpBug37714.php
index 9d7cc0e..2852ce5 100644
--- a/maintenance/tidyUpBug37714.php
+++ b/maintenance/tidyUpBug37714.php
@@ -38,7 +38,7 @@
                                        [ 'log_id' => $row->log_id ],
                                        __METHOD__
                                );
-                               wfWaitForSlaves();
+                               wfGetLBFactory()->waitForReplication();
                        }
                }
        }
diff --git a/maintenance/update.php b/maintenance/update.php
index 529c069..8bd2abd 100755
--- a/maintenance/update.php
+++ b/maintenance/update.php
@@ -120,7 +120,7 @@
 
                $this->output( "MediaWiki {$wgVersion} Updater\n\n" );
 
-               wfWaitForSlaves();
+               wfGetLBFactory()->waitForReplication();
 
                if ( !$this->hasOption( 'skip-compat-checks' ) ) {
                        $this->compatChecks();
diff --git a/maintenance/updateCollation.php b/maintenance/updateCollation.php
index 84fc2d2..760b5a8 100644
--- a/maintenance/updateCollation.php
+++ b/maintenance/updateCollation.php
@@ -139,7 +139,7 @@
                        } else {
                                $this->output( "Fixing collation for $count 
rows.\n" );
                        }
-                       wfWaitForSlaves();
+                       wfGetLBFactory()->waitForReplication();
                }
                $count = 0;
                $batchCount = 0;
@@ -227,7 +227,7 @@
 
                        if ( !$dryRun && ++$batchCount % self::SYNC_INTERVAL == 
0 ) {
                                $this->output( "Waiting for replica DBs ... " );
-                               wfWaitForSlaves();
+                               wfGetLBFactory()->waitForReplication();
                                $this->output( "done\n" );
                        }
                } while ( $res->numRows() == self::BATCH_SIZE );
diff --git a/maintenance/updateRestrictions.php 
b/maintenance/updateRestrictions.php
index c0b7b10..8ba0e31 100644
--- a/maintenance/updateRestrictions.php
+++ b/maintenance/updateRestrictions.php
@@ -108,7 +108,7 @@
                        }
                        $blockStart += $batchSize - 1;
                        $blockEnd += $batchSize - 1;
-                       wfWaitForSlaves();
+                       wfGetLBFactory()->waitForReplication();
                }
                $this->output( "...removing dead rows from page_restrictions\n" 
);
                // Kill any broken rows from previous imports
diff --git a/maintenance/updateSpecialPages.php 
b/maintenance/updateSpecialPages.php
index 58f23df..3d492d1 100644
--- a/maintenance/updateSpecialPages.php
+++ b/maintenance/updateSpecialPages.php
@@ -128,7 +128,7 @@
                        $this->output( "Reconnected\n\n" );
                }
                # Wait for the replica DB to catch up
-               wfWaitForSlaves();
+               wfGetLBFactory()->waitForReplication();
        }
 
        public function doSpecialPageCacheUpdates( $dbw ) {

-- 
To view, visit https://gerrit.wikimedia.org/r/394537
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I21adcc6076487356d1edd07c1b41c646b9363b62
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Haikalizz <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to