aboutsummaryrefslogtreecommitdiffstats
path: root/include/contact_widgets.php
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2020-10-25 10:32:07 +0000
committerMario <mario@mariovavti.com>2020-10-25 10:32:07 +0000
commitdd3d65cb1c7b1da18cea01c58df0b731d3e2fb13 (patch)
treec1c0fbe77217af5b24a75fc17b29e74de3ed5007 /include/contact_widgets.php
parent5e19632f2de2fa51cff7ca9a3bd5353593fd7fea (diff)
parent35299ed7c36e7adbc93b8f43076c07fb824c4db5 (diff)
downloadvolse-hubzilla-dd3d65cb1c7b1da18cea01c58df0b731d3e2fb13.tar.gz
volse-hubzilla-dd3d65cb1c7b1da18cea01c58df0b731d3e2fb13.tar.bz2
volse-hubzilla-dd3d65cb1c7b1da18cea01c58df0b731d3e2fb13.zip
Merge branch 'dev' of https://framagit.org/hubzilla/core into dev
Diffstat (limited to 'include/contact_widgets.php')
-rw-r--r--include/contact_widgets.php49
1 files changed, 31 insertions, 18 deletions
diff --git a/include/contact_widgets.php b/include/contact_widgets.php
index 6ad276b00..626a825b2 100644
--- a/include/contact_widgets.php
+++ b/include/contact_widgets.php
@@ -1,6 +1,6 @@
<?php /** @file */
-
+use Zotlabs\Lib\Cache;
function findpeople_widget() {
@@ -59,6 +59,7 @@ function fileas_widget($baseurl,$selected = '') {
));
}
+
function categories_widget($baseurl,$selected = '') {
if(! feature_enabled(App::$profile['profile_uid'],'categories'))
@@ -70,25 +71,36 @@ function categories_widget($baseurl,$selected = '') {
$item_normal = item_normal();
+ $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'
+ $item_normal
+ $sql_extra
+ 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)
+ );
+ }
+ else
+ $r = unserialize($content);
+
$terms = array();
- $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'
- $item_normal
- $sql_extra
- 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)
- );
if($r && count($r)) {
+
+ Cache::set($key, serialize($r));
+
foreach($r as $rr)
$terms[] = array('name' => $rr['term'], 'selected' => (($selected == $rr['term']) ? 'selected' : ''));
@@ -104,6 +116,7 @@ function categories_widget($baseurl,$selected = '') {
return '';
}
+
function cardcategories_widget($baseurl,$selected = '') {
if(! feature_enabled(App::$profile['profile_uid'],'categories'))