svn: /pear/pear-core/trunk/PEAR/ Start/CLI.php Start.php
| From: | Helgi Þormar Þorbjörnsson | Date: | Wed, 07 Apr 2010 21:52:24 +0000 |
| Subject: | svn: /pear/pear-core/trunk/PEAR/ Start/CLI.php Start.php | ||
| Groups: | php.pear.cvs php.pear.core | ||
| Request: | Send a blank email to pear-core+get-9368@lists.php.net to get a copy of this message | ||
dufuz Wed, 07 Apr 2010 21:52:24 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=297649
Log:
Fix Bug #14841 Installing pear into directory with space fails [dufuz]
Hide the extra slashes in the recommended layout section and a few CS fixes.
Bug: http://pear.php.net/bugs/14841 (unknown)
Changed paths:
U pear/pear-core/trunk/PEAR/Start/CLI.php
U pear/pear-core/trunk/PEAR/Start.php
Modified: pear/pear-core/trunk/PEAR/Start/CLI.php
===================================================================
--- pear/pear-core/trunk/PEAR/Start/CLI.php 2010-04-07 21:47:50 UTC (rev 297648)
+++ pear/pear-core/trunk/PEAR/Start/CLI.php 2010-04-07 21:52:24 UTC (rev 297649)
@@ -22,7 +22,7 @@
}
$this->origpwd = getcwd();
$this->config = array_keys($this->configPrompt);
-
+
// make indices run from 1...
array_unshift($this->config, "");
unset($this->config[0]);
@@ -65,14 +65,12 @@
Are you installing a system-wide PEAR or a local copy?
(system|local) [system] : ";
$tmp = trim(fgets($this->tty, 1024));
- if (!empty($tmp)) {
- if (strtolower($tmp) !== 'system') {
- print "Please confirm local copy by typing 'yes' : ";
- $tmp = trim(fgets($this->tty, 1024));
- if (strtolower($tmp) == 'yes') {
- $this->localInstall = true;
- $this->pear_conf = '$prefix\\pear.ini';
- }
+ if (!empty($tmp) && strtolower($tmp) !== 'system') {
+ print "Please confirm local copy by typing 'yes' : ";
+ $tmp = trim(fgets($this->tty, 1024));
+ if (strtolower($tmp) == 'yes') {
+ $this->localInstall = true;
+ $this->pear_conf = '$prefix\\pear.ini';
}
}
} else {
@@ -103,7 +101,7 @@
}
printf("%2d. $this->descFormat : %s\n", $n,
$this->configPrompt[$var], $fullvar);
}
-
+
print "\n$this->first-$this->last, 'all' or Enter to continue:
";
$tmp = trim(fgets($this->tty, 1024));
if (empty($tmp)) {
@@ -116,6 +114,7 @@
break;
}
}
+
if (isset($this->config[(int)$tmp])) {
$var = $this->config[(int)$tmp];
$desc = $this->configPrompt[$var];
@@ -240,13 +239,16 @@
fclose($fh);
$wshSaved = true;
}
- exec('cscript ' . $cscript . ' "' . $label . '"
//noLogo', $arPath);
+
+ exec('cscript ' . escapeshellarg($cscript) . ' "' .
escapeshellarg($label) . '" //noLogo', $arPath);
if (!count($arPath) || $arPath[0]=='' || $arPath[0]=='cancel') {
return '';
} elseif ($arPath[0]=='invalid') {
echo "Invalid Path.\n";
return '';
}
+
+ @unlink($cscript);
return $arPath[0];
}
@@ -316,7 +318,7 @@
If the specified directory is also not in the include_path used by
your scripts, you will have problems getting any PEAR packages working.
";
-
+
if ($php_ini = $this->getPhpiniPath()) {
print "\n\nWould you like to alter php.ini <$php_ini>? [Y/n] : ";
$alter_phpini = !stristr(fgets($this->tty, 1024), "n");
@@ -336,20 +338,20 @@
}
}
}
-
+
print "
Current include path : ".ini_get('include_path')."
Configured directory : $this->php_dir
Currently used php.ini (guess) : $php_ini
";
-
+
print "Press Enter to continue: ";
fgets($this->tty, 1024);
}
-
+
$pear_cmd = $this->bin_dir . DIRECTORY_SEPARATOR . 'pear';
$pear_cmd = OS_WINDOWS ? strtolower($pear_cmd).'.bat' : $pear_cmd;
-
+
// check that the installed pear and the one in the path are the same (if any)
$pear_old = System::which(OS_WINDOWS ? 'pear.bat' : 'pear',
$this->bin_dir);
if ($pear_old && ($pear_old != $pear_cmd)) {
@@ -366,9 +368,9 @@
"be sure to use the new $pear_cmd command\n";
}
}
-
+
print "\nThe 'pear' command is now at your service at $pear_cmd\n";
-
+
// Alert the user if the pear cmd is not in PATH
$old_dir = $pear_old ? dirname($pear_old) : false;
if (!$this->which('pear', $old_dir)) {
@@ -378,7 +380,7 @@
** '$this->bin_dir' to your PATH environment variable.
";
-
+
print "Run it without parameters to see the available actions, try 'pear
list'
to see what packages are installed, or 'pear help' for help.
@@ -391,7 +393,7 @@
";
}
-
+
if (OS_WINDOWS && !$this->localInstall) {
$this->win32CreateRegEnv();
}
@@ -419,7 +421,7 @@
{
unset($dirs[$key]);
}
-
+
foreach ($dirs as $dir) {
$dir = str_replace('\\\\', '\\', $dir);
if (!strlen($dir)) {
@@ -506,7 +508,7 @@
} else {
$newPath[0] = $this->php_dir;
}
-
+
foreach ($arrayPath as $path) {
$newPath[]= $path;
}
@@ -584,7 +586,7 @@
'"PHP_PEAR_DATA_DIR"="' . addslashes($this->data_dir) .
'"' . $nl .
'"PHP_PEAR_PHP_BIN"="' . addslashes($this->php_bin) .
'"' . $nl .
'"PHP_PEAR_TEST_DIR"="' . addslashes($this->test_dir) .
'"' . $nl;
-
+
$fh = fopen($this->prefix . DIRECTORY_SEPARATOR . 'PEAR_ENV.reg',
'wb');
if($fh){
fwrite($fh, $reg, strlen($reg));
Modified: pear/pear-core/trunk/PEAR/Start.php
===================================================================
--- pear/pear-core/trunk/PEAR/Start.php 2010-04-07 21:47:50 UTC (rev 297648)
+++ pear/pear-core/trunk/PEAR/Start.php 2010-04-07 21:52:24 UTC (rev 297649)
@@ -88,16 +88,21 @@
}
}
+ $slash = "\\";
+ if (strrpos($this->prefix, '\\') === (strlen($this->prefix) - 1)) {
+ $slash = '';
+ }
+
$this->localInstall = false;
$this->bin_dir = '$prefix';
- $this->temp_dir = '$prefix\tmp';
- $this->download_dir = '$prefix\tmp';
- $this->php_dir = '$prefix\pear';
- $this->doc_dir = '$prefix\docs';
- $this->data_dir = '$prefix\data';
- $this->test_dir = '$prefix\tests';
- $this->www_dir = '$prefix\www';
- $this->cfg_dir = '$prefix\cfg';
+ $this->temp_dir = '$prefix' . $slash . 'tmp';
+ $this->download_dir = '$prefix' . $slash . 'tmp';
+ $this->php_dir = '$prefix' . $slash . 'pear';
+ $this->doc_dir = '$prefix' . $slash . 'docs';
+ $this->data_dir = '$prefix' . $slash . 'data';
+ $this->test_dir = '$prefix' . $slash . 'tests';
+ $this->www_dir = '$prefix' . $slash . 'www';
+ $this->cfg_dir = '$prefix' . $slash . 'cfg';
$this->pear_conf = PEAR_CONFIG_SYSCONFDIR . '\\pear.ini';
/*
* Detects php.exe
@@ -237,6 +242,7 @@
};
$_ENV['TMPDIR'] = $_ENV['TEMP'] = $this->prefix .
'/tmp';
}
+
return @chdir($this->ptmp);
}