From: Stig Bakken Date: Sat, 15 Feb 2003 20:28:54 +0000 (+0000) Subject: * import PEAR 1.0.1 X-Git-Tag: php-4.3.2RC1~193 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5c988b679e29cc34a7a7c2ddebd53799ea975ba1;p=php * import PEAR 1.0.1 --- diff --git a/pear/OS/Guess.php b/pear/OS/Guess.php index 2cb218db17..8e28e4f3be 100644 --- a/pear/OS/Guess.php +++ b/pear/OS/Guess.php @@ -71,6 +71,10 @@ // }}} +/* TODO: + * - define endianness, to allow matchSignature("bigend") etc. + */ + class OS_Guess { var $sysname; @@ -209,4 +213,4 @@ class OS_Guess * c-basic-offset: 4 * End: */ -?> \ No newline at end of file +?> diff --git a/pear/PEAR.php b/pear/PEAR.php index 7fa35a8495..7f034b7b0a 100644 --- a/pear/PEAR.php +++ b/pear/PEAR.php @@ -670,11 +670,7 @@ class PEAR_Error var $code = -1; var $message = ''; var $userinfo = ''; - - // Wait until we have a stack-groping function in PHP. - //var $file = ''; - //var $line = 0; - + var $backtrace = null; // }}} // {{{ constructor @@ -709,6 +705,9 @@ class PEAR_Error $this->code = $code; $this->mode = $mode; $this->userinfo = $userinfo; + if (function_exists("debug_backtrace")) { + $this->backtrace = debug_backtrace(); + } if ($mode & PEAR_ERROR_CALLBACK) { $this->level = E_USER_NOTICE; $this->callback = $options; @@ -853,6 +852,25 @@ class PEAR_Error return $this->getUserInfo(); } + // }}} + // {{{ getBacktrace() + + /** + * Get the call backtrace from where the error was generated. + * Supported with PHP 4.3.0 or newer. + * + * @param int $frame (optional) what frame to fetch + * @return array Backtrace, or NULL if not available. + * @access public + */ + function getBacktrace($frame = null) + { + if ($frame === null) { + return $this->backtrace; + } + return $this->backtrace[$frame]; + } + // }}} // {{{ addUserInfo() diff --git a/pear/PEAR/Command/Config.php b/pear/PEAR/Command/Config.php index abe8b93101..762ad31e2c 100644 --- a/pear/PEAR/Command/Config.php +++ b/pear/PEAR/Command/Config.php @@ -222,4 +222,4 @@ displays help for all configuration parameters. // }}} } -?> +?> \ No newline at end of file diff --git a/pear/PEAR/Command/Package.php b/pear/PEAR/Command/Package.php index 1d532e9856..cba77138de 100644 --- a/pear/PEAR/Command/Package.php +++ b/pear/PEAR/Command/Package.php @@ -52,6 +52,69 @@ package.xml). 'shortcut' => 'pv', 'options' => array(), 'doc' => ' +', + ), + 'cvsdiff' => array( + 'summary' => 'Run a "cvs diff" for all files in a package', + 'function' => 'doCvsDiff', + 'shortcut' => 'cd', + 'options' => array( + 'quiet' => array( + 'shortopt' => 'q', + 'doc' => 'Be quiet', + ), + 'reallyquiet' => array( + 'shortopt' => 'Q', + 'doc' => 'Be really quiet', + ), + 'date' => array( + 'shortopt' => 'D', + 'doc' => 'Diff against revision of DATE', + 'arg' => 'DATE', + ), + 'release' => array( + 'shortopt' => 'R', + 'doc' => 'Diff against tag for package release REL', + 'arg' => 'REL', + ), + 'revision' => array( + 'shortopt' => 'r', + 'doc' => 'Diff against revision REV', + 'arg' => 'REV', + ), + 'context' => array( + 'shortopt' => 'c', + 'doc' => 'Generate context diff', + ), + 'unified' => array( + 'shortopt' => 'u', + 'doc' => 'Generate unified diff', + ), + 'ignore-case' => array( + 'shortopt' => 'i', + 'doc' => 'Ignore case, consider upper- and lower-case letters equivalent', + ), + 'ignore-whitespace' => array( + 'shortopt' => 'b', + 'doc' => 'Ignore changes in amount of white space', + ), + 'ignore-blank-lines' => array( + 'shortopt' => 'B', + 'doc' => 'Ignore changes that insert or delete blank lines', + ), + 'brief' => array( + 'doc' => 'Report only whether the files differ, no details', + ), + 'dry-run' => array( + 'shortopt' => 'n', + 'doc' => 'Don\'t do anything, just pretend', + ), + ), + 'doc' => ' +Compares all the files in a package. Without any options, this +command will compare the current code with the last checked-in code. +Using the -r or -R option you may compare the current code with that +of a specific release. ', ), 'cvstag' => array( @@ -75,8 +138,12 @@ package.xml). 'shortopt' => 'd', 'doc' => 'Remove tag', ), + 'dry-run' => array( + 'shortopt' => 'n', + 'doc' => 'Don\'t do anything, just pretend', + ), ), - 'doc' => ' + 'doc' => ' Sets a CVS tag on all files in a package. Use this command after you have packaged a distribution tarball with the "package" command to tag what revisions of what files were in that release. If need to fix something @@ -294,8 +361,11 @@ Wrote: /usr/src/redhat/RPMS/i386/PEAR::Net_Socket-1.0-1.i386.rpm foreach ($files as $file) { $command .= ' ' . escapeshellarg($file); } + if ($this->config->get('verbose') > 1) { + $this->output .= "+ $command\n"; + } $this->output .= "+ $command\n"; - if (empty($options['n'])) { + if (empty($options['dry-run'])) { $fp = popen($command, "r"); while ($line = fgets($fp, 1024)) { $this->output .= rtrim($line)."\n"; @@ -306,6 +376,69 @@ Wrote: /usr/src/redhat/RPMS/i386/PEAR::Net_Socket-1.0-1.i386.rpm return true; } + // }}} + // {{{ doCvsDiff() + + function doCvsDiff($command, $options, $params) + { + $this->output = ''; + if (sizeof($params) < 1) { + $help = $this->getHelp($command); + return $this->raiseError("$command: missing parameter: $help[0]"); + } + $obj = new PEAR_Common; + $info = $obj->infoFromDescriptionFile($params[0]); + if (PEAR::isError($info)) { + return $this->raiseError($info); + } + $files = array_keys($info['filelist']); + $cmd = "cvs"; + if (isset($options['quiet'])) { + $cmd .= ' -q'; + unset($options['quiet']); + } + if (isset($options['reallyquiet'])) { + $cmd .= ' -Q'; + unset($options['reallyquiet']); + } + if (isset($options['release'])) { + $cvsversion = preg_replace('/[^a-z0-9]/i', '_', $options['release']); + $cvstag = "RELEASE_$cvsversion"; + $options['revision'] = $cvstag; + unset($options['release']); + } + $execute = true; + if (isset($options['dry-run'])) { + $execute = false; + unset($options['dry-run']); + } + $cmd .= ' diff'; + // the rest of the options are passed right on to "cvs diff" + foreach ($options as $option => $optarg) { + $arg = @$this->commands[$command]['options'][$option]['arg']; + $short = @$this->commands[$command]['options'][$option]['shortopt']; + $cmd .= $short ? " -$short" : " --$option"; + if ($arg && $optarg) { + $cmd .= ($short ? '' : '=') . escapeshellarg($optarg); + } + } + foreach ($files as $file) { + $cmd .= ' ' . escapeshellarg($file); + } + if ($this->config->get('verbose') > 1) { + $this->output .= "+ $cmd\n"; + } + if ($execute) { + $fp = popen($cmd, "r"); + while ($line = fgets($fp, 1024)) { + $this->output .= rtrim($line)."\n"; + } + pclose($fp); + } + $this->ui->outputData($this->output, $command); + return true; + } + // }}} // {{{ doRunTests() diff --git a/pear/PEAR/Command/Remote.php b/pear/PEAR/Command/Remote.php index 9dec810bac..2142037c8a 100644 --- a/pear/PEAR/Command/Remote.php +++ b/pear/PEAR/Command/Remote.php @@ -88,6 +88,16 @@ Download a package tarball. The file will be named as suggested by the server, for example if you download the DB package and the latest stable version of DB is 1.2, the downloaded file will be DB-1.2.tgz.', ), + 'clear-cache' => array( + 'summary' => 'Clear XML-RPC Cache', + 'function' => 'doClearCache', + 'shortcut' => 'cc', + 'options' => array(), + 'doc' => ' +Clear the XML-RPC cache. See also the cache_ttl configuration +parameter. +', + ), ); // }}} @@ -354,6 +364,43 @@ version of DB is 1.2, the downloaded file will be DB-1.2.tgz.', return true; } + // }}} + // {{{ doClearCache() + + function doClearCache($command, $options, $params) + { + $cache_dir = $this->config->get('cache_dir'); + $verbose = $this->config->get('verbose'); + $output = ''; + if (!($dp = @opendir($cache_dir))) { + return $this->raiseError("opendir($cache_dir) failed: $php_errormsg"); + } + if ($verbose >= 1) { + $output .= "reading directory $cache_dir\n"; + } + $num = 0; + while ($ent = readdir($dp)) { + if (preg_match('/^xmlrpc_cache_[a-z0-9]{32}$/', $ent)) { + $path = $cache_dir . DIRECTORY_SEPARATOR . $ent; + $ok = @unlink($path); + if ($ok) { + if ($verbose >= 2) { + $output .= "deleted $path\n"; + } + $num++; + } elseif ($verbose >= 1) { + $output .= "failed to delete $path\n"; + } + } + } + closedir($dp); + if ($verbose >= 1) { + $output .= "$num cache entries cleared\n"; + } + $this->ui->outputData(rtrim($output), $command); + return $num; + } + // }}} } diff --git a/pear/PEAR/Config.php b/pear/PEAR/Config.php index 2e3d667fce..8f5f1f39cc 100644 --- a/pear/PEAR/Config.php +++ b/pear/PEAR/Config.php @@ -33,33 +33,33 @@ $GLOBALS['_PEAR_Config_instance'] = null; // PHP_ prefix is for some security, PHP protects environment // variables starting with PHP_*. -if (isset($_ENV['PHP_PEAR_SYSCONF_DIR'])) { - define('PEAR_CONFIG_SYSCONFDIR', $_ENV['PHP_PEAR_SYSCONF_DIR']); -} elseif (isset($_ENV['SystemRoot'])) { - define('PEAR_CONFIG_SYSCONFDIR', $_ENV['SystemRoot']); -} elseif (@is_dir(PHP_SYSCONFDIR)) { +if (getenv('PHP_PEAR_SYSCONF_DIR')) { + define('PEAR_CONFIG_SYSCONFDIR', getenv('PHP_PEAR_SYSCONF_DIR')); +} elseif (getenv('SystemRoot')) { + define('PEAR_CONFIG_SYSCONFDIR', getenv('SystemRoot')); +} else { define('PEAR_CONFIG_SYSCONFDIR', PHP_SYSCONFDIR); } // Default for master_server -if (isset($_ENV['PHP_PEAR_MASTER_SERVER'])) { - define('PEAR_CONFIG_DEFAULT_MASTER_SERVER', $_ENV['PHP_PEAR_MASTER_SERVER']); +if (getenv('PHP_PEAR_MASTER_SERVER')) { + define('PEAR_CONFIG_DEFAULT_MASTER_SERVER', getenv('PHP_PEAR_MASTER_SERVER')); } else { define('PEAR_CONFIG_DEFAULT_MASTER_SERVER', 'pear.php.net'); } // Default for http_proxy -if (isset($_ENV['PHP_PEAR_HTTP_PROXY'])) { - define('PEAR_CONFIG_DEFAULT_HTTP_PROXY', $_ENV['PHP_PEAR_HTTP_PROXY']); -} elseif (isset($_ENV['http_proxy'])) { - define('PEAR_CONFIG_DEFAULT_HTTP_PROXY', $_ENV['http_proxy']); +if (getenv('PHP_PEAR_HTTP_PROXY')) { + define('PEAR_CONFIG_DEFAULT_HTTP_PROXY', getenv('PHP_PEAR_HTTP_PROXY')); +} elseif (getenv('http_proxy')) { + define('PEAR_CONFIG_DEFAULT_HTTP_PROXY', getenv('http_proxy')); } else { define('PEAR_CONFIG_DEFAULT_HTTP_PROXY', ''); } // Default for php_dir -if (isset($_ENV['PHP_PEAR_INSTALL_DIR'])) { - define('PEAR_CONFIG_DEFAULT_PHP_DIR', $_ENV['PHP_PEAR_INSTALL_DIR']); +if (getenv('PHP_PEAR_INSTALL_DIR')) { + define('PEAR_CONFIG_DEFAULT_PHP_DIR', getenv('PHP_PEAR_INSTALL_DIR')); } else { if (@is_dir(PEAR_INSTALL_DIR.DIRECTORY_SEPARATOR.'lib')) { define('PEAR_CONFIG_DEFAULT_PHP_DIR', @@ -70,46 +70,46 @@ if (isset($_ENV['PHP_PEAR_INSTALL_DIR'])) { } // Default for ext_dir -if (isset($_ENV['PHP_PEAR_EXTENSION_DIR'])) { - define('PEAR_CONFIG_DEFAULT_EXT_DIR', $_ENV['PHP_PEAR_EXTENSION_DIR']); +if (getenv('PHP_PEAR_EXTENSION_DIR')) { + define('PEAR_CONFIG_DEFAULT_EXT_DIR', getenv('PHP_PEAR_EXTENSION_DIR')); } else { define('PEAR_CONFIG_DEFAULT_EXT_DIR', ini_get('extension_dir')); } // Default for doc_dir -if (isset($_ENV['PHP_PEAR_DOC_DIR'])) { - define('PEAR_CONFIG_DEFAULT_DOC_DIR', $_ENV['PHP_PEAR_DOC_DIR']); +if (getenv('PHP_PEAR_DOC_DIR')) { + define('PEAR_CONFIG_DEFAULT_DOC_DIR', getenv('PHP_PEAR_DOC_DIR')); } else { define('PEAR_CONFIG_DEFAULT_DOC_DIR', PEAR_INSTALL_DIR.DIRECTORY_SEPARATOR.'docs'); } // Default for bin_dir -if (isset($_ENV['PHP_PEAR_BIN_DIR'])) { - define('PEAR_CONFIG_DEFAULT_BIN_DIR', $_ENV['PHP_PEAR_BIN_DIR']); +if (getenv('PHP_PEAR_BIN_DIR')) { + define('PEAR_CONFIG_DEFAULT_BIN_DIR', getenv('PHP_PEAR_BIN_DIR')); } else { define('PEAR_CONFIG_DEFAULT_BIN_DIR', PHP_BINDIR); } // Default for data_dir -if (isset($_ENV['PHP_PEAR_DATA_DIR'])) { - define('PEAR_CONFIG_DEFAULT_DATA_DIR', $_ENV['PHP_PEAR_DATA_DIR']); +if (getenv('PHP_PEAR_DATA_DIR')) { + define('PEAR_CONFIG_DEFAULT_DATA_DIR', getenv('PHP_PEAR_DATA_DIR')); } else { define('PEAR_CONFIG_DEFAULT_DATA_DIR', PEAR_INSTALL_DIR.DIRECTORY_SEPARATOR.'data'); } // Default for test_dir -if (isset($_ENV['PHP_PEAR_TEST_DIR'])) { - define('PEAR_CONFIG_DEFAULT_TEST_DIR', $_ENV['PHP_PEAR_TEST_DIR']); +if (getenv('PHP_PEAR_TEST_DIR')) { + define('PEAR_CONFIG_DEFAULT_TEST_DIR', getenv('PHP_PEAR_TEST_DIR')); } else { define('PEAR_CONFIG_DEFAULT_TEST_DIR', PEAR_INSTALL_DIR.DIRECTORY_SEPARATOR.'tests'); } // Default for cache_dir -if (isset($_ENV['PHP_PEAR_CACHE_DIR'])) { - define('PEAR_CONFIG_DEFAULT_CACHE_DIR', $_ENV['PHP_PEAR_CACHE_DIR']); +if (getenv('PHP_PEAR_CACHE_DIR')) { + define('PEAR_CONFIG_DEFAULT_CACHE_DIR', getenv('PHP_PEAR_CACHE_DIR')); } else { define('PEAR_CONFIG_DEFAULT_CACHE_DIR', System::tmpdir() . DIRECTORY_SEPARATOR . 'pear' . @@ -117,51 +117,51 @@ if (isset($_ENV['PHP_PEAR_CACHE_DIR'])) { } // Default for php_bin -if (isset($_ENV['PHP_PEAR_PHP_BIN'])) { - define('PEAR_CONFIG_DEFAULT_PHP_BIN', $_ENV['PHP_PEAR_PHP_BIN']); +if (getenv('PHP_PEAR_PHP_BIN')) { + define('PEAR_CONFIG_DEFAULT_PHP_BIN', getenv('PHP_PEAR_PHP_BIN')); } else { define('PEAR_CONFIG_DEFAULT_PHP_BIN', PEAR_CONFIG_DEFAULT_BIN_DIR. DIRECTORY_SEPARATOR.'php'.(OS_WINDOWS ? '.exe' : '')); } // Default for verbose -if (isset($_ENV['PHP_PEAR_VERBOSE'])) { - define('PEAR_CONFIG_DEFAULT_VERBOSE', $_ENV['PHP_PEAR_VERBOSE']); +if (getenv('PHP_PEAR_VERBOSE')) { + define('PEAR_CONFIG_DEFAULT_VERBOSE', getenv('PHP_PEAR_VERBOSE')); } else { define('PEAR_CONFIG_DEFAULT_VERBOSE', 1); } // Default for preferred_state -if (isset($_ENV['PHP_PEAR_PREFERRED_STATE'])) { - define('PEAR_CONFIG_DEFAULT_PREFERRED_STATE', $_ENV['PHP_PEAR_PREFERRED_STATE']); +if (getenv('PHP_PEAR_PREFERRED_STATE')) { + define('PEAR_CONFIG_DEFAULT_PREFERRED_STATE', getenv('PHP_PEAR_PREFERRED_STATE')); } else { define('PEAR_CONFIG_DEFAULT_PREFERRED_STATE', 'stable'); } // Default for umask -if (isset($_ENV['PHP_PEAR_UMASK'])) { - define('PEAR_CONFIG_DEFAULT_UMASK', $_ENV['PHP_PEAR_UMASK']); +if (getenv('PHP_PEAR_UMASK')) { + define('PEAR_CONFIG_DEFAULT_UMASK', getenv('PHP_PEAR_UMASK')); } else { - define('PEAR_CONFIG_DEFAULT_UMASK', umask()); + define('PEAR_CONFIG_DEFAULT_UMASK', decoct(umask())); } // Default for cache_ttl -if (isset($_ENV['PHP_PEAR_CACHE_TTL'])) { - define('PEAR_CONFIG_DEFAULT_CACHE_TTL', $_ENV['PHP_PEAR_CACHE_TTL']); +if (getenv('PHP_PEAR_CACHE_TTL')) { + define('PEAR_CONFIG_DEFAULT_CACHE_TTL', getenv('PHP_PEAR_CACHE_TTL')); } else { define('PEAR_CONFIG_DEFAULT_CACHE_TTL', 3600); } // Default for sig_type -if (isset($_ENV['PHP_PEAR_SIG_TYPE'])) { - define('PEAR_CONFIG_DEFAULT_SIG_TYPE', $_ENV['PHP_PEAR_SIG_TYPE']); +if (getenv('PHP_PEAR_SIG_TYPE')) { + define('PEAR_CONFIG_DEFAULT_SIG_TYPE', getenv('PHP_PEAR_SIG_TYPE')); } else { define('PEAR_CONFIG_DEFAULT_SIG_TYPE', 'gpg'); } // Default for sig_bin -if (isset($_ENV['PHP_PEAR_SIG_BIN'])) { - define('PEAR_CONFIG_DEFAULT_SIG_BIN', $_ENV['PHP_PEAR_SIG_BIN']); +if (getenv('PHP_PEAR_SIG_BIN')) { + define('PEAR_CONFIG_DEFAULT_SIG_BIN', getenv('PHP_PEAR_SIG_BIN')); } else { define('PEAR_CONFIG_DEFAULT_SIG_BIN', System::which( @@ -169,8 +169,8 @@ if (isset($_ENV['PHP_PEAR_SIG_BIN'])) { } // Default for sig_keydir -if (isset($_ENV['PHP_PEAR_SIG_KEYDIR'])) { - define('PEAR_CONFIG_DEFAULT_SIG_KEYDIR', $_ENV['PHP_PEAR_SIG_KEYDIR']); +if (getenv('PHP_PEAR_SIG_KEYDIR')) { + define('PEAR_CONFIG_DEFAULT_SIG_KEYDIR', getenv('PHP_PEAR_SIG_KEYDIR')); } else { define('PEAR_CONFIG_DEFAULT_SIG_KEYDIR', PEAR_CONFIG_SYSCONFDIR . DIRECTORY_SEPARATOR . 'pearkeys'); diff --git a/pear/PEAR/Frontend/CLI.php b/pear/PEAR/Frontend/CLI.php index 14ea336418..2e84eb9e00 100644 --- a/pear/PEAR/Frontend/CLI.php +++ b/pear/PEAR/Frontend/CLI.php @@ -33,7 +33,6 @@ class PEAR_Frontend_CLI extends PEAR var $type = 'CLI'; var $lp = ''; // line prefix - var $omode = 'plain'; var $params = array(); var $term = array( 'bold' => '', @@ -68,7 +67,7 @@ class PEAR_Frontend_CLI extends PEAR function displayLine($text) { - trigger_error("Frontend::displayLine deprecated", E_USER_ERROR); + trigger_error("PEAR_Frontend_CLI::displayLine deprecated", E_USER_ERROR); } function _displayLine($text) @@ -81,7 +80,7 @@ class PEAR_Frontend_CLI extends PEAR function display($text) { - trigger_error("Frontend::display deprecated", E_USER_ERROR); + trigger_error("PEAR_Frontend_CLI::display deprecated", E_USER_ERROR); } function _display($text) @@ -111,7 +110,7 @@ class PEAR_Frontend_CLI extends PEAR function displayHeading($title) { - trigger_error("Frontend::displayHeading deprecated", E_USER_ERROR); + trigger_error("PEAR_Frontend_CLI::displayHeading deprecated", E_USER_ERROR); } function _displayHeading($title) @@ -160,7 +159,7 @@ class PEAR_Frontend_CLI extends PEAR function userConfirm($prompt, $default = 'yes') { - trigger_error("Frontend::userConfirm not yet converted", E_USER_ERROR); + trigger_error("PEAR_Frontend_CLI::userConfirm not yet converted", E_USER_ERROR); static $positives = array('y', 'yes', 'on', '1'); static $negatives = array('n', 'no', 'off', '0'); print "$this->lp$prompt [$default] : "; @@ -188,12 +187,11 @@ class PEAR_Frontend_CLI extends PEAR function startTable($params = array()) { - trigger_error("Frontend::startTable deprecated", E_USER_ERROR); + trigger_error("PEAR_Frontend_CLI::startTable deprecated", E_USER_ERROR); } function _startTable($params = array()) { - $this->omode = 'table'; $params['table_data'] = array(); $params['widest'] = array(); // indexed by column $params['highest'] = array(); // indexed by row @@ -206,7 +204,7 @@ class PEAR_Frontend_CLI extends PEAR function tableRow($columns, $rowparams = array(), $colparams = array()) { - trigger_error("Frontend::tableRow deprecated", E_USER_ERROR); + trigger_error("PEAR_Frontend_CLI::tableRow deprecated", E_USER_ERROR); } function _tableRow($columns, $rowparams = array(), $colparams = array()) @@ -256,12 +254,11 @@ class PEAR_Frontend_CLI extends PEAR function endTable() { - trigger_error("Frontend::tableRow deprecated", E_USER_ERROR); + trigger_error("PEAR_Frontend_CLI::tableRow deprecated", E_USER_ERROR); } function _endTable() { - $this->omode = ''; extract($this->params); if (!empty($caption)) { $this->_displayHeading($caption); diff --git a/pear/PEAR/Remote.php b/pear/PEAR/Remote.php index c85a682ec7..3095d74c62 100644 --- a/pear/PEAR/Remote.php +++ b/pear/PEAR/Remote.php @@ -58,7 +58,7 @@ class PEAR_Remote extends PEAR if (!file_exists($cachedir)) { System::mkdir('-p '.$cachedir); } - $filename = $cachedir.'/xmlrpc_cache_'.$id; + $filename = $cachedir . DIRECTORY_SEPARATOR . 'xmlrpc_cache_' . $id; if (!file_exists($filename)) { return null; }; @@ -313,16 +313,16 @@ class PEAR_Remote extends PEAR $lastkey = key($php_val); if ($firstkey === 0 && is_int($lastkey) && ($lastkey + 1) == count($php_val)) { - $is_continous = true; + $is_continuous = true; reset($php_val); $size = count($php_val); for ($expect = 0; $expect < $size; $expect++, next($php_val)) { if (key($php_val) !== $expect) { - $is_continous = false; + $is_continuous = false; break; } } - if ($is_continous) { + if ($is_continuous) { reset($php_val); $arr = array(); while (list($k, $v) = each($php_val)) { @@ -332,7 +332,7 @@ class PEAR_Remote extends PEAR break; } } - // fall though if not numerical and continous + // fall though if not numerical and continuous case "object": $arr = array(); while (list($k, $v) = each($php_val)) { diff --git a/pear/System.php b/pear/System.php index e9341b3db6..98754e9e17 100644 --- a/pear/System.php +++ b/pear/System.php @@ -433,15 +433,17 @@ class System // XXX FIXME honor safe mode $path_delim = OS_WINDOWS ? ';' : ':'; - $exe_suffix = OS_WINDOWS ? '.exe' : ''; + $exe_suffixes = OS_WINDOWS ? array('.exe','.bat','.cmd','.com') : array(''); $path_elements = explode($path_delim, getenv('PATH')); - foreach ($path_elements as $dir) { - $file = $dir . DIRECTORY_SEPARATOR . $program . $exe_suffix; - if (@is_file($file) && @$pear_is_executable($file)) { - return $file; + foreach ($exe_suffixes as $suff) { + foreach ($path_elements as $dir) { + $file = $dir . DIRECTORY_SEPARATOR . $program . $suff; + if (@is_file($file) && @$pear_is_executable($file)) { + return $file; + } } } return $fallback; } } -?> \ No newline at end of file +?> diff --git a/pear/package-PEAR.xml b/pear/package-PEAR.xml index 6324d72674..a3cdf6bb1a 100644 --- a/pear/package-PEAR.xml +++ b/pear/package-PEAR.xml @@ -31,15 +31,23 @@ - 1.0b3 + 1.0.1 stable - 2002-12-13 + 2003-01-10 -* fixed "info" shortcut (conflicted with "install") -* added "php_bin" config parameter -* all "non-personal" config parameters now use - environment variables for defaults (very useful - to override the default php_dir on Windows!) +* PEAR_Error class has call backtrace available by + calling getBacktrace(). Available if used with + PHP 4.3 or newer. + +* PEAR_Config class uses getenv() rather than $_ENV + to read environment variables. + +* System::which() Windows fix, now looks for + exe/bat/cmd/com suffixes rather than just exe + +* Added "pear cvsdiff" command + +* Windows output buffering bugfix for "pear" command @@ -93,6 +101,37 @@ + + 1.0 + stable + 2002-12-27 + + * set default cache_ttl to 1 hour + * added "clear-cache" command + + + + Archive_Tar + Console_Getopt + + + + 1.0b3 + stable + 2002-12-13 + + * fixed "info" shortcut (conflicted with "install") + * added "php_bin" config parameter + * all "non-personal" config parameters now use + environment variables for defaults (very useful + to override the default php_dir on Windows!) + + + + Archive_Tar + Console_Getopt + + 1.0b2 stable diff --git a/pear/package.dtd b/pear/package.dtd index 340c22a08e..265bbdf017 100644 --- a/pear/package.dtd +++ b/pear/package.dtd @@ -1,10 +1,10 @@