]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/favorited.php
Merge branch 'master' of gitorious.org:statusnet/mainline into 0.9.x
[quix0rs-gnu-social.git] / actions / favorited.php
index 9ffa5b84454093fde32b98460751b60bbab32745..19d49feecfcc8224d7bb9433ac80965f14163351 100644 (file)
@@ -185,26 +185,11 @@ class FavoritedAction extends Action
 
     function showContent()
     {
-        $weightexpr = common_sql_weight('fave.modified', common_config('popular', 'dropoff'));
-
-        $qry = 'SELECT notice.*, '.
-          $weightexpr . ' as weight ' .
-          'FROM notice JOIN fave ON notice.id = fave.notice_id ' .
-          'GROUP BY id,profile_id,uri,content,rendered,url,created,notice.modified,reply_to,is_local,source,notice.conversation ' .
-          'ORDER BY weight DESC';
-
-        $offset = ($this->page - 1) * NOTICES_PER_PAGE;
-        $limit  = NOTICES_PER_PAGE + 1;
-
-        if (common_config('db', 'type') == 'pgsql') {
-            $qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset;
-        } else {
-            $qry .= ' LIMIT ' . $offset . ', ' . $limit;
-        }
-
-        $notice = Memcached_DataObject::cachedQuery('Notice',
-                                                    $qry,
-                                                    600);
+        $pop = new Popularity();
+        $pop->offset = ($this->page - 1) * NOTICES_PER_PAGE;
+        $pop->limit  = NOTICES_PER_PAGE;
+        $pop->expiry = 600;
+        $notice = $pop->getNotices();
 
         $nl = new NoticeList($notice, $this);