Hi,
I have implemented the Web File Manager on our Intranet (and what a great little module it is, too).
However, I need to control the auditing on files uploaded.
I presume this feature is not implemented, so I propose to hack the module code to allow the following.
If a user downloads an existing file for editing, then there should be a mechanism to lock the file for other access and when the user uploads the file again, it should archive the file on the server and replace with the updated version. The user name/id of the person updating the file should also be logged.
To do this I'm planning to create a database table with uid, file_id and file. When the file is downloaded the file on the server is placed into the custom database as a BLOB along with the user's uid and the file_id (extracted from webfm).
The file is replaced with an HTML or text file which simply reads: "This file has been checked out by $username", perhaps with a link to the BLOB combined with suitable warnings.
When a file is uploaded I want to check that the user is the user who has checked out the file. If it is, then the filename is checked against the file on the server (the one that has the "This file has been checked out by $username") and if the filenames match, then the checkout file is replaced. If the filenames don't match, then the system could issue a warning and an option to rename the file.
If the user is not the user who checked out the file (and the filename is checked out), then suitable warnings should be issued and the file option to replace the file should be offered.
I'm planning on writing 2 functions
function file_checkout($fid){
}
function file_checkin($fid){
}
which I plan to call from the end of the webfm_send_file() and the webfm_upload () functions in webfm.module.
Is this approach advisable?
Are there better ways of achieving this?