X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=classes%2FNotice_tag.php;h=809403a9bd99ac89be0785ad0e1c01655f15d307;hb=8b0f45d0a715fd25beb0aef9d42de3b91c5cd1ca;hp=9ade36c34a7dfc0cdf0e8a63b548b3db6f643724;hpb=3593f3f1323bfce289bc9805629f7d126dac7ae6;p=quix0rs-gnu-social.git diff --git a/classes/Notice_tag.php b/classes/Notice_tag.php index 9ade36c34a..809403a9bd 100644 --- a/classes/Notice_tag.php +++ b/classes/Notice_tag.php @@ -36,48 +36,11 @@ class Notice_tag extends Memcached_DataObject /* the code above is auto generated do not remove the tag below */ ###END_AUTOCODE - static function getStream($tag, $offset=0, $limit=20) { - - $ids = Notice::stream(array('Notice_tag', '_streamDirect'), - array($tag), - 'notice_tag:notice_ids:' . Cache::keyize($tag), - $offset, $limit); - - return Notice::getStreamByIds($ids); - } - - function _streamDirect($tag, $offset, $limit, $since_id, $max_id) + static function getStream($tag, $offset=0, $limit=20, $sinceId=0, $maxId=0) { - $nt = new Notice_tag(); - - $nt->tag = $tag; - - $nt->selectAdd(); - $nt->selectAdd('notice_id'); - - if ($since_id != 0) { - $nt->whereAdd('notice_id > ' . $since_id); - } - - if ($max_id != 0) { - $nt->whereAdd('notice_id < ' . $max_id); - } - - $nt->orderBy('notice_id DESC'); - - if (!is_null($offset)) { - $nt->limit($offset, $limit); - } - - $ids = array(); - - if ($nt->find()) { - while ($nt->fetch()) { - $ids[] = $nt->notice_id; - } - } - - return $ids; + $stream = new TagNoticeStream($tag); + + return $stream->getNotices($offset, $limit, $sinceId, $maxId); } function blowCache($blowLast=false) @@ -92,4 +55,19 @@ class Notice_tag extends Memcached_DataObject { return Memcached_DataObject::pkeyGet('Notice_tag', $kv); } + + static function url($tag) + { + if (common_config('singleuser', 'enabled')) { + // regular TagAction isn't set up in 1user mode + $nickname = User::singleUserNickname(); + $url = common_local_url('showstream', + array('nickname' => $nickname, + 'tag' => $tag)); + } else { + $url = common_local_url('tag', array('tag' => $tag)); + } + + return $url; + } }