avoid removing of data when user removed a maildir
When a maildir is removed it must be considered new for the sync. However, the local cache of the folder remains. This means the sync of the folder removes all the missing emails. Avoid loosing of data for users not aware of the local cache by removing any pre-existing status cache of a folder when we actually want to create the database. Improve style. Github-fix: https://github.com/OfflineIMAP/offlineimap/issues/333 Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
@ -88,6 +88,14 @@ class LocalStatusSQLiteFolder(BaseFolder):
|
||||
if version < LocalStatusSQLiteFolder.cur_version:
|
||||
self.__upgrade_db(version)
|
||||
|
||||
def purge(self):
|
||||
"""Remove any pre-existing database."""
|
||||
|
||||
try:
|
||||
os.unlink(self.filename)
|
||||
except OSError as e:
|
||||
self.ui.debug('', "could not remove file %s: %s"%
|
||||
(self.filename, e))
|
||||
|
||||
def storesmessages(self):
|
||||
return False
|
||||
|
Reference in New Issue
Block a user