[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Fix bogus field reference in Category::getCountMessage() cal...

2017-04-19 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/349144 )

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
---
M includes/Category.php
M includes/CategoryViewer.php
2 files changed, 8 insertions(+), 10 deletions(-)

Approvals:
  Krinkle: Looks good to me, approved
  jenkins-bot: Verified



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/349144
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I40623203e97f7155c2af171a37b1128a59415315
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz 
Gerrit-Reviewer: Krinkle 
Gerrit-Reviewer: jenkins-bot <>

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


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Fix bogus field reference in Category::getCountMessage() cal...

2017-04-19 Thread Aaron Schulz (Code Review)
Aaron Schulz has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/349144 )

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

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

Bug: T162941
Change-Id: I40623203e97f7155c2af171a37b1128a59415315
---
M includes/CategoryViewer.php
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/44/349144/1

diff --git a/includes/CategoryViewer.php b/includes/CategoryViewer.php
index 0205d70..7d3ba74 100644
--- a/includes/CategoryViewer.php
+++ b/includes/CategoryViewer.php
@@ -744,7 +744,7 @@
DeferredUpdates::addCallableUpdate( function () use ( 
$category ) {
# Avoid excess contention on the same category 
(T162121)
$dbw = wfGetDB( DB_MASTER );
-   $name = __METHOD__ . ':' . md5( $this->mName );
+   $name = __METHOD__ . ':' . md5( 
$category->getName() );
$scopedLock = $dbw->getScopedLockAndFlush( 
$name, __METHOD__, 1 );
if ( $scopedLock ) {
$category->refreshCounts();

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I40623203e97f7155c2af171a37b1128a59415315
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz 

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