From: Reedy Date: Sat, 9 Feb 2019 23:27:14 +0000 (+0000) Subject: Make attachLatest.php wait for DB replica lag X-Git-Tag: 1.34.0-rc.0~2859^2 X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=commitdiff_plain;h=d66d388caad4cbe7ff5926d44398ee394961f644 Make attachLatest.php wait for DB replica lag Change-Id: I4f402ba772d0b0dda8360eaacf11e318f659efc0 --- diff --git a/maintenance/attachLatest.php b/maintenance/attachLatest.php index 897972c75a..4da09018c4 100644 --- a/maintenance/attachLatest.php +++ b/maintenance/attachLatest.php @@ -24,6 +24,8 @@ * @ingroup Maintenance */ +use MediaWiki\MediaWikiServices; + require_once __DIR__ . '/Maintenance.php'; /** @@ -53,6 +55,7 @@ class AttachLatest extends Maintenance { $conds, __METHOD__ ); + $lbFactory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory(); $n = 0; foreach ( $result as $row ) { $pageId = intval( $row->page_id ); @@ -78,6 +81,7 @@ class AttachLatest extends Maintenance { if ( $this->hasOption( 'fix' ) ) { $page = WikiPage::factory( $title ); $page->updateRevisionOn( $dbw, $revision ); + $lbFactory->waitForReplication(); } $n++; }