diff options
author | Friendika <info@friendika.com> | 2011-06-23 18:25:33 -0700 |
---|---|---|
committer | Friendika <info@friendika.com> | 2011-06-23 18:25:33 -0700 |
commit | a15bd91d1733e8198169a1a492f0268691b7152a (patch) | |
tree | dd730e04ba33a0015eb3c94effeb798aaac8689c /include/event.php | |
parent | 38cf37d3c3a4bc9873aa12eed5167b356282385f (diff) | |
download | volse-hubzilla-a15bd91d1733e8198169a1a492f0268691b7152a.tar.gz volse-hubzilla-a15bd91d1733e8198169a1a492f0268691b7152a.tar.bz2 volse-hubzilla-a15bd91d1733e8198169a1a492f0268691b7152a.zip |
don't update an event that hasn't changed.
Diffstat (limited to 'include/event.php')
-rw-r--r-- | include/event.php | 16 |
1 files changed, 16 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', |