Merge "Remove 'Browser default' editfont option"
[lhc/web/wiklou.git] / includes / deferred / LinksUpdate.php
index 072c1e0..dfe89ba 100644 (file)
@@ -102,8 +102,6 @@ class LinksUpdate extends DataUpdate implements EnqueueableDataUpdate {
        private $db;
 
        /**
-        * Constructor
-        *
         * @param Title $title Title of the page we're updating
         * @param ParserOutput $parserOutput Output from a full parse of this page
         * @param bool $recursive Queue jobs for recursive updates?
@@ -194,7 +192,7 @@ class LinksUpdate extends DataUpdate implements EnqueueableDataUpdate {
         * Acquire a lock for performing link table updates for a page on a DB
         *
         * @param IDatabase $dbw
-        * @param integer $pageId
+        * @param int $pageId
         * @param string $why One of (job, atomicity)
         * @return ScopedCallback
         * @throws RuntimeException
@@ -368,20 +366,22 @@ class LinksUpdate extends DataUpdate implements EnqueueableDataUpdate {
                        return;
                }
 
-               $wikiId = $this->getDB()->getWikiID();
+               $domainId = $this->getDB()->getDomainID();
                $wp = WikiPage::factory( $this->mTitle );
                $lbf = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
                // T163801: try to release any row locks to reduce contention
-               $lbf->commitAndWaitForReplication( __METHOD__, $this->ticket, [ 'wiki' => $wikiId ] );
+               $lbf->commitAndWaitForReplication( __METHOD__, $this->ticket, [ 'domain' => $domainId ] );
 
                foreach ( array_chunk( array_keys( $added ), $wgUpdateRowsPerQuery ) as $addBatch ) {
                        $wp->updateCategoryCounts( $addBatch, [], $this->mId );
-                       $lbf->commitAndWaitForReplication( __METHOD__, $this->ticket, [ 'wiki' => $wikiId ] );
+                       $lbf->commitAndWaitForReplication(
+                               __METHOD__, $this->ticket, [ 'domain' => $domainId ] );
                }
 
                foreach ( array_chunk( array_keys( $deleted ), $wgUpdateRowsPerQuery ) as $deleteBatch ) {
                        $wp->updateCategoryCounts( [], $deleteBatch, $this->mId );
-                       $lbf->commitAndWaitForReplication( __METHOD__, $this->ticket, [ 'wiki' => $wikiId ] );
+                       $lbf->commitAndWaitForReplication(
+                               __METHOD__, $this->ticket, [ 'domain' => $domainId ] );
                }
        }
 
@@ -452,10 +452,12 @@ class LinksUpdate extends DataUpdate implements EnqueueableDataUpdate {
                        }
                }
 
+               $domainId = $this->getDB()->getDomainID();
+
                foreach ( $deleteWheres as $deleteWhere ) {
                        $this->getDB()->delete( $table, $deleteWhere, __METHOD__ );
                        $lbf->commitAndWaitForReplication(
-                               __METHOD__, $this->ticket, [ 'wiki' => $this->getDB()->getWikiID() ]
+                               __METHOD__, $this->ticket, [ 'domain' => $domainId ]
                        );
                }
 
@@ -463,7 +465,7 @@ class LinksUpdate extends DataUpdate implements EnqueueableDataUpdate {
                foreach ( $insertBatches as $insertBatch ) {
                        $this->getDB()->insert( $table, $insertBatch, __METHOD__, 'IGNORE' );
                        $lbf->commitAndWaitForReplication(
-                               __METHOD__, $this->ticket, [ 'wiki' => $this->getDB()->getWikiID() ]
+                               __METHOD__, $this->ticket, [ 'domain' => $domainId ]
                        );
                }
 
@@ -550,7 +552,6 @@ class LinksUpdate extends DataUpdate implements EnqueueableDataUpdate {
                foreach ( $diffs as $url => $dummy ) {
                        foreach ( wfMakeUrlIndexes( $url ) as $index ) {
                                $arr[] = [
-                                       'el_id' => $this->getDB()->nextSequenceValue( 'externallinks_el_id_seq' ),
                                        'el_from' => $this->mId,
                                        'el_to' => $url,
                                        'el_index' => $index,
@@ -1146,7 +1147,7 @@ class LinksUpdate extends DataUpdate implements EnqueueableDataUpdate {
                }
 
                return [
-                       'wiki' => $this->getDB()->getWikiID(),
+                       'wiki' => WikiMap::getWikiIdFromDomain( $this->getDB()->getDomainID() ),
                        'job'  => new JobSpecification(
                                'refreshLinksPrioritized',
                                [