FileID or ID for Filedocuments

4
To clean up some diskspace I've written a module that checks the files in the data/files folder to see if there still is a database record for this file. If theres not i can delete the file, if there is I should keep it. My only problem is how to retrieve the files I found in the folder from the database. For example: file 10031 from data/files/0100/10031 was found, now should i query the database for System.FileDocument with ID 10031 or System.FileDocument with FileID 10031?
asked
1 answers
0

In 3.3.10 the normal situation is that a file is stored by FileID, however there is still backward compatibility code for applications that used to run on version 2.5.2 or lower, where it does get the file by the ID of the file document object.

Normally you don't have to perform manual cleanups anyway, it will be a very rare situation where a file is still on disk but not in the database anymore, if nothing goes wrong they are just deleted together. Do you have a reason to assume you have unlinked files on disk?

answered