Hi
Should Drupal 7.x still have Unmanaged file operations and should they be deprecated?
Unless all file operations are Managed, then implementing hook_file_*() calls are useless in detecting Unmanaged file operations. This also also true when providing custom file stream wrappers to hook_stream_wrappers_alter().
In Drupal 7.x, there are two types of file operations:
- Managed - Both file metadata is persisted to Drupal database TABLE file_managed and appropriate hook_file_*() calls are invoked.
- Unmanaged - Neither file metadata is persisted to Drupal database TABLE file_managed nor are any hook_file_*() calls invoked.
For example, uploading an image is Managed, but the generated (by GD) style images (thumbnail, medium, and large) are Unmanaged. Thereby, any file operation performed upon main image files are captured (via hook_file invocations), but none of the file operations pertaining to styled images are captured (works un-noticed and no hook_file are invoked).
To elaborate what happens with styled images (thumbnail, medium, and large):
- imagegd() generates and saves styled image directly to disc without using any Drupal file API operation.