diff options
author | Zach Copley <zach@status.net> | 2010-11-17 22:16:08 +0000 |
---|---|---|
committer | Zach Copley <zach@status.net> | 2010-11-17 22:16:08 +0000 |
commit | 645a4d1754128fdb34e4805ea9aa59f41af8df6f (patch) | |
tree | 10336fb9b33aa12b8bffa03d1d93e2b30d6d7b6d /actions/favorited.php | |
parent | 163f18b8acd59e7343da4bdde9d0a5f5bd762308 (diff) | |
parent | 197b56778a04a1d0f12dabb84e95dc9b80902aeb (diff) |
Merge branch '0.9.x' of git@gitorious.org:statusnet/mainline into 0.9.x
Diffstat (limited to 'actions/favorited.php')
-rw-r--r-- | actions/favorited.php | 28 |
1 files changed, 5 insertions, 23 deletions
diff --git a/actions/favorited.php b/actions/favorited.php index d8980440d..19d49feec 100644 --- a/actions/favorited.php +++ b/actions/favorited.php @@ -185,29 +185,11 @@ class FavoritedAction extends Action function showContent() { - $weightexpr = common_sql_weight('fave.modified', common_config('popular', 'dropoff')); - $cutoff = sprintf("fave.modified > '%s'", - common_sql_date(time() - common_config('popular', 'cutoff'))); - - $qry = 'SELECT notice.*, '. - $weightexpr . ' as weight ' . - 'FROM notice JOIN fave ON notice.id = fave.notice_id ' . - "WHERE $cutoff " . - '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); |