X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FCategory.php;h=50ffeec1c8aba5145eaa22556dc9f0d7c32b4e1a;hb=97a8fb78faa4ca2d9604140e5547f5deae5a2524;hp=d558dbc44dbc32268bda0e8d60889260ecdfc6d9;hpb=e968a1f431ad058dcb14adb2757bde5664b99a79;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Category.php b/includes/Category.php index d558dbc44d..50ffeec1c8 100644 --- a/includes/Category.php +++ b/includes/Category.php @@ -96,7 +96,7 @@ class Category { $this->mSubcats = $row->cat_subcats; $this->mFiles = $row->cat_files; - # (bug 13683) If the count is negative, then 1) it's obviously wrong + # (T15683) If the count is negative, then 1) it's obviously wrong # and should not be kept, and 2) we *probably* don't have to scan many # rows to obtain the correct figure, so let's risk a one-time recount. if ( $this->mPages < 0 || $this->mSubcats < 0 || $this->mFiles < 0 ) { @@ -321,6 +321,13 @@ class Category { } $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' );