6.0.0-alpha10
5/17/25

[#8096] Download big folders as zip
Summary Download big folders as zip
Queue IMP
Queue Version Git master
Type Enhancement
State Resolved
Priority 1. Low
Owners Horde Developers (at) , slusarz (at) horde (dot) org
Requester valerio (at) dei (dot) unipd (dot) it
Created 03/18/2009 (5904 days ago)
Due
Updated 07/14/2009 (5786 days ago)
Assigned 06/28/2009 (5802 days ago)
Resolved 07/14/2009 (5786 days ago)
Milestone
Patch No

History
07/14/2009 03:00:38 AM Michael Slusarz Comment #11
State ⇒ Resolved
Version ⇒ Git master
Reply to this comment
I was writing from scratch a function to create Zip archive (mostly
complete) when I stumbled on this nice piece of software
http://www.phpconcept.net/pclzip/index.en.php
Even Joomla uses it.
That library is the definition of mega-bloat.  And it doesn't do 
streams, so it is of little value.



I have added stream support to Horde_Compress_Zip, and IMP 5.0 uses 
these streams to download the data.  It uses PHP's temp streams, so it 
will not use more than 2 MB of memory.
06/28/2009 04:27:41 PM Chuck Hagenbuch Assigned to Michael Slusarz
Assigned to Horde DevelopersHorde Developers
State ⇒ Assigned
 
06/10/2009 06:42:14 PM valerio (at) dei (dot) unipd (dot) it Comment #10
New Attachment: patch_with_PclZip.patch Download
Reply to this comment
I was writing from scratch a function to create Zip archive (mostly 
complete) when I stumbled on this nice piece of software

http://www.phpconcept.net/pclzip/index.en.php

Even Joomla uses it.



So, I rewrote a patch which use the last PclZip(2.8) copied in lib/PclZip.php

and some tricks to get the correct file name inside the archive.



Prerequisite: none (all inside the patch)


06/03/2009 05:56:21 PM Michael Slusarz Comment #9 Reply to this comment
Because ZipArchive is from a PHP extension (or PECL package), not a
PEAR package. Installation is another notch harder. I'm happy to use
it if it's available, but we should not require it.
To explain a bit more: your patch will cause a fatal error if 
ZipArchive is not installed.  There's no problem with using ZipArchive 
if available with a fallback.  Just can't require the existence of the 
extension.
06/03/2009 05:47:45 PM valerio (at) dei (dot) unipd (dot) it Comment #8 Reply to this comment
... and I forgot to correct myself:

it's *"Zip PECL extension"*

ZipArchive is the name  of the main class.



Not be confused with ZipArchive Library (full version is commercial)



php-pecl-zip is available in RPM, deb , ecc.
06/03/2009 05:41:46 PM Chuck Hagenbuch Comment #7 Reply to this comment
Because ZipArchive is from a PHP extension (or PECL package), not a 
PEAR package. Installation is another notch harder. I'm happy to use 
it if it's available, but we should not require it.
06/03/2009 05:30:22 PM valerio (at) dei (dot) unipd (dot) it Comment #6 Reply to this comment
Can you create a patch which works without ZipArchive being available?
I googled for zip php libs but all I found is: read the file in 
memory, compress it and write it.

Obviously this doesn't help.

I will investigate if I can: read a chunk, compress it and 
progressively add to the zip file.



BTW

Excerpt from http://www.horde.org/horde/docs/?f=INSTALL.html

pear install -o Log Mail Mail_Mime DB Date File

pear -d preferred_state=beta install -a Services_Weather



So, what's the problem in including one more (useful) package?


06/03/2009 01:45:52 PM Chuck Hagenbuch Comment #5
Patch ⇒ No
Reply to this comment
Can you create a patch which works without ZipArchive being available?
03/30/2009 10:09:25 PM Michael Slusarz Comment #4 Reply to this comment
This won't be committed because it assumes the user has the PECL 
module installed.
03/30/2009 10:06:35 PM Michael Slusarz Deleted Original Message
 
03/18/2009 02:37:18 PM valerio (at) dei (dot) unipd (dot) it Comment #3
New Attachment: folders_Folder[1].patch Download
Reply to this comment
I agree with your comment ( I search compress library in Horde 
framework before writing the patch).



Until Horde4 with ZipStream is ready  I will be happy using tmp files.



!important!



A collegue notice that old PHP versions have a memory leak in fpassthrough()

that should be replaced with:



        while(!feof($mbfile)) {

                echo fread($mbfile, 4096);

                ob_flush();

        }



Attached patch solves this issue and (maybe) is faster.
03/18/2009 01:54:22 PM Michael Rubinsky Comment #2
State ⇒ Feedback
Reply to this comment
There is ticket for Ansel (Bug: 7814) for using a stream for zip 
downloading. That should probably be made a framework ticket to be 
implemented in Horde_Compress and would probably make sense here as 
well.
03/18/2009 12:45:27 PM valerio (at) dei (dot) unipd (dot) it Comment #1
Priority ⇒ 1. Low
Type ⇒ Enhancement
Summary ⇒ Download big folders as zip
Queue ⇒ IMP
Milestone ⇒
Patch ⇒ Yes
New Attachment: folders_Folder.patch
State ⇒ New
Reply to this comment
Problem:

When requesting a ZIP of one  "big" mailbox (or many small) PHP may 
exceed max memory limit.

The attached patch uses tempnam() and is based on Ross Becker work:

http://lists.horde.org/archives/imp/Week-of-Mon-20040906/039136.html



Prerequisite: ZipArchive pecl extension



Todo: tmpdir should change with OS default (now is "/tmp") but tempnam 
behaviour is different between php version and OS.

Saved Queries