summaryrefslogtreecommitdiff
path: root/lib/popularnoticesection.php
diff options
context:
space:
mode:
authorBrenda Wallace <shiny@cpan.org>2010-01-09 21:43:25 +0000
committerBrenda Wallace <shiny@cpan.org>2010-01-09 21:43:25 +0000
commit4de09d6bd4eab3259d42fa846e4dd31f2516a038 (patch)
treedf650402df1abcb64e1aa9640eeeb782b3c20f03 /lib/popularnoticesection.php
parentf4459dfedcdea2f2a6078bedf9530deb45b6d52c (diff)
parentf396701b6466749c09ce16b1e7f2f96c10b05cdd (diff)
Merge commit 'origin/0.9.x' into 0.9.x
Diffstat (limited to 'lib/popularnoticesection.php')
-rw-r--r--lib/popularnoticesection.php6
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;
}