====== Plugin ArchiveUpload ====== ---- plugin ---- description: Allows to extract an archive (.zip/.tgz/.tar/.tar.gz/.gz) on upload. author : Michael Klier email : chi@chimeric.de type : action lastupdate : 2009-05-21 compatible : > 2009-02-14, 2008-05-05 depends : conflicts : similar : tags : upload, archive downloadurl: http://cloud.github.com/downloads/chimeric/dokuwiki-plugin-archiveupload/plugin-archiveupload.tgz bugtracker : http://github.com/chimeric/dokuwiki-plugin-archiveupload/issues sourcerepo : http://github.com/chimeric/dokuwiki-plugin-archiveupload/ donationurl: https://www.paypal.com/xclick/business=chi%40chimeric.de&item_name=DokuWiki%2BPlugin%2BDonation&no_shipping=1&no_note=1&tax=0¤cy_code=EUR&lc=US ---- ^ Download | [[http://cloud.github.com/downloads/chimeric/dokuwiki-plugin-archiveupload/plugin-archiveupload.tgz|plugin-archiveupload.tgz]] | ^ Github URL | [[http://github.com/chimeric/dokuwiki-plugin-archiveupload]] | ===== Donate ===== Support the ongoing development of DokuWiki Plugins and Templates and [[https://www.paypal.com/xclick/business=chi%40chimeric.de&item_name=DokuWiki%2BPlugin%2BDonation&no_shipping=1&no_note=1&tax=0¤cy_code=EUR&lc=US|buy me a coffee]] ;-) (Suggested: 3€ for a regular or 5€ for big latte with caramel). ===== Description ===== This Plugin allows you to extract an archive directly on upload. It does all the mime-type and security checks DokuWiki normally does. Currently supported archive types are: ''.zip .tgz .tar .tar.gz .gz''. Once installed, it adds another checkbox to the upload form which, when ticked, will cause the plugin to try to extract the uploaded file as an archive. {{http://www.chimeric.de/_media/projects/dokuwiki/plugin/archiveupload/screenshot.png}} ===== Installation ===== Download the archive and unpack it into ''/lib/plugins''. * [[http://cloud.github.com/downloads/chimeric/dokuwiki-plugin-archiveupload/plugin-archiveupload.tgz|.tgz]] Plugin Manager. The plugin is also available via git. % cd /lib/plugins % git clone git://github.com/chimeric/dokuwiki-plugin-archiveupload.git archiveupload ===== Configuration ===== This plugin has no configuration options. ===== Changelog ===== A complete changelog can be found [[http://github.com/chimeric/dokuwiki-plugin-archiveupload/commits/|here]]. {{rss>http://github.com/feeds/chimeric/commits/dokuwiki-plugin-archiveupload/master 10 1d}} ===== Bugs / Feature Requests ===== Please report bugs and feature requests at the [[http://github.com/chimeric/dokuwiki-plugin-archiveupload/issues|bug tracker]]. ===== Discussion ===== ==== Ignoring Directories ==== I've made a slight modification to my version: giving the option for directories to be ignored. Essentially, the user might have zipped the files in the current directory, might have zipped them from the directory above... there is no way of knowing until the files have been uploaded, and then it's a bit of a pain to move them. So, a few minor tweaks:- 1. Add this into ''handle_form_output'' in ''action.php'' (also requires you to change the lang files):- $event->data->addElement(form_makeCheckboxField('ignoredirs', 0, $this->getLang('ignoredirs'))); 2. Add the following to the ''lang//lang.php'':- $lang['ignoredirs'] = 'Ignore archive directories'; 3. Add the following into ''postProcessFiles'', after the line ''$fn_new = str_replace(':', '/', cleanID($fn_new));'':- if ( isset( $_REQUEST['ignoredirs'] ) ) { $lastslash = strrpos( $fn_new, '/' ); $fn_new = ( $lastslash !== false ) ? substr( $lastslash, $lastslash+1 ) : $fn_new; if ( $fn_new == '' ) continue; // This is a directory, and these are being ignored } In my limited testing, this makes sure that all the files in the archive are put in the same directory. -- [[public@ssbd.net|Andy Turner 2009-07-14 13:40]] ==== Firing MEDIA_UPLOAD_FINISH? ==== One thought that I've had - and I've not looked at whether this works or is feasible - I reckon that the ''MEDIA_UPLOAD_FINISH'' event should be fired for all of the uploaded files. For example, if I want to resize uploaded images to conform to a maximum size, I can't upload them by archive. So, is it technically feasible to modify the action plugin to repeatedly fire MEDIA_UPLOAD_FINISH for each file uploaded? (Or am I talking nonsense and it does this already :-P) -- [[public@ssbd.net|Andy Turner 2009-07-14 13:42]]