From 4d939a399a039c8b2bfebeca13fc97a43a1727de Mon Sep 17 00:00:00 2001 From: Derick Alangi Date: Wed, 3 Jul 2019 13:52:16 +0100 Subject: [PATCH] Avoid usage of deprecated `ObjectCache::getMainWANInstance()` Replacement with services made available in 1.28 and this extension requires 1.31. So, the replacement is good. Change-Id: I1960a36541c9578abc3178a3a5ddcac7c32b8292 --- includes/BaseBlacklist.php | 10 ++++++---- includes/SpamBlacklist.php | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/includes/BaseBlacklist.php b/includes/BaseBlacklist.php index 4605f0e2..7746d3b9 100644 --- a/includes/BaseBlacklist.php +++ b/includes/BaseBlacklist.php @@ -1,5 +1,7 @@ getBlacklistType(); - $cache = ObjectCache::getMainWANInstance(); + $cache = MediaWikiServices::getInstance()->getMainWANObjectCache(); return $cache->getWithSetCallback( $cache->makeKey( 'spamblacklist', $type, 'blacklist-regex' ), @@ -253,7 +255,7 @@ abstract class BaseBlacklist { public function getWhitelists() { $that = $this; $type = $this->getBlacklistType(); - $cache = ObjectCache::getMainWANInstance(); + $cache = MediaWikiServices::getInstance()->getMainWANObjectCache(); return $cache->getWithSetCallback( $cache->makeKey( 'spamblacklist', $type, 'whitelist-regex' ), @@ -282,7 +284,7 @@ abstract class BaseBlacklist { $miss = false; $that = $this; - $cache = ObjectCache::getMainWANInstance(); + $cache = MediaWikiServices::getInstance()->getMainWANObjectCache(); $regexes = $cache->getWithSetCallback( // This used to be cached per-site, but that could be bad on a shared // server where not all wikis have the same configuration. @@ -307,7 +309,7 @@ abstract class BaseBlacklist { public function clearCache() { $listType = $this->getBlacklistType(); - $cache = ObjectCache::getMainWANInstance(); + $cache = MediaWikiServices::getInstance()->getMainWANObjectCache(); $cache->delete( $cache->makeKey( 'spamblacklist', $listType, 'shared-blacklist-regex' ) ); $cache->delete( $cache->makeKey( 'spamblacklist', $listType, 'blacklist-regex' ) ); $cache->delete( $cache->makeKey( 'spamblacklist', $listType, 'whitelist-regex' ) ); diff --git a/includes/SpamBlacklist.php b/includes/SpamBlacklist.php index a6fbaf43..4e5f8a38 100644 --- a/includes/SpamBlacklist.php +++ b/includes/SpamBlacklist.php @@ -271,7 +271,7 @@ class SpamBlacklist extends BaseBlacklist { * @return array */ public function getCurrentLinks( Title $title ) { - $cache = ObjectCache::getMainWANInstance(); + $cache = MediaWikiServices::getInstance()->getMainWANObjectCache(); $fname = __METHOD__; return $cache->getWithSetCallback( // Key is warmed via warmCachesForFilter() from ApiStashEdit