whitespace conflicts in User.php
darcs-hash:20081211163434-5ed1f-38d9bf093db72d27837cbfe76d46fd518adc3bb6.gz
This commit is contained in:
parent
e85835d0d3
commit
35bc21d3bb
|
@ -289,13 +289,11 @@ class User extends Memcached_DataObject
|
||||||
$cache = common_memcache();
|
$cache = common_memcache();
|
||||||
|
|
||||||
# XXX: Kind of a hack.
|
# XXX: Kind of a hack.
|
||||||
|
|
||||||
if ($cache) {
|
if ($cache) {
|
||||||
# This is the stream of favorite notices, in rev chron
|
# This is the stream of favorite notices, in rev chron
|
||||||
# order. This forces it into cache.
|
# order. This forces it into cache.
|
||||||
$faves = $this->favoriteNotices(0, NOTICE_CACHE_WINDOW);
|
$faves = $this->favoriteNotices(0, NOTICE_CACHE_WINDOW);
|
||||||
$cnt = 0;
|
$cnt = 0;
|
||||||
|
|
||||||
while ($faves->fetch()) {
|
while ($faves->fetch()) {
|
||||||
if ($faves->id < $notice->id) {
|
if ($faves->id < $notice->id) {
|
||||||
# If we passed it, it's not a fave
|
# If we passed it, it's not a fave
|
||||||
|
@ -315,12 +313,10 @@ class User extends Memcached_DataObject
|
||||||
# Otherwise, cache doesn't have all faves;
|
# Otherwise, cache doesn't have all faves;
|
||||||
# fall through to the default
|
# fall through to the default
|
||||||
}
|
}
|
||||||
|
|
||||||
$fave = Fave::pkeyGet(array('user_id' => $this->id,
|
$fave = Fave::pkeyGet(array('user_id' => $this->id,
|
||||||
'notice_id' => $notice->id));
|
'notice_id' => $notice->id));
|
||||||
return ((is_null($fave)) ? false : true);
|
return ((is_null($fave)) ? false : true);
|
||||||
}
|
}
|
||||||
|
|
||||||
function mutuallySubscribed($other) {
|
function mutuallySubscribed($other) {
|
||||||
return $this->isSubscribed($other) &&
|
return $this->isSubscribed($other) &&
|
||||||
$other->isSubscribed($this);
|
$other->isSubscribed($this);
|
||||||
|
@ -329,13 +325,11 @@ class User extends Memcached_DataObject
|
||||||
function mutuallySubscribedUsers() {
|
function mutuallySubscribedUsers() {
|
||||||
|
|
||||||
# 3-way join; probably should get cached
|
# 3-way join; probably should get cached
|
||||||
|
|
||||||
$qry = 'SELECT user.* ' .
|
$qry = 'SELECT user.* ' .
|
||||||
'FROM subscription sub1 JOIN user ON sub1.subscribed = user.id ' .
|
'FROM subscription sub1 JOIN user ON sub1.subscribed = user.id ' .
|
||||||
'JOIN subscription sub2 ON user.id = sub2.subscriber ' .
|
'JOIN subscription sub2 ON user.id = sub2.subscriber ' .
|
||||||
'WHERE sub1.subscriber = %d and sub2.subscribed = %d ' .
|
'WHERE sub1.subscriber = %d and sub2.subscribed = %d ' .
|
||||||
'ORDER BY user.nickname';
|
'ORDER BY user.nickname';
|
||||||
|
|
||||||
$user = new User();
|
$user = new User();
|
||||||
$user->query(sprintf($qry, $this->id, $this->id));
|
$user->query(sprintf($qry, $this->id, $this->id));
|
||||||
|
|
||||||
|
@ -347,21 +341,18 @@ class User extends Memcached_DataObject
|
||||||
'SELECT notice.* ' .
|
'SELECT notice.* ' .
|
||||||
'FROM notice JOIN reply ON notice.id = reply.notice_id ' .
|
'FROM notice JOIN reply ON notice.id = reply.notice_id ' .
|
||||||
'WHERE reply.profile_id = %d ';
|
'WHERE reply.profile_id = %d ';
|
||||||
|
|
||||||
return Notice::getStream(sprintf($qry, $this->id),
|
return Notice::getStream(sprintf($qry, $this->id),
|
||||||
'user:replies:'.$this->id,
|
'user:replies:'.$this->id,
|
||||||
$offset, $limit, $since_id, $before_id, NULL, $since);
|
$offset, $limit, $since_id, $before_id, NULL, $since);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getNotices($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=NULL) {
|
function getNotices($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=NULL) {
|
||||||
$qry =
|
$profile = $this->getProfile();
|
||||||
'SELECT * ' .
|
if (!$profile) {
|
||||||
'FROM notice ' .
|
return NULL;
|
||||||
'WHERE profile_id = %d ';
|
} else {
|
||||||
|
return $profile->getNotices($offset, $limit, $since_id, $before_id);
|
||||||
return Notice::getStream(sprintf($qry, $this->id),
|
}
|
||||||
'user:notices:'.$this->id,
|
|
||||||
$offset, $limit, $since_id, $before_id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function favoriteNotices($offset=0, $limit=NOTICES_PER_PAGE) {
|
function favoriteNotices($offset=0, $limit=NOTICES_PER_PAGE) {
|
||||||
|
@ -369,7 +360,6 @@ class User extends Memcached_DataObject
|
||||||
'SELECT notice.* ' .
|
'SELECT notice.* ' .
|
||||||
'FROM notice JOIN fave ON notice.id = fave.notice_id ' .
|
'FROM notice JOIN fave ON notice.id = fave.notice_id ' .
|
||||||
'WHERE fave.user_id = %d ';
|
'WHERE fave.user_id = %d ';
|
||||||
|
|
||||||
return Notice::getStream(sprintf($qry, $this->id),
|
return Notice::getStream(sprintf($qry, $this->id),
|
||||||
'user:faves:'.$this->id,
|
'user:faves:'.$this->id,
|
||||||
$offset, $limit);
|
$offset, $limit);
|
||||||
|
@ -390,6 +380,7 @@ class User extends Memcached_DataObject
|
||||||
$order = NULL;
|
$order = NULL;
|
||||||
} else if ($enabled === true ||
|
} else if ($enabled === true ||
|
||||||
($enabled == 'transitional' && $this->inboxed == 1)) {
|
($enabled == 'transitional' && $this->inboxed == 1)) {
|
||||||
|
|
||||||
$qry =
|
$qry =
|
||||||
'SELECT notice.* ' .
|
'SELECT notice.* ' .
|
||||||
'FROM notice JOIN notice_inbox ON notice.id = notice_inbox.notice_id ' .
|
'FROM notice JOIN notice_inbox ON notice.id = notice_inbox.notice_id ' .
|
||||||
|
@ -397,7 +388,6 @@ class User extends Memcached_DataObject
|
||||||
# NOTE: we override ORDER
|
# NOTE: we override ORDER
|
||||||
$order = 'ORDER BY notice_inbox.created DESC, notice_inbox.notice_id DESC ';
|
$order = 'ORDER BY notice_inbox.created DESC, notice_inbox.notice_id DESC ';
|
||||||
}
|
}
|
||||||
|
|
||||||
return Notice::getStream(sprintf($qry, $this->id),
|
return Notice::getStream(sprintf($qry, $this->id),
|
||||||
'user:notices_with_friends:' . $this->id,
|
'user:notices_with_friends:' . $this->id,
|
||||||
$offset, $limit, $since_id, $before_id,
|
$offset, $limit, $since_id, $before_id,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user