summaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
authorGravatar mkaay <mkaay@mkaay.de> 2011-02-05 21:09:08 +0100
committerGravatar mkaay <mkaay@mkaay.de> 2011-02-05 21:09:08 +0100
commit654784125f072edf1c731582c2a9efc5b1f61fbf (patch)
treeb8fd96266f40cc893799ff9402a5c9f7aa4f6b85 /module
parentbeaker + jinja2 lib (diff)
downloadpyload-654784125f072edf1c731582c2a9efc5b1f61fbf.tar.xz
fixed database conversion
Diffstat (limited to 'module')
-rw-r--r--module/DatabaseBackend.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/module/DatabaseBackend.py b/module/DatabaseBackend.py
index 5aa3365fa..ca4ab1e56 100644
--- a/module/DatabaseBackend.py
+++ b/module/DatabaseBackend.py
@@ -219,6 +219,22 @@ class DatabaseBackend(Thread):
self.c.executemany("INSERT INTO users(name, password, email) VALUES (?, ?, ?)", users)
move("pyload.db", "pyload.old.db")
+ if exists("web.db"):
+ try:
+ self.core.log.info(_("Moving users"))
+ except:
+ print "Moving users"
+ conn = sqlite3.connect('web.db')
+ c = conn.cursor()
+ c.execute("SELECT name, password, email, role, permission FROM users")
+ for r in c:
+ self.c.execute('SELECT name FROM users WHERE name=?', (r[0], ))
+ if self.c.fetchone() is None:
+ self.c.executemany("INSERT INTO users (name, password, email, role, permission) VALUES (?, ?, ?, ?, ?)", r)
+ c.close()
+ conn.close()
+
+ move("web.db", "web.old.db")
self.c.execute('VACUUM')
def createCursor(self):