aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2023-04-09 18:51:55 +0000
committerMario <mario@mariovavti.com>2023-04-09 18:51:55 +0000
commit4873f61d6cb494e82d7aef3892c99b81a41cea61 (patch)
treef4898a31c92efa13a098ef4934b8d1490397caf8
parent1538107ae45f9b7c09d377083cf969ca81d373c0 (diff)
downloadvolse-hubzilla-4873f61d6cb494e82d7aef3892c99b81a41cea61.tar.gz
volse-hubzilla-4873f61d6cb494e82d7aef3892c99b81a41cea61.tar.bz2
volse-hubzilla-4873f61d6cb494e82d7aef3892c99b81a41cea61.zip
disable thread listener interface by default and minor fixes
-rw-r--r--Zotlabs/Lib/Libzot.php18
-rw-r--r--Zotlabs/Lib/ThreadListener.php20
2 files changed, 28 insertions, 10 deletions
diff --git a/Zotlabs/Lib/Libzot.php b/Zotlabs/Lib/Libzot.php
index 97ea1bbfd..a8334595f 100644
--- a/Zotlabs/Lib/Libzot.php
+++ b/Zotlabs/Lib/Libzot.php
@@ -984,7 +984,7 @@ class Libzot {
}
elseif (!$ud_flags) {
// nothing changed but we still need to update the updates record
- q("update updates set ud_flags = ( ud_flags | %d ) where ud_addr = '%s' and not (ud_flags & %d) > 0 ",
+ q("update updates set ud_flags = ( ud_flags | %d ) where ud_addr = '%s' and (ud_flags & %d) = 0 ",
intval(UPDATE_FLAGS_UPDATED),
dbesc($address),
intval(UPDATE_FLAGS_UPDATED)
@@ -1394,15 +1394,17 @@ class Libzot {
dbesc($thread_parent)
);
- $uids = ids_to_querystr($uids, 'uid');
+ if ($uids) {
+ $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'])
- );
+ $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['channel_hash'];
+ if ($z) {
+ foreach ($z as $zv) {
+ $r[] = $zv['channel_hash'];
+ }
}
}
}
diff --git a/Zotlabs/Lib/ThreadListener.php b/Zotlabs/Lib/ThreadListener.php
index 308e02255..ef245b1ce 100644
--- a/Zotlabs/Lib/ThreadListener.php
+++ b/Zotlabs/Lib/ThreadListener.php
@@ -4,18 +4,30 @@ namespace Zotlabs\Lib;
class ThreadListener {
+ public static function isEnabled() {
+ return Config::Get('system','enable_thread_listener');
+ }
+
static public function store($target_id,$portable_id,$ltype = 0) {
+ if (!self::isEnabled()) {
+ return true;
+ }
+
$x = self::fetch($target_id,$portable_id,$ltype = 0);
- if(! $x) {
+ if(! $x) {
$r = q("insert into listeners ( target_id, portable_id, ltype ) values ( '%s', '%s' , %d ) ",
dbesc($target_id),
dbesc($portable_id),
intval($ltype)
);
- }
+ }
}
static public function fetch($target_id,$portable_id,$ltype = 0) {
+ if (!self::isEnabled()) {
+ return false;
+ }
+
$x = q("select * from listeners where target_id = '%s' and portable_id = '%s' and ltype = %d limit 1",
dbesc($target_id),
dbesc($portable_id),
@@ -28,6 +40,10 @@ class ThreadListener {
}
static public function fetch_by_target($target_id,$ltype = 0) {
+ if (!self::isEnabled()) {
+ return [];
+ }
+
$x = q("select * from listeners where target_id = '%s' and ltype = %d",
dbesc($target_id),
intval($ltype)