Add db maintenance routine. Move cleanup functions to maintenance module...

There has been a vandalism incident recently. Presumably someone used a script to create many empty db records. I've added maintenance function that every 5 minutes will remove db records with empty filename.