Make attachLatest.php wait for DB replica lag

Change-Id: I4f402ba772d0b0dda8360eaacf11e318f659efc0
This commit is contained in:
Reedy 2019-02-09 23:27:14 +00:00
parent 2cae063de0
commit d66d388caa

View file

@ -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++;
}