aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2025-03-28 20:46:17 +0000
committerMario <mario@mariovavti.com>2025-03-28 20:46:17 +0000
commitdb5d67a4e09366eefc6742f9b5bd790c85a078a3 (patch)
treed86fbbb8af138c7a6f566b73893ab99c344e867b /Zotlabs
parent6e390a06e1a344f9824069bfc1a197955daa7136 (diff)
downloadvolse-hubzilla-db5d67a4e09366eefc6742f9b5bd790c85a078a3.tar.gz
volse-hubzilla-db5d67a4e09366eefc6742f9b5bd790c85a078a3.tar.bz2
volse-hubzilla-db5d67a4e09366eefc6742f9b5bd790c85a078a3.zip
cleanup deprecated forum queries and possibly improved performance
Diffstat (limited to 'Zotlabs')
-rw-r--r--Zotlabs/Module/Network.php13
-rw-r--r--Zotlabs/Module/Sse_bs.php13
2 files changed, 3 insertions, 23 deletions
diff --git a/Zotlabs/Module/Network.php b/Zotlabs/Module/Network.php
index 0b1a90f08..5573ed469 100644
--- a/Zotlabs/Module/Network.php
+++ b/Zotlabs/Module/Network.php
@@ -278,21 +278,12 @@ class Network extends \Zotlabs\Web\Controller {
$likes_sql = " AND verb NOT IN ('Like', 'Dislike', '" . dbesc(ACTIVITY_LIKE) . "', '" . dbesc(ACTIVITY_DISLIKE) . "') ";
// This is for nouveau view public forum cid queries (if a forum notification is clicked)
+ $sql_extra = " AND item.parent IN (SELECT DISTINCT parent FROM item WHERE uid = " . intval(local_channel()) . " AND ( author_xchan = '" . dbesc($cid_r[0]['abook_xchan']) . "' OR owner_xchan = '" . dbesc($cid_r[0]['abook_xchan']) . "' ) $item_normal) AND item_unseen = 1 AND verb != 'Announce' $likes_sql ";
- $sql_extra = " AND owner_xchan = '" . protect_sprintf(dbesc($cid_r[0]['abook_xchan'])) . "' AND item_unseen = 1 $likes_sql ";
}
else {
// This is for threaded view cid queries (e.g. if a forum is selected from the forum filter)
- $ttype = (($pf) ? TERM_FORUM : TERM_MENTION);
-
- $p1 = dbq("SELECT DISTINCT parent FROM item WHERE uid = " . intval(local_channel()) . " AND ( author_xchan = '" . dbesc($cid_r[0]['abook_xchan']) . "' OR owner_xchan = '" . dbesc($cid_r[0]['abook_xchan']) . "' ) $item_normal ");
- $p2 = dbq("SELECT oid AS parent FROM term WHERE uid = " . intval(local_channel()) . " AND ttype = $ttype AND term = '" . dbesc($cid_r[0]['xchan_name']) . "'");
-
- $p_str = ids_to_querystr(array_merge($p1, $p2), 'parent');
- if(! $p_str)
- killme();
-
- $sql_extra = " AND item.parent IN ( $p_str ) ";
+ $sql_extra = " AND item.parent IN (SELECT DISTINCT parent FROM item WHERE uid = " . intval(local_channel()) . " AND ( author_xchan = '" . dbesc($cid_r[0]['abook_xchan']) . "' OR owner_xchan = '" . dbesc($cid_r[0]['abook_xchan']) . "' ) $item_normal) ";
}
}
diff --git a/Zotlabs/Module/Sse_bs.php b/Zotlabs/Module/Sse_bs.php
index a2c8d0660..8847ff242 100644
--- a/Zotlabs/Module/Sse_bs.php
+++ b/Zotlabs/Module/Sse_bs.php
@@ -602,26 +602,15 @@ class Sse_bs extends Controller {
$i = 0;
for($x = 0; $x < $fcount; $x ++) {
- /*
- $p = q("SELECT oid AS parent FROM term WHERE uid = %d AND ttype = %d AND term = '%s'",
- intval(self::$uid),
- intval(TERM_FORUM),
- dbesc($forums[$x]['xchan_name'])
- );
-
- $p_str = ids_to_querystr($p, 'parent');
- $p_sql = (($p_str) ? "OR parent IN ( $p_str )" : '');
- */
$r = q("select count(*) as total from item
- where uid = %d and ( owner_xchan = '%s' OR author_xchan = '%s' $p_sql ) and author_xchan != '%s' and verb != 'Announce' and item_unseen = 1 $sql_extra $item_normal",
+ where uid = %d and (owner_xchan = '%s' or author_xchan = '%s') and author_xchan != '%s' and verb != 'Announce' and item_unseen = 1 $sql_extra $item_normal",
intval(self::$uid),
dbesc($forums[$x]['xchan_hash']),
dbesc($forums[$x]['xchan_hash']),
dbesc(self::$ob_hash)
);
-
if($r[0]['total']) {
$forums[$x]['notify_link'] = z_root() . '/network/?f=&pf=1&unseen=1&cid=' . $forums[$x]['abook_id'];