]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
reorder notices when not using memcached
authorEvan Prodromou <evan@status.net>
Wed, 9 Dec 2009 02:02:54 +0000 (21:02 -0500)
committerEvan Prodromou <evan@status.net>
Wed, 9 Dec 2009 02:02:54 +0000 (21:02 -0500)
classes/Notice.php

index bcd7947bd17fa848f5f5535f50e74d22f6e9d27e..c36c5a9c6b771b3dbc9896d63cf01ef9cf507f4f 100644 (file)
@@ -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);
         }
     }