From: Aaron Schulz Date: Thu, 3 Jan 2013 00:56:00 +0000 (-0800) Subject: Added $wgMaxBacklinksInvalidate to avoid massive html cache invalidation. X-Git-Tag: 1.31.0-rc.0~21126 X-Git-Url: https://git.cyclocoop.org/%242?a=commitdiff_plain;h=b23188b8adc15c477b1cecc138af2f35c95d82e8;p=lhc%2Fweb%2Fwiklou.git Added $wgMaxBacklinksInvalidate to avoid massive html cache invalidation. Change-Id: I4fadded0e351883a907d307d64af31cdc6164240 --- diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 3fe76fc264..aae3d5a381 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -6169,6 +6169,15 @@ $wgUpdateRowsPerJob = 500; */ $wgUpdateRowsPerQuery = 100; +/** + * Do not purge all the pages that use a page when it is edited + * if there are more than this many such pages. This is used to + * avoid invalidating a large portion of the squid/parser cache. + * + * This setting should factor in any squid/parser cache expiry settings. + */ +$wgMaxBacklinksInvalidate = false; + /** @} */ # End job queue } /************************************************************************//** diff --git a/includes/cache/HTMLCacheUpdate.php b/includes/cache/HTMLCacheUpdate.php index 791ae3e8b9..8962cf345b 100644 --- a/includes/cache/HTMLCacheUpdate.php +++ b/includes/cache/HTMLCacheUpdate.php @@ -46,6 +46,8 @@ class HTMLCacheUpdate implements DeferrableUpdate { } public function doUpdate() { + global $wgMaxBacklinksInvalidate; + wfProfileIn( __METHOD__ ); $job = new HTMLCacheUpdateJob( @@ -58,7 +60,9 @@ class HTMLCacheUpdate implements DeferrableUpdate { ); $count = $this->mTitle->getBacklinkCache()->getNumLinks( $this->mTable, 200 ); - if ( $count >= 200 ) { // many backlinks + if ( $wgMaxBacklinksInvalidate !== false && $count > $wgMaxBacklinksInvalidate ) { + wfDebug( "Skipped HTML cache invalidation of {$this->mTitle->getPrefixedText}." ); + } elseif ( $count >= 200 ) { // many backlinks JobQueueGroup::singleton()->push( $job ); JobQueueGroup::singleton()->deduplicateRootJob( $job ); } else { // few backlinks ($count might be off even if 0)