MCPcopy
hub / github.com/pyload/pyload / _checkVersion

Method _checkVersion

module/database/DatabaseBackend.py:160–182  ·  view source on GitHub ↗

check db version and delete it if needed

(self)

Source from the content-addressed store, hash-verified

158 self.jobs.put("quit")
159
160 def _checkVersion(self):
161 """ check db version and delete it if needed"""
162 if not exists("files.version"):
163 f = open("files.version", "wb")
164 f.write(str(DB_VERSION))
165 f.close()
166 return
167
168 f = open("files.version", "rb")
169 v = int(f.read().strip())
170 f.close()
171 if v < DB_VERSION:
172 if v < 2:
173 try:
174 self.manager.core.log.warning(_("Filedatabase was deleted due to incompatible version."))
175 except:
176 print "Filedatabase was deleted due to incompatible version."
177 remove("files.version")
178 move("files.db", "files.backup.db")
179 f = open("files.version", "wb")
180 f.write(str(DB_VERSION))
181 f.close()
182 return v
183
184 def _convertDB(self, v):
185 try:

Callers 1

runMethod · 0.95

Calls 6

existsFunction · 0.85
removeFunction · 0.85
_Function · 0.50
writeMethod · 0.45
closeMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected