[horde] Database cleanup horde_histories

Jens Wahnes wahnes at uni-koeln.de
Wed May 1 07:42:20 UTC 2019


Philipp Faeustlin wrote:
> Hi is there a way to clean up the horde_histories database table?
> 
> It seem like entries in this table will never be removed. Not even if 
> you remove a user per cli.
> 
> Is this supposed to work like this or is there something wrong with my 
> installation of Horde?

I'm having the same problem of a ever growing horde_histories table as 
well. I think this behaviour is intended. The problem with deleting 
stuff from the horde_histories table is that there can be entries there 
by deleted users that are still needed. For example, there could be a 
shared calendar that user X added entries to (especially if it's 
recurring event) that are relevant even after X's account is deleted. If 
one were to delete the entries of user X in horde_histories upon 
deleting their other data (horde-remove-user-data), the event in the 
shared calendar could not be displayed properly anymore.

One thing that I've done in the past is to change the "history_who" 
field of entries from users long deleted to "-system-" to anonymize 
those entries for reasons of data protection. That should allow old 
entries to still be used to reconstruct entries in shared calendars, but 
not to keep personal data of people to longer relevant.

Another approach I've taken is to specifically delete old entries from 
horde_histories (of users long deleted) that refer to IMP. I don't know 
if there can be entries of the "IMP" kind relevant to other users still 
existing done by deleted users (maybe when using shared mail folders?). 
Still I would want to get rid of them, because "IMP" entries are by far 
the largest in numbers in our setup, plus it's not that upsetting after 
all when one is unable to look up the history of and old email (with the 
email itself still being stored on the mail server). So with a MySQL 
database, I used something along the lines of

DELETE FROM horde_histories USING horde_histories LEFT JOIN horde_prefs 
on (history_who=horde_prefs.pref_uid AND 
horde_prefs.pref_name='last_login' AND horde_prefs.pref_scope='horde') 
WHERE horde_prefs.pref_uid IS NULL AND object_uid like 'imp:%' AND 
history_ts < 1483225200

to remove very old "IMP" entries in horde_histories. So far this has 
been working well for me, but I wouldn't want to bet that this is the 
way to go.


Jens


More information about the horde mailing list