cleanup orphan file records
This commit is contained in:
parent
8fa5d10122
commit
10acaacbd9
1 changed files with 7 additions and 3 deletions
|
@ -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()
|
||||
|
||||
|
|
Loading…
Reference in a new issue