1
0
mirror of https://github.com/mail-in-a-box/mailinabox.git synced 2025-04-21 03:02:09 +00:00

Check for db first and clear sessions to force re-login

This commit is contained in:
root 2018-12-03 11:06:58 -08:00
parent a7023d3758
commit 2e4d825b6e

View File

@ -149,8 +149,10 @@ def migration_11(env):
pass pass
def migration_12(env): def migration_12(env):
# Upgrading from Carddav Roundcube plugin to version 3+ requires the carddav_ # Upgrading to Carddav Roundcube plugin to version 3+, it requires the carddav_*
# tables to be dropped # tables to be dropped.
# Checking that the roundcube database already exists.
if os.path.exists(os.path.join(env["STORAGE_ROOT"], "mail/roundcube/roundcube.sqlite")):
import sqlite3 import sqlite3
conn = sqlite3.connect(os.path.join(env["STORAGE_ROOT"], "mail/roundcube/roundcube.sqlite")) conn = sqlite3.connect(os.path.join(env["STORAGE_ROOT"], "mail/roundcube/roundcube.sqlite"))
c = conn.cursor() c = conn.cursor()
@ -171,6 +173,15 @@ def migration_12(env):
conn.commit() conn.commit()
conn.close() conn.close()
# Delete all sessions, requring users to login again to recreate carddav_*
# databases
conn = sqlite3.connect(os.path.join(env["STORAGE_ROOT"], "mail/roundcube/roundcube.sqlite"))
c = conn.cursor()
c.execute("delete from session;")
conn.commit()
conn.close()
def get_current_migration(): def get_current_migration():
ver = 0 ver = 0
while True: while True: