Use ObjectCacheFactory instead of deprecated ObjectCache methods

Bug: T363770
Change-Id: I235642d059855a8c5f7296095965687ae73c6efb
This commit is contained in:
Wandji69 2024-05-28 01:24:22 +01:00 committed by Krinkle
parent 40a66cf54f
commit b93b997de5
2 changed files with 5 additions and 5 deletions

View file

@ -7,7 +7,6 @@ use MediaWiki\MediaWikiServices;
use MediaWiki\Revision\SlotRecord; use MediaWiki\Revision\SlotRecord;
use MediaWiki\Title\Title; use MediaWiki\Title\Title;
use MediaWiki\User\User; use MediaWiki\User\User;
use ObjectCache;
use TextContent; use TextContent;
/** /**
@ -374,7 +373,8 @@ abstract class BaseBlacklist {
// FIXME: This is a hack to use Memcached where possible (incl. WMF), // FIXME: This is a hack to use Memcached where possible (incl. WMF),
// but have CACHE_DB as fallback (instead of no cache). // but have CACHE_DB as fallback (instead of no cache).
// This might be a good candidate for T248005. // This might be a good candidate for T248005.
$cache = ObjectCache::getInstance( $wgMessageCacheType ); $services = MediaWikiServices::getInstance()->getObjectCacheFactory();
$cache = $services->getInstance( $wgMessageCacheType );
$listType = $this->getBlacklistType(); $listType = $this->getBlacklistType();
// There are two keys, when the warning key expires, a random thread will refresh // There are two keys, when the warning key expires, a random thread will refresh

View file

@ -10,7 +10,6 @@ use MediaWiki\ExternalLinks\ExternalLinksLookup;
use MediaWiki\MediaWikiServices; use MediaWiki\MediaWikiServices;
use MediaWiki\Title\Title; use MediaWiki\Title\Title;
use MediaWiki\User\User; use MediaWiki\User\User;
use ObjectCache;
use RequestContext; use RequestContext;
use Wikimedia\AtEase\AtEase; use Wikimedia\AtEase\AtEase;
use Wikimedia\Rdbms\Database; use Wikimedia\Rdbms\Database;
@ -62,8 +61,9 @@ class SpamBlacklist extends BaseBlacklist {
$preventLog = false, $preventLog = false,
$mode = 'check' $mode = 'check'
) { ) {
$statsd = MediaWikiServices::getInstance()->getStatsdDataFactory(); $services = MediaWikiServices::getInstance();
$cache = ObjectCache::getLocalClusterInstance(); $statsd = $services->getStatsdDataFactory();
$cache = $services->getObjectCacheFactory()->getLocalClusterInstance();
if ( !$links ) { if ( !$links ) {
return false; return false;