Unzipping on the server?

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
oddcarl
Regular
Posts: 27
Joined: Mon Nov 13, 2006 5:53 am
Location: The Barbary Coast of California

Unzipping on the server?

Post by oddcarl »

Wondering if the Serendipity zip file can be uploaded to the server and then unzipped using that cpanel feature? That would be great because Serendipity program has gotten large.

Thanks..oddcarl
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Unzipping on the server?

Post by garvinhicking »

Hi!

If cpanel can unzip a file, sure, it should work without a problem :)

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
oddcarl
Regular
Posts: 27
Joined: Mon Nov 13, 2006 5:53 am
Location: The Barbary Coast of California

Post by oddcarl »

OK, thanks Garvin, I'll try it. I know Gallery2 will work using their pre-installer but I don't know if that is something special they made up.

Thanks..oddcarl
judebert
Regular
Posts: 2478
Joined: Sat Oct 15, 2005 6:57 am
Location: Orlando, FL
Contact:

Post by judebert »

I just write a php script that calls system("unzip myfile.zip"); to install the newest release.

Of course, I delete it immediately, so nobody else can do the same.
Judebert
---
Website | Wishlist | PayPal
stm999999999
Regular
Posts: 1531
Joined: Tue Mar 07, 2006 11:25 pm
Location: Berlin, Germany
Contact:

Post by stm999999999 »

but, the zip has a folder inside (e.g. serendipity-nightly). How do you extract the files without these folder?
Ciao, Stephan
judebert
Regular
Posts: 2478
Joined: Sat Oct 15, 2005 6:57 am
Location: Orlando, FL
Contact:

Post by judebert »

Either I repack it with the appropriate directory name on a local computer, or I do something like:

Code: Select all

// Extract into temporary directory
system("unzip -d /tmp myfile.zip");
// Copy to my blog
system("cp -R /tmp/serendipity/* /htdocs/blog");
// Remove the tmp file
system("rm -rf /tmp/serendipity");
Judebert
---
Website | Wishlist | PayPal
oddcarl
Regular
Posts: 27
Joined: Mon Nov 13, 2006 5:53 am
Location: The Barbary Coast of California

Post by oddcarl »

Thanks for the replies all. One question remains, when it comes time to upgrade, can I do it via uploading the new zipfile? not sure exactly how to upgrade with this method.

Thanks..oddcarl
stm999999999
Regular
Posts: 1531
Joined: Tue Mar 07, 2006 11:25 pm
Location: Berlin, Germany
Contact:

Post by stm999999999 »

every update is just a "copy all files of the archive to the webspace" - your config_local.inc.php should be untouched, because this should not be in the archives.
Ciao, Stephan
judebert
Regular
Posts: 2478
Joined: Sat Oct 15, 2005 6:57 am
Location: Orlando, FL
Contact:

Post by judebert »

As stm9x9 says, you've got to copy all the files. You can either:
  1. download the archive to a local machine, unarchive it locally, and upload the files with an FTP client
  2. upload the archive to the remote machine and use a custom PHP script to unarchive it
If you choose to unarchive on the remote machine, you either need to modify the archive to match your directory, or write the script to copy files from the archive directory (usually serendipity/) to your blog directory.
Judebert
---
Website | Wishlist | PayPal
stm999999999
Regular
Posts: 1531
Joined: Tue Mar 07, 2006 11:25 pm
Location: Berlin, Germany
Contact:

Post by stm999999999 »

judebert wrote:Either I repack it with the appropriate directory name on a local computer, or I do something like:

Code: Select all

// Extract into temporary directory
system("unzip -d /tmp myfile.zip");
Do you have an idea, what to do if the hoster does not allow "system", "passthrough" etc? Is there a php-variante for this all?
Ciao, Stephan
williamts99
Regular
Posts: 30
Joined: Sat Dec 10, 2005 11:50 pm
Contact:

Post by williamts99 »

If you can get SSH access to your host you can use that to transfer, rename, decompress the zip file, and rename if you must. You also might want to look into using the wget command that way you can download the zip from the hosting server directly to your server. That saves you a ton of time as there is nothing faster then server to server transfers.

It takes me about 3 seconds to download the zip file by using the command:
wget http://prdownloads.sourceforge.net/php- ... p?download
^that is all one line
then another 3 seconds to unzip using
unzip serendipity-1.1.2.zip
which will unzip all of the files into the serendipity/ directory and if the files exist it will ask if you want to overwrite and give you the option of yes/no/All/None/Rename

That is about it, and of course this could all be automated.

Edit: I figured I would post a very simple php script that would do this all automatically, pretty crude without any options, buttons, variables etc, but it will get the job done for you automatically, s9y will be extracted to the serendipity/ directory where ever you put the script and will overwrite any files that exist in the serendipity directory. Copy and paste it into a file named install.php or whatever then upload to desired directory and run by visiting the page.

Code: Select all

<?php
// This PHP command will download the ZIP file
system('wget http://prdownloads.sourceforge.net/php-blog/serendipity-1.1.2.zip?download');
// Then this PHP command will unzip the downloaded files while overwriting exisiting files
system('unzip -o serendipity-1.1.2.zip');
// And finally this PHP command will remove the downloaded zip file
system('rm serendipity-1.1.2.zip');
?>
judebert
Regular
Posts: 2478
Joined: Sat Oct 15, 2005 6:57 am
Location: Orlando, FL
Contact:

Post by judebert »

stm999999999 wrote:Do you have an idea, what to do if the hoster does not allow "system", "passthrough" etc? Is there a php-variante for this all?
PHP has some zip functions, but I don't know how to use them, I'm afraid. It looks like they're cooking up something really nice, but it's only in CM right now.
Judebert
---
Website | Wishlist | PayPal
Post Reply