X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fjobqueue%2Fjobs%2FRefreshLinksJob.php;h=5f33ae045e04d5296ae6f434b91feedafb003a24;hb=65d7d79d1ba09afc362f9e542b7df97b7ecc9c3e;hp=b0dcd57442bfb1f41fc9867ac1b864fb7d7bafcd;hpb=7e350ba150404509d764c96a5ea4dbc9aa51d3ac;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/jobqueue/jobs/RefreshLinksJob.php b/includes/jobqueue/jobs/RefreshLinksJob.php index b0dcd57442..5f33ae045e 100644 --- a/includes/jobqueue/jobs/RefreshLinksJob.php +++ b/includes/jobqueue/jobs/RefreshLinksJob.php @@ -88,7 +88,8 @@ class RefreshLinksJob extends Job { // enqueued will be reflected in backlink page parses when the leaf jobs run. if ( !isset( $params['range'] ) ) { try { - wfGetLBFactory()->waitForReplication( [ + $lbFactory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory(); + $lbFactory->waitForReplication( [ 'wiki' => wfWikiID(), 'timeout' => self::LAG_WAIT_TIMEOUT ] ); @@ -128,13 +129,18 @@ class RefreshLinksJob extends Job { * @return bool */ protected function runForTitle( Title $title ) { - $stats = MediaWikiServices::getInstance()->getStatsdDataFactory(); + $services = MediaWikiServices::getInstance(); + $stats = $services->getStatsdDataFactory(); + $lbFactory = $services->getDBLoadBalancerFactory(); + $ticket = $lbFactory->getEmptyTransactionTicket( __METHOD__ ); $page = WikiPage::factory( $title ); $page->loadPageData( WikiPage::READ_LATEST ); // Serialize links updates by page ID so they see each others' changes - $scopedLock = LinksUpdate::acquirePageLock( wfGetDB( DB_MASTER ), $page->getId(), 'job' ); + $dbw = $lbFactory->getMainLB()->getConnection( DB_MASTER ); + /** @noinspection PhpUnusedLocalVariableInspection */ + $scopedLock = LinksUpdate::acquirePageLock( $dbw, $page->getId(), 'job' ); // Get the latest ID *after* acquirePageLock() flushed the transaction. // This is used to detect edits/moves after loadPageData() but before the scope lock. // The works around the chicken/egg problem of determining the scope lock key. @@ -241,10 +247,7 @@ class RefreshLinksJob extends Job { $parserOutput ); - $factory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory(); - $ticket = $factory->getEmptyTransactionTicket( __METHOD__ ); foreach ( $updates as $key => $update ) { - $update->setTransactionTicket( $ticket ); // FIXME: This code probably shouldn't be here? // Needed by things like Echo notifications which need // to know which user caused the links update @@ -263,7 +266,10 @@ class RefreshLinksJob extends Job { } } - DataUpdate::runUpdates( $updates ); + foreach ( $updates as $update ) { + $update->setTransactionTicket( $ticket ); + $update->doUpdate(); + } InfoAction::invalidateCache( $title );