Skip to content
Permalink
Browse files

show log modification date if modified on the next day or later; upda…

…tes #921
  • Loading branch information...
following5 committed Mar 3, 2016
1 parent d2bd3e9 commit 5b545fdc6f9819f14d88de0ea603b1d162227114
@@ -757,6 +757,25 @@ function dbv_147()
sql("ALTER TABLE `log_types` ADD COLUMN `maintenance_logs` tinyint(1) NOT NULL");
}
function dbv_148() // add log contents modification date
{
if (!sql_field_exists('cache_logs', 'entry_last_modified'))
{
sql("ALTER TABLE `cache_logs` ADD COLUMN `entry_last_modified` datetime NOT NULL COMMENT 'via Trigger (cache_logs)' AFTER `date_created`");
sql("UPDATE `cache_logs` SET `entry_last_modified`=`date_created`");
}
if (!sql_field_exists('cache_logs_archived', 'entry_last_modified'))
{
sql("ALTER TABLE `cache_logs_archived` ADD COLUMN `entry_last_modified` datetime NOT NULL AFTER `date_created`");
sql("UPDATE `cache_logs_archived` SET `entry_last_modified`=`date_created`");
}
if (!sql_field_exists('cache_logs_modified', 'entry_last_modified'))
{
sql("ALTER TABLE `cache_logs_modified` ADD COLUMN `entry_last_modified` datetime NOT NULL AFTER `date_created`");
sql("UPDATE `cache_logs_modified` SET `entry_last_modified`=`date_created`");
}
}
// When adding new mutations, take care that they behave well if run multiple
// times. This improves robustness of database versioning.
@@ -74,6 +74,9 @@ be incorporated into some new modification date field.
cache_logs
----------

entry_last_modified
Is update when the user edits the log or adds/changes/removes log pictures.

last_modified
Is updated when
- any user-provided log content field changes
@@ -2847,6 +2847,7 @@ INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2560', 'By logg
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2561', 'By logging \"Available\", you also confirm that the geocache description is up-to-date.', '2015-06-17 10:09:14');
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2562', 'You may indicate here what is the current maintenance state of the geocache.', '2015-06-17 10:09:14');
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2563', 'You may indicate here if the cache description is up-to-date.', '2015-06-17 10:09:14');
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2564', 'last modified on', '2015-06-17 10:09:14');

-- Table sys_trans_ref
SET NAMES 'utf8';
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2561', 'DE', 'Mit einem &bdquo;kann-gesucht-werden&ldquo;-Log bestätigst du auch,<br />dass die Cachebeschreibung aktuell ist.', '2015-06-17 10:09:14');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2562', 'DE', 'Hier kannst du den aktuellen Wartungszustand des Caches angeben.', '2015-06-17 10:09:14');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2563', 'DE', 'Hier kannst du den aktuellen Zustand der Cachebeschreibung angeben.', '2015-06-17 10:09:14');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2564', 'DE', 'zuletzt geändert am', '2015-06-17 10:09:14');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('1', 'EN', 'Reorder IDs', '2010-09-02 00:15:30');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2', 'EN', 'The database could not be reconnected.', '2010-08-28 11:48:07');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('3', 'EN', 'Testing – please do not login', '2010-08-28 11:48:07');
@@ -1078,6 +1078,7 @@
/* dont overwrite date values while XML client is running */
IF ISNULL(@XMLSYNC) OR @XMLSYNC!=1 THEN
SET NEW.`date_created`=NOW();
SET NEW.`entry_last_modified`=NOW();
SET NEW.`last_modified`=NOW();
SET NEW.`log_last_modified`=NEW.`last_modified`;
END IF;
@@ -1146,19 +1147,29 @@
*/
IF DATEDIFF(NOW(), OLD.`date_created`) > 1 THEN
INSERT IGNORE INTO `cache_logs_modified`
(`id`, `uuid`, `node`, `date_created`, `last_modified`, `log_last_modified`,
(`id`, `uuid`, `node`, `date_created`, `entry_last_modified`, `last_modified`, `log_last_modified`,
`cache_id`, `user_id`, `type`, `oc_team_comment`, `date`,
`needs_maintenance`, `listing_outdated`,
`text`, `text_html`, `modify_date`)
VALUES
(OLD.`id`, OLD.`uuid`, OLD.`node`, OLD.`date_created`, OLD.`last_modified`,
(OLD.`id`, OLD.`uuid`, OLD.`node`, OLD.`date_created`, OLD.`entry_last_modified`, OLD.`last_modified`,
OLD.`log_last_modified`, OLD.`cache_id`, OLD.`user_id`, OLD.`type`,
OLD.`needs_maintenance`, OLD.`listing_outdated`,
OLD.`oc_team_comment`, OLD.`date`, OLD.`text`, OLD.`text_html`, NOW());
END IF;
SET NEW.`last_modified`=NOW();
END IF;
/* entry_last_modified MUST ONLY be changed if the visible log entry changes! */
IF NEW.`type`!=OLD.`type` OR
NEW.`oc_team_comment`!=OLD.`oc_team_comment` OR
NEW.`date`!=OLD.`date` OR
NEW.`needs_maintenance`!=OLD.`needs_maintenance` OR
NEW.`listing_outdated`!=OLD.`listing_outdated` OR
NEW.`text`!=BINARY OLD.`text` OR
NEW.`picture`!=OLD.`picture` THEN
SET NEW.`entry_last_modified`=NOW();
END IF;
IF NEW.`picture`!=OLD.`picture` THEN
SET NEW.`log_last_modified`=NOW();
END IF;
@@ -1546,6 +1557,11 @@
CALL sp_update_cache_listingdate(NEW.`object_id`);
END IF;
END IF;
/* cache_logs.entry_last_modified MUST ONLY be changed if the visible log entry changes! */
IF NEW.`object_type`=1 AND NOT IFNULL(@dont_update_logdate,FALSE) AND
(NEW.`title`!=BINARY OLD.`title` OR NEW.`spoiler`!=OLD.`spoiler`) THEN
UPDATE `cache_logs` SET `entry_last_modified`=NEW.`last_modified` WHERE `id`=NEW.`object_id`;
END IF;
IF @archive_picop AND
( ( NEW.`object_type`=2 AND
OLD.`date_created` < LEFT(NOW(),10) AND
@@ -5,6 +5,7 @@ CREATE TABLE `cache_logs` (
`uuid` varchar(36) NOT NULL,
`node` tinyint(3) unsigned NOT NULL default '0',
`date_created` datetime NOT NULL COMMENT 'via Trigger (cache_logs)',
`entry_last_modified` datetime NOT NULL COMMENT 'via Trigger (cache_logs)',
`last_modified` datetime NOT NULL COMMENT 'via Trigger (cache_logs)',
`log_last_modified` datetime NOT NULL COMMENT 'via Triggers',
`cache_id` int(10) unsigned NOT NULL,
@@ -5,6 +5,7 @@ CREATE TABLE `cache_logs_archived` (
`uuid` varchar(36) NOT NULL,
`node` tinyint(3) unsigned NOT NULL,
`date_created` datetime NOT NULL,
`entry_last_modified` datetime NOT NULL,
`last_modified` datetime NOT NULL,
`log_last_modified` datetime NOT NULL,
`cache_id` int(10) unsigned NOT NULL,
@@ -5,6 +5,7 @@ CREATE TABLE `cache_logs_modified` (
`uuid` varchar(36) NOT NULL,
`node` tinyint(3) unsigned NOT NULL,
`date_created` datetime NOT NULL,
`entry_last_modified` datetime NOT NULL,
`last_modified` datetime NOT NULL,
`log_last_modified` datetime NOT NULL,
`cache_id` int(10) unsigned NOT NULL,
@@ -346,6 +346,8 @@ static function getLogsArray($cacheid, $start, $count, $deleted=false)
`cache_logs`.`id` AS `id`,
`cache_logs`.`uuid` AS `uuid`,
`cache_logs`.`date` AS `date`,
`cache_logs`.`entry_last_modified`,
DATEDIFF(`cache_logs`.`entry_last_modified`, `cache_logs`.`date_created`) >= 1 AS `late_modified`,
substr(`cache_logs`.`date`,12) AS `time`, /* 00:00:01 = 00:00 logged, 00:00:00 = no time */
`cache_logs`.`type` AS `type`,
`cache_logs`.`oc_team_comment` AS `oc_team_comment`,
@@ -90,9 +90,14 @@
<br />
{/foreach}

{if $logItem.late_modified}
<p>{if $logItem.pictures}<br />{/if}
<small><em>{t}last modified on{/t} {$logItem.entry_last_modified|date_format:$opt.format.datelong}</em></small></p>
{/if}

{if $logItem.deleted_by_name != ""}
<span style="color:red">{t}Deleted by{/t} {$logItem.deleted_by_name},
{$logItem.deletion_date|date_format:$opt.format.date}</span>
<p><span style="color:red">{t}Deleted by{/t} {$logItem.deleted_by_name},
{$logItem.deletion_date|date_format:$opt.format.date}</span></p>
{/if}

</div>

0 comments on commit 5b545fd

Please sign in to comment.
You can’t perform that action at this time.