External zip utility

Other ::: local_externalzip
Maintained by Catalyst logoAaron Wells
Allows Moodle to use the command-line zip utility (/usr/bin/zip) instead of the PHP ZipArchive library.
Latest release:
25 sites
2 fans
Current versions available: 1

This package adds a settings page to allow Moodle to use external command-line zip and unzip utilities rather than the PHP ZipArchive library. It's intended as a workaround to ZipArchive's inability to handle large zip files (see http://tracker.moodle.org/browse/MDL-34388 ).

I've only tested it in Ubuntu 12.04, so it may not work properly on other platforms, if their "zip" and "unzip" utilities have different command-line options or output formats. It almost certainly won't work in Windows, although it could with some work.

I welcome community contributions. If you've got a fix to make this plugin work on a different OS, or with a later version of Moodle, please send me a github pull request or a patch file.


Catalyst logo
Aaron Wells (Lead maintainer)
Please login to view contributors details and/or to contact them

Comments RSS

Show comments
  • Germán and Temudgin
    Fri, Sep 28, 2012, 10:22 AM
    Hi Aaron,
    This seems a worthy addition to many Moodle sites, but I could not find the language strings available for translating it to other languages in AMOS. This could be due to the language strings not properly managed (but they are indeed in the local_externalzip.php file).

    Below are the mexican spanish translated strings:

    $string['pluginname'] = 'Utilería ZIP externa';

    $string['ziphandler'] = 'Manejador de archivo ZIP';
    $string['ziphandler_help'] = "Moodle soporta completamente tanto usar la biblioteca PHP ZipArchive o usar una utilería ZIP externa. ZipArchive es soportada completamente por Moodle, pero se sabe que tiene problemas al manejar archivos mayores de 2GB.";
    $string['phpziparchive_option'] = 'ZipArchive';
    $string['externalzip_option'] = 'Utilería ZIP externa';
    $string['pathtozip'] = 'Ruta a zip';
    $string['pathtozip_help'] = 'Ruta a utilería ZIP externa';
    $string['pathtounzip'] = 'Ruta a UNZIP';
    $string['pathtounzip_help'] = 'Ruta a utilería UNZIP externa';

    Would you be so kind as to check this. Help may be available by David Mudrak (in charge of language tool)

    German Valero (mexican spanish language pack maintainer).
  • Wed, Apr 17, 2013, 9:34 PM
    Hi Aaron,

    Thanks for creating this plugin. I was able to install the plugin. I turned on External Zip Utility. Made sure the paths were correct. However, we're still not able to restore a course from a file over 2GB. Course under 2GB are okay. We're still getting the "error/tmp_backup_directory_not_found" error. Any ideas what might be causing this? Thanks. John
  • Wed, Jul 17, 2013, 5:08 AM
    After hours of frustration, I wanted to share what I discovered about Moodle 2.5 and this plug-in. When you install the plug-in via the install plug-in feature of Moodle, it doesn't do a complete installation. It does not patch the zip-archive file properly/at all. This may have to do with a typo. In the readme.txt file included with this add-on, it says to run:

    patch -p1 < local/externalzip/lib-filestorage-zip_archive-php.patch

    in fact, you need to run:

    patch -p1 < local/externalzip/lib-filestorage-zip_archive.php.patch

    (it's archive.php, not archive-php). Once I did that from the command line, it all worked!

    So, John might be having the same problem as I was which is that, while it LOOKED like the external zip add-on was installed and selected to be used instead of ZipArchive, it was still trying to use ZipArchive.
  • Catalyst logo
    Wed, Jul 17, 2013, 6:50 AM
    Thanks for the report, Doug. I've updated the documentation, and packaged a new release that includes this typo fix, as well as an improvement to the admin screen submitted by Ruslan Kabalin.
  • Catalyst logo
    Wed, Jul 17, 2013, 7:05 AM
    Hi German,

    Sorry for the slow reply. I think the reason my strings don't show up in AMOS is because this plugin is classified as an "Other" plugin, and therefore AMOS doesn't know where its strings should go. I submitted it as a "Local" plugin, but the Moodle plugin directory maintainers decided it should be an "Other" because it includes a patch file.

    Fortunately, the only changes it makes to the interface are on the admin screens, so end users won't see untranslated English strings. I'll go ahead and include your Mexican Spanish translation in the package as well.
  • Wed, Jul 17, 2013, 7:11 AM
    Thanks, Aaron! What needs to be done to upgrade the add-on from the old version to the new version?

    By the way, you'll appreciate that, due to the time zone difference, my Mac is reporting the new files as modified on "Tomorrow 10:34 AM". smile
  • Catalyst logo
    Wed, Jul 17, 2013, 7:28 AM
    Hi Doug,

    I've put together a new revision with upgrade instructions, version 0.9.2.
  • Catalyst logo
    Wed, Jul 17, 2013, 7:46 AM
    Hi Doug, by the way, if you can verify that the plugin works in Moodle 2.5, let me know and I'll update the release details accordingly.
  • Thu, Jul 18, 2013, 1:27 AM
    Aaron, the plugin seems to work in Moodle 2.5 as far as I can tell, but I've only used it for Backup and Restore.

    I'm not sure, though, if installation of the plugin via Moodle works now (it didn't run the patch when I did it that way with version 0.9.0), but manual installation works.

    Correct me if I'm wrong, but it seems like the README.txt file included with version 0.9.2 does not include the upgrade instructions; I had to find those on this page in the Downloads tab, under "See more".
  • Sat, Aug 10, 2013, 10:05 AM
    I had tested the plugin in Moodle 2.5.1+ (Build: 20130808) at ubuntu13.04, and follow the instruction in readme.txt ,but failed to install,could you help me?Thank you very much
  • Catalyst logo
    Tue, Sep 10, 2013, 1:21 PM
    I've had a report about this plugin not working for the upload of SCORM files. Based on the description it sounds like a problem in the externalzip_archive's extract_zipfile() function not properly getting the list of the SCORM archive's contents. I haven't had a chance to investigate and fix the problem myself, though.
  • Thu, Jan 9, 2014, 12:02 AM
    I installed it on 2.5.3+ and it works "almost" fine. Doing a "Download all" of Legacy Course Files produces a 0-length zip file. It may be the related to Aaron's problem. Adding (at the beginning of function add_directory):
    if ($pathinarchive == '') {
    return true;
    makes it work for us.
Please login to post comments