This module gives you the possibility to "lock" files. Locking files means adding an extra file_usage entry, because Drupal will delete files which aren't used anymore. But by now there is no possibility to keep "unused" files.
This behaviour can cause some trouble, for example if you're customer deletes and recreates nodes and than ask you why you've deleted all their files ;-)
An other 'misbehaviour usecase' is the bug described in this comment by tsvenson.
This is also bad considering that the Media/File Entity comes with a multi file import feature. Those imported files all have 0 in the usage table. Then if you add/remove it from a node, it will also be physically removed from the file system.
- "Update options" in file overview (for existing files)
- Lock selected files
- Unlock selected files
- Automatic file lock for new files*
- All files
- by filename pattern
- by regular expression
- Hook choosable (Update 23.12)
- all -> all file_save actions
- file_insert -> file create actions (new files)
- file_update -> file update actions (existing files)
*that means for EVERY new file. By using hook_file_insert, which will also be triggered on uploaded files while editing content (files will also be saved and locked if you actually don't save the node)
Some Ideas for additional functions
- Automatic lock by file types
- Automatic lock for specific file fields
- Option to lock files with a checkbox in the upload formular
- Apply file lock to all existing files (with filters)
By now file_lock acts in the background, there is no UI which shows the files that are locked and which aren't. A workaround could be to use a view in media browser showing the complete file_usage.
Tested and developed for the newest media module 7.x-2.x-dev (2011-Dec-07) (but should also work without that)