diff options
author | Sarven Capadisli <csarven@status.net> | 2010-01-05 01:16:48 +0000 |
---|---|---|
committer | Sarven Capadisli <csarven@status.net> | 2010-01-05 01:16:48 +0000 |
commit | 48289e607bf207b40201075be8b599c0f3fa597e (patch) | |
tree | d310e7091467460905287bc29b33098cf986a906 /lib/popularnoticesection.php | |
parent | eb9514120a882aacae38f8b85a1f431852b44b89 (diff) | |
parent | 440b9957f9ae6fdfdb44c39074803fcdbc64112d (diff) |
Merge branch '0.9.x' of git@gitorious.org:statusnet/mainline into 0.9.x
Diffstat (limited to 'lib/popularnoticesection.php')
-rw-r--r-- | lib/popularnoticesection.php | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/popularnoticesection.php b/lib/popularnoticesection.php index 9fbc9d2dd..fbf9a60ab 100644 --- a/lib/popularnoticesection.php +++ b/lib/popularnoticesection.php @@ -48,17 +48,17 @@ class PopularNoticeSection extends NoticeSection { function getNotices() { + // @fixme there should be a common func for this if (common_config('db', 'type') == 'pgsql') { - $weightexpr='sum(exp(-extract(epoch from (now() - fave.modified)) / %s))'; if (!empty($this->out->tag)) { $tag = pg_escape_string($this->out->tag); } } else { - $weightexpr='sum(exp(-(now() - fave.modified) / %s))'; if (!empty($this->out->tag)) { $tag = mysql_escape_string($this->out->tag); } } + $weightexpr = common_sql_weight('fave.modified', common_config('popular', 'dropoff')); $qry = "SELECT notice.*, $weightexpr as weight "; if(isset($tag)) { $qry .= 'FROM notice_tag, notice JOIN fave ON notice.id = fave.notice_id ' . @@ -78,7 +78,7 @@ class PopularNoticeSection extends NoticeSection $qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset; $notice = Memcached_DataObject::cachedQuery('Notice', - sprintf($qry, common_config('popular', 'dropoff')), + $qry, 1200); return $notice; } |