|
|
Choosing A Webhost: |
cvs: pearweb /public_html go-pear: msg#00057php.pear.core
pajoye Fri Apr 28 22:58:25 2006 UTC Modified files: /pearweb/public_html go-pear Log: - improve tempdir detection - display error and stops when no working tempdir are found or given http://cvs.php.net/viewcvs.cgi/pearweb/public_html/go-pear?r1=1.87&r2=1.88&diff_format=u Index: pearweb/public_html/go-pear diff -u pearweb/public_html/go-pear:1.87 pearweb/public_html/go-pear:1.88 --- pearweb/public_html/go-pear:1.87 Thu Apr 27 14:09:42 2006 +++ pearweb/public_html/go-pear Fri Apr 28 22:58:25 2006 @@ -18,7 +18,7 @@ # | Pierre-Alain Joye <pierre@xxxxxxx> | # | Greg Beaver <cellog@xxxxxxx> | # +----------------------------------------------------------------------+ -# $Id: go-pear,v 1.87 2006/04/27 14:09:42 pajoye Exp $ +# $Id: go-pear,v 1.88 2006/04/28 22:58:25 pajoye Exp $ # # Automatically download all the files needed to run the "pear" command # (the PEAR package installer). Requires PHP 4.1.0 or newer. @@ -90,8 +90,10 @@ echo '<pre>'; print_r($var); echo '</pre>'; + } else { + print_r($var); + print_r($var); } - print_r($var); } $sapi_name = php_sapi_name(); @@ -109,6 +111,7 @@ ini_set('html_errors', WEBINSTALLER); ini_set('magic_quotes_runtime', false); error_reporting( E_ALL & ~E_NOTICE); +error_reporting( E_ALL); define('WINDOWS', (substr(PHP_OS, 0, 3) == 'WIN')); define('GO_PEAR_VER', '0.5.0'); @@ -424,33 +427,6 @@ } } -#### -# Temp stuff -#### -if (!empty($tmp_dir)) { - tmp_dir($tmp_dir); -} else { - tmp_dir(); -} - -$foo = $ptmp; -$ptmp = tempnam($foo, 'gope'); -if (WINDOWS) { - $ptmp = str_replace($foo,'',$ptmp); - $foo=str_replace("\\\\",'/',$foo); - $s = substr($ptmp,0,1); - if($s=="\\" || $s=='/' ){ - $ptmp = $foo.'/'.substr($ptmp,1); - } else { - $ptmp = $foo.'/'.$ptmp; - } -} - -rm_rf($ptmp); -mkdir_p($ptmp, 0700); -$ok = @chdir($ptmp); -$tmp_dir = $ptmp; - while (!WEBINSTALLER) { print " Below is a suggested file layout for your new PEAR installation. To @@ -539,6 +515,49 @@ } } + +#### +# Temp stuff +#### +if (!empty($tmp_dir)) { + $_found = tmp_dir($tmp_dir); +} else { + $_found = tmp_dir(); +} + +if (!$_found) { + print " +****************************************************************************** +FATAL ERROR! We cannot initialize the temp directory. Please be sure to give +full write access to this directory and the install directory. + +"; + + if (!empty($tmp_dir)) { + print "'$tmp_dir' was given."; + } +} + +$foo = $ptmp; + +$ptmp = tempnam($ptmp, 'gope'); + +if (WINDOWS) { + $ptmp = str_replace($foo,'',$ptmp); + $foo = str_replace("\\\\",'/',$foo); + $s = substr($ptmp,0,1); + if($s == "\\" || $s == '/' ){ + $ptmp = $foo . '/' . substr($ptmp,1); + } else { + $ptmp = $foo . '/' . $ptmp; + } +} + +rm_rf($ptmp); +mkdir_p($ptmp, 0700); +$ok = @chdir($ptmp); +$tmp_dir = $ptmp; + foreach ($config_vars as $var) { $dir = $$var; @@ -588,7 +607,9 @@ $urltemplate = 'http://pear.php.net/get/%s'; $have_gzip = true; } + print "Loading zlib: ".($have_gzip ? 'ok' : 'failed')."\n"; + if (!$have_gzip) { print "Downloading uncompressed packages\n"; }; @@ -617,10 +638,11 @@ $local_dir[$file_pkg] = $file; } } + foreach ($installer_packages as $pkg) { if (isset($local_dir[$pkg])) { echo str_pad("Using local package: $pkg", max(38,21+strlen($pkg)+4), '.'); - copy(dirname(__FILE__).'/go-pear-bundle/'.$local_dir[$pkg], $local_dir[$pkg]); + copy(dirname(__FILE__) . '/go-pear-bundle/' . $local_dir[$pkg], $local_dir[$pkg]); $tarball[$pkg] = $local_dir[$pkg]; echo "ok\n"; displayHTMLProgress($progress += round(65 / count($to_install))); @@ -630,7 +652,9 @@ $msg = str_pad("Downloading package: $pkg", max(38,21+strlen($pkg)+4), '.'); print $msg; $url = sprintf($urltemplate, $pkg); + $pkg = str_replace('-stable', '', $pkg); + $tarball[$pkg] = download_url($url, null, $http_proxy); print "ok\n"; displayHTMLProgress($progress += round(65 / count($to_install))); @@ -714,7 +738,7 @@ print 'Extracting installer..................'; $dot = strrpos($tarball['PEAR'], '.'); $pkg = substr($tarball['PEAR'], 0, $dot); -$ext = substr($tarball['PEAR'], $dot+1); +$ext = substr($tarball['PEAR'], $dot + 1); include_once 'Archive/Tar.php'; $tar = &new Archive_Tar($tarball['PEAR'], $have_gzip); @@ -965,9 +989,7 @@ if (!empty($proxy) && $tmp_proxy['user'] != '') { $request .= 'Proxy-Authorization: Basic ' . base64_encode($tmp_proxy['user'] . ':' . $tmp_proxy['pass']) . "\r\n"; -// print "\nauthenticating against proxy with : user = ${tmp_proxy['user']} \n"; -// print "and pass = ${tmp_proxy['pass']}\n"; - } // if + } $request .= "\r\n"; fwrite($fp, $request); $cdh = "content-disposition:"; @@ -979,13 +1001,14 @@ } if (preg_match('/^Content-Length: (.*)$/i', $line, $matches)) { $content_length = trim($matches[1]); - }; + } if ($use_suggested_filename && !strncasecmp($line, $cdh, $cdhl)) { if (eregi('filename="([^"]+)"', $line, $matches)) { $destfile = basename($matches[1]); } } } + if ($content_length) { displayHTMLSetDownload($destfile); }; @@ -1151,17 +1174,20 @@ if ($default) { if (!is_dir($default)) { - if (mkdir_p($default)) { - /* try it really, is_writable is buggy with openbasedir */ - $fh = @fopen(realpath($default . "/test"),"wb"); - if ($fh) { - $ptmp = $default; - return true; - } else { - return false; - } + if (!mkdir_p($default)) { + return false; } } + + /* try it really, is_writable is buggy with openbasedir */ + $fh = fopen(realpath($default) . "/test","wb"); + if ($fh) { + $ptmp = $default; + return true; + } else { + $ptmp = "failed"; + return false; + } } $_temp = false; -- PEAR CVS Mailing List (http://pear.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | cvs: pearweb /public_html go-pear, Pierre-Alain Joye |
|---|---|
| Previous by Thread: | cvs: pearweb /public_html go-pear, Pierre-Alain Joye |
| Next by Thread: | cvs: pearweb /public_html/support icons.php index.php lists.php slides.php tutorials.php, Pierre-Alain Joye |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
Free MagazinesCisco NewsReceive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business. subscribe Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field. subscribe The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business. subscribe Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company. subscribe Total Telecom Total Telecom is "The Economist of the communications industry". subscribe |