How to track files downloaded with filebrowser
Today I had a client that wanted to track the private files their users download. They used the filebrowser module as the user interface to browse the private directory. There is no tracking system with this module. In addition, filebrowser handles files differently than the default Drupal system. Usually every time a file is downloaded the file_download() function is called.
Solution: Creating a custom module
Inside your custom module add the following lines:
/** * Implements hook_download_manager_process() * its part of the filebrowser module */ function MYMODULE_filebrowser_download_manager_process($delta = NULL, $file = NULL, $filename = NULL) { switch ($delta) { case 'private': watchdog('private downloaded', "private file download: $filename"); break; } }
Now, every time a file is downloaded, it is logged to watchdog.
Additional Tools and Resources
I like to install the views watchdog module. Then, I customize it by adding a user filter
Add new comment