From: Aaron Schulz Date: Fri, 3 Jun 2016 05:07:58 +0000 (-0700) Subject: Avoid DBPerformance warnings in Category::initialize() X-Git-Tag: 1.31.0-rc.0~6716^2 X-Git-Url: http://git.cyclocoop.org/data/modifier.php?a=commitdiff_plain;h=29b0524b4eb5ec3642883e9c414b15c4acf5b75a;p=lhc%2Fweb%2Fwiklou.git Avoid DBPerformance warnings in Category::initialize() Use DeferredUpdates and zero-out negative values in the meantime. Bug: T92357 Change-Id: Ia1339395b70b042edba6dc1d570acb92c90a287b --- diff --git a/includes/Category.php b/includes/Category.php index 6209a1a9ea..28b566a7f9 100644 --- a/includes/Category.php +++ b/includes/Category.php @@ -95,7 +95,11 @@ class Category { # 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 ) { - $this->refreshCounts(); + $this->mPages = max( $this->mPages, 0 ); + $this->mSubcats = max( $this->mSubcats, 0 ); + $this->mFiles = max( $this->mFiles, 0 ); + + DeferredUpdates::addCallableUpdate( [ $this, 'refreshCounts' ] ); } return true;