diff --git a/setup/migrate.py b/setup/migrate.py index 1d5911ab..b10f085f 100755 --- a/setup/migrate.py +++ b/setup/migrate.py @@ -148,6 +148,40 @@ def migration_11(env): # meh pass +def migration_12(env): + # Upgrading to Carddav Roundcube plugin to version 3+, it requires the carddav_* + # 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 + conn = sqlite3.connect(os.path.join(env["STORAGE_ROOT"], "mail/roundcube/roundcube.sqlite")) + c = conn.cursor() + # Get a list of all the tables that begin with 'carddav_' + c.execute("SELECT name FROM sqlite_master WHERE type = ? AND name LIKE ?", ('table', 'carddav_%')) + carddav_tables = c.fetchall() + # If there were tables that begin with 'carddav_', drop them + if carddav_tables: + for table in carddav_tables: + try: + table = table[0] + c = conn.cursor() + dropcmd = "DROP TABLE %s" % table + c.execute(dropcmd) + except: + print("Failed to drop table", table, e) + # Save. + conn.commit() + 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(): ver = 0 while True: diff --git a/setup/webmail.sh b/setup/webmail.sh index 567a4f5a..cdf73cfb 100755 --- a/setup/webmail.sh +++ b/setup/webmail.sh @@ -39,8 +39,8 @@ VERSION=1.3.8 HASH=90c7900ccf7b2f46fe49c650d5adb9b85ee9cc22 PERSISTENT_LOGIN_VERSION=dc5ca3d3f4415cc41edb2fde533c8a8628a94c76 HTML5_NOTIFIER_VERSION=4b370e3cd60dabd2f428a26f45b677ad1b7118d5 -CARDDAV_VERSION=2.0.4 -CARDDAV_HASH=d93f3cfb3038a519e71c7c3212c1d16f5da609a4 +CARDDAV_VERSION=3.0.3 +CARDDAV_HASH=d1e3b0d851ffa2c6bd42bf0c04f70d0e1d0d78f8 UPDATE_KEY=$VERSION:$PERSISTENT_LOGIN_VERSION:$HTML5_NOTIFIER_VERSION:$CARDDAV_VERSION