From 5890dea4ffca37e9dfa7433d363a8ca4cffb44cf Mon Sep 17 00:00:00 2001 From: Daimona Eaytoy Date: Fri, 23 Oct 2020 16:41:27 +0200 Subject: [PATCH] Deduplicate cache keys used to check blockautopromote Previously, AbuseFilterHooks would proxy the data from a slower backend (db-replicated) to a faster one (hash) reusing the same key. This change makes it use a dedicated key, so that the "main" key can be kept internal inside the upcoming BlockAutopromoteStore. Change-Id: Id46a66991d0e994ee0a83b83b9c95e8951f3041c --- includes/AbuseFilterHooks.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/includes/AbuseFilterHooks.php b/includes/AbuseFilterHooks.php index cb759fa8d..35f7ab40e 100644 --- a/includes/AbuseFilterHooks.php +++ b/includes/AbuseFilterHooks.php @@ -294,9 +294,15 @@ class AbuseFilterHooks { if ( ( $wgAbuseFilterActions['blockautopromote'] ?? false ) && $promote ) { $cache = ObjectCache::getInstance( 'hash' ); - $key = AbuseFilter::autoPromoteBlockKey( $cache, $user ); + // Proxy the blockautopromote data to a faster backend, using an appropriate key + $quickCacheKey = $cache->makeKey( + 'abusefilter', + 'blockautopromote', + 'quick', + $user->getId() + ); $blocked = (bool)$cache->getWithSetCallback( - $key, + $quickCacheKey, $cache::TTL_PROC_LONG, function () use ( $user ) { return AbuseFilter::getAutoPromoteBlockStatus( $user );