diff options
Diffstat (limited to 'Zotlabs/Lib/ThreadListener.php')
-rw-r--r-- | Zotlabs/Lib/ThreadListener.php | 20 |
1 files changed, 18 insertions, 2 deletions
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) |