Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Feature: Add archive extraction functionality to filetree contextmenu #12775
What does it do ?
Based on the forum discussion here: http://forums.modx.com/thread/84971/unzip-function-for-file-manager#dis-post-497458
This adds a filetree context menu item "Extract file" for .zip files (zip only for now), the PR includes an additional permission (file_unpack) and corresponding lexicon entry plus all necessary modifications in the core to make it work. That includes an additional method unpack() in the modfilehandler class where this feature could be used in another context (sure, that functionality could be used before this PR via the xPDO Archive class when loaded properly). It also adds the unrelated method move() as an alias of the rename() method to the filehandler, that's just something I find useful to write meaningful code when using the filehandler (depending on what the intended action is you can use either method to make the code speak for himself).
The file/folder structure inside the extracted archive will be preserved and the content of the archive will be extracted to the same folder as the archive lives in.
Why is it needed ?
Because extracting archives from the manager is awesome =)
This is the refactoring of the following PR (which was closed because I wanted to change too many things...again =D): #11352
Credits also go to Susan Ottwell for providing the right idea and approach to get this running!
Things to be aware
a) This will probably not work when you pull this into an existing installation of MODX as there is a new permission (file_unpack) that is "installed" when you install MODX, so basically to fully test it a new build of MODX has to be created and installed (or the permission has to be added manually)
Oh, yes please! Someone had a patch for adding this some time ago, but it was a bit uncertain in that it did patch the core and didn't work well as newer versions of MODX were a bit different in the core. This is the one feature that I need to be able to get rid of FTP/SFTP altogether and work entirely in the MODX Manager!
If you have an installation that's suitable for such test (backup the original assets folder =D), could you test what happens if you pack a folder called "assets" with a few files in it (some with the same name, but no content for example as in the existing assets folder) and you unpack it inside the MODX_BASE_PATH...the question is, will that "kill"/replace the assets folder completely (which would be bad) or just replace existing files with the same name and add the new ones, e.g. "merge" the original and the packed one (that's better)?