X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2Fnoticestream.php;h=0f53daf83f407e15a878d747d1268b972eb451c9;hb=bfe869b8fbb168e2cf7c5ca7f480b12aed6f835a;hp=be28aa61867526f56214ca9ed7f9f6b9534e20a7;hpb=cb183359e23ae7a5cfb483fa06c6c4b7a8b05fff;p=quix0rs-gnu-social.git diff --git a/lib/noticestream.php b/lib/noticestream.php index be28aa6186..0f53daf83f 100644 --- a/lib/noticestream.php +++ b/lib/noticestream.php @@ -46,6 +46,14 @@ if (!defined('STATUSNET')) { */ abstract class NoticeStream { + // Will only get notices with the 'post' activityverb by default. + protected $selectVerbs = array(); + + public function __construct() + { + $this->selectVerbs = array(ActivityVerb::POST, ActivityUtils::resolveUri(ActivityVerb::POST, true)); + } + abstract function getNoticeIds($offset, $limit, $since_id, $max_id); function getNotices($offset, $limit, $sinceId = null, $maxId = null) @@ -59,42 +67,6 @@ abstract class NoticeStream static function getStreamByIds($ids) { - $cache = Cache::instance(); - - if (!empty($cache)) { - $notices = array(); - foreach ($ids as $id) { - $n = Notice::staticGet('id', $id); - if (!empty($n)) { - $notices[] = $n; - } - } - return new ArrayWrapper($notices); - } else { - $notice = new Notice(); - if (empty($ids)) { - //if no IDs requested, just return the notice object - return $notice; - } - $notice->whereAdd('id in (' . implode(', ', $ids) . ')'); - - $notice->find(); - - $temp = array(); - - while ($notice->fetch()) { - $temp[$notice->id] = clone($notice); - } - - $wrapped = array(); - - foreach ($ids as $id) { - if (array_key_exists($id, $temp)) { - $wrapped[] = $temp[$id]; - } - } - - return new ArrayWrapper($wrapped); - } + return Notice::multiGet('id', $ids); } }