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:
|
for f in File.query:
|
||||||
if not state.tasks.connected:
|
if not state.tasks.connected:
|
||||||
return
|
return
|
||||||
path = f.item.get_path()
|
if f.item:
|
||||||
if not os.path.exists(path):
|
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
|
dirty = True
|
||||||
f.item.remove_file()
|
|
||||||
if dirty:
|
if dirty:
|
||||||
state.db.session.commit()
|
state.db.session.commit()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue