aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2023-04-08 20:18:17 +0000
committerMario <mario@mariovavti.com>2023-04-08 20:18:17 +0000
commit9b93dc51373878d7a0cbce3053e4308e7715b9c1 (patch)
tree2fb87ed54c4690ddd85716b688d88283da52d24a /Zotlabs
parent5ec721b97823df32dca418bf2b5343b70c584114 (diff)
downloadvolse-hubzilla-9b93dc51373878d7a0cbce3053e4308e7715b9c1.tar.gz
volse-hubzilla-9b93dc51373878d7a0cbce3053e4308e7715b9c1.tar.bz2
volse-hubzilla-9b93dc51373878d7a0cbce3053e4308e7715b9c1.zip
split up a potentially long running sql query
Diffstat (limited to 'Zotlabs')
-rw-r--r--Zotlabs/Lib/Libzot.php14
1 files changed, 10 insertions, 4 deletions
diff --git a/Zotlabs/Lib/Libzot.php b/Zotlabs/Lib/Libzot.php
index 129ac6b56..97ea1bbfd 100644
--- a/Zotlabs/Lib/Libzot.php
+++ b/Zotlabs/Lib/Libzot.php
@@ -1389,14 +1389,20 @@ class Libzot {
$r = [];
$thread_parent = self::find_parent($env, $act);
if ($thread_parent) {
- $z = q("select channel_hash as hash from channel left join item on channel.channel_id = item.uid where ( item.thr_parent = '%s' OR item.parent_mid = '%s' ) and channel_hash != '%s'",
+ $uids = q("SELECT uid FROM item WHERE thr_parent = '%s' OR parent_mid = '%s'",
dbesc($thread_parent),
- dbesc($thread_parent),
- dbesc($env['sender'])
+ dbesc($thread_parent)
);
+
+ $uids = ids_to_querystr($uids, 'uid');
+
+ $z = q("SELECT channel_hash FROM channel WHERE channel_hash != '%s' AND channel_id IN ($uids)",
+ dbesc($msg['sender'])
+ );
+
if ($z) {
foreach ($z as $zv) {
- $r[] = $zv['hash'];
+ $r[] = $zv['channel_hash'];
}
}
}