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 <nicolas.s-dev@laposte.net>
This commit is contained in:
parent
49c6f14ce4
commit
c8206f24e1
@ -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
|
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
|
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
|
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
|
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
|
sqlite module must be installed. The historical plain status cache is not
|
||||||
'offlineimap.conf' for legacy compatibility with versions prior to '6.4.0'.
|
supported anymore.
|
||||||
+
|
+
|
||||||
If you switch the backend from plain to sqlite, you may want to delete the old
|
If you switch the backend from plain to sqlite, you may want to delete the old
|
||||||
cache directory in '<metadata>/Account-<account>/LocalStatus' manually (the
|
cache directory in '<metadata>/Account-<account>/LocalStatus' manually (the
|
||||||
|
@ -314,14 +314,6 @@ remoterepository = RemoteExample
|
|||||||
#postsynchook = notifysync.sh
|
#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.
|
# This option stands in the [Account Test] section.
|
||||||
#
|
#
|
||||||
# If you have a limited amount of bandwidth available you can exclude larger
|
# If you have a limited amount of bandwidth available you can exclude larger
|
||||||
|
@ -20,31 +20,37 @@ import os
|
|||||||
from offlineimap.folder.LocalStatus import LocalStatusFolder
|
from offlineimap.folder.LocalStatus import LocalStatusFolder
|
||||||
from offlineimap.folder.LocalStatusSQLite import LocalStatusSQLiteFolder
|
from offlineimap.folder.LocalStatusSQLite import LocalStatusSQLiteFolder
|
||||||
from offlineimap.repository.Base import BaseRepository
|
from offlineimap.repository.Base import BaseRepository
|
||||||
|
from offlineimap.error import OfflineImapError
|
||||||
|
|
||||||
|
|
||||||
class LocalStatusRepository(BaseRepository):
|
class LocalStatusRepository(BaseRepository):
|
||||||
def __init__(self, reposname, account):
|
def __init__(self, reposname, account):
|
||||||
BaseRepository.__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 = {}
|
||||||
self.backends['sqlite'] = {
|
self.backends['sqlite'] = {
|
||||||
'class': LocalStatusSQLiteFolder,
|
'class': LocalStatusSQLiteFolder,
|
||||||
'root': os.path.join(account.getaccountmeta(), 'LocalStatus-sqlite')
|
'root': os.path.join(account.getaccountmeta(), 'LocalStatus-sqlite')
|
||||||
}
|
}
|
||||||
|
|
||||||
self.backends['plain'] = {
|
self.backends['plain'] = {
|
||||||
'class': LocalStatusFolder,
|
'class': LocalStatusFolder,
|
||||||
'root': os.path.join(account.getaccountmeta(), 'LocalStatus')
|
'root': os.path.join(account.getaccountmeta(), 'LocalStatus')
|
||||||
}
|
}
|
||||||
|
|
||||||
# Set class and root for the configured backend
|
if self.account.getconf('status_backend', None) is not None:
|
||||||
self.setup_backend(self.account.getconf('status_backend', 'sqlite'))
|
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):
|
if not os.path.exists(self.root):
|
||||||
os.mkdir(self.root, 0o700)
|
os.mkdir(self.root, 0o700)
|
||||||
|
|
||||||
# self._folders is a dict of name:LocalStatusFolders()
|
# self._folders is a dict of name:LocalStatusFolders().
|
||||||
self._folders = {}
|
self._folders = {}
|
||||||
|
|
||||||
def _instanciatefolder(self, foldername):
|
def _instanciatefolder(self, foldername):
|
||||||
@ -56,10 +62,6 @@ class LocalStatusRepository(BaseRepository):
|
|||||||
self.root = self.backends[backend]['root']
|
self.root = self.backends[backend]['root']
|
||||||
self.LocalStatusFolderClass = self.backends[backend]['class']
|
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):
|
def import_other_backend(self, folder):
|
||||||
for bk, dic in self.backends.items():
|
for bk, dic in self.backends.items():
|
||||||
# Skip folder's own type.
|
# Skip folder's own type.
|
||||||
|
Loading…
Reference in New Issue
Block a user