aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kostikov <max@kostikov.co>2021-01-20 22:28:38 +0100
committerMax Kostikov <max@kostikov.co>2021-01-20 22:28:38 +0100
commit8134e9cae0ebdb551db7d044f8bd5558ca6903cd (patch)
treedbdc47addae45d3b965dfe5e3b0a8aa6a2f4c033
parent70ee41f2529e459d229ccc298cb4c9d8f4db838b (diff)
downloadvolse-hubzilla-8134e9cae0ebdb551db7d044f8bd5558ca6903cd.tar.gz
volse-hubzilla-8134e9cae0ebdb551db7d044f8bd5558ca6903cd.tar.bz2
volse-hubzilla-8134e9cae0ebdb551db7d044f8bd5558ca6903cd.zip
Process channel categories list in background
-rw-r--r--include/contact_widgets.php38
1 files changed, 21 insertions, 17 deletions
diff --git a/include/contact_widgets.php b/include/contact_widgets.php
index 3b22a3c6d..0719d4011 100644
--- a/include/contact_widgets.php
+++ b/include/contact_widgets.php
@@ -71,35 +71,39 @@ function categories_widget($baseurl,$selected = '') {
$item_normal = item_normal();
- $key = __FUNCTION__ . "-" . App::$profile['profile_uid'];
- $content = Cache::get($key, '5 MINUTE');
+ $key = __FUNCTION__ . "-" . App::$profile['profile_uid'];
+ $content = Cache::get($key, '5 MINUTE');
if (! $content) {
- $r = q("select distinct(term.term) from term join item on term.oid = item.id
- where item.uid = %d
- and term.uid = item.uid
- and term.ttype = %d
- and term.otype = %d
- and item.owner_xchan = '%s'
- and item.item_wall = 1
- and item.verb != '%s'
+
+ $content = Cache::get($key, '1 MONTH');
+
+ $arr = [
+ "SELECT distinct(term.term) FROM term JOIN item ON term.oid = item.id
+ WHERE item.uid = %d
+ AND term.uid = item.uid
+ AND term.ttype = %d
+ AND term.otype = %d
+ AND item.owner_xchan = '%s'
+ AND item.item_wall = 1
+ AND item.verb != '%s'
$item_normal
$sql_extra
- order by term.term asc",
+ ORDER BY term.term ASC",
intval(App::$profile['profile_uid']),
intval(TERM_CATEGORY),
intval(TERM_OBJ_POST),
dbesc(App::$profile['channel_hash']),
dbesc(ACTIVITY_UPDATE)
- );
+ ];
+
+ \Zotlabs\Daemon\Master::Summon([ 'Cache_query', $key, $arr ]);
}
- else
- $r = unserialize($content);
- $terms = array();
- if($r && count($r)) {
+ $r = unserialize($content);
- Cache::set($key, serialize($r));
+ $terms = [];
+ if($r && count($r)) {
foreach($r as $rr)
$terms[] = array('name' => $rr['term'], 'selected' => (($selected == $rr['term']) ? 'selected' : ''));