aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Module/Sse_bs.php
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2022-11-15 21:22:10 +0000
committerMario <mario@mariovavti.com>2022-11-15 21:22:10 +0000
commitc392a77b46958555bc16592fe4d57e9ab0b7e126 (patch)
treebcb9767aa34814c9199ed42e899e1174d1543afd /Zotlabs/Module/Sse_bs.php
parent08c2c9bc22b5cffc21e8f7d7ea1cda30c2e1af93 (diff)
downloadvolse-hubzilla-c392a77b46958555bc16592fe4d57e9ab0b7e126.tar.gz
volse-hubzilla-c392a77b46958555bc16592fe4d57e9ab0b7e126.tar.bz2
volse-hubzilla-c392a77b46958555bc16592fe4d57e9ab0b7e126.zip
performance: just count the first 99 unseen items and display 99+ if there are more than 99
Diffstat (limited to 'Zotlabs/Module/Sse_bs.php')
-rw-r--r--Zotlabs/Module/Sse_bs.php24
1 files changed, 12 insertions, 12 deletions
diff --git a/Zotlabs/Module/Sse_bs.php b/Zotlabs/Module/Sse_bs.php
index 3a4e4e09e..4aabcafcb 100644
--- a/Zotlabs/Module/Sse_bs.php
+++ b/Zotlabs/Module/Sse_bs.php
@@ -205,18 +205,18 @@ class Sse_bs extends Controller {
}
- $r = q("SELECT count(id) as total FROM item
+ $r = q("SELECT id FROM item
WHERE uid = %d and item_unseen = 1 AND item_wall = 0 AND item_private IN (0, 1)
AND obj_type NOT IN ('Document', 'Video', 'Audio', 'Image')
AND author_xchan != '%s'
$item_normal
- $sql_extra",
+ $sql_extra LIMIT 100",
intval(self::$uid),
dbesc(self::$ob_hash)
);
if($r)
- $result['network']['count'] = intval($r[0]['total']);
+ $result['network']['count'] = count($r);
return $result;
}
@@ -285,17 +285,17 @@ class Sse_bs extends Controller {
}
- $r = q("SELECT count(id) as total FROM item
+ $r = q("SELECT id FROM item
WHERE uid = %d and item_unseen = 1 AND item_private = 2
$item_normal
$sql_extra
- AND author_xchan != '%s'",
+ AND author_xchan != '%s' LIMIT 100",
intval(self::$uid),
dbesc(self::$ob_hash)
);
if($r)
- $result['dm']['count'] = intval($r[0]['total']);
+ $result['dm']['count'] = count($r);
return $result;
}
@@ -365,17 +365,17 @@ class Sse_bs extends Controller {
}
- $r = q("SELECT count(id) as total FROM item
+ $r = q("SELECT id FROM item
WHERE uid = %d and item_unseen = 1 AND item_wall = 1 AND item_private IN (0, 1)
$item_normal
$sql_extra
- AND author_xchan != '%s'",
+ AND author_xchan != '%s' LIMIT 100",
intval(self::$uid),
dbesc(self::$ob_hash)
);
if($r)
- $result['home']['count'] = intval($r[0]['total']);
+ $result['home']['count'] = count($r);
return $result;
}
@@ -458,19 +458,19 @@ class Sse_bs extends Controller {
}
- $r = q("SELECT count(id) as total FROM item
+ $r = q("SELECT id FROM item
WHERE uid = %d AND item_unseen = 1
AND created > '%s'
$item_normal
$sql_extra
- AND author_xchan != '%s'",
+ AND author_xchan != '%s' LIMIT 100",
intval($sys['channel_id']),
dbescdate($_SESSION['static_loadtime']),
dbesc(self::$ob_hash)
);
if($r)
- $result['pubs']['count'] = intval($r[0]['total']);
+ $result['pubs']['count'] = count($r);
return $result;
}