Remove usage of deprecated cache code from Echo

Bug: T221165
Change-Id: Ib7512395b1cc4fd5e13a8d13bd966b1088f34374
This commit is contained in:
Derick Alangi 2019-04-17 12:59:14 +01:00
parent 9208a5b02e
commit 7e5e63b1d5
2 changed files with 11 additions and 5 deletions

View file

@ -609,7 +609,7 @@ class MWEchoNotifUser {
*/
protected function getMemcKey( $key ) {
global $wgEchoCacheVersion;
return wfMemcKey( $key, $this->mUser->getId(), $wgEchoCacheVersion );
return $this->cache->makeKey( $key, $this->mUser->getId(), $wgEchoCacheVersion );
}
/**
@ -625,7 +625,7 @@ class MWEchoNotifUser {
if ( !$globalId ) {
return false;
}
return wfGlobalCacheKey( $key, $globalId, $wgEchoCacheVersion );
return $this->cache->makeGlobalKey( $key, $globalId, $wgEchoCacheVersion );
}
/**

View file

@ -1,5 +1,7 @@
<?php
use MediaWiki\MediaWikiServices;
/**
* A small wrapper around ObjectCache to manage
* storing the last time a user has seen notifications
@ -46,7 +48,7 @@ class EchoSeenTime {
// cache. (T144534)
if ( $c === null ) {
$c = new CachedBagOStuff(
ObjectCache::getMainStashInstance()
MediaWikiServices::getInstance()->getMainObjectStash()
);
}
@ -136,7 +138,9 @@ class EchoSeenTime {
* @return string Memcached key
*/
protected function getMemcKey( $type = 'all' ) {
$localKey = wfMemcKey( 'echo', 'seen', $type, 'time', $this->user->getId() );
$localKey = self::cache()->makeKey(
'echo', 'seen', $type, 'time', $this->user->getId()
);
if ( !$this->user->getOption( 'echo-cross-wiki-notifications' ) ) {
return $localKey;
@ -149,6 +153,8 @@ class EchoSeenTime {
return $localKey;
}
return wfGlobalCacheKey( 'echo', 'seen', $type, 'time', $globalId );
return self::cache()->makeGlobalKey(
'echo', 'seen', $type, 'time', $globalId
);
}
}