summaryrefslogtreecommitdiff
path: root/lib/subs.php
diff options
context:
space:
mode:
authorsarven <csarven@plantard.controlezvous.ca>2009-01-23 08:52:24 +0000
committersarven <csarven@plantard.controlezvous.ca>2009-01-23 08:52:24 +0000
commit0aa2cb35f19fa52160331e9a3846fc9a37a8bc98 (patch)
tree1612445f9c7657f8800191be46312e0ed4e1a5aa /lib/subs.php
parent6c9bbdb56174f106ceeebab9a4b6f0ee452ee17f (diff)
parent9c5ab86d0e9fd318eaa3767651975d85a9ffce1a (diff)
Merge branch 'master' of ../trunk
Diffstat (limited to 'lib/subs.php')
-rw-r--r--lib/subs.php34
1 files changed, 16 insertions, 18 deletions
diff --git a/lib/subs.php b/lib/subs.php
index 6fa1dcad3..0e7b9ded5 100644
--- a/lib/subs.php
+++ b/lib/subs.php
@@ -60,23 +60,22 @@ function subs_subscribe_to($user, $other)
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));
- }
- }
+ $cache = common_memcache();
+
+ if ($cache) {
+ $cache->delete(common_cache_key('user:notices_with_friends:' . $user->id));
+ }
+
if ($other->autosubscribe && !$other->isSubscribed($user) && !$user->hasBlocked($other)) {
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));
- }
- }
+ $cache = common_memcache();
+
+ if ($cache) {
+ $cache->delete(common_cache_key('user:notices_with_friends:' . $other->id));
+ }
subs_notify($user, $other);
}
@@ -134,12 +133,11 @@ function subs_unsubscribe_to($user, $other)
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));
- }
- }
+ $cache = common_memcache();
+
+ if ($cache) {
+ $cache->delete(common_cache_key('user:notices_with_friends:' . $user->id));
+ }
return true;
}