From: Tim Starling Date: Thu, 25 Aug 2016 01:37:38 +0000 (+1000) Subject: Clear SiteStats process cache after DB update X-Git-Tag: 1.31.0-rc.0~5902 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/%7B%7B%20url_for%28%27admin_users%27%29%20%7D%7D?a=commitdiff_plain;h=18938b1ce8ea73833edc9090fa5c89195698c073;p=lhc%2Fweb%2Fwiklou.git 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 --- 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; }