]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/personaltagcloudsection.php
Merge branch '0.7.x' of git://gitorious.org/laconica/mgrdcm-twitapibools into review...
[quix0rs-gnu-social.git] / lib / personaltagcloudsection.php
index 0882822db2a2532e1c44782e89f3138a9dce5adb..978153a84e33cf04a007a853db100b9f773b6fab 100644 (file)
@@ -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 ' .