summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar root <root@raspberrypi.(none)> 2015-04-21 08:39:29 +0200
committerGravatar root <root@raspberrypi.(none)> 2015-04-21 08:39:29 +0200
commit3c7eb723000f9e1577a8e1df7d14595d6af6b90c (patch)
tree7478edf440cc1d53bffc298b90397a0c12a3864c
parenthotfix (diff)
downloadpyload-3c7eb723000f9e1577a8e1df7d14595d6af6b90c.tar.xz
hotfix 2
-rw-r--r--pyload/database/Backend.py22
1 files changed, 12 insertions, 10 deletions
diff --git a/pyload/database/Backend.py b/pyload/database/Backend.py
index b6540b2be..2f112bea4 100644
--- a/pyload/database/Backend.py
+++ b/pyload/database/Backend.py
@@ -175,18 +175,20 @@ class DatabaseBackend(Thread):
f.write(str(DB_VERSION))
return
- with open("files.version", "wb+") as f:
+ v = 0
+ with open("files.version", "rb") 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")
+ 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:
f.write(str(DB_VERSION))
- return v
+ return v
def _convertDB(self, v):