3 if (!defined('GNUSOCIAL')) { exit(1); }
5 class RawBookmarksNoticeStream extends NoticeStream
10 function __construct($user_id, $own)
12 $this->user_id = $user_id;
16 function getNoticeIds($offset, $limit, $since_id, $max_id)
18 $notice = new Notice();
21 $qry = 'SELECT notice.* FROM notice ';
22 $qry .= 'INNER JOIN bookmark ON bookmark.uri = notice.uri ';
23 $qry .= 'WHERE bookmark.profile_id = ' . $this->user_id . ' ';
24 $qry .= 'AND notice.is_local != ' . Notice::GATEWAY . ' ';
27 $qry .= 'AND notice.id > ' . $since_id . ' ';
31 $qry .= 'AND notice.id <= ' . $max_id . ' ';
34 // NOTE: we sort by bookmark time, not by notice time!
35 $qry .= 'ORDER BY created DESC ';
36 if (!is_null($offset)) {
37 $qry .= "LIMIT $limit OFFSET $offset";
42 while ($notice->fetch()) {
53 * Notice stream for bookmarks
57 * @author Stephane Berube <chimo@chromic.org>
58 * @copyright 2011 StatusNet, Inc.
59 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
60 * @link http://status.net/
63 class BookmarksNoticeStream extends ScopingNoticeStream
65 function __construct($user_id, $own, Profile $scoped=null)
67 $stream = new RawBookmarksNoticeStream($user_id, $own);
70 $key = 'bookmark:ids_by_user_own:'.$user_id;
72 $key = 'bookmark:ids_by_user:'.$user_id;
75 parent::__construct(new CachingNoticeStream($stream, $key), $scoped);