4822: data privacy improvement, purge log files

This commit is contained in:
following
2013-02-12 23:59:07 +01:00
parent 86dc6e44f6
commit d15ee5f962
9 changed files with 57 additions and 7 deletions

View File

@ -133,6 +133,11 @@
$opt['news']['mail'] = 'root';
$opt['mail']['subject'] = '[local.opencaching.de] ';
/* Purge log files - age in days (0 = keep infinite)
*/
$opt['logic']['logs']['purge_email'] = 0;
$opt['logic']['logs']['purge_userdata'] = 0;
/* 3rd party library options
* see https://my.garmin.com/api/communicator/key-generator.jsp
*/

View File

@ -341,6 +341,11 @@
// fill_gaps = false: continue with the last waypoint
$opt['logic']['waypoint_pool']['fill_gaps'] = false;
/* Purge log files - age in days (0 = keep infinite)
*/
$opt['logic']['logs']['purge_email'] = 30;
$opt['logic']['logs']['purge_userdata'] = 14;
/* Database charset
* frontend and php charsets are UTF-8
* here you can set a different charset for the MySQL-Engine

View File

@ -25,3 +25,4 @@ date commit ID change
2012-11-17 39a25f99 removed cache_waypoint_pool.cache_id and index cache_id
added cache_waypoint_pool.uuid and index uuid
changed caches.wp_oc to 'NOT NULL'
2013-02-12 added indices logentries:date and email_user:date

View File

@ -604,6 +604,7 @@ INSERT INTO `logentries_types` (`id`, `module`, `eventname`) VALUES ('4', 'appro
INSERT INTO `logentries_types` (`id`, `module`, `eventname`) VALUES ('5', 'cache', 'changeowner');
INSERT INTO `logentries_types` (`id`, `module`, `eventname`) VALUES ('6', 'user', 'disable');
INSERT INTO `logentries_types` (`id`, `module`, `eventname`) VALUES ('7', 'user', 'delete');
INSERT INTO `logentries_types` (`id`, `module`, `eventname`) VALUES ('8', 'notification', 'sendmail');
-- Table news_topics
SET NAMES 'utf8';

View File

@ -9,5 +9,6 @@ CREATE TABLE `email_user` (
`to_user_id` int(10) unsigned NOT NULL default '0',
`to_email` varchar(60) NOT NULL,
PRIMARY KEY (`id`),
KEY `from_user_id` (`from_user_id`)
KEY `from_user_id` (`from_user_id`),
KEY `date` (`date_created`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;

View File

@ -10,5 +10,6 @@ CREATE TABLE `logentries` (
`objectid2` int(10) unsigned NOT NULL default '0',
`logtext` mediumtext NOT NULL,
`details` blob NOT NULL,
PRIMARY KEY (`id`)
PRIMARY KEY (`id`),
KEY `date` (`date_created`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;

View File

@ -711,12 +711,13 @@ class user
sql("UPDATE `user` SET `password`=NULL, `email`=NULL,
`is_active_flag`=0,
`latitude`=0, `longitude`=0,
`last_name`='', `first_name`='',
`country`=NULL, `new_pw_code`=NULL,
`new_pw_date`=NULL, `new_email`=NULL,
`new_email_code`=NULL, `activation_code`='',
`last_name`='', `first_name`='', `country`=NULL,
`new_pw_code`=NULL, `new_pw_date`=NULL,
`new_email`=NULL, `new_email_code`=NULL, `new_email_date`=NULL,
`permanent_login_flag`=0, `activation_code`='',
`notify_radius`=0, `statpic_text`=''
WHERE `user_id`='&1'", $this->nUserId);
sql("DELETE FROM `user_options` WHERE `user_id`='&1'", $this->nUserId);
$this->reload();
return true;

View File

@ -129,7 +129,7 @@ function process_new_cache($notify)
}
// logentry($module, $eventid, $userid, $objectid1, $objectid2, $logtext, $details)
logentry('notify_newcache', 5, $notify['recid'], $notify['cache_id'], 0, 'Sending mail to ' . $mailadr, array());
logentry('notify_newcache', 8, $notify['recid'], $notify['cache_id'], 0, 'Sending mail to ' . $mailadr, array());
return 0;
}

View File

@ -0,0 +1,35 @@
<?php
/***************************************************************************
* For license information see doc/license.txt
*
* Unicode Reminder メモ
*
* Delete old log entries with personal user data for data privacy
***************************************************************************/
checkJob(new purge_logs());
class purge_logs
{
var $name = 'purge_logs';
var $interval = 86400; // daily
function run()
{
global $opt;
if ($opt['logic']['logs']['purge_email'] > 0)
{
sql("DELETE FROM `email_user` WHERE date_created < NOW() - INTERVAL &1 DAY",
$opt['logic']['logs']['purge_email']);
sql("DELETE FROM `logentries` WHERE date_created < NOW() - INTERVAL &1 DAY AND eventid IN (1,2,3,8)",
$opt['logic']['logs']['purge_email']);
}
if ($opt['logic']['logs']['purge_userdata'] > 0)
sql("DELETE FROM `logentries` WHERE date_created < NOW() - INTERVAL &1 DAY AND eventid IN (6,7)",
$opt['logic']['logs']['purge_userdata']);
}
}
?>