6.0.0-git
2019-05-23

[#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 2009-03-18 (3718 days ago)
Due
Updated 2009-07-14 (3600 days ago)
Assigned 2009-06-28 (3616 days ago)
Resolved 2009-07-14 (3600 days ago)
Milestone
Patch No

History
2009-07-14 03:00:38 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.
2009-06-28 16:27:41 Chuck Hagenbuch Assigned to Michael Slusarz
Assigned to Horde DevelopersHorde Developers
State ⇒ Assigned
 
2009-06-10 18:42:14 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)


2009-06-03 17:56:21 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.
2009-06-03 17:47:45 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.
2009-06-03 17:41:46 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.
2009-06-03 17:30:22 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?


2009-06-03 13:45:52 Chuck Hagenbuch Comment #5
Patch ⇒ No
Reply to this comment
Can you create a patch which works without ZipArchive being available?
2009-03-30 22:09:25 Michael Slusarz Comment #4 Reply to this comment
This won't be committed because it assumes the user has the PECL 
module installed.
2009-03-30 22:06:35 Michael Slusarz Deleted Original Message
 
2009-03-18 14:37:18 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.
2009-03-18 13:54:22 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.
2009-03-18 12:45:27 valerio (at) dei (dot) unipd (dot) it Comment #1
Type ⇒ Enhancement
State ⇒ New
Priority ⇒ 1. Low
Summary ⇒ Download big folders as zip
Queue ⇒ IMP
Milestone ⇒
Patch ⇒ Yes
New Attachment: folders_Folder.patch
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