X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FCategory.php;h=41ecc65032f8002d9f5aaac4bd17a790c1f54fda;hb=418cb8d9b313a3a8d760bf15d87f0d2557e19cd3;hp=46b86d8cd8583e0bd28990d6e003c3bdc3442c9c;hpb=e03388b39aa68b21cfe566577359cca5bc85a3e4;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Category.php b/includes/Category.php index 46b86d8cd8..41ecc65032 100644 --- a/includes/Category.php +++ b/includes/Category.php @@ -48,7 +48,7 @@ class Category { /** * Set up all member variables using a database query. - * @param int $mode + * @param int $mode One of (Category::LOAD_ONLY, Category::LAZY_INIT_ROW) * @throws MWException * @return bool True on success, false on failure. */ @@ -335,6 +335,16 @@ class Category { $dbw->startAtomic( __METHOD__ ); + // Lock the `category` row before locking `categorylinks` rows to try + // to avoid deadlocks with LinksDeletionUpdate (T195397) + $dbw->selectField( + 'category', + 1, + [ 'cat_title' => $this->mName ], + __METHOD__, + [ 'FOR UPDATE' ] + ); + // Lock all the `categorylinks` records and gaps for this category; // this is a separate query due to postgres/oracle limitations $dbw->selectRowCount(