X-Git-Url: https://git.cyclocoop.org/%242?a=blobdiff_plain;f=maintenance%2FattachLatest.php;h=e1d7fca7e7fab9f4715ed0a10ac7e3ed8d6d3a9e;hb=260a734173bcc6b414aafb92de559505fe47bafc;hp=36060d8371c473202d4026098dbd0db2776f1f06;hpb=c340c41b37b5079ba90489f6b212bb8e4642031a;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/attachLatest.php b/maintenance/attachLatest.php index 36060d8371..e1d7fca7e7 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,9 @@ class AttachLatest extends Maintenance { $conds, __METHOD__ ); + $lbFactory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory(); + $dbDomain = $lbFactory->getLocalDomainID(); + $n = 0; foreach ( $result as $row ) { $pageId = intval( $row->page_id ); @@ -63,21 +68,23 @@ class AttachLatest extends Maintenance { [ 'rev_page' => $pageId ], __METHOD__ ); if ( !$latestTime ) { - $this->output( wfWikiID() . " $pageId [[$name]] can't find latest rev time?!\n" ); + $this->output( "$dbDomain $pageId [[$name]] can't find latest rev time?!\n" ); continue; } $revision = Revision::loadFromTimestamp( $dbw, $title, $latestTime ); if ( is_null( $revision ) ) { - $this->output( wfWikiID() - . " $pageId [[$name]] latest time $latestTime, can't find revision id\n" ); + $this->output( + "$dbDomain $pageId [[$name]] latest time $latestTime, can't find revision id\n" + ); continue; } $id = $revision->getId(); - $this->output( wfWikiID() . " $pageId [[$name]] latest time $latestTime, rev id $id\n" ); + $this->output( "$dbDomain $pageId [[$name]] latest time $latestTime, rev id $id\n" ); if ( $this->hasOption( 'fix' ) ) { $page = WikiPage::factory( $title ); $page->updateRevisionOn( $dbw, $revision ); + $lbFactory->waitForReplication(); } $n++; } @@ -88,5 +95,5 @@ class AttachLatest extends Maintenance { } } -$maintClass = "AttachLatest"; +$maintClass = AttachLatest::class; require_once RUN_MAINTENANCE_IF_MAIN;