3 class RawEventsNoticeStream extends NoticeStream
8 function __construct(Profile $target)
10 $this->target = $target;
13 function getNoticeIds($offset, $limit, $since_id, $max_id)
15 $notice = new Notice();
18 $qry = 'SELECT notice.* FROM notice ';
19 $qry .= 'INNER JOIN happening ON happening.uri = notice.uri ';
20 $qry .= 'WHERE happening.profile_id = ' . $this->target->getID() . ' ';
21 $qry .= 'AND notice.is_local != ' . Notice::GATEWAY . ' ';
24 $qry .= 'AND notice.id > ' . $since_id . ' ';
28 $qry .= 'AND notice.id <= ' . $max_id . ' ';
31 // NOTE: we sort by bookmark time, not by notice time!
32 $qry .= 'ORDER BY created DESC ';
33 if (!is_null($offset)) {
34 $qry .= "LIMIT $limit OFFSET $offset";
39 while ($notice->fetch()) {
49 class EventsNoticeStream extends ScopingNoticeStream
51 function __construct(Profile $target, Profile $scoped=null)
53 $stream = new RawEventsNoticeStream($target);
55 if ($target->sameAs($scoped)) {
56 $key = 'bookmark:ids_by_user_own:'.$target->getID();
58 $key = 'bookmark:ids_by_user:'.$target->getID();
61 parent::__construct(new CachingNoticeStream($stream, $key), $scoped);