From 18938b1ce8ea73833edc9090fa5c89195698c073 Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Thu, 25 Aug 2016 11:37:38 +1000 Subject: [PATCH] Clear SiteStats process cache after DB update This fixes a phpunit test error, wherein {{NUMBEROFFILES}} would give the number of files in the host wiki, not in the temporary database, when Scribunto was installed, due to a Scribunto phpunit data provider calling SiteStats::pages(). Change-Id: Ic0d021a72addaa2a13a6b94fd34dccc423de3a8f --- includes/SiteStats.php | 4 ++++ includes/deferred/SiteStatsUpdate.php | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/includes/SiteStats.php b/includes/SiteStats.php index 03b4b8cd57..604ab93f7f 100644 --- a/includes/SiteStats.php +++ b/includes/SiteStats.php @@ -36,6 +36,10 @@ class SiteStats { /** @var int[] */ private static $pageCount = []; + static function unload() { + self::$loaded = false; + } + static function recache() { self::load( true ); } diff --git a/includes/deferred/SiteStatsUpdate.php b/includes/deferred/SiteStatsUpdate.php index b8e2726d5a..30aae153dd 100644 --- a/includes/deferred/SiteStatsUpdate.php +++ b/includes/deferred/SiteStatsUpdate.php @@ -122,6 +122,9 @@ class SiteStatsUpdate implements DeferrableUpdate { // Commit the updates and unlock the table $dbw->unlock( $lockKey, __METHOD__ ); } + + // Invalid cache used by parser functions + SiteStats::unload(); } /** @@ -152,6 +155,9 @@ class SiteStatsUpdate implements DeferrableUpdate { __METHOD__ ); + // Invalid cache used by parser functions + SiteStats::unload(); + return $activeUsers; } -- 2.20.1