diff options
author | Zach Copley <zach@controlyourself.ca> | 2009-03-04 16:21:37 -0800 |
---|---|---|
committer | Zach Copley <zach@controlyourself.ca> | 2009-03-04 16:21:37 -0800 |
commit | 77e4fad9fac63151c3eee0c3c785c8cf2fa356fb (patch) | |
tree | 9803f20b702a6233d67bd201166268f9780e5e4e /lib/personaltagcloudsection.php | |
parent | 36bb33fb1d7b4befe2fb68c2eef0712619359293 (diff) | |
parent | e239a5529abc0958c4f874811ff704f1e5d6ba62 (diff) |
Merge branch '0.7.x' of git@gitorious.org:laconica/dev into 0.7.x
Diffstat (limited to 'lib/personaltagcloudsection.php')
-rw-r--r-- | lib/personaltagcloudsection.php | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/personaltagcloudsection.php b/lib/personaltagcloudsection.php index 0882822db..978153a84 100644 --- a/lib/personaltagcloudsection.php +++ b/lib/personaltagcloudsection.php @@ -58,8 +58,14 @@ class PersonalTagCloudSection extends TagCloudSection function getTags() { - $qry = 'SELECT notice_tag.tag, '. - 'sum(exp(-(now() - notice_tag.created)/%s)) as weight ' . + if (common_config('db', 'type') == 'pgsql') { + $weightexpr='sum(exp(-extract(epoch from (now() - notice_tag.created)) / %s))'; + } else { + $weightexpr='sum(exp(-(now() - notice_tag.created) / %s))'; + } + + $qry = 'SELECT notice_tag.tag, '. + $weightexpr . ' as weight ' . 'FROM notice_tag JOIN notice ' . 'ON notice_tag.notice_id = notice.id ' . 'WHERE notice.profile_id = %d ' . |