X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=classes%2FUser.php;h=bea47a3b058c8b70e74230ab5bce6c1b27667517;hb=0535b439445cdfbbefb4fe2b22d4791260e2adec;hp=a01a3106f294608458af4af3b1d878c1afb4612f;hpb=d98ecc760dd8ed3b4d2366aad1c5a36ddf11c710;p=quix0rs-gnu-social.git diff --git a/classes/User.php b/classes/User.php index a01a3106f2..bea47a3b05 100644 --- a/classes/User.php +++ b/classes/User.php @@ -443,7 +443,7 @@ class User extends Memcached_DataObject 'SELECT notice.* ' . 'FROM notice JOIN subscription ON notice.profile_id = subscription.subscribed ' . 'WHERE subscription.subscriber = %d ' . - 'AND notice.is_local != ' . NOTICE_GATEWAY; + 'AND notice.is_local != ' . Notice::GATEWAY; return Notice::getStream(sprintf($qry, $this->id), 'user:notices_with_friends:' . $this->id, $offset, $limit, $since_id, $before_id, @@ -491,7 +491,11 @@ class User extends Memcached_DataObject // ;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(); } function getSelfTags() @@ -600,50 +604,16 @@ class User extends Memcached_DataObject function getSubscriptions($offset=0, $limit=null) { - $qry = - 'SELECT profile.* ' . - 'FROM profile JOIN subscription ' . - 'ON profile.id = subscription.subscribed ' . - 'WHERE subscription.subscriber = %d ' . - 'AND subscription.subscribed != subscription.subscriber ' . - 'ORDER BY subscription.created DESC '; - - if (common_config('db','type') == 'pgsql') { - $qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset; - } else { - $qry .= ' LIMIT ' . $offset . ', ' . $limit; - } - - $profile = new Profile(); - - $profile->query(sprintf($qry, $this->id)); - - return $profile; + $profile = $this->getProfile(); + assert(!empty($profile)); + return $profile->getSubscriptions($offset, $limit); } function getSubscribers($offset=0, $limit=null) { - $qry = - 'SELECT profile.* ' . - 'FROM profile JOIN subscription ' . - 'ON profile.id = subscription.subscriber ' . - 'WHERE subscription.subscribed = %d ' . - 'AND subscription.subscribed != subscription.subscriber ' . - 'ORDER BY subscription.created DESC '; - - if ($offset) { - if (common_config('db','type') == 'pgsql') { - $qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset; - } else { - $qry .= ' LIMIT ' . $offset . ', ' . $limit; - } - } - - $profile = new Profile(); - - $cnt = $profile->query(sprintf($qry, $this->id)); - - return $profile; + $profile = $this->getProfile(); + assert(!empty($profile)); + return $profile->getSubscribers($offset, $limit); } function getTaggedSubscribers($tag, $offset=0, $limit=null)