aboutsummaryrefslogtreecommitdiffstats
path: root/include/taxonomy.php
diff options
context:
space:
mode:
authorMax Kostikov <max@kostikov.co>2021-01-20 22:24:00 +0100
committerMax Kostikov <max@kostikov.co>2021-01-20 22:24:00 +0100
commit70ee41f2529e459d229ccc298cb4c9d8f4db838b (patch)
tree29ff28b533be68a467459099e71e91d94caa54d5 /include/taxonomy.php
parent491dffd9b734c1f7aa879cca6e48eae5dc7b3f03 (diff)
downloadvolse-hubzilla-70ee41f2529e459d229ccc298cb4c9d8f4db838b.tar.gz
volse-hubzilla-70ee41f2529e459d229ccc298cb4c9d8f4db838b.tar.bz2
volse-hubzilla-70ee41f2529e459d229ccc298cb4c9d8f4db838b.zip
Process public tags cloud in background
Diffstat (limited to 'include/taxonomy.php')
-rw-r--r--include/taxonomy.php50
1 files changed, 26 insertions, 24 deletions
diff --git a/include/taxonomy.php b/include/taxonomy.php
index e06568d19..5681db88c 100644
--- a/include/taxonomy.php
+++ b/include/taxonomy.php
@@ -354,30 +354,32 @@ function pub_tagadelic($net,$site,$limit,$recent,$safemode,$type) {
$sql_extra .= " and not term.term in ( " . stringify_array($unsafetags,true) . ") ";
}
}
-
-
- $key = __FUNCTION__ . "-" . md5($site . $recent . $safemode . $limit . $type);
- $content = Cache::get($key, '1 MINUTE');
-
- if(! $content) {
- // Fetch tags
- $r = q("SELECT term, count(term) AS total FROM term LEFT JOIN item ON term.oid = item.id
- where term.ttype = %d
- and otype = %d and item_type = %d
- $sql_extra $uids $item_normal
- group by term order by total desc %s",
- intval($type),
- intval(TERM_OBJ_POST),
- intval(ITEM_TYPE_POST),
- ((intval($count)) ? "limit $count" : '')
- );
- } else
- $r = unserialize($content);
-
- if(! $r)
- return array();
- else
- Cache::set($key, serialize($r));
+
+ $key = __FUNCTION__ . "-" . md5($site . $recent . $safemode . $limit . $type);
+
+ $content = Cache::get($key, '1 MINUTE');
+ if(! $content) {
+
+ $content = Cache::get($key, '1 WEEK');
+ $arr = [
+ "SELECT term, count(term) AS total FROM term LEFT JOIN item ON term.oid = item.id
+ WHERE term.ttype = %d
+ AND otype = %d
+ AND item_type = %d
+ $sql_extra $uids $item_normal
+ GROUP BY term ORDER BY total DESC %s",
+ intval($type),
+ intval(TERM_OBJ_POST),
+ intval(ITEM_TYPE_POST),
+ (intval($count) ? "LIMIT $count" : '')
+ ];
+
+ \Zotlabs\Daemon\Master::Summon([ 'Cache_query', $key, $arr ]);
+ }
+
+ $r = unserialize($content);
+ if(! $r)
+ return [];
return Zotlabs\Text\Tagadelic::calc($r);
}