aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Lib/ThreadListener.php
diff options
context:
space:
mode:
authorManuel Jiménez Friaza <mjfriaza@openmailbox.org>2019-02-19 12:15:59 +0100
committerManuel Jiménez Friaza <mjfriaza@openmailbox.org>2019-02-19 12:15:59 +0100
commitc5bb0745737432c6d27e9468e56ad0bd33698462 (patch)
tree7d6b7a364941b9325ea319e6564e9f6123f059f2 /Zotlabs/Lib/ThreadListener.php
parent4e8fc6d19851b6d05a49d5151aaa1f0f1fcfb5c0 (diff)
parentcead10b9af6ff9d8b1bc702ca21d27af7c2112f0 (diff)
downloadvolse-hubzilla-c5bb0745737432c6d27e9468e56ad0bd33698462.tar.gz
volse-hubzilla-c5bb0745737432c6d27e9468e56ad0bd33698462.tar.bz2
volse-hubzilla-c5bb0745737432c6d27e9468e56ad0bd33698462.zip
Merge remote-tracking branch 'upstream/dev' into dev
Diffstat (limited to 'Zotlabs/Lib/ThreadListener.php')
-rw-r--r--Zotlabs/Lib/ThreadListener.php53
1 files changed, 53 insertions, 0 deletions
diff --git a/Zotlabs/Lib/ThreadListener.php b/Zotlabs/Lib/ThreadListener.php
new file mode 100644
index 000000000..308e02255
--- /dev/null
+++ b/Zotlabs/Lib/ThreadListener.php
@@ -0,0 +1,53 @@
+<?php
+
+namespace Zotlabs\Lib;
+
+class ThreadListener {
+
+ static public function store($target_id,$portable_id,$ltype = 0) {
+ $x = self::fetch($target_id,$portable_id,$ltype = 0);
+ 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) {
+ $x = q("select * from listeners where target_id = '%s' and portable_id = '%s' and ltype = %d limit 1",
+ dbesc($target_id),
+ dbesc($portable_id),
+ intval($ltype)
+ );
+ if($x) {
+ return $x[0];
+ }
+ return false;
+ }
+
+ static public function fetch_by_target($target_id,$ltype = 0) {
+ $x = q("select * from listeners where target_id = '%s' and ltype = %d",
+ dbesc($target_id),
+ intval($ltype)
+ );
+
+ return $x;
+ }
+
+ static public function delete_by_target($target_id, $ltype = 0) {
+ return q("delete from listeners where target_id = '%s' and ltype = %d",
+ dbesc($target_id),
+ intval($ltype)
+ );
+ }
+
+ static public function delete_by_pid($portable_id, $ltype = 0) {
+ return q("delete from listeners where portable_id = '%s' and ltype = %d",
+ dbesc($portable_id),
+ intval($ltype)
+ );
+ }
+
+}