Aaron Schulz has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/312452

Change subject: Use provided transaction ticket in onLinksUpdateComplete()
......................................................................

Use provided transaction ticket in onLinksUpdateComplete()

Change-Id: I7255729c298f317bd944117b9fe5e8eafcc8938b
---
M includes/Hooks.php
1 file changed, 6 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/GeoData 
refs/changes/52/312452/1

diff --git a/includes/Hooks.php b/includes/Hooks.php
index df271e4..133a73c 100644
--- a/includes/Hooks.php
+++ b/includes/Hooks.php
@@ -104,8 +104,9 @@
         * @see https://www.mediawiki.org/wiki/Manual:Hooks/LinksUpdateComplete
         *
         * @param LinksUpdate $linksUpdate
+        * @param int|null $ticket
         */
-       public static function onLinksUpdateComplete( LinksUpdate $linksUpdate 
) {
+       public static function onLinksUpdateComplete( LinksUpdate $linksUpdate, 
$ticket = null ) {
                $out = $linksUpdate->getParserOutput();
                $data = [];
                $coordFromMetadata = self::getCoordinatesIfFile( 
$linksUpdate->getTitle() );
@@ -121,7 +122,7 @@
                        $data[] = $coordFromMetadata;
                }
 
-               self::doLinksUpdate( $data, $linksUpdate->mId );
+               self::doLinksUpdate( $data, $linksUpdate->mId, $ticket );
        }
 
        private static function getCoordinatesIfFile( Title $title ) {
@@ -154,9 +155,10 @@
        /**
         * @param Coord[] $coords
         * @param int $pageId
+        * @param int|null $ticket
         * @throws \DBUnexpectedError
         */
-       private static function doLinksUpdate( array $coords, $pageId ) {
+       private static function doLinksUpdate( array $coords, $pageId, $ticket 
) {
                $services = MediaWikiServices::getInstance();
 
                $add = [];
@@ -185,7 +187,7 @@
 
                $dbw = wfGetDB( DB_MASTER );
                $lbFactory = $services->getDBLoadBalancerFactory();
-               $ticket = $lbFactory->getEmptyTransactionTicket( __METHOD__ );
+               $ticket = $ticket ?: $lbFactory->getEmptyTransactionTicket( 
__METHOD__ );
                $batchSize = $services->getMainConfig()->get( 
'UpdateRowsPerQuery' );
 
                $deleteIds = array_keys( $delete );

-- 
To view, visit https://gerrit.wikimedia.org/r/312452
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7255729c298f317bd944117b9fe5e8eafcc8938b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/GeoData
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <asch...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to