In our system we have some files hosted on external storage services and both files and generated pages are cached through a reverse proxy.
To make sure that we don't delete a file which is still referred to by a page cached in the reverse proxy, we need to make delayed deletes of all files.
This is done by introducing a hook in the file_unmanaged_delete() function, which allows other modules to alter the list of functions called when a module requests a file delete. In our case we replace the drupal_unlink with our own function that adds file URI to a queue of files scheduled to be deleted in the future, and we have implemented a cron job to do the actual deletion at a later time.
Comment | File | Size | Author |
---|---|---|---|
#1 | drupal-introduce_hook_file_unmanaged_delete_alter-1935038-1.patch | 1.96 KB | esbenvb |
Comments
Comment #1
esbenvb CreditAttribution: esbenvb commentedHere's a patch.
IMPORTANT: When porting the patch, remember to supply the correct author information as mentioned here:
http://drupal.org/user/989064
Comment #2
dudycz CreditAttribution: dudycz commentedI'm still learning Drupal so forgive me the question but is it not to late to add hook to 7.x?