Greetings,
first of all, thank you for this great module.
I would like to add a new option to the "actions" menu to unzip the selected file.
Using shell_exec() should be pretty easy as long as "unzip" exists on the server, I would just like a few hints on where to start and how to implement it.
Thank you in advance
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | filebrowser_unzip.tar_.gz (110617) | 1000 bytes | Nicolas Georget |
| #4 | filebrowser_unzip.tar_.gz | 817 bytes | Yoran |
Comments
Comment #1
Nicolas Georget commentedFirst, you can add an new action into the function
filebrowser_filebrowser_actions_info($node)line 834 of the filefilebrowser.module:Then, you will need to implement the new action that you declared into the function
filebrowser_filebrowser_action_process($node, $action, $fids)just after (line 856):It's a draft but it's a start. There are other things to consider, as the implementation of the permissions, reload the node after the extraction...
The second way to do that is to use the PHP ZipArchive lib and preview the files inside the ZIP (as a folder) and resulting an extraction of some files only. Use the second parameter of the method
$zip->extractTo($target, array($myFile1, $myFile2, $myFile3))to do that...Comment #2
smekras commentedI'm somewhat of a newbie with php and at the moment I don't really care about extra features other than unzipping a single selected file. I tried copying the code above in the right place but it is returning errors about fids (is that the variable that returns the selected files?). I would appreciate it if someone could help me out with that.
thanks
Comment #3
pantoflen commentedsubscribe. anyone?
Comment #4
Yoran commented@Nicolas Georget
You was'nt that far ;-) I attached to this comment a sample module adding "unarchive" to filebrowser.
I don't feel like this should be part of core filebrowser module, but perhaps I'm wrong about this.
Comment #5
Nicolas Georget commentedI added a warning message in case of the user has not the right to view subdirectory listings!
Might be useful if the user unzip the archive and watch nothing happens.
By the way Yoran, do you know your constant
FILEBROWSER_VIEW_DIRECORY_LISTINGSshould have a 't': FILEBROWSER_VIEW_DIRECTORY_LISTINGS ;-)Comment #6
Yoran commentedOh well, ok, corrected un -dev :)