diff options
author | Zach Copley <zach@status.net> | 2010-09-30 13:59:02 -0700 |
---|---|---|
committer | Zach Copley <zach@status.net> | 2010-09-30 13:59:02 -0700 |
commit | 23c45d6c493ac08341d4c7e259a9c227c1f1970d (patch) | |
tree | bbca87731b1b7338c54942f26eee6e3be95f2a74 /classes/User.php | |
parent | bc2b72a8723054affc4c71ab9ae55cf40aba7447 (diff) | |
parent | 3224f7fec9906b00684851759fcb476517d14e48 (diff) |
Merge branch 'anon-fave-plugin' into 0.9.x
Diffstat (limited to 'classes/User.php')
-rw-r--r-- | classes/User.php | 44 |
1 files changed, 3 insertions, 41 deletions
diff --git a/classes/User.php b/classes/User.php index b85192b29..e784fd9e9 100644 --- a/classes/User.php +++ b/classes/User.php @@ -412,37 +412,8 @@ class User extends Memcached_DataObject function hasFave($notice) { - $cache = common_memcache(); - - // XXX: Kind of a hack. - - if ($cache) { - // This is the stream of favorite notices, in rev chron - // order. This forces it into cache. - - $ids = Fave::stream($this->id, 0, NOTICE_CACHE_WINDOW); - - // If it's in the list, then it's a fave - - if (in_array($notice->id, $ids)) { - return true; - } - - // If we're not past the end of the cache window, - // then the cache has all available faves, so this one - // is not a fave. - - if (count($ids) < NOTICE_CACHE_WINDOW) { - return false; - } - - // Otherwise, cache doesn't have all faves; - // fall through to the default - } - - $fave = Fave::pkeyGet(array('user_id' => $this->id, - 'notice_id' => $notice->id)); - return ((is_null($fave)) ? false : true); + $profile = $this->getProfile(); + return $profile->hasFave($notice); } function mutuallySubscribed($other) @@ -511,17 +482,8 @@ class User extends Memcached_DataObject function blowFavesCache() { - $cache = common_memcache(); - if ($cache) { - // Faves don't happen chronologically, so we need to blow - // ;last cache, too - $cache->delete(common_cache_key('fave:ids_by_user:'.$this->id)); - $cache->delete(common_cache_key('fave:ids_by_user:'.$this->id.';last')); - $cache->delete(common_cache_key('fave:ids_by_user_own:'.$this->id)); - $cache->delete(common_cache_key('fave:ids_by_user_own:'.$this->id.';last')); - } $profile = $this->getProfile(); - $profile->blowFaveCount(); + $profile->blowFavesCache(); } function getSelfTags() |