-
Notifications
You must be signed in to change notification settings - Fork 5
"Safe" file deletion
Deleting file safely implies counting file references, which can be stored:
-
In the DNN content items
-
In the database table
-
In the HTML code (links) or elsewhere
Extension which provide safe file deletion (presumably with the corresponding content) will need to:
-
Get DNN content items related to the file
-
Get database records related to the file
-
If file is referenced by any content items or records, which is not about to be deleted right now, the file should not be deleted
-
If file is referenced only by content items or records, which is just about to be deleted, that file can be "safely" deleted
Probably it’s better try to delete content item/database records first, and only after that delete the file.
R7.Dnn.Extensions provide Content/ContentHelper.GetContentItemsByFile for p.1, while concrete extension should be responsible for implementing p.2 and general algorithm.
Implementation of p.3 looks like most problematic - it’s another reason to embrace implementing of DNN ContentItems API across various extensions.