mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-11-12 09:26:05 +00:00
Merge "NotifUser: Un-merge getMemcKey() and getGlobalMemcKey()"
This commit is contained in:
commit
533a58dfcc
|
@ -612,17 +612,24 @@ class MWEchoNotifUser {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build a memcached key.
|
* Build a cache key for local use (local to this wiki)
|
||||||
|
*
|
||||||
* @param string $key Key, typically prefixed with echo-notification-
|
* @param string $key Key, typically prefixed with echo-notification-
|
||||||
* @param bool $global If true, return a global memc key; if false, return one local to this wiki
|
* @return string Cache key
|
||||||
* @return string|false Memcached key, or false if one could not be generated (can only happen for global keys)
|
|
||||||
*/
|
*/
|
||||||
protected function getMemcKey( $key, $global = false ) {
|
protected function getMemcKey( $key ) {
|
||||||
global $wgEchoCacheVersion;
|
global $wgEchoCacheVersion;
|
||||||
if ( !$global ) {
|
|
||||||
return wfMemcKey( $key, $this->mUser->getId(), $wgEchoCacheVersion );
|
return wfMemcKey( $key, $this->mUser->getId(), $wgEchoCacheVersion );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build a cache key for global use
|
||||||
|
*
|
||||||
|
* @param string $key Key, typically prefixed with echo-notification-
|
||||||
|
* @return string|false Memcached key, or false if one could not be generated
|
||||||
|
*/
|
||||||
|
protected function getGlobalMemcKey( $key ) {
|
||||||
|
global $wgEchoCacheVersion;
|
||||||
$lookup = CentralIdLookup::factory();
|
$lookup = CentralIdLookup::factory();
|
||||||
$globalId = $lookup->centralIdFromLocalUser( $this->mUser, CentralIdLookup::AUDIENCE_RAW );
|
$globalId = $lookup->centralIdFromLocalUser( $this->mUser, CentralIdLookup::AUDIENCE_RAW );
|
||||||
if ( !$globalId ) {
|
if ( !$globalId ) {
|
||||||
|
@ -631,10 +638,6 @@ class MWEchoNotifUser {
|
||||||
return wfGlobalCacheKey( $key, $globalId, $wgEchoCacheVersion );
|
return wfGlobalCacheKey( $key, $globalId, $wgEchoCacheVersion );
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getGlobalMemcKey( $key ) {
|
|
||||||
return $this->getMemcKey( $key, true );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Lazy-construct an EchoForeignNotifications instance. This instance is force-enabled, so it
|
* Lazy-construct an EchoForeignNotifications instance. This instance is force-enabled, so it
|
||||||
* returns information about cross-wiki notifications even if the user has them disabled.
|
* returns information about cross-wiki notifications even if the user has them disabled.
|
||||||
|
|
Loading…
Reference in a new issue