From: Evan Prodromou Date: Wed, 9 Dec 2009 02:02:54 +0000 (-0500) Subject: reorder notices when not using memcached X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=45408142e9d7431dd4a664262d4806c655cc5c68;p=quix0rs-gnu-social.git reorder notices when not using memcached --- diff --git a/classes/Notice.php b/classes/Notice.php index bcd7947bd1..c36c5a9c6b 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -788,10 +788,24 @@ class Notice extends Memcached_DataObject return $notice; } $notice->whereAdd('id in (' . implode(', ', $ids) . ')'); - $notice->orderBy('id DESC'); $notice->find(); - return $notice; + + $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); } }