diff options
author | 2015-04-21 20:50:05 +0200 | |
---|---|---|
committer | 2015-04-21 20:50:05 +0200 | |
commit | ce9e0c03e131162523ec949fc66b6802920fcd3b (patch) | |
tree | b82a8b5fc0a309f69733b0a004284f4ef45833d8 /pyload/database | |
parent | hotfix 2 (diff) | |
download | pyload-ce9e0c03e131162523ec949fc66b6802920fcd3b.tar.xz |
revert for merge
Diffstat (limited to 'pyload/database')
-rw-r--r-- | pyload/database/Backend.py | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/pyload/database/Backend.py b/pyload/database/Backend.py index 2f112bea4..b6540b2be 100644 --- a/pyload/database/Backend.py +++ b/pyload/database/Backend.py @@ -175,20 +175,18 @@ class DatabaseBackend(Thread): f.write(str(DB_VERSION)) return - v = 0 - with open("files.version", "rb") as f: + with open("files.version", "wb+") as f: v = int(f.read().strip()) - if v < DB_VERSION: - if v < 2: - try: - self.manager.core.log.warning(_("Filedatabase was deleted due to incompatible version.")) - except Exception: - print "Filedatabase was deleted due to incompatible version." - remove("files.version") - move("files.db", "files.backup.db") - with open("files.version", "wb") as f: + if v < DB_VERSION: + if v < 2: + try: + self.manager.core.log.warning(_("Filedatabase was deleted due to incompatible version.")) + except Exception: + print "Filedatabase was deleted due to incompatible version." + remove("files.version") + move("files.db", "files.backup.db") f.write(str(DB_VERSION)) - return v + return v def _convertDB(self, v): |