subscriptions clear user with-friends cache, too
darcs-hash:20080915071500-84dde-765c8c289d5cf7f71c2a49967bde4ecda28d9ea8.gz
This commit is contained in:
parent
df724990bd
commit
d86f954797
22
lib/subs.php
22
lib/subs.php
@ -43,15 +43,28 @@ function subs_subscribe_user($user,$other_nickname) {
|
||||
|
||||
subs_notify($other, $user);
|
||||
|
||||
if (common_config('memcached', 'enabled')) {
|
||||
$cache = new Memcache();
|
||||
if ($cache->connect(common_config('memcached', 'server'), common_config('memcached', 'port'))) {
|
||||
$cache->delete(common_cache_key('user:notices_with_friends:' . $user->id));
|
||||
}
|
||||
}
|
||||
|
||||
if ($other->autosubscribe && !$other->isSubscribed($user)) {
|
||||
if (!$other->subscribeTo($user)) {
|
||||
return _('Could not subscribe other to you.');
|
||||
}
|
||||
if (common_config('memcached', 'enabled')) {
|
||||
$cache = new Memcache();
|
||||
if ($cache->connect(common_config('memcached', 'server'), common_config('memcached', 'port'))) {
|
||||
$cache->delete(common_cache_key('user:notices_with_friends:' . $other->id));
|
||||
}
|
||||
}
|
||||
|
||||
subs_notify($user, $other);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
function subs_notify($listenee, $listener) {
|
||||
@ -90,6 +103,13 @@ function subs_unsubscribe_user($user, $other_nickname) {
|
||||
if (!$sub->delete())
|
||||
return _('Couldn\'t delete subscription.');
|
||||
|
||||
if (common_config('memcached', 'enabled')) {
|
||||
$cache = new Memcache();
|
||||
if ($cache->connect(common_config('memcached', 'server'), common_config('memcached', 'port'))) {
|
||||
$cache->delete(common_cache_key('user:notices_with_friends:' . $user->id));
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user