don't update an event that hasn't changed.
This commit is contained in:
parent
38cf37d3c3
commit
a15bd91d17
3 changed files with 18 additions and 0 deletions
|
@ -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',
|
||||
|
|
|
@ -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'];
|
||||
|
|
|
@ -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),
|
||||
|
|
Loading…
Reference in a new issue