I would've expected to be able to upload Bartik theme into Update Manager (http://drupal.org/node/683026#comment-2486156) but when I enter http://drupal.org/files/issues/bartik.zip as the URL to install, I get:
Error message
Cannot extract temporary://update-cache/bartik.zip, not a valid archive.
I swear we added support for .zip files, so I'm not sure why this happens.
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | 693082-10.ArchiverZip.patch | 2.93 KB | dww |
| #9 | 693082-9.ArchiverZip.patch | 2.82 KB | dww |
| #8 | 693082-8.ArchiverZip.patch | 4.2 KB | dww |
| #6 | 693082-6.ArchiverZip.patch | 3.14 KB | dww |
| #4 | 693082-4.ArchiverZip.patch | 2.82 KB | dww |
Comments
Comment #1
reglogge commentedWell, correct me if I'm wrong, but there seems indeed to be no support for actually handling zip-files yet.
Evidence:
- modules/system/system.archiver.inc only implements the tar-archiver which lives in modules/system/system.tar.inc. This class doesn't handle zip-files, only gzipped tarballs.
- also, in modules/system/system.api.php (line 2634...) there is no mention of a zip archiver class:
Maybe adding a zip archiver class was forgotten after this #604618: Create a common interface for Archive operations so we can handle .zip, .tar.gz. was closed?
Comment #2
xmarket commentedPlease support .tgz archives too.
Thanks,
XMarket
Comment #3
dwwThat's by design. For now, core only supports .tar, .tar.gz, and .tgz. There's plumbing to let contrib support .zip if someone wanted (perhaps via Update advanced):
#604618: Create a common interface for Archive operations so we can handle .zip, .tar.gz.
#605918: Port update manager to use the new Archiver class, not directly Archive_Tar
If we wanted to natively support .zip in core, someone needs to add an ArchiverZip class that implements the ArchiverInterface, e.g. in modules/system/system.archiver.inc.
If y'all want that in D7, great, just say so. Otherwise, feel free to move this to D8.
Note, even if we had an ArchiverZip, this wouldn't work so long as file_save_upload() is broken via #693084: Regression: file_munge_filename() extension handling broken by move to File Field.
Comment #4
dwwUntested, but something like this should do.
Comment #5
dww@xmarket: see #700592: ArchiverTar class supports .tgz but we don't recognize it
Comment #6
dwwOkay, tested this one and it actually works to install new modules. ;) Our ArchiverInterface is a bit stupid when it comes to the listContents() function. There's a call site in update.manager.inc that expects the array in a certain format (the one returned by tar), but the interface docs don't clearly specify what the array returned by this method is supposed to look like. See #700686: ArchiverInterface::listContents() doesn't match documentation and doesn't make sense... If that patch lands, this will need a slightly different (and simpler) patch.
Comment #7
dwwSo, if #700686: ArchiverInterface::listContents() doesn't match documentation and doesn't make sense lands, all we need in ArchiverZip is this:
I'm not going to attach that as a patch yet, since that'll confuse the bot, but it'll be easy to re-roll this as needed.
Guess I'm working on this, so I should assign myself. ;)
Comment #8
dwwYay, webchick committed #700686: ArchiverInterface::listContents() doesn't match documentation and doesn't make sense, so here's a re-roll of #6 using the function from #7.
Comment #9
dwwargh, stupid patch. basically had the diff applied twice. Try this.
Comment #10
dwwBased on review from chx in IRC:
A) added @link http://php.net/zip
B) added a @todo about the Exception in the constructor when open() fails.
Also, while I was working on these, I noticed upon closer inspection that ZipArchive::open() returns error codes on failure, not just FALSE, so we need to test for !== TRUE, not just !.
Comment #11
chx commentedI guess that works.
Comment #12
dries commented'Exception' should be 'exception'?
Comment #13
dries commentedI made the small change pointed out in #12 and committed this patch to CVS HEAD. Thanks!