From: Michael J. Rubinsky Date: Fri, 18 Dec 2009 05:22:09 +0000 (-0500) Subject: Remove geolocation data from storage when events are deleted. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=ef559df93dc48a2f68987cbfbb975b04a2dea034;p=horde.git Remove geolocation data from storage when events are deleted. --- diff --git a/kronolith/lib/Driver/Sql.php b/kronolith/lib/Driver/Sql.php index c50988c23..ed4f4d802 100644 --- a/kronolith/lib/Driver/Sql.php +++ b/kronolith/lib/Driver/Sql.php @@ -788,6 +788,11 @@ class Kronolith_Driver_Sql extends Kronolith_Driver $tagger = Kronolith::getTagger(); $tagger->replaceTags($event->uid, array(), 'event'); + /* Remove any geolocation data */ + if ($gDriver = Kronolith::getGeoDriver()) { + $gDriver->deleteLocation($event->id); + } + /* Notify about the deleted event. */ if (!$silent) { $result = Kronolith::sendNotification($event, 'delete'); diff --git a/kronolith/lib/Geo.php b/kronolith/lib/Geo.php index ad10d031f..9e477f149 100644 --- a/kronolith/lib/Geo.php +++ b/kronolith/lib/Geo.php @@ -42,6 +42,22 @@ abstract class Kronolith_Geo return $driver; } + /** + * Delete an entry from storage + * + * @param string $event_id + * + * @return void + */ + public function deleteLocation($event_id) + { + $sql = "DELETE FROM kronolith_events_geo WHERE event_id = '" . $event_id . "'"; + $result = $this->_write_db->query($sql); + if ($result instanceof PEAR_Error) { + throw new Horde_Exception($result->getMessage()); + } + } + abstract public function setLocation($event_id, $point); abstract public function getLocation($event_id); abstract public function removeLocation($event_id);