summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Weiske <cweiske@cweiske.de>2011-03-24 08:50:18 +0100
committerChristian Weiske <cweiske@cweiske.de>2011-03-24 08:50:18 +0100
commit3f57237b88688f956add02bc18cd4642082fb526 (patch)
treef8b5d9fb508265c16538106fb8c9f41631bfad08
parent0f481a99ea1dea8ec993c37f0613a48f97463e6b (diff)
downloadsemanticscuttle-3f57237b88688f956add02bc18cd4642082fb526.tar.gz
semanticscuttle-3f57237b88688f956add02bc18cd4642082fb526.tar.bz2
make getPopularTags a tiny bit easier
-rw-r--r--src/SemanticScuttle/Service/Bookmark2Tag.php16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/SemanticScuttle/Service/Bookmark2Tag.php b/src/SemanticScuttle/Service/Bookmark2Tag.php
index 83a8aed..b69cfd4 100644
--- a/src/SemanticScuttle/Service/Bookmark2Tag.php
+++ b/src/SemanticScuttle/Service/Bookmark2Tag.php
@@ -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';