3 class FileNoticeStream extends CachingNoticeStream
5 function __construct($file)
7 parent::__construct(new RawFileNoticeStream($file),
8 'file:notice-ids:'.$this->url);
12 class RawFileNoticeStream extends NoticeStream
14 protected $file = null;
16 function __construct($file)
19 parent::__construct();
23 * Stream of notices linking to this URL
25 * @param integer $offset Offset to show; default is 0
26 * @param integer $limit Limit of notices to show
27 * @param integer $since_id Since this notice
28 * @param integer $max_id Before this notice
30 * @return array ids of notices that link to this file
32 function getNoticeIds($offset, $limit, $since_id, $max_id)
34 $f2p = new File_to_post();
37 $f2p->selectAdd('post_id');
39 $f2p->file_id = $this->file->id;
41 Notice::addWhereSinceId($f2p, $since_id, 'post_id', 'modified');
42 Notice::addWhereMaxId($f2p, $max_id, 'post_id', 'modified');
44 $f2p->orderBy('modified DESC, post_id DESC');
46 if (!is_null($offset)) {
47 $f2p->limit($offset, $limit);
53 while ($f2p->fetch()) {
54 $ids[] = $f2p->post_id;