123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- <?php
- defined('GNUSOCIAL') || die();
- class SpamNoticeStream extends ScopingNoticeStream
- {
- public function __construct(Profile $scoped = null)
- {
- parent::__construct(
- new CachingNoticeStream(new RawSpamNoticeStream(), 'spam_score:notice_ids'),
- $scoped
- );
- }
- }
- class RawSpamNoticeStream extends NoticeStream
- {
- public function getNoticeIds($offset, $limit, $since_id, $max_id)
- {
- $ss = new Spam_score();
- $ss->is_spam = true;
- $ss->selectAdd();
- $ss->selectAdd('notice_id');
- Notice::addWhereSinceId($ss, $since_id, 'notice_id');
- Notice::addWhereMaxId($ss, $max_id, 'notice_id');
- $ss->orderBy('notice_created DESC, notice_id DESC');
- if (!is_null($offset)) {
- $ss->limit($offset, $limit);
- }
- $ids = array();
- if ($ss->find()) {
- while ($ss->fetch()) {
- $ids[] = $ss->notice_id;
- }
- }
- return $ids;
- }
- }
|