]> git.mxchange.org Git - friendica.git/commitdiff
Delete event when the item is deleted
authorMichael Vogel <icarus@dabo.de>
Fri, 16 Oct 2015 23:25:25 +0000 (01:25 +0200)
committerMichael Vogel <icarus@dabo.de>
Fri, 16 Oct 2015 23:25:25 +0000 (01:25 +0200)
include/event.php
include/items.php

index a87dba64fbcde1b5c4816d7f64bdbecb6805b989..d56388a77a0e407212b7572b8680b8b16e855ec9 100644 (file)
@@ -204,7 +204,13 @@ function ev_compare($a,$b) {
        return strcmp($date_a,$date_b);
 }
 
+function event_delete($event_id) {
+       if ($event_id == 0)
+               return;
 
+       q("DELETE FROM `event` WHERE `id` = %d", intval($event_id));
+       logger("Deleted event ".$event_id, LOGGER_DEBUG);
+}
 
 function event_store($arr) {
 
index 795001bec68f497f2b1526013fd6aa4836ab8954..7d1ab1cb36c52398a62f4b5f1c10adac68c55a60 100644 (file)
@@ -2558,6 +2558,11 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
                                        if(! $item['deleted'])
                                                logger('consume_feed: deleting item ' . $item['id'] . ' uri=' . $item['uri'], LOGGER_DEBUG);
 
+                                       if($item['object-type'] === ACTIVITY_OBJ_EVENT) {
+                                               logger("Deleting event ".$item['event-id'], LOGGER_DEBUG);
+                                               event_delete($item['event-id']);
+                                       }
+
                                        if(($item['verb'] === ACTIVITY_TAG) && ($item['object-type'] === ACTIVITY_OBJ_TAGTERM)) {
                                                $xo = parse_xml_string($item['object'],false);
                                                $xt = parse_xml_string($item['target'],false);
@@ -3544,6 +3549,11 @@ function local_delivery($importer,$data) {
 
                                        logger('local_delivery: deleting item ' . $item['id'] . ' uri=' . $item['uri'], LOGGER_DEBUG);
 
+                                       if($item['object-type'] === ACTIVITY_OBJ_EVENT) {
+                                               logger("Deleting event ".$item['event-id'], LOGGER_DEBUG);
+                                               event_delete($item['event-id']);
+                                       }
+
                                        if(($item['verb'] === ACTIVITY_TAG) && ($item['object-type'] === ACTIVITY_OBJ_TAGTERM)) {
                                                $xo = parse_xml_string($item['object'],false);
                                                $xt = parse_xml_string($item['target'],false);