diff options
-rw-r--r-- | include/event.php | 16 | ||||
-rw-r--r-- | include/items.php | 1 | ||||
-rw-r--r-- | mod/dfrn_notify.php | 1 |
3 files changed, 18 insertions, 0 deletions
diff --git a/include/event.php b/include/event.php index 8078a9a5e..f79266e33 100644 --- a/include/event.php +++ b/include/event.php @@ -213,6 +213,22 @@ function event_store($arr) { if($arr['id']) { + + // has the event actually changed? + + $r = q("SELECT * FROM `event` WHERE `id` = %d AND `uid` = %d LIMIT 1", + intval($arr['id']), + intval($arr['uid']) + ); + if((! count($r)) || ($r[0]['edited'] === $arr['edited'])) { + $r = q("SELECT * FROM `item` WHERE `event-id` = %d AND `uid` = %d LIMIT 1", + intval($arr['id']), + intval($arr['uid']) + ); + return((count($r)) ? $r[0]['id'] : 0); + } + + $r = q("UPDATE `event` SET `edited` = '%s', `start` = '%s', diff --git a/include/items.php b/include/items.php index 2a934af3a..47a38d5e5 100644 --- a/include/items.php +++ b/include/items.php @@ -1347,6 +1347,7 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $secure_fee if(x($ev,'desc') && x($ev,'start')) { $ev['uid'] = $importer['uid']; $ev['uri'] = $item_id; + $ev['edited'] = $datarray['edited']; if(is_array($contact)) $ev['cid'] = $contact['id']; diff --git a/mod/dfrn_notify.php b/mod/dfrn_notify.php index f6d1f2be5..dd0172243 100644 --- a/mod/dfrn_notify.php +++ b/mod/dfrn_notify.php @@ -676,6 +676,7 @@ function dfrn_notify_post(&$a) { $ev['cid'] = $importer['id']; $ev['uid'] = $importer['uid']; $ev['uri'] = $item_id; + $ev['edited'] = $datarray['edited']; $r = q("SELECT * FROM `event` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1", dbesc($item_id), |