3 class TaggedProfileNoticeStream extends CachingNoticeStream
5 function __construct($profile, $tag)
7 parent::__construct(new RawTaggedProfileNoticeStream($profile, $tag),
8 'profile:notice_ids_tagged:'.$profile->id.':'.Cache::keyize($tag));
12 class RawTaggedProfileNoticeStream extends NoticeStream
17 function __construct($profile, $tag)
19 $this->profile = $profile;
23 function getNoticeIds($offset, $limit, $since_id, $max_id)
25 // XXX It would be nice to do this without a join
26 // (necessary to do it efficiently on accounts with long history)
28 $notice = new Notice();
31 "select id from notice join notice_tag on id=notice_id where tag='".
32 $notice->escape($this->tag) .
33 "' and profile_id=" . intval($this->profile->id);
35 $since = Notice::whereSinceId($since_id, 'id', 'notice.created');
37 $query .= " and ($since)";
40 $max = Notice::whereMaxId($max_id, 'id', 'notice.created');
42 $query .= " and ($max)";
45 $query .= ' order by notice.created DESC, id DESC';
47 if (!is_null($offset)) {
48 $query .= " LIMIT " . intval($limit) . " OFFSET " . intval($offset);
51 $notice->query($query);
55 while ($notice->fetch()) {