I'd like to manually change the status column of a record in file_managed. The file URI is located in a permanent location. I simply forgot to change the status to 0 before performing file_save. I have no need to for all the hooks to get called associated with saving a file. So is it safe to manually update the status field in a file_managed record?

Along the same line, if there are no references to a particular fid in file_managed (ie no corresponding records in file_usage and no other fid references), is it safe to remove the file_managed record altogether?

1 Answer 1


No there's no harm in modifying the table manually, as long as you know what you're doing.

If there are no references to the file in the file_usage table, and you don't need the file any more, it's perfectly safe to simply delete the line from the file_managed table. Alternatively you could set the status for that file to zero in the table, and let it be deleted automatically on Drupal's cron run.

The advantage of doing it that way is that the physical file is also deleted automatically so you don't have to clean up yourself.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.