]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/noticestream.php
Removed plugin Google-Analytics as this is free/libre and decentralized
[quix0rs-gnu-social.git] / lib / noticestream.php
index b60fc236f706e60e34ffa8d57bf4999ea61f8ceb..3b597fa08cf03899ca42406084fad93dc5c99d8b 100644 (file)
@@ -46,9 +46,18 @@ if (!defined('STATUSNET')) {
  */
 abstract class NoticeStream
 {
-    abstract function getNoticeIds($offset, $limit, $sinceId, $maxId);
+    protected $selectVerbs = array();
+    protected $unselectVerbs = array();
 
-    function getNotices($offset=0, $limit=20, $sinceId=0, $maxId=0)
+    public function __construct()
+    {
+        $this->selectVerbs = array(ActivityVerb::POST, ActivityUtils::resolveUri(ActivityVerb::POST, true));
+        $this->unselectVerbs = array(ActivityVerb::DELETE);
+    }
+
+    abstract function getNoticeIds($offset, $limit, $since_id, $max_id);
+
+    function getNotices($offset, $limit, $sinceId = null, $maxId = null)
     {
         $ids = $this->getNoticeIds($offset, $limit, $sinceId, $maxId);
 
@@ -59,42 +68,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);
     }
 }