cleanup orphan file records

This commit is contained in:
j 2016-01-11 19:59:55 +05:30
parent 8fa5d10122
commit 10acaacbd9

View file

@ -33,10 +33,14 @@ def remove_missing():
for f in File.query:
if not state.tasks.connected:
return
if f.item:
path = f.item.get_path()
if not os.path.exists(path):
dirty = True
f.item.remove_file()
else:
state.db.session.delete(f)
dirty = True
if dirty:
state.db.session.commit()