aboutsummaryrefslogtreecommitdiffstats
path: root/include/sharedwithme.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/sharedwithme.php')
-rw-r--r--include/sharedwithme.php32
1 files changed, 32 insertions, 0 deletions
diff --git a/include/sharedwithme.php b/include/sharedwithme.php
new file mode 100644
index 000000000..b01764ad3
--- /dev/null
+++ b/include/sharedwithme.php
@@ -0,0 +1,32 @@
+<?php
+
+function apply_updates() {
+
+ //check for updated items and remove them
+ $x = q("SELECT mid, max(object) AS object FROM item WHERE verb = '%s' AND obj_type = '%s' GROUP BY mid",
+ dbesc(ACTIVITY_UPDATE),
+ dbesc(ACTIVITY_OBJ_FILE)
+ );
+
+ if($x) {
+
+ foreach($x as $xx) {
+
+ $object = json_decode($xx['object'],true);
+
+ $d_mid = $object['d_mid'];
+ $u_mid = $xx['mid'];
+
+ $y = q("DELETE FROM item WHERE obj_type = '%s' AND (verb = '%s' AND mid = '%s') OR (verb = '%s' AND mid = '%s')",
+ dbesc(ACTIVITY_OBJ_FILE),
+ dbesc(ACTIVITY_POST),
+ dbesc($d_mid),
+ dbesc(ACTIVITY_UPDATE),
+ dbesc($u_mid)
+ );
+
+ }
+
+ }
+
+}