Hashar has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/350011 )

Change subject: Fix bogus field reference in Category::getCountMessage() 
callback
......................................................................


Fix bogus field reference in Category::getCountMessage() callback

Follows-up 922e68f739f143. (T162121)

Bug: T162941
Change-Id: I40623203e97f7155c2af171a37b1128a59415315
(cherry picked from commit 52c3a500284589098d994207ed7cd8bbff528c55)
---
M includes/Category.php
M includes/CategoryViewer.php
2 files changed, 8 insertions(+), 10 deletions(-)

Approvals:
  Hashar: Verified
  20after4: Looks good to me, approved



diff --git a/includes/Category.php b/includes/Category.php
index ece32ea..50ffeec 100644
--- a/includes/Category.php
+++ b/includes/Category.php
@@ -321,6 +321,13 @@
                }
 
                $dbw = wfGetDB( DB_MASTER );
+               # Avoid excess contention on the same category (T162121)
+               $name = __METHOD__ . ':' . md5( $this->mName );
+               $scopedLock = $dbw->getScopedLockAndFlush( $name, __METHOD__, 1 
);
+               if ( !$scopedLock ) {
+                       return;
+               }
+
                $dbw->startAtomic( __METHOD__ );
 
                $cond1 = $dbw->conditional( [ 'page_namespace' => NS_CATEGORY 
], 1, 'NULL' );
diff --git a/includes/CategoryViewer.php b/includes/CategoryViewer.php
index 0205d70..7086a48 100644
--- a/includes/CategoryViewer.php
+++ b/includes/CategoryViewer.php
@@ -740,16 +740,7 @@
                        // to refresh the incorrect category table entry -- 
which should be
                        // quick due to the small number of entries.
                        $totalcnt = $rescnt;
-                       $category = $this->cat;
-                       DeferredUpdates::addCallableUpdate( function () use ( 
$category ) {
-                               # Avoid excess contention on the same category 
(T162121)
-                               $dbw = wfGetDB( DB_MASTER );
-                               $name = __METHOD__ . ':' . md5( $this->mName );
-                               $scopedLock = $dbw->getScopedLockAndFlush( 
$name, __METHOD__, 1 );
-                               if ( $scopedLock ) {
-                                       $category->refreshCounts();
-                               }
-                       } );
+                       DeferredUpdates::addCallableUpdate( [ $this->cat, 
'refreshCounts' ] );
                } else {
                        // Case 3: hopeless.  Don't give a total count at all.
                        // Messages: category-subcat-count-limited, 
category-article-count-limited,

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I40623203e97f7155c2af171a37b1128a59415315
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/core
Gerrit-Branch: wmf/1.29.0-wmf.20
Gerrit-Owner: Hashar <[email protected]>
Gerrit-Reviewer: 20after4 <[email protected]>
Gerrit-Reviewer: Aaron Schulz <[email protected]>
Gerrit-Reviewer: Hashar <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to