]> gitweb.fluxo.info Git - semanticscuttle.git/commitdiff
make getPopularTags a tiny bit easier
authorChristian Weiske <cweiske@cweiske.de>
Thu, 24 Mar 2011 07:50:18 +0000 (08:50 +0100)
committerChristian Weiske <cweiske@cweiske.de>
Thu, 24 Mar 2011 07:50:18 +0000 (08:50 +0100)
src/SemanticScuttle/Service/Bookmark2Tag.php

index 83a8aed71d4a8947fbd7fe0567a4f1135ce61dda..b69cfd430e6a75de350eec63502af3d5638ad4d9 100644 (file)
@@ -550,14 +550,6 @@ class SemanticScuttle_Service_Bookmark2Tag extends SemanticScuttle_DbService
             $privacy = '';
         }
 
-        if (is_null($days) || !is_int($days)) {
-            $span = '';
-        } else {
-            $span = ' AND B.bDatetime > "'
-                . date('Y-m-d H:i:s', time() - (86400 * $days))
-                . '"';
-        }
-
         $query = 'SELECT'
             . ' T.tag, COUNT(T.bId) AS bCount'
             . ' FROM '
@@ -579,7 +571,13 @@ class SemanticScuttle_Service_Bookmark2Tag extends SemanticScuttle_DbService
                 . ' AND B.bId = T.bId' . $privacy;
         }
 
-        $query .= $span . ' AND LEFT(T.tag, 7) <> "system:"'
+        if (is_int($days)) {
+            $query .= ' AND B.bDatetime > "'
+                . date('Y-m-d H:i:s', time() - (86400 * $days))
+                . '"';
+        }
+
+        $query .= ' AND LEFT(T.tag, 7) <> "system:"'
             . ' GROUP BY T.tag'
             . ' ORDER BY bCount DESC, tag';