migrate in the correct place
This commit is contained in:
parent
5ba54a5811
commit
e5c61095f9
|
@ -120,21 +120,6 @@ def check_and_possibly_create_paths():
|
|||
create_log_db()
|
||||
gajim.logger.init_vars()
|
||||
|
||||
def migrate_logs_db_to_indeces():
|
||||
print _('migrating logs database to indeces')
|
||||
con = sqlite.connect(logger.LOG_DB_PATH)
|
||||
cur = con.cursor()
|
||||
# apply indeces
|
||||
cur.executescript(
|
||||
'''
|
||||
CREATE INDEX IF NOT EXISTS idx_logs_jid_id_kind ON logs (jid_id, kind);
|
||||
CREATE INDEX IF NOT EXISTS idx_unread_messages_jid_id ON unread_messages (jid_id);
|
||||
'''
|
||||
)
|
||||
|
||||
con.commit()
|
||||
con.close()
|
||||
|
||||
def create_path(directory):
|
||||
print _('creating %s directory') % directory
|
||||
os.mkdir(directory, 0700)
|
||||
|
|
|
@ -141,7 +141,7 @@ class Config:
|
|||
'send_on_ctrl_enter': [opt_bool, False, _('Send message on Ctrl+Enter and with Enter make new line (Mirabilis ICQ Client default behaviour).')],
|
||||
'show_roster_on_startup': [opt_bool, True],
|
||||
'key_up_lines': [opt_int, 25, _('How many lines to store for Ctrl+KeyUP.')],
|
||||
'version': [ opt_str, '0.10.1.3' ], # which version created the config
|
||||
'version': [ opt_str, '0.10.1.4' ], # which version created the config
|
||||
'search_engine': [opt_str, 'http://www.google.com/search?&q=%s&sourceid=gajim'],
|
||||
'dictionary_url': [opt_str, 'WIKTIONARY', _("Either custom url with %s in it where %s is the word/phrase or 'WIKTIONARY' which means use wiktionary.")],
|
||||
'always_english_wikipedia': [opt_bool, False],
|
||||
|
|
|
@ -126,8 +126,7 @@ class OptionsParser:
|
|||
os.chmod(self.__filename, 0600)
|
||||
|
||||
def update_config(self, old_version, new_version):
|
||||
# Convert '0.x.y' to (0, x, y)
|
||||
old_version_list = old_version.split('.')
|
||||
old_version_list = old_version.split('.') # convert '0.x.y' to (0, x, y)
|
||||
old = []
|
||||
while len(old_version_list):
|
||||
old.append(int(old_version_list.pop(0)))
|
||||
|
@ -146,7 +145,9 @@ class OptionsParser:
|
|||
self.update_config_to_01012()
|
||||
if old < [0, 10, 1, 3] and new >= [0, 10, 1, 3]:
|
||||
self.update_config_to_01013()
|
||||
|
||||
if old < [0, 10, 1, 4] and new >= [0, 10, 1, 4]:
|
||||
self.update_config_to_01014()
|
||||
|
||||
gajim.logger.init_vars()
|
||||
gajim.config.set('version', new_version)
|
||||
|
||||
|
@ -301,3 +302,26 @@ class OptionsParser:
|
|||
pass
|
||||
con.close()
|
||||
gajim.config.set('version', '0.10.1.3')
|
||||
|
||||
def update_config_to_01014():
|
||||
'''apply indeces to the logs database'''
|
||||
import exceptions
|
||||
try:
|
||||
from pysqlite2 import dbapi2 as sqlite
|
||||
except ImportError:
|
||||
raise exceptions.PysqliteNotAvailable
|
||||
import logger
|
||||
print _('migrating logs database to indeces')
|
||||
con = sqlite.connect(logger.LOG_DB_PATH)
|
||||
cur = con.cursor()
|
||||
# apply indeces
|
||||
cur.executescript(
|
||||
'''
|
||||
CREATE INDEX IF NOT EXISTS idx_logs_jid_id_kind ON logs (jid_id, kind);
|
||||
CREATE INDEX IF NOT EXISTS idx_unread_messages_jid_id ON unread_messages (jid_id);
|
||||
'''
|
||||
)
|
||||
|
||||
con.commit()
|
||||
con.close()
|
||||
gajim.config.set('version', '0.10.1.4')
|
||||
|
|
|
@ -1996,11 +1996,6 @@ if __name__ == '__main__':
|
|||
gtkgui_helpers.possibly_set_gajim_as_xmpp_handler()
|
||||
|
||||
check_paths.check_and_possibly_create_paths()
|
||||
|
||||
#FIXME: when .14 is out, remove this :D
|
||||
if gajim.config.get('version') <= '0.10.1.3':
|
||||
gajim.config.set('version', '0.10.1.4')
|
||||
check_paths.migrate_logs_db_to_indeces()
|
||||
|
||||
Interface()
|
||||
gtk.main()
|
||||
|
|
Loading…
Reference in New Issue