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:
3
TODO
3
TODO
@@ -1,7 +1,10 @@
|
||||
## GENERAL
|
||||
* on start up, should validate the import/storage/recycle bin paths exist and spit an error if they dont
|
||||
|
||||
* issue where someone could call IP .../Imp/photos and SP .../Sto/photos and then static/photos is ambiguous:
|
||||
-- DONE: make path prefix by static/<ptype.name>/ so that files are in: static/<ptype.name>/in_path.pp/dir.rel_path/
|
||||
-- then deleting below would just path_prefix from static/storage to .pa_bin/storage, etc.
|
||||
-- need to create the subdir if it does not exist in recycle_bin_path
|
||||
-- need to be able to view recycle bin (should be simple when we have path_types) &&& should able to consolidate the files_ip/files_sp/files_rb? route handling functions
|
||||
-- could also allow undelete per file / show content as another Files->View and more like storage (i.e. show folders)
|
||||
* storage_path viewing needs to be by folder / not a big grab bag of files (by default - DONE)
|
||||
|
||||
@@ -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