Update to PEAR 1.7.2, Image_Canvas 0.3.1, Image_Color 1.0.3, Image_Graph 0.7.2, XML_Parser 1.3.1.
Removed PHP_Compat, and references to it. Removed ionCube/Zend/mmCache compatibility checks in test.php script. Changed minimum PHP requirement to 5.0 in test.php script.
This commit is contained in:
@@ -14,9 +14,9 @@
|
||||
* @package PEAR
|
||||
* @author Stig Bakken <ssb@php.net>
|
||||
* @author Greg Beaver <cellog@php.net>
|
||||
* @copyright 1997-2005 The PHP Group
|
||||
* @copyright 1997-2008 The PHP Group
|
||||
* @license http://www.php.net/license/3_0.txt PHP License 3.0
|
||||
* @version CVS: $Id: CLI.php,v 1.56 2005/10/19 04:11:26 cellog Exp $
|
||||
* @version CVS: $Id: CLI.php,v 1.68 2008/01/03 20:26:36 cellog Exp $
|
||||
* @link http://pear.php.net/package/PEAR
|
||||
* @since File available since Release 0.1
|
||||
*/
|
||||
@@ -31,9 +31,9 @@ require_once 'PEAR/Frontend.php';
|
||||
* @package PEAR
|
||||
* @author Stig Bakken <ssb@php.net>
|
||||
* @author Greg Beaver <cellog@php.net>
|
||||
* @copyright 1997-2005 The PHP Group
|
||||
* @copyright 1997-2008 The PHP Group
|
||||
* @license http://www.php.net/license/3_0.txt PHP License 3.0
|
||||
* @version Release: 1.4.5
|
||||
* @version Release: 1.7.2
|
||||
* @link http://pear.php.net/package/PEAR
|
||||
* @since Class available since Release 0.1
|
||||
*/
|
||||
@@ -143,7 +143,19 @@ class PEAR_Frontend_CLI extends PEAR_Frontend
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@$this->_displayLine("#$i: $frame[class]$frame[type]$frame[function] $frame[line]");
|
||||
if (!isset($frame['class'])) {
|
||||
$frame['class'] = '';
|
||||
}
|
||||
if (!isset($frame['type'])) {
|
||||
$frame['type'] = '';
|
||||
}
|
||||
if (!isset($frame['function'])) {
|
||||
$frame['function'] = '';
|
||||
}
|
||||
if (!isset($frame['line'])) {
|
||||
$frame['line'] = '';
|
||||
}
|
||||
$this->_displayLine("#$i: $frame[class]$frame[type]$frame[function] $frame[line]");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -309,50 +321,43 @@ class PEAR_Frontend_CLI extends PEAR_Frontend
|
||||
$answers[$param['name']] = '';
|
||||
}
|
||||
}
|
||||
$tried = false;
|
||||
do {
|
||||
$ok = array('yesno' => 'no');
|
||||
do {
|
||||
$answers = $this->userDialog('', $prompts, $types, $answers);
|
||||
} while (count(array_filter($answers)) != count($prompts));
|
||||
$this->outputData('Your choices:');
|
||||
foreach ($prompts as $name => $prompt) {
|
||||
$this->outputData($prompt . ': ' . $answers[$name]);
|
||||
if ($tried) {
|
||||
$i = 1;
|
||||
foreach ($answers as $var => $value) {
|
||||
if (!strlen($value)) {
|
||||
echo $this->bold("* Enter an answer for #" . $i . ": ({$prompts[$var]})\n");
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
$ok = $this->userDialog('',
|
||||
array(
|
||||
'yesno' => 'These Choices OK? (use "abort" to halt)'
|
||||
),
|
||||
array(
|
||||
'yesno' => 'string',
|
||||
),
|
||||
array(
|
||||
'yesno' => 'yes'
|
||||
)
|
||||
);
|
||||
if ($ok['yesno'] == 'abort') {
|
||||
return false;
|
||||
}
|
||||
} while ($ok['yesno'] != 'yes');
|
||||
$answers = $this->userDialog('', $prompts, $types, $answers);
|
||||
$tried = true;
|
||||
} while (is_array($answers) && count(array_filter($answers)) != count($prompts));
|
||||
return $answers;
|
||||
}
|
||||
// {{{ userDialog(prompt, [type], [default])
|
||||
|
||||
function userDialog($command, $prompts, $types = array(), $defaults = array())
|
||||
function userDialog($command, $prompts, $types = array(), $defaults = array(),
|
||||
$screensize = 20)
|
||||
{
|
||||
$result = array();
|
||||
if (is_array($prompts)) {
|
||||
// php 5.0.0 inexplicably breaks BC with this behavior
|
||||
// now reading from STDIN is the intended syntax
|
||||
if (version_compare(phpversion(), '5.0.0', '<')) {
|
||||
$fp = fopen("php://stdin", "r");
|
||||
}
|
||||
if (!is_array($prompts)) {
|
||||
return array();
|
||||
}
|
||||
$testprompts = array_keys($prompts);
|
||||
$result = $defaults;
|
||||
if (!defined('STDIN')) {
|
||||
$fp = fopen('php://stdin', 'r');
|
||||
} else {
|
||||
$fp = STDIN;
|
||||
}
|
||||
reset($prompts);
|
||||
if (count($prompts) == 1 && $types[key($prompts)] == 'yesno') {
|
||||
foreach ($prompts as $key => $prompt) {
|
||||
$type = $types[$key];
|
||||
$default = @$defaults[$key];
|
||||
if ($type == 'password') {
|
||||
system('stty -echo');
|
||||
}
|
||||
print "$this->lp$prompt ";
|
||||
print "$prompt ";
|
||||
if ($default) {
|
||||
print "[$default] ";
|
||||
}
|
||||
@@ -365,19 +370,55 @@ class PEAR_Frontend_CLI extends PEAR_Frontend
|
||||
}
|
||||
$line = fgets(STDIN, 2048);
|
||||
}
|
||||
if ($type == 'password') {
|
||||
system('stty echo');
|
||||
print "\n";
|
||||
}
|
||||
if ($default && trim($line) == "") {
|
||||
$result[$key] = $default;
|
||||
} else {
|
||||
$result[$key] = trim($line);
|
||||
}
|
||||
}
|
||||
if (version_compare(phpversion(), '5.0.0', '<')) {
|
||||
fclose($fp);
|
||||
return $result;
|
||||
}
|
||||
while (true) {
|
||||
$descLength = max(array_map('strlen', $prompts));
|
||||
$descFormat = "%-{$descLength}s";
|
||||
$last = count($prompts);
|
||||
|
||||
$i = 0;
|
||||
foreach ($prompts as $n => $var) {
|
||||
printf("%2d. $descFormat : %s\n", ++$i, $prompts[$n], isset($result[$n]) ?
|
||||
$result[$n] : null);
|
||||
}
|
||||
|
||||
print "\n1-$last, 'all', 'abort', or Enter to continue: ";
|
||||
$tmp = trim(fgets($fp, 1024));
|
||||
if (empty($tmp)) {
|
||||
break;
|
||||
}
|
||||
if ($tmp == 'abort') {
|
||||
return false;
|
||||
}
|
||||
if (isset($testprompts[(int)$tmp - 1])) {
|
||||
$var = $testprompts[(int)$tmp - 1];
|
||||
$desc = $prompts[$var];
|
||||
$current = @$result[$var];
|
||||
print "$desc [$current] : ";
|
||||
$tmp = trim(fgets($fp, 1024));
|
||||
if (trim($tmp) !== '') {
|
||||
$result[$var] = trim($tmp);
|
||||
}
|
||||
} elseif ($tmp == 'all') {
|
||||
foreach ($prompts as $var => $desc) {
|
||||
$current = $result[$var];
|
||||
print "$desc [$current] : ";
|
||||
$tmp = trim(fgets($fp, 1024));
|
||||
if (trim($tmp) !== '') {
|
||||
$result[$var] = trim($tmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!defined('STDIN')) {
|
||||
fclose($fp);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
@@ -455,12 +496,17 @@ class PEAR_Frontend_CLI extends PEAR_Frontend
|
||||
} else {
|
||||
$w = strlen($col);
|
||||
}
|
||||
if ($w > @$this->params['widest'][$i]) {
|
||||
|
||||
if (isset($this->params['widest'][$i])) {
|
||||
if ($w > $this->params['widest'][$i]) {
|
||||
$this->params['widest'][$i] = $w;
|
||||
}
|
||||
} else {
|
||||
$this->params['widest'][$i] = $w;
|
||||
}
|
||||
$tmp = count_chars($columns[$i], 1);
|
||||
// handle unix, mac and windows formats
|
||||
$lines = (isset($tmp[10]) ? $tmp[10] : @$tmp[13]) + 1;
|
||||
$lines = (isset($tmp[10]) ? $tmp[10] : (isset($tmp[13]) ? $tmp[13] : 0)) + 1;
|
||||
if ($lines > $highest) {
|
||||
$highest = $lines;
|
||||
}
|
||||
@@ -626,6 +672,10 @@ class PEAR_Frontend_CLI extends PEAR_Frontend
|
||||
$this->_endTable();
|
||||
break;
|
||||
case 'list-all':
|
||||
if (!isset($data['data'])) {
|
||||
$this->_displayLine('No packages in channel');
|
||||
break;
|
||||
}
|
||||
$this->_startTable($data);
|
||||
if (isset($data['headline']) && is_array($data['headline'])) {
|
||||
$this->_tableRow($data['headline'], array('bold' => true), array(1 => array('wrap' => 55)));
|
||||
@@ -662,6 +712,7 @@ class PEAR_Frontend_CLI extends PEAR_Frontend
|
||||
$this->_endTable();
|
||||
break;
|
||||
case 'remote-info':
|
||||
$d = $data;
|
||||
$data = array(
|
||||
'caption' => 'Package details:',
|
||||
'border' => false,
|
||||
@@ -675,6 +726,12 @@ class PEAR_Frontend_CLI extends PEAR_Frontend
|
||||
array("Description", $data['description']),
|
||||
),
|
||||
);
|
||||
if (isset($d['deprecated']) && $d['deprecated']) {
|
||||
$conf = &PEAR_Config::singleton();
|
||||
$reg = $conf->getRegistry();
|
||||
$name = $reg->parsedPackageNameToString($d['deprecated'], true);
|
||||
$data['data'][] = array('Deprecated! use', $name);
|
||||
}
|
||||
default: {
|
||||
if (is_array($data)) {
|
||||
$this->_startTable($data);
|
||||
|
Reference in New Issue
Block a user