]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/noticestream.php
Merge branch 'mention_branch' into 'nightly'
[quix0rs-gnu-social.git] / lib / noticestream.php
index be28aa61867526f56214ca9ed7f9f6b9534e20a7..01c5ee4a72e56e970aec2db641f26daf63b3300d 100644 (file)
@@ -46,6 +46,19 @@ if (!defined('STATUSNET')) {
  */
 abstract class NoticeStream
 {
+    protected $selectVerbs   = null;    // must be set to array
+    protected $unselectVerbs = null;    // must be set to array
+
+    public function __construct()
+    {
+        if ($this->selectVerbs === null) {
+            $this->selectVerbs = array(ActivityVerb::POST, ActivityUtils::resolveUri(ActivityVerb::POST, true));
+        }
+        if ($this->unselectVerbs === null) {
+            $this->unselectVerbs = array(ActivityVerb::DELETE);
+        }
+    }
+
     abstract function getNoticeIds($offset, $limit, $since_id, $max_id);
 
     function getNotices($offset, $limit, $sinceId = null, $maxId = null)
@@ -59,42 +72,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);
     }
 }