From c8206f24e10ce8f3b287f29165991cdaf01823c8 Mon Sep 17 00:00:00 2001 From: Nicolas Sebrecht Date: Sat, 25 Mar 2017 13:12:11 +0100 Subject: [PATCH] remove support for the status_backend configuration option Stop the run when this option is found. Migrating from the historical plain text status cache is still supported. Signed-off-by: Nicolas Sebrecht --- docs/offlineimap.txt | 6 +++--- offlineimap.conf | 8 -------- offlineimap/repository/LocalStatus.py | 20 +++++++++++--------- 3 files changed, 14 insertions(+), 20 deletions(-) diff --git a/docs/offlineimap.txt b/docs/offlineimap.txt index e15a03e..e0cbf19 100644 --- a/docs/offlineimap.txt +++ b/docs/offlineimap.txt @@ -228,10 +228,10 @@ if a mail has been added or deleted on either side. The historical status cache is a plain text file that writes out the complete file for each single new message (or even changed flag) to a temporary file. If you have plenty of files in a folder, this is a few hundred kilo to megabytes -for each mail and is bound to make things slow. The latest default status cache +for each mail and is bound to make things slow. The latest status cache is sqlite. This saves plenty of disk activity. The sqlite engine and the Python -sqlite module must be installed. Enable the 'status_backend = plain' setting in -'offlineimap.conf' for legacy compatibility with versions prior to '6.4.0'. +sqlite module must be installed. The historical plain status cache is not +supported anymore. + If you switch the backend from plain to sqlite, you may want to delete the old cache directory in '/Account-/LocalStatus' manually (the diff --git a/offlineimap.conf b/offlineimap.conf index e13b8db..2f0e57a 100644 --- a/offlineimap.conf +++ b/offlineimap.conf @@ -314,14 +314,6 @@ remoterepository = RemoteExample #postsynchook = notifysync.sh -# This option stands in the [Account Test] section. -# -# The historical backend is 'plain' which writes out the state in plain text -# files. See manual. -# -#status_backend = sqlite - - # This option stands in the [Account Test] section. # # If you have a limited amount of bandwidth available you can exclude larger diff --git a/offlineimap/repository/LocalStatus.py b/offlineimap/repository/LocalStatus.py index ff99eab..a651fd2 100644 --- a/offlineimap/repository/LocalStatus.py +++ b/offlineimap/repository/LocalStatus.py @@ -20,31 +20,37 @@ import os from offlineimap.folder.LocalStatus import LocalStatusFolder from offlineimap.folder.LocalStatusSQLite import LocalStatusSQLiteFolder from offlineimap.repository.Base import BaseRepository +from offlineimap.error import OfflineImapError class LocalStatusRepository(BaseRepository): def __init__(self, reposname, account): BaseRepository.__init__(self, reposname, account) - # class and root for all backends + # class and root for all backends. self.backends = {} self.backends['sqlite'] = { 'class': LocalStatusSQLiteFolder, 'root': os.path.join(account.getaccountmeta(), 'LocalStatus-sqlite') } - self.backends['plain'] = { 'class': LocalStatusFolder, 'root': os.path.join(account.getaccountmeta(), 'LocalStatus') } - # Set class and root for the configured backend - self.setup_backend(self.account.getconf('status_backend', 'sqlite')) + if self.account.getconf('status_backend', None) is not None: + raise OfflineImapError( + "the 'status_backend' configuration option is not supported" + " anymore; please, remove this configuration option.", + OfflineImapError.ERROR.REPO + ) + # Set class and root for sqlite. + self.setup_backend('sqlite') if not os.path.exists(self.root): os.mkdir(self.root, 0o700) - # self._folders is a dict of name:LocalStatusFolders() + # self._folders is a dict of name:LocalStatusFolders(). self._folders = {} def _instanciatefolder(self, foldername): @@ -56,10 +62,6 @@ class LocalStatusRepository(BaseRepository): self.root = self.backends[backend]['root'] self.LocalStatusFolderClass = self.backends[backend]['class'] - else: - raise SyntaxWarning("Unknown status_backend '%s' for account '%s'"% - (backend, self.account.name)) - def import_other_backend(self, folder): for bk, dic in self.backends.items(): # Skip folder's own type.