Pure PHP ZIP replacement for Archive Upload

jhuebel

Joined: 2005-11-15
Posts: 2
Posted: Tue, 2005-11-15 02:46

Has anybody attemped to replace the unzip tool with a pure PHP implementation? I'm interested in doing this since the hosting service I'm using (godaddy.com) doesn't provide unzip.

I have a general idea where the modification needs to happen, but haven't a clue about implementing it.

In modules/archiveupload/classes/ArchiveExtractToolkit.class there is this line:

list ($success) = $platform->exec(array(array($unzip, $sourceFilename)));

That's where the unzip exec happens, but what's the best way of replacing this with a php unzip function that uses a syntax like unzip($filename,$destpath)?

Jason

 
draco2002

Joined: 2003-04-28
Posts: 70
Posted: Tue, 2005-11-15 03:05

your on the right track.

check out the comments here, it should help you out with what you need

http://us2.php.net/zip

-Draco

|| G1 + G2 Hosting | Custom Theming | Donate to Gallery ||

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Tue, 2005-11-15 03:05

implementing in pure php isn't a good idea. it would take much much longer and you'd take a lot of the server cpu resources.

http://www.php.net/zip would be worth a try.

 
draco2002

Joined: 2003-04-28
Posts: 70
Posted: Tue, 2005-11-15 03:06

beat yeah ;) (down to the minute, wheres the second counter on that one :) )

-edit- I read more into this and valiant is definetly right on the cpu usage. You might want to check into what commands are available and work with those if possible before doing a pure php unzip.

-Draco

|| G1 + G2 Hosting | Custom Theming | Donate to Gallery ||

 
jhuebel

Joined: 2005-11-15
Posts: 2
Posted: Fri, 2005-11-18 20:40

Well, the downside to the built-in zip support PHP offers is that it requires support for ZZIPlib to be compiled in. GoDaddy.com doesn't have that support included in their PHP install. So, I'm either left with finding out if they have an unzip executable or using a pure php implementation. I don't think the PHP implementation would be too bad, since we're only talking about <8MB zip files. 8MB is their upload limit anyway.

Thanks for the replies, though...

 
nefarious

Joined: 2005-09-29
Posts: 23
Posted: Sat, 2006-02-04 23:25

I have attached the zip and unzip package I use on godaddy. Just make sure you set the path correctly in gallery.

nef

 
lrshooter

Joined: 2006-04-14
Posts: 1
Posted: Fri, 2006-04-14 18:07

I also use GoDaddy for hosting and since I've been interested in opening archives on the site I was looking for some "cheats" where somone else already did the legwork on the PHP. While you are correct that the zziplib is not installed, zlib IS in installed. At least on my Version 2 Linux hosting. If you've not upgraded yet, do so. You get more space, more BW and less $. This includes PHP 5 and the entire GZip lib is installed then. Downside is this works on .gz files so you might have to change things around a bit for your situation to work.

Good luck.

http://us2.php.net/manual/en/ref.zlib.php This ones included.