3 class FaveNoticeStream extends CachingNoticeStream
5 function __construct($user_id, $own)
7 $stream = new RawFaveNoticeStream($user_id, $own);
9 $key = 'fave:ids_by_user_own:'.$user_id;
11 $key = 'fave:ids_by_user:'.$user_id;
13 parent::__construct($stream, $key);
17 class RawFaveNoticeStream extends NoticeStream
22 function __construct($user_id, $own)
24 $this->user_id = $user_id;
29 * Note that the sorting for this is by order of *fave* not order of *notice*.
31 * @fixme add since_id, max_id support?
33 * @param <type> $user_id
35 * @param <type> $offset
36 * @param <type> $limit
37 * @param <type> $since_id
38 * @param <type> $max_id
41 function getNoticeIds($offset, $limit, $since_id, $max_id)
47 $qry = 'SELECT fave.* FROM fave ';
48 $qry .= 'WHERE fave.user_id = ' . $this->user_id . ' ';
50 $qry = 'SELECT fave.* FROM fave ';
51 $qry .= 'INNER JOIN notice ON fave.notice_id = notice.id ';
52 $qry .= 'WHERE fave.user_id = ' . $this->user_id . ' ';
53 $qry .= 'AND notice.is_local != ' . Notice::GATEWAY . ' ';
57 $qry .= 'AND notice_id > ' . $since_id . ' ';
61 $qry .= 'AND notice_id <= ' . $max_id . ' ';
64 // NOTE: we sort by fave time, not by notice time!
66 $qry .= 'ORDER BY modified DESC ';
68 if (!is_null($offset)) {
69 $qry .= "LIMIT $limit OFFSET $offset";
76 while ($fav->fetch()) {
77 $ids[] = $fav->notice_id;