[Phpfreechat-svn] SF.net SVN: phpfreechat: [713] trunk/contrib/pfcInstaller2
Status: Beta
Brought to you by:
kerphi
From: <ke...@us...> - 2006-08-29 20:15:34
|
Revision: 713 Author: kerphi Date: 2006-08-29 13:15:26 -0700 (Tue, 29 Aug 2006) ViewCVS: http://svn.sourceforge.net/phpfreechat/?rev=713&view=rev Log Message: ----------- make possible to download local archives Modified Paths: -------------- trunk/contrib/pfcInstaller2/archive trunk/contrib/pfcInstaller2/mirrors trunk/contrib/pfcInstaller2/step2.php Modified: trunk/contrib/pfcInstaller2/archive =================================================================== --- trunk/contrib/pfcInstaller2/archive 2006-08-28 21:08:22 UTC (rev 712) +++ trunk/contrib/pfcInstaller2/archive 2006-08-29 20:15:26 UTC (rev 713) @@ -1 +1 @@ -phpfreechat-0.6.tar.gz +phpfreechat-1.0-beta5.tar.gz Modified: trunk/contrib/pfcInstaller2/mirrors =================================================================== --- trunk/contrib/pfcInstaller2/mirrors 2006-08-28 21:08:22 UTC (rev 712) +++ trunk/contrib/pfcInstaller2/mirrors 2006-08-29 20:15:26 UTC (rev 713) @@ -1 +1 @@ -http://www.phpfreechat.net/download \ No newline at end of file +http://www.phpfreechat.net/download Modified: trunk/contrib/pfcInstaller2/step2.php =================================================================== --- trunk/contrib/pfcInstaller2/step2.php 2006-08-28 21:08:22 UTC (rev 712) +++ trunk/contrib/pfcInstaller2/step2.php 2006-08-29 20:15:26 UTC (rev 713) @@ -17,6 +17,9 @@ <?php if (!$isinstalled) { + // delete the old archive + @unlink($dstpath."/".$archivename); + $param = array(); if (isset($_GET["host"])) $http["proxy_host"] = $_GET["host"]; if (isset($_GET["port"])) $http["proxy_port"] = $_GET["port"]; @@ -27,18 +30,39 @@ // loop over the mirrors for($i = 0; $i<count($mirrors) && !$unziped; $i++) { - $req =& new HTTP_Request($mirrors[$i]."/".$archivename, $param); - if (!PEAR::isError($req->sendRequest())) - { - $archivecontent = $req->getResponseBody(); - file_put_contents($dstpath."/".$archivename, $archivecontent); - + $copied = false; + if (preg_match("/^\//",$mirrors[$i])) + { + // local file + if (!file_exists($mirrors[$i]."/".$archivename)) + $errors[$mirrors[$i]][] = "Local file not found"; + else + { + @copy($mirrors[$i]."/".$archivename,$dstpath."/".$archivename); + $copied = true; + } + } + else + { + // remote file + $req =& new HTTP_Request($mirrors[$i]."/".$archivename, $param); + if (!PEAR::isError($req->sendRequest())) + { + $archivecontent = $req->getResponseBody(); + file_put_contents($dstpath."/".$archivename, $archivecontent); + } + } + if (file_exists($dstpath."/".$archivename)) $copied = true; + + // the archive has been copied (but maybe it just contains a html error page!) + if ($copied) + { require_once "File/Archive.php"; $src = $dstpath."/".$archivename."/"; $dest = $dstpath; $res = @File_Archive::extract( $src, $dest ); if (PEAR::isError($res)) - $errors[$mirrors[$i]] = array($res->getMessage()); + $errors[$mirrors[$i]][] = $res->getMessage(); else $unziped = true; } @@ -53,7 +77,7 @@ else { echo "<p>Error!</p>"; - print_r($errors); + echo "<pre>"; print_r($errors); echo "</pre>"; } } ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |