From 1fdb539b488a25ba8018affbf3dd2cf81b5dd615 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Tue, 3 Apr 2012 17:15:58 -0400 Subject: [PATCH] Squashed commit of the following: commit 6216ef2c9c1ab4bb038177f90b97127e4c2b6d00 Author: Evan Prodromou Date: Tue Apr 3 17:14:07 2012 -0400 filter the notices commit 57fe6c012d380a8f2f8ec505f35e2094e58b4ac4 Author: Evan Prodromou Date: Tue Apr 3 17:08:36 2012 -0400 return value, end condition commit cc985407f89f2d222f3164f8bc14b0764163e83f Author: Evan Prodromou Date: Tue Apr 3 17:06:49 2012 -0400 fix call to count() commit 9efdfde70ea307b7409a4140647f343224cb595f Author: Evan Prodromou Date: Tue Apr 3 17:06:05 2012 -0400 fix class name in pivotGet commit 311599ac117dda8b6cd5f522687322b89dcc909d Author: Evan Prodromou Date: Tue Apr 3 17:03:28 2012 -0400 inboxfix --- lib/inboxnoticestream.php | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/lib/inboxnoticestream.php b/lib/inboxnoticestream.php index 5517cef113..58b0075050 100644 --- a/lib/inboxnoticestream.php +++ b/lib/inboxnoticestream.php @@ -135,4 +135,30 @@ class RawInboxNoticeStream extends NoticeStream return $ids; } + + function getNotices($offset, $limit, $sinceId, $maxId) + { + $all = array(); + + do { + + $ids = $this->getNoticeIds($offset, $limit, $sinceId, $maxId); + + $notices = Memcached_DataObject::pivotGet('Notice', 'id', $ids); + + // By default, takes out false values + + $notices = array_filter($notices); + + $all = array_merge($all, $notices); + + if (count($notices < count($ids))) { + $offset += $limit; + $limit -= count($notices); + } + + } while (count($notices) < count($ids) && count($ids) > 0); + + return new ArrayWrapper($all); + } }