mostly a TODO update, but start of recycle bin in DB work (PATH, etc.) is now created when we do a force rebuild from the GUI
This commit is contained in:
@@ -281,10 +281,18 @@ def MessageToFE( job_id, alert, message ):
|
||||
session.commit()
|
||||
return msg.id
|
||||
|
||||
def ProcessRecycleBinDir(parent_job):
|
||||
settings = session.query(Settings).first()
|
||||
if settings == None:
|
||||
raise Exception("Cannot create file data with no settings / recycle bin path is missing")
|
||||
paths = settings.recycle_bin_path.split("#")
|
||||
ptype = session.query(PathType).filter(PathType.name=='Bin').first().id
|
||||
JobsForPaths( parent_job, paths, ptype )
|
||||
|
||||
def ProcessStorageDirs(parent_job):
|
||||
settings = session.query(Settings).first()
|
||||
if settings == None:
|
||||
raise Exception("Cannot create file data with no settings / import path is missing")
|
||||
raise Exception("Cannot create file data with no settings / storage path is missing")
|
||||
paths = settings.storage_path.split("#")
|
||||
ptype = session.query(PathType).filter(PathType.name=='Storage').first().id
|
||||
JobsForPaths( parent_job, paths, ptype )
|
||||
@@ -469,6 +477,7 @@ def JobForceScan(job):
|
||||
session.query(File).delete()
|
||||
session.query(Entry).delete()
|
||||
session.commit()
|
||||
ProcessRecycleBinDir(job)
|
||||
ProcessImportDirs(job)
|
||||
ProcessStorageDirs(job)
|
||||
FinishJob(job, "Completed (forced remove and recreation of all file data)")
|
||||
@@ -536,6 +545,15 @@ def ResetExistsOnFS(job, path):
|
||||
# used when scanning and a file has been removed out from under PA, or
|
||||
# when we remove duplicates
|
||||
def RemoveFileFromDB(id):
|
||||
print( "DDP: this should just switch the path link to the recycle bin and maybe udpate rel_path?")
|
||||
|
||||
# okay, so 'id' will have EntryDirLink -> PathDirLink needs a change, what about rel_path?
|
||||
|
||||
pdl = session.query(PathDirLink).join(Dir).join(EntryDirLink).filter(EntryDirLink.entry_id==id).first()
|
||||
print( pdl )
|
||||
|
||||
# think this needs to just switch pdl.path_id to bin???
|
||||
|
||||
session.query(EntryDirLink).filter(EntryDirLink.entry_id==id).delete()
|
||||
session.query(File).filter(File.eid==id).delete()
|
||||
session.query(Entry).filter(Entry.id==id).delete()
|
||||
@@ -936,6 +954,7 @@ def CheckForDups(job):
|
||||
FinishJob(job, f"Finished looking for duplicates")
|
||||
return
|
||||
|
||||
# Actually moves the physical file from its current real directory to a subdir of the recycle bin path
|
||||
def RemoveFileFromFS( del_me ):
|
||||
try:
|
||||
settings = session.query(Settings).first()
|
||||
|
||||
Reference in New Issue
Block a user