added okapi notification on updates of cache location and npa s

This commit is contained in:
following
2013-07-10 20:13:31 +02:00
parent 04c95e5f0a
commit 1c6e320fb8
2 changed files with 15 additions and 1 deletions

View File

@@ -49,7 +49,9 @@ meta_last_modified
Is updated if any data changes which is output by OKAPI's geocache method but
not part of the cache listing itself. This currently applies to geokrets in
the cache (gk_item_waypoint table) and to log and recommendation statistics
(stat_caches table). Things like caches.wp_gc_maintained may be added.
(stat_caches table), and to the Cronjob-generated information in cache_location
and cache_npa_areas tables. Things like caches.wp_gc_maintained may be added.
Updating this field triggers an update of okapi_syncbase. We don't update
okapi_syncbase directly, as it may be missing because OKAPI is not installed.

View File

@@ -876,6 +876,9 @@
OLD.`latitude`!=NEW.`latitude` THEN
SET NEW.`need_npa_recalc`=1;
END IF;
IF OLD.`need_npa_recalc` AND NOT NEW.`need_npa_recalc` THEN
SET NEW.`meta_last_modified` = NOW();
END IF;
IF OLD.`status`=5 AND NEW.`status`<>5 THEN
SET NEW.`date_created`=NOW();
@@ -1048,6 +1051,7 @@
FOR EACH ROW
BEGIN
SET NEW.`last_modified`=NOW();
UPDATE `caches` SET `meta_last_modified`=NOW() WHERE `caches`.`cache_id`=NEW.`cache_id`;
END;");
sql_dropTrigger('cacheLocationBeforeUpdate');
@@ -1055,6 +1059,14 @@
FOR EACH ROW
BEGIN
SET NEW.`last_modified`=NOW();
UPDATE `caches` SET `meta_last_modified`=NOW() WHERE `caches`.`cache_id`=NEW.`cache_id`;
END;");
sql_dropTrigger('cacheLocationAfterDelete');
sql("CREATE TRIGGER `cacheLocationAfterDelete` AFTER DELETE ON `cache_location`
FOR EACH ROW
BEGIN
UPDATE `caches` SET `meta_last_modified`=NOW() WHERE `caches`.`cache_id`=OLD.`cache_id`;
END;");
sql_dropTrigger('cacheLogsBeforeInsert');