cvs: php-src(PHP_4_3) /pear PEAR.php System.php package-PEAR.xml package.dtd template.spec /pear/Archive Tar.php /pear/Console Getopt.php /pear/OS
Guess.php /pear/PEAR Autoloader.php Builder.php Command.php Common.php Config.php Dependency.php Downloader.php ErrorStack.php Exception.php
Installer.php Packager.php Registry.php Remote.php RunTest.php /pear/PEAR/Command Auth.php Build.php Common.php Config.php Install.php Mirror.php
Package.php Registry.php Remote.php /pear/PEAR/Frontend CLI.php /pear/scripts pear.in pearcmd.php

From: Date: Mon, 28 Mar 2005 16:57:03 +0000
Subject: cvs: php-src(PHP_4_3) /pear PEAR.php System.php package-PEAR.xml package.dtd template.spec /pear/Archive Tar.php /pear/Console Getopt.php /pear/OS
Guess.php /pear/PEAR Autoloader.php Builder.php Command.php Common.php Config.php Dependency.php Downloader.php ErrorStack.php Exception.php
Installer.php Packager.php Registry.php Remote.php RunTest.php /pear/PEAR/Command Auth.php Build.php Common.php Config.php Install.php Mirror.php
Package.php Registry.php Remote.php /pear/PEAR/Frontend CLI.php /pear/scripts pear.in pearcmd.php
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-31142@lists.php.net to get a copy of this message
cellog Mon Mar 28 11:57:03 2005 EDT Added files: (Branch: PHP_4_3) /php-src/pear/PEAR Exception.php RunTest.php Removed files: /php-src/pear/scripts pear.in Modified files: /php-src/pear/Archive Tar.php /php-src/pear/Console Getopt.php /php-src/pear/OS Guess.php /php-src/pear PEAR.php System.php package-PEAR.xml package.dtd template.spec /php-src/pear/PEAR Autoloader.php Builder.php Command.php Common.php Config.php Dependency.php Downloader.php ErrorStack.php Installer.php Packager.php Registry.php Remote.php /php-src/pear/PEAR/Command Auth.php Build.php Common.php Config.php Install.php Mirror.php Package.php Registry.php Remote.php /php-src/pear/PEAR/Frontend CLI.php /php-src/pear/scripts pearcmd.php Log: merge in PEAR 1.3.5

http://cvs.php.net/diff.php/php-src/pear/Archive/Tar.php?r1=1.13.4.8&r2=1.13.4.9&ty=u Index: php-src/pear/Archive/Tar.php diff -u php-src/pear/Archive/Tar.php:1.13.4.8 php-src/pear/Archive/Tar.php:1.13.4.9 --- php-src/pear/Archive/Tar.php:1.13.4.8 Sun Jan 25 20:26:45 2004 +++ php-src/pear/Archive/Tar.php Mon Mar 28 11:56:56 2005 @@ -1,9 +1,9 @@ <?php /* vim: set ts=4 sw=4: */ // +----------------------------------------------------------------------+ -// | PHP Version 4 | +// | PHP Version 5 | // +----------------------------------------------------------------------+ -// | Copyright (c) 1997-2003 The PHP Group | +// | Copyright (c) 1997-2004 The PHP Group | // +----------------------------------------------------------------------+ // | This source file is subject to version 3.0 of the PHP license, | // | that is bundled with this package in the file LICENSE, and is | @@ -16,7 +16,7 @@ // | Author: Vincent Blavet <vincent@blavet.net> | // +----------------------------------------------------------------------+ // -// $Id: Tar.php,v 1.13.4.8 2004/01/26 01:26:45 pajoye Exp $ +// $Id: Tar.php,v 1.13.4.9 2005/03/28 16:56:56 cellog Exp $ require_once 'PEAR.php'; @@ -24,7 +24,7 @@ * Creates a (compressed) Tar archive * * @author Vincent Blavet <vincent@blavet.net> -* @version $Revision: 1.13.4.8 $ +* @version $Revision: 1.13.4.9 $ * @package Archive */ class Archive_Tar extends PEAR http://cvs.php.net/diff.php/php-src/pear/Console/Getopt.php?r1=1.21.4.9&r2=1.21.4.10&ty=u Index: php-src/pear/Console/Getopt.php diff -u php-src/pear/Console/Getopt.php:1.21.4.9 php-src/pear/Console/Getopt.php:1.21.4.10 --- php-src/pear/Console/Getopt.php:1.21.4.9 Tue Mar 1 13:19:48 2005 +++ php-src/pear/Console/Getopt.php Mon Mar 28 11:56:58 2005 @@ -1,9 +1,9 @@ <?php /* vim: set expandtab tabstop=4 shiftwidth=4: */ // +----------------------------------------------------------------------+ -// | PHP Version 4 | +// | PHP Version 5 | // +----------------------------------------------------------------------+ -// | Copyright (c) 1997-2003 The PHP Group | +// | Copyright (c) 1997-2004 The PHP Group | // +----------------------------------------------------------------------+ // | This source file is subject to version 3.0 of the PHP license, | // | that is bundled with this package in the file LICENSE, and is | @@ -16,7 +16,7 @@ // | Author: Andrei Zmievski <andrei@php.net> | // +----------------------------------------------------------------------+ // -// $Id: Getopt.php,v 1.21.4.9 2005/03/01 18:19:48 andrei Exp $ +// $Id: Getopt.php,v 1.21.4.10 2005/03/28 16:56:58 cellog Exp $ require_once 'PEAR.php'; http://cvs.php.net/diff.php/php-src/pear/OS/Guess.php?r1=1.3.6.10&r2=1.3.6.11&ty=u Index: php-src/pear/OS/Guess.php diff -u php-src/pear/OS/Guess.php:1.3.6.10 php-src/pear/OS/Guess.php:1.3.6.11 --- php-src/pear/OS/Guess.php:1.3.6.10 Fri Oct 24 01:34:16 2003 +++ php-src/pear/OS/Guess.php Mon Mar 28 11:56:58 2005 @@ -1,9 +1,9 @@ <?php // // +----------------------------------------------------------------------+ -// | PHP Version 4 | +// | PHP Version 5 | // +----------------------------------------------------------------------+ -// | Copyright (c) 1997-2003 The PHP Group | +// | Copyright (c) 1997-2004 The PHP Group | // +----------------------------------------------------------------------+ // | This source file is subject to version 3.0 of the PHP license, | // | that is bundled with this package in the file LICENSE, and is | @@ -17,7 +17,7 @@ // | | // +----------------------------------------------------------------------+ // -// $Id: Guess.php,v 1.3.6.10 2003/10/24 05:34:16 cellog Exp $ +// $Id: Guess.php,v 1.3.6.11 2005/03/28 16:56:58 cellog Exp $ // {{{ uname examples @@ -68,6 +68,11 @@ // SparcStation 20 Solaris 8: // SunOS host.example.com 5.8 Generic_108528-12 sun4m sparc SUNW,SPARCstation-20 // +// Mac OS X (Darwin) +// Darwin home-eden.local 7.5.0 Darwin Kernel Version 7.5.0: Thu Aug 5 19:26:16 PDT 2004; root:xnu/xnu-517.7.21.obj~3/RELEASE_PPC Power Macintosh +// +// Mac OS X early versions +// // }}} @@ -97,11 +102,11 @@ static $sysmap = array( 'HP-UX' => 'hpux', 'IRIX64' => 'irix', - // Darwin? ); static $cpumap = array( 'i586' => 'i386', 'i686' => 'i386', + 'ppc' => 'powerpc', ); if ($uname === null) { $uname = php_uname(); @@ -138,6 +143,24 @@ // use only the first two digits from the kernel version $release = ereg_replace('^([[:digit:]]+\.[[:digit:]]+).*', '\1', $parts[2]); break; + case 'Mac' : + $sysname = 'darwin'; + $nodename = $parts[2]; + $release = $parts[3]; + if ($cpu == 'Macintosh') { + if ($parts[$n - 2] == 'Power') { + $cpu = 'powerpc'; + } + } + break; + case 'Darwin' : + if ($cpu == 'Macintosh') { + if ($parts[$n - 2] == 'Power') { + $cpu = 'powerpc'; + } + } + $release = ereg_replace('^([[:digit:]]+\.[[:digit:]]+).*', '\1', $parts[2]); + break; default: $release = ereg_replace('-.*', '', $parts[2]); break; @@ -255,7 +278,6 @@ } } - /* * Local Variables: * indent-tabs-mode: nil http://cvs.php.net/diff.php/php-src/pear/PEAR.php?r1=1.50.2.18&r2=1.50.2.19&ty=u Index: php-src/pear/PEAR.php diff -u php-src/pear/PEAR.php:1.50.2.18 php-src/pear/PEAR.php:1.50.2.19 --- php-src/pear/PEAR.php:1.50.2.18 Sat Apr 3 01:28:46 2004 +++ php-src/pear/PEAR.php Mon Mar 28 11:56:58 2005 @@ -1,24 +1,24 @@ <?php // -// +----------------------------------------------------------------------+ -// | PEAR, the PHP Extension and Application Repository | -// +----------------------------------------------------------------------+ -// | Copyright (c) 1997-2004 The PHP Group | -// +----------------------------------------------------------------------+ -// | This source file is subject to version 2.0 of the PHP license, | -// | that is bundled with this package in the file LICENSE, and is | -// | available through the world-wide-web at the following url: | -// | http://www.php.net/license/3_0.txt. | -// | If you did not receive a copy of the PHP license and are unable to | -// | obtain it through the world-wide-web, please send a note to | -// | license@php.net so we can mail you a copy immediately. | -// +----------------------------------------------------------------------+ -// | Authors: Sterling Hughes <sterling@php.net> | -// | Stig Bakken <ssb@php.net> | -// | Tomas V.V.Cox <cox@idecnet.com> | -// +----------------------------------------------------------------------+ +// +--------------------------------------------------------------------+ +// | PEAR, the PHP Extension and Application Repository | +// +--------------------------------------------------------------------+ +// | Copyright (c) 1997-2004 The PHP Group | +// +--------------------------------------------------------------------+ +// | This source file is subject to version 3.0 of the PHP license, | +// | that is bundled with this package in the file LICENSE, and is | +// | available through the world-wide-web at the following url: | +// | http://www.php.net/license/3_0.txt. | +// | If you did not receive a copy of the PHP license and are unable to | +// | obtain it through the world-wide-web, please send a note to | +// | license@php.net so we can mail you a copy immediately. | +// +--------------------------------------------------------------------+ +// | Authors: Sterling Hughes <sterling@php.net> | +// | Stig Bakken <ssb@php.net> | +// | Tomas V.V.Cox <cox@idecnet.com> | +// +--------------------------------------------------------------------+ // -// $Id: PEAR.php,v 1.50.2.18 2004/04/03 06:28:46 cellog Exp $ +// $Id: PEAR.php,v 1.50.2.19 2005/03/28 16:56:58 cellog Exp $ // define('PEAR_ERROR_RETURN', 1); @@ -59,7 +59,7 @@ $GLOBALS['_PEAR_shutdown_funcs'] = array(); $GLOBALS['_PEAR_error_handler_stack'] = array(); -ini_set('track_errors', true); +@ini_set('track_errors', true); /** * Base class for other PEAR classes. Provides rudimentary @@ -152,18 +152,22 @@ */ function PEAR($error_class = null) { - $classname = get_class($this); + $classname = strtolower(get_class($this)); if ($this->_debug) { print "PEAR constructor called, class=$classname\n"; } if ($error_class !== null) { $this->_error_class = $error_class; } - while ($classname) { + while ($classname && strcasecmp($classname, "pear")) { $destructor = "_$classname"; if (method_exists($this, $destructor)) { global $_PEAR_destructor_object_list; $_PEAR_destructor_object_list[] = &$this; + if (!isset($GLOBALS['_PEAR_SHUTDOWN_REGISTERED'])) { + register_shutdown_function("_PEAR_call_destructors"); + $GLOBALS['_PEAR_SHUTDOWN_REGISTERED'] = true; + } break; } else { $classname = get_parent_class($classname); @@ -187,7 +191,7 @@ */ function _PEAR() { if ($this->_debug) { - printf("PEAR destructor called, class=%s\n", get_class($this)); + printf("PEAR destructor called, class=%s\n", strtolower(get_class($this))); } } @@ -561,6 +565,77 @@ } // }}} + function staticPushErrorHandling($mode, $options = null) + { + $stack = &$GLOBALS['_PEAR_error_handler_stack']; + $def_mode = &$GLOBALS['_PEAR_default_error_mode']; + $def_options = &$GLOBALS['_PEAR_default_error_options']; + $stack[] = array($def_mode, $def_options); + switch ($mode) { + case PEAR_ERROR_EXCEPTION: + case PEAR_ERROR_RETURN: + case PEAR_ERROR_PRINT: + case PEAR_ERROR_TRIGGER: + case PEAR_ERROR_DIE: + case null: + $def_mode = $mode; + $def_options = $options; + break; + + case PEAR_ERROR_CALLBACK: + $def_mode = $mode; + // class/object method callback + if (is_callable($options)) { + $def_options = $options; + } else { + trigger_error("invalid error callback", E_USER_WARNING); + } + break; + + default: + trigger_error("invalid error mode", E_USER_WARNING); + break; + } + $stack[] = array($mode, $options); + return true; + } + + function staticPopErrorHandling() + { + $stack = &$GLOBALS['_PEAR_error_handler_stack']; + $setmode = &$GLOBALS['_PEAR_default_error_mode']; + $setoptions = &$GLOBALS['_PEAR_default_error_options']; + array_pop($stack); + list($mode, $options) = $stack[sizeof($stack) - 1]; + array_pop($stack); + switch ($mode) { + case PEAR_ERROR_EXCEPTION: + case PEAR_ERROR_RETURN: + case PEAR_ERROR_PRINT: + case PEAR_ERROR_TRIGGER: + case PEAR_ERROR_DIE: + case null: + $setmode = $mode; + $setoptions = $options; + break; + + case PEAR_ERROR_CALLBACK: + $setmode = $mode; + // class/object method callback + if (is_callable($options)) { + $setoptions = $options; + } else { + trigger_error("invalid error callback", E_USER_WARNING); + } + break; + + default: + trigger_error("invalid error mode", E_USER_WARNING); + break; + } + return true; + } + // {{{ pushErrorHandling() /** @@ -665,6 +740,9 @@ sizeof($_PEAR_destructor_object_list)) { reset($_PEAR_destructor_object_list); + if (@PEAR::getStaticProperty('PEAR', 'destructlifo')) { + $_PEAR_destructor_object_list = array_reverse($_PEAR_destructor_object_list); + } while (list($k, $objref) = each($_PEAR_destructor_object_list)) { $classname = get_class($objref); while ($classname) { @@ -738,7 +816,9 @@ $this->mode = $mode; $this->userinfo = $userinfo; if (function_exists("debug_backtrace")) { - $this->backtrace = debug_backtrace(); + if (@!PEAR::getStaticProperty('PEAR_Error', 'skiptrace')) { + $this->backtrace = debug_backtrace(); + } } if ($mode & PEAR_ERROR_CALLBACK) { $this->level = E_USER_NOTICE; @@ -929,14 +1009,16 @@ E_USER_ERROR => 'error'); if ($this->mode & PEAR_ERROR_CALLBACK) { if (is_array($this->callback)) { - $callback = get_class($this->callback[0]) . '::' . + $callback = (is_object($this->callback[0]) ? + strtolower(get_class($this->callback[0])) : + $this->callback[0]) . '::' . $this->callback[1]; } else { $callback = $this->callback; } return sprintf('[%s: message="%s" code=%d mode=callback '. 'callback=%s prefix="%s" info="%s"]', - get_class($this), $this->message, $this->code, + strtolower(get_class($this)), $this->message, $this->code, $callback, $this->error_message_prefix, $this->userinfo); } @@ -954,7 +1036,7 @@ } return sprintf('[%s: message="%s" code=%d mode=%s level=%s '. 'prefix="%s" info="%s"]', - get_class($this), $this->message, $this->code, + strtolower(get_class($this)), $this->message, $this->code, implode("|", $modes), $levels[$this->level], $this->error_message_prefix, $this->userinfo); @@ -963,8 +1045,6 @@ // }}} } -register_shutdown_function("_PEAR_call_destructors"); - /* * Local Variables: * mode: php http://cvs.php.net/diff.php/php-src/pear/System.php?r1=1.21.2.15&r2=1.21.2.16&ty=u Index: php-src/pear/System.php diff -u php-src/pear/System.php:1.21.2.15 php-src/pear/System.php:1.21.2.16 --- php-src/pear/System.php:1.21.2.15 Sun Jan 25 20:26:43 2004 +++ php-src/pear/System.php Mon Mar 28 11:56:58 2005 @@ -5,7 +5,7 @@ // +----------------------------------------------------------------------+ // | Copyright (c) 1997-2004 The PHP Group | // +----------------------------------------------------------------------+ -// | This source file is subject to version 2.0 of the PHP license, | +// | This source file is subject to version 3.0 of the PHP license, | // | that is bundled with this package in the file LICENSE, and is | // | available through the world-wide-web at the following url: | // | http://www.php.net/license/3_0.txt. | @@ -16,7 +16,7 @@ // | Authors: Tomas V.V.Cox <cox@idecnet.com> | // +----------------------------------------------------------------------+ // -// $Id: System.php,v 1.21.2.15 2004/01/26 01:26:43 pajoye Exp $ +// $Id: System.php,v 1.21.2.16 2005/03/28 16:56:58 cellog Exp $ // require_once 'PEAR.php'; @@ -48,7 +48,7 @@ * * @package System * @author Tomas V.V.Cox <cox@idecnet.com> -* @version $Revision: 1.21.2.15 $ +* @version $Revision: 1.21.2.16 $ * @access public * @see http://pear.php.net/manual/ */ http://cvs.php.net/diff.php/php-src/pear/package-PEAR.xml?r1=1.28.2.38&r2=1.28.2.39&ty=u Index: php-src/pear/package-PEAR.xml diff -u php-src/pear/package-PEAR.xml:1.28.2.38 php-src/pear/package-PEAR.xml:1.28.2.39 --- php-src/pear/package-PEAR.xml:1.28.2.38 Thu Apr 29 22:09:01 2004 +++ php-src/pear/package-PEAR.xml Mon Mar 28 11:56:58 2005 @@ -4,22 +4,22 @@ <name>PEAR</name> <summary>PEAR Base System</summary> <description>The PEAR package contains: - * the PEAR base class - * the PEAR_Error error handling mechanism - * the alpha-quality PEAR_ErrorStack advanced error handling mechanism * the PEAR installer, for creating, distributing and installing packages + * the alpha-quality PEAR_Exception php5-only exception class + * the beta-quality PEAR_ErrorStack advanced error handling mechanism + * the PEAR_Error error handling mechanism * the OS_Guess class for retrieving info about the OS where PHP is running on * the System class for quick handling common operations with files and directories + * the PEAR base class </description> - <license>PHP License</license> <maintainers> <maintainer> <user>ssb</user> <role>lead</role> - <name>Stig Sæther Bakken</name> + <name>Stig Bakken</name> <email>stig@php.net</email> </maintainer> <maintainer> @@ -29,43 +29,42 @@ <email>cox@idecnet.com</email> </maintainer> <maintainer> - <user>mj</user> - <role>developer</role> - <name>Martin Jansen</name> - <email>mj@php.net</email> + <user>cellog</user> + <role>lead</role> + <name>Greg Beaver</name> + <email>cellog@php.net</email> </maintainer> <maintainer> <user>pajoye</user> - <role>developer</role> + <role>lead</role> <name>Pierre-Alain Joye</name> <email>pajoye@pearfr.org</email> </maintainer> <maintainer> - <user>cellog</user> - <role>lead</role> - <name>Greg Beaver</name> - <email>cellog@php.net</email> + <user>mj</user> + <role>developer</role> + <name>Martin Jansen</name> + <email>mj@php.net</email> </maintainer> </maintainers> <release> - <version>1.3.2</version> - <date>2004-04-06</date> + <version>1.3.5</version> + <date>2005-02-18</date> <state>stable</state> + <license>PHP License</license> <notes> -Installer: - * fix Bug #1186 raise a notice error on PEAR::Common $_packageName + * fix Bug #3505: pecl can't install PDO + * enhance pear run-tests dramatically + * fix Bug #3506: pear install should export the pear version into the environment </notes> <provides type="class" name="OS_Guess" /> <provides type="class" name="System" /> <provides type="function" name="md5_file" /> <filelist> - <file role="data" name="package.dtd"/> - <file role="data" name="template.spec"/> - <file role="php" name="PEAR.php"/> - <file role="php" name="System.php"/> + <dir name="OS"> + <file role="php" name="Guess.php"/> + </dir> <dir name="PEAR"> - <file role="php" name="Autoloader.php"/> - <file role="php" name="Command.php"/> <dir name="Command"> <file role="php" name="Auth.php"/> <file role="php" name="Build.php"/> @@ -77,22 +76,25 @@ <file role="php" name="Remote.php"/> <file role="php" name="Mirror.php"/> </dir> + <dir name="Frontend"> + <file role="php" name="CLI.php"/> + </dir> + <file role="php" name="Autoloader.php"/> + <file role="php" name="Command.php"/> <file role="php" name="Common.php"/> <file role="php" name="Config.php"/> <file role="php" name="Dependency.php"/> <file role="php" name="Downloader.php"/> + <file role="php" name="Exception.php"/> <file role="php" name="ErrorStack.php"/> - <dir name="Frontend"> - <file role="php" name="CLI.php"/> - </dir> - <file role="php" name="Builder.php"/> + <file role="php" name="Builder.php"> + <replace from="@PEAR-VER@" to="version" type="package-info"/> + </file> <file role="php" name="Installer.php"/> <file role="php" name="Packager.php"/> <file role="php" name="Registry.php"/> <file role="php" name="Remote.php"/> - </dir> - <dir name="OS"> - <file role="php" name="Guess.php"/> + <file role="php" name="RunTest.php"/> </dir> <dir name="scripts" baseinstalldir="/"> <file role="script" install-as="pear" name="pear.sh"> @@ -113,6 +115,10 @@ <replace from="@include_path@" to="php_dir" type="pear-config"/> </file> </dir> + <file role="data" name="package.dtd"/> + <file role="data" name="template.spec"/> + <file role="php" name="PEAR.php"/> + <file role="php" name="System.php"/> </filelist> <deps> <dep type="php" rel="ge" version="4.2"/> @@ -146,22 +152,49 @@ </notes> </release> <release> - <version>1.3</version> - <date>2004-02-20</date> + <version>1.3.3</version> + <date>2004-10-28</date> <state>stable</state> <notes> -PEAR Installer: - -* Bug #171 --alldeps with a rel=&quot;eq&quot; should install the required version, if possible -* Bug #249 installing from an url doesnt work -* Bug #248 --force command does not work as expected -* Bug #293 [Patch] PEAR_Error not calling static method callbacks for error-handler -* Bug #324 pear -G gives Fatal Error (PHP-GTK not installed, but error is at engine level) -* Bug #594 PEAR_Common::analyzeSourceCode fails on string with $var and { -* Bug #521 Incorrect filename in naming warnings -* Moved download code into its own class -* Fully unit tested the installer, packager, downloader, and PEAR_Common - +Installer: + * fix Bug #1186 raise a notice error on PEAR::Common $_packageName + * fix Bug #1249 display the right state when using --force option + * fix Bug #2189 upgrade-all stops if dependancy fails + * fix Bug #1637 The use of interface causes warnings when packaging with PEAR + * fix Bug #1420 Parser bug for T_DOUBLE_COLON + * fix Request #2220 pear5 build fails on dual php4/php5 system + * fix Bug #1163 pear makerpm fails with packages that supply role="doc" + +Other: + * add PEAR_Exception class for PHP5 users + * fix critical problem in package.xml for linux in 1.3.2 + * fix staticPopCallback() in PEAR_ErrorStack + * fix warning in PEAR_Registry for windows 98 users + </notes> + </release> + <release> + <version>1.3.3.1</version> + <date>2004-11-08</date> + <state>stable</state> + <notes> + add RunTest.php to package.xml, make run-tests display failed tests, and use ui + </notes> + </release> + <release> + <version>1.3.4</version> + <date>2005-01-01</date> + <state>stable</state> + <notes> + * fix a serious problem caused by a bug in all versions of PHP that caused multiple registration + of the shutdown function of PEAR.php + * fix Bug #2861: package.dtd does not define NUMBER + * fix Bug #2946: ini_set warning errors + * fix Bug #3026: Dependency type &quot;ne&quot; is needed, &quot;not&quot; is not handled + properly + * fix Bug #3061: potential warnings in PEAR_Exception + * implement Request #2848: PEAR_ErrorStack logger extends, PEAR_ERRORSTACK_DIE + * implement Request #2914: Dynamic Include Path for run-tests command + * make pear help listing more useful (put how-to-use info at the bottom of the listing) </notes> </release> </changelog> http://cvs.php.net/diff.php/php-src/pear/package.dtd?r1=1.27.4.11&r2=1.27.4.12&ty=u Index: php-src/pear/package.dtd diff -u php-src/pear/package.dtd:1.27.4.11 php-src/pear/package.dtd:1.27.4.12 --- php-src/pear/package.dtd:1.27.4.11 Sun Jan 25 20:26:43 2004 +++ php-src/pear/package.dtd Mon Mar 28 11:56:58 2005 @@ -1,5 +1,5 @@ <!-- - $Id: package.dtd,v 1.27.4.11 2004/01/26 01:26:43 pajoye Exp $ + $Id: package.dtd,v 1.27.4.12 2005/03/28 16:56:58 cellog Exp $ This is the PEAR package description, version 1.0. It should be used with the informal public identifier: @@ -20,7 +20,7 @@ Stig S. Bakken <ssb@php.net> --> - +<!ENTITY % NUMBER "CDATA"> <!ELEMENT package (name|summary|description|license|maintainers|release|changelog)+> <!ATTLIST package type (source|binary|empty) "empty" version CDATA #REQUIRED> @@ -65,8 +65,8 @@ <!ATTLIST file role (php|ext|src|test|doc|data|script) 'php' debug (na|on|off) 'na' zts (na|on|off) 'na' - phpapi NUMBER #IMPLIED - zendapi NUMBER #IMPLIED + phpapi %NUMBER; #IMPLIED + zendapi %NUMBER; #IMPLIED format CDATA #IMPLIED baseinstalldir CDATA #IMPLIED platform CDATA #IMPLIED http://cvs.php.net/diff.php/php-src/pear/template.spec?r1=1.2.2.1&r2=1.2.2.2&ty=u Index: php-src/pear/template.spec diff -u php-src/pear/template.spec:1.2.2.1 php-src/pear/template.spec:1.2.2.2 --- php-src/pear/template.spec:1.2.2.1 Tue Jun 17 13:13:17 2003 +++ php-src/pear/template.spec Mon Mar 28 11:56:58 2005 @@ -30,25 +30,29 @@ %build echo BuildRoot=%{buildroot} +%clean +[ -n "%{buildroot}" -a "%{buildroot}" != / ] && rm -rf %{buildroot} + %postun pear uninstall --nodeps -r @package@ -rm @rpm_xml_dir@/@package@.xml %post pear install --nodeps -r @rpm_xml_dir@/@package@.xml %install -pear -c %{buildroot}/pearrc install --nodeps -R %{buildroot} \ - $RPM_SOURCE_DIR/@package@-%{version}.tgz +pear -c "%{buildroot}/pearrc" install --nodeps -R "%{buildroot}" \ + "$RPM_SOURCE_DIR/@package@-%{version}.tgz" rm %{buildroot}/pearrc rm %{buildroot}/%{_libdir}/php/pear/.filemap rm %{buildroot}/%{_libdir}/php/pear/.lock rm -rf %{buildroot}/%{_libdir}/php/pear/.registry -if [ -d "%{buildroot}/docs/@package@/doc" ]; then - rm -rf $RPM_BUILD_DIR/doc - mv %{buildroot}/docs/@package@/doc $RPM_BUILD_DIR - rm -rf %{buildroot}/docs -fi +for DOCDIR in docs doc examples; do + if [ -d "%{buildroot}/docs/@package@/$DOCDIR" ]; then + rm -rf $RPM_BUILD_DIR/$DOCDIR + mv %{buildroot}/docs/@package@/$DOCDIR $RPM_BUILD_DIR + rm -rf %{buildroot}/docs + fi +done mkdir -p %{buildroot}@rpm_xml_dir@ tar -xzf $RPM_SOURCE_DIR/@package@-%{version}.tgz package.xml cp -p package.xml %{buildroot}@rpm_xml_dir@/@package@.xml http://cvs.php.net/diff.php/php-src/pear/PEAR/Autoloader.php?r1=1.4.6.12&r2=1.4.6.13&ty=u Index: php-src/pear/PEAR/Autoloader.php diff -u php-src/pear/PEAR/Autoloader.php:1.4.6.12 php-src/pear/PEAR/Autoloader.php:1.4.6.13 --- php-src/pear/PEAR/Autoloader.php:1.4.6.12 Thu Feb 26 21:22:05 2004 +++ php-src/pear/PEAR/Autoloader.php Mon Mar 28 11:56:58 2005 @@ -1,7 +1,7 @@ <?php // /* vim: set expandtab tabstop=4 shiftwidth=4: */ // +----------------------------------------------------------------------+ -// | PHP Version 4 | +// | PHP Version 5 | // +----------------------------------------------------------------------+ // | Copyright (c) 1997-2004 The PHP Group | // +----------------------------------------------------------------------+ @@ -17,7 +17,7 @@ // | | // +----------------------------------------------------------------------+ // -// $Id: Autoloader.php,v 1.4.6.12 2004/02/27 02:22:05 cellog Exp $ +// $Id: Autoloader.php,v 1.4.6.13 2005/03/28 16:56:58 cellog Exp $ if (!extension_loaded("overload")) { // die hard without ext/overload http://cvs.php.net/diff.php/php-src/pear/PEAR/Builder.php?r1=1.7.4.12&r2=1.7.4.13&ty=u Index: php-src/pear/PEAR/Builder.php diff -u php-src/pear/PEAR/Builder.php:1.7.4.12 php-src/pear/PEAR/Builder.php:1.7.4.13 --- php-src/pear/PEAR/Builder.php:1.7.4.12 Tue Jun 8 14:15:22 2004 +++ php-src/pear/PEAR/Builder.php Mon Mar 28 11:56:58 2005 @@ -1,7 +1,7 @@ <?php // // +----------------------------------------------------------------------+ -// | PHP Version 4 | +// | PHP Version 5 | // +----------------------------------------------------------------------+ // | Copyright (c) 1997-2004 The PHP Group | // +----------------------------------------------------------------------+ @@ -16,7 +16,7 @@ // | Authors: Stig Sæther Bakken <ssb@php.net> | // +----------------------------------------------------------------------+ // -// $Id: Builder.php,v 1.7.4.12 2004/06/08 18:15:22 cellog Exp $ +// $Id: Builder.php,v 1.7.4.13 2005/03/28 16:56:58 cellog Exp $ require_once 'PEAR/Common.php'; @@ -150,6 +150,49 @@ } // }}} + // {{{ _harventInstDir + /** + * @param string + * @param string + * @param array + * @access private + */ + function _harvestInstDir($dest_prefix, $dirname, &$built_files) + { + $d = opendir($dirname); + if (!$d) + return false; + + $ret = true; + while (($ent = readdir($d)) !== false) { + if ($ent{0} == '.') + continue; + + $full = $dirname . DIRECTORY_SEPARATOR . $ent; + if (is_dir($full)) { + if (!$this->_harvestInstDir( + $dest_prefix . DIRECTORY_SEPARATOR . $ent, + $full, $built_files)) { + $ret = false; + break; + } + } else { + $dest = $dest_prefix . DIRECTORY_SEPARATOR . $ent; + $built_files[] = array( + 'file' => $full, + 'dest' => $dest, + 'php_api' => $this->php_api_version, + 'zend_mod_api' => $this->zend_module_api_no, + 'zend_ext_api' => $this->zend_extension_api_no, + ); + } + } + closedir($d); + return $ret; + } + + // }}} + // {{{ build() /** @@ -198,7 +241,7 @@ $dir = getcwd(); $this->log(2, "building in $dir"); $this->current_callback = $callback; - putenv('PATH=' . getenv('PATH') . ':' . $this->config->get('bin_dir')); + putenv('PATH=' . $this->config->get('bin_dir') . ':' . getenv('PATH')); $err = $this->_runCommand("phpize", array(&$this, 'phpizeCallback')); if (PEAR::isError($err)) { return $err; @@ -231,14 +274,20 @@ } $build_basedir = "/var/tmp/pear-build-$user"; $build_dir = "$build_basedir/$info[package]-$info[version]"; + $inst_dir = "$build_basedir/install-$info[package]-$info[version]"; $this->log(1, "building in $build_dir"); if (is_dir($build_dir)) { - System::rm("-rf $build_dir"); + System::rm(array('-rf', $build_dir)); } - if (!System::mkDir("-p $build_dir")) { + if (!System::mkDir(array('-p', $build_dir))) { return $this->raiseError("could not create build dir: $build_dir"); } $this->addTempFile($build_dir); + if (!System::mkDir(array('-p', $inst_dir))) { + return $this->raiseError("could not create temporary install dir: $inst_dir"); + } + $this->addTempFile($inst_dir); + if (getenv('MAKE')) { $make_command = getenv('MAKE'); } else { @@ -247,10 +296,13 @@ $to_run = array( $configure_command, $make_command, + "$make_command INSTALL_ROOT=\"$inst_dir\" install", + "find \"$inst_dir\" -ls" ); if (!@chdir($build_dir)) { return $this->raiseError("could not chdir to $build_dir"); } + putenv('PHP_PEAR_VERSION=@PEAR-VER@'); foreach ($to_run as $cmd) { $err = $this->_runCommand($cmd, $callback); if (PEAR::isError($err)) { @@ -267,26 +319,8 @@ return $this->raiseError("no `modules' directory found"); } $built_files = array(); - while ($ent = readdir($dp)) { - if ($ent{0} == '.' || substr($ent, -3) == '.la') { - continue; - } - // harvest! - if (@copy("modules/$ent", "$dir/$ent")) { - $built_files[] = array( - 'file' => "$dir/$ent", - 'php_api' => $this->php_api_version, - 'zend_mod_api' => $this->zend_module_api_no, - 'zend_ext_api' => $this->zend_extension_api_no, - ); - - $this->log(1, "$ent copied to $dir/$ent"); - } else { - chdir($old_cwd); - return $this->raiseError("failed copying $ent to $dir"); - } - } - closedir($dp); + $prefix = exec("php-config --prefix"); + $this->_harvestInstDir($prefix, $inst_dir . DIRECTORY_SEPARATOR . $prefix, $built_files); chdir($old_cwd); return $built_files; } http://cvs.php.net/diff.php/php-src/pear/PEAR/Command.php?r1=1.16.4.12&r2=1.16.4.13&ty=u Index: php-src/pear/PEAR/Command.php diff -u php-src/pear/PEAR/Command.php:1.16.4.12 php-src/pear/PEAR/Command.php:1.16.4.13 --- php-src/pear/PEAR/Command.php:1.16.4.12 Thu Feb 26 21:24:16 2004 +++ php-src/pear/PEAR/Command.php Mon Mar 28 11:56:58 2005 @@ -1,7 +1,7 @@ <?php // // +----------------------------------------------------------------------+ -// | PHP Version 4 | +// | PHP Version 5 | // +----------------------------------------------------------------------+ // | Copyright (c) 1997-2004 The PHP Group | // +----------------------------------------------------------------------+ @@ -16,7 +16,7 @@ // | Author: Stig Bakken <ssb@php.net> | // +----------------------------------------------------------------------+ // -// $Id: Command.php,v 1.16.4.12 2004/02/27 02:24:16 cellog Exp $ +// $Id: Command.php,v 1.16.4.13 2005/03/28 16:56:58 cellog Exp $ require_once "PEAR.php"; @@ -280,6 +280,7 @@ $GLOBALS['_PEAR_Command_shortcuts'][$shortcut] = $command; } } + @closedir($dp); return true; } http://cvs.php.net/diff.php/php-src/pear/PEAR/Common.php?r1=1.81.2.18&r2=1.81.2.19&ty=u Index: php-src/pear/PEAR/Common.php diff -u php-src/pear/PEAR/Common.php:1.81.2.18 php-src/pear/PEAR/Common.php:1.81.2.19 --- php-src/pear/PEAR/Common.php:1.81.2.18 Sat Jun 12 02:16:17 2004 +++ php-src/pear/PEAR/Common.php Mon Mar 28 11:56:59 2005 @@ -17,7 +17,7 @@ // | Tomas V.V.Cox <cox@idecnet.com> | // +----------------------------------------------------------------------+ // -// $Id: Common.php,v 1.81.2.18 2004/06/12 06:16:17 cellog Exp $ +// $Id: Common.php,v 1.81.2.19 2005/03/28 16:56:59 cellog Exp $ require_once 'PEAR.php'; require_once 'Archive/Tar.php'; @@ -34,7 +34,7 @@ define('PEAR_COMMON_PACKAGE_NAME_PREG', '/^' . _PEAR_COMMON_PACKAGE_NAME_PREG . '$/'); // this should allow: 1, 1.0, 1.0RC1, 1.0dev, 1.0dev123234234234, 1.0a1, 1.0b1, 1.0pl1 -define('_PEAR_COMMON_PACKAGE_VERSION_PREG', '\d+(?:\.\d+)*(?:[a-z]+\d*)?'); +define('_PEAR_COMMON_PACKAGE_VERSION_PREG', '\d+(?:\.\d+)*(?:[a-zA-Z]+\d*)?'); define('PEAR_COMMON_PACKAGE_VERSION_PREG', '/^' . _PEAR_COMMON_PACKAGE_VERSION_PREG . '$/i'); // XXX far from perfect :-) @@ -69,7 +69,7 @@ * Valid dependency relations * @var array */ -$GLOBALS['_PEAR_Common_dependency_relations'] = array('has','eq','lt','le','gt','ge','not'); +$GLOBALS['_PEAR_Common_dependency_relations'] = array('has','eq','lt','le','gt','ge','not', 'ne'); /** * Valid file roles @@ -98,7 +98,9 @@ // }}} /** - * Class providing common functionality for PEAR adminsitration classes. + * Class providing common functionality for PEAR administration classes. + * @deprecated This class will disappear, and its components will be spread + * into smaller classes, like the AT&T breakup */ class PEAR_Common extends PEAR { @@ -142,12 +144,6 @@ * @access private */ var $_validPackageFile; - /** - * Temporary variable used in sorting packages by dependency in {@link sortPkgDeps()} - * @var array - * @access private - */ - var $_packageSortTree; // }}} @@ -1133,18 +1129,31 @@ if (!empty($d['optional'])) { if (!in_array($d['optional'], array('yes', 'no'))) { $errors[] = "dependency $i: invalid relation optional attribute '$d[optional]', should be one of: yes no"; + } else { + if (($d['rel'] == 'not' || $d['rel'] == 'ne') && $d['optional'] == 'yes') { + $errors[] = "dependency $i: 'not' and 'ne' dependencies cannot be " . + "optional"; + } } } - if ($d['rel'] != 'has' && empty($d['version'])) { + if ($d['rel'] != 'not' && $d['rel'] != 'has' && empty($d['version'])) { $warnings[] = "dependency $i: missing version"; - } elseif ($d['rel'] == 'has' && !empty($d['version'])) { - $warnings[] = "dependency $i: version ignored for `has' dependencies"; + } elseif (($d['rel'] == 'not' || $d['rel'] == 'has') && !empty($d['version'])) { + $warnings[] = "dependency $i: version ignored for `$d[rel]' dependencies"; + } + if ($d['rel'] == 'not' && !empty($d['version'])) { + $warnings[] = "dependency $i: 'not' defines a total conflict, to exclude " . + "specific versions, use 'ne'"; } if ($d['type'] == 'php' && !empty($d['name'])) { $warnings[] = "dependency $i: name ignored for php type dependencies"; } elseif ($d['type'] != 'php' && empty($d['name'])) { $errors[] = "dependency $i: missing name"; } + if ($d['type'] == 'php' && $d['rel'] == 'not') { + $errors[] = "dependency $i: PHP dependencies cannot use 'not' " . + "rel, use 'ne' to exclude versions"; + } $i++; } } @@ -1293,6 +1302,15 @@ if (!function_exists("token_get_all")) { return false; } + if (!defined('T_DOC_COMMENT')) { + define('T_DOC_COMMENT', T_COMMENT); + } + if (!defined('T_INTERFACE')) { + define('T_INTERFACE', -1); + } + if (!defined('T_IMPLEMENTS')) { + define('T_IMPLEMENTS', -1); + } if (!$fp = @fopen($file, "r")) { return false; } @@ -1315,17 +1333,21 @@ $brace_level = 0; $lastphpdoc = ''; $current_class = ''; + $current_interface = ''; $current_class_level = -1; $current_function = ''; $current_function_level = -1; $declared_classes = array(); + $declared_interfaces = array(); $declared_functions = array(); $declared_methods = array(); $used_classes = array(); $used_functions = array(); $extends = array(); + $implements = array(); $nodeps = array(); $inquote = false; + $interface = false; for ($i = 0; $i < sizeof($tokens); $i++) { if (is_array($tokens[$i])) { list($token, $data) = $tokens[$i]; @@ -1341,6 +1363,14 @@ } } switch ($token) { + case T_WHITESPACE: + continue; + case ';': + if ($interface) { + $current_function = ''; + $current_function_level = -1; + } + break; case '"': $inquote = true; break; @@ -1362,6 +1392,8 @@ case ']': $bracket_level--; continue 2; case '(': $paren_level++; continue 2; case ')': $paren_level--; continue 2; + case T_INTERFACE: + $interface = true; case T_CLASS: if (($current_class_level != -1) || ($current_function_level != -1)) { PEAR::raiseError("Parser error: Invalid PHP file $file", @@ -1371,19 +1403,38 @@ case T_FUNCTION: case T_NEW: case T_EXTENDS: + case T_IMPLEMENTS: $look_for = $token; continue 2; case T_STRING: + if (version_compare(zend_version(), '2.0', '<')) { + if (in_array(strtolower($data), + array('public', 'private', 'protected', 'abstract', + 'interface', 'implements', 'clone', 'throw') + )) { + PEAR::raiseError('Error: PHP5 packages must be packaged by php 5 PEAR'); + return false; + } + } if ($look_for == T_CLASS) { $current_class = $data; $current_class_level = $brace_level; $declared_classes[] = $current_class; + } elseif ($look_for == T_INTERFACE) { + $current_interface = $data; + $current_class_level = $brace_level; + $declared_interfaces[] = $current_interface; + } elseif ($look_for == T_IMPLEMENTS) { + $implements[$current_class] = $data; } elseif ($look_for == T_EXTENDS) { $extends[$current_class] = $data; } elseif ($look_for == T_FUNCTION) { if ($current_class) { $current_function = "$current_class::$data"; $declared_methods[$current_class][] = $data; + } elseif ($current_interface) { + $current_function = "$current_interface::$data"; + $declared_methods[$current_interface][] = $data; } else { $current_function = $data; $declared_functions[] = $current_function; @@ -1398,6 +1449,7 @@ case T_VARIABLE: $look_for = 0; continue 2; + case T_DOC_COMMENT: case T_COMMENT: if (preg_match('!^/\*\*\s!', $data)) { $lastphpdoc = $data; @@ -1422,10 +1474,12 @@ return array( "source_file" => $file, "declared_classes" => $declared_classes, + "declared_interfaces" => $declared_interfaces, "declared_methods" => $declared_methods, "declared_functions" => $declared_functions, "used_classes" => array_diff(array_keys($used_classes), $nodeps), "inheritance" => $extends, + "implements" => $implements, ); } http://cvs.php.net/diff.php/php-src/pear/PEAR/Config.php?r1=1.35.2.16&r2=1.35.2.17&ty=u Index: php-src/pear/PEAR/Config.php diff -u php-src/pear/PEAR/Config.php:1.35.2.16 php-src/pear/PEAR/Config.php:1.35.2.17 --- php-src/pear/PEAR/Config.php:1.35.2.16 Sun Jan 25 20:26:46 2004 +++ php-src/pear/PEAR/Config.php Mon Mar 28 11:56:59 2005 @@ -1,7 +1,7 @@ <?php // // +----------------------------------------------------------------------+ -// | PHP Version 4 | +// | PHP Version 5 | // +----------------------------------------------------------------------+ // | Copyright (c) 1997-2004 The PHP Group | // +----------------------------------------------------------------------+ @@ -16,7 +16,7 @@ // | Author: Stig Bakken <ssb@php.net> | // +----------------------------------------------------------------------+ // -// $Id: Config.php,v 1.35.2.16 2004/01/26 01:26:46 pajoye Exp $ +// $Id: Config.php,v 1.35.2.17 2005/03/28 16:56:59 cellog Exp $ require_once 'PEAR.php'; require_once 'System.php'; http://cvs.php.net/diff.php/php-src/pear/PEAR/Dependency.php?r1=1.14.4.20&r2=1.14.4.21&ty=u Index: php-src/pear/PEAR/Dependency.php diff -u php-src/pear/PEAR/Dependency.php:1.14.4.20 php-src/pear/PEAR/Dependency.php:1.14.4.21 --- php-src/pear/PEAR/Dependency.php:1.14.4.20 Sun Jan 25 20:26:46 2004 +++ php-src/pear/PEAR/Dependency.php Mon Mar 28 11:56:59 2005 @@ -1,7 +1,7 @@ <?php // // +----------------------------------------------------------------------+ -// | PHP Version 4 | +// | PHP Version 5 | // +----------------------------------------------------------------------+ // | Copyright (c) 1997-2004 The PHP Group | // +----------------------------------------------------------------------+ @@ -17,7 +17,7 @@ // | Stig Bakken <ssb@php.net> | // +----------------------------------------------------------------------+ // -// $Id: Dependency.php,v 1.14.4.20 2004/01/26 01:26:46 pajoye Exp $ +// $Id: Dependency.php,v 1.14.4.21 2005/03/28 16:56:59 cellog Exp $ require_once "PEAR.php"; @@ -204,7 +204,7 @@ } foreach ($deps as $dep) { if ($dep['type'] == 'pkg' && strcasecmp($dep['name'], $package) == 0) { - if ($dep['rel'] == 'ne') { + if ($dep['rel'] == 'ne' || $dep['rel'] == 'not') { continue; } if (isset($dep['optional']) && $dep['optional'] == 'yes') { @@ -244,7 +244,7 @@ } if (!extension_loaded($name)) { - if ($relation == 'ne') { + if ($relation == 'not') { return false; } if ($opt) { @@ -322,7 +322,8 @@ return false; } if ($relation == 'not') { - $errmsg = "Invalid dependency - 'not' is allowed when specifying PHP, you must run PHP in PHP"; + $errmsg = 'Invalid dependency - "not" is not allowed for php dependencies, ' . + 'php cannot conflict with itself'; return PEAR_DEPENDENCY_BAD_DEPENDENCY; } if (substr($req, 0, 2) == 'v.') { http://cvs.php.net/diff.php/php-src/pear/PEAR/Downloader.php?r1=1.9.2.7&r2=1.9.2.8&ty=u Index: php-src/pear/PEAR/Downloader.php diff -u php-src/pear/PEAR/Downloader.php:1.9.2.7 php-src/pear/PEAR/Downloader.php:1.9.2.8 --- php-src/pear/PEAR/Downloader.php:1.9.2.7 Fri Apr 30 12:37:40 2004 +++ php-src/pear/PEAR/Downloader.php Mon Mar 28 11:56:59 2005 @@ -1,7 +1,7 @@ <?php // // +----------------------------------------------------------------------+ -// | PHP Version 4 | +// | PHP Version 5 | // +----------------------------------------------------------------------+ // | Copyright (c) 1997-2004 The PHP Group | // +----------------------------------------------------------------------+ @@ -18,7 +18,7 @@ // | Martin Jansen <mj@php.net> | // +----------------------------------------------------------------------+ // -// $Id: Downloader.php,v 1.9.2.7 2004/04/30 16:37:40 cellog Exp $ +// $Id: Downloader.php,v 1.9.2.8 2005/03/28 16:56:59 cellog Exp $ require_once 'PEAR/Common.php'; require_once 'PEAR/Registry.php'; @@ -68,7 +68,7 @@ /** * Options from command-line passed to Install. - * + * * Recognized options:<br /> * - onlyreqdeps : install all required dependencies as well * - alldeps : install all dependencies, including optional @@ -82,7 +82,7 @@ /** * Downloaded Packages after a call to download(). - * + * * Format of each entry: * * <code> @@ -97,7 +97,7 @@ /** * Packages slated for download. - * + * * This is used to prevent downloading a package more than once should it be a dependency * for two packages to be installed. * Format of each entry: @@ -110,10 +110,10 @@ * @var array */ var $_toDownload = array(); - + /** * Array of every package installed, with names lower-cased. - * + * * Format: * <code> * array('package1' => 0, 'package2' => 1, ); @@ -121,7 +121,7 @@ * @var array */ var $_installed = array(); - + /** * @var array * @access private @@ -129,7 +129,7 @@ var $_errorStack = array(); // {{{ PEAR_Downloader() - + function PEAR_Downloader(&$ui, $options, &$config) { $this->_options = $options; @@ -158,7 +158,7 @@ } parent::PEAR_Common(); } - + // }}} // {{{ configSet() function configSet($key, $value, $layer = 'user') @@ -170,14 +170,14 @@ $this->_preferredState = null; } } - + // }}} // {{{ setOptions() function setOptions($options) { $this->_options = $options; } - + // }}} // {{{ _downloadFile() /** @@ -302,7 +302,7 @@ /** * Retrieve a list of downloaded packages after a call to {@link download()}. - * + * * Also resets the list of downloaded packages. * @return array */ @@ -327,7 +327,7 @@ { return $this->doDownload($packages); } - + // }}} // {{{ doDownload() @@ -381,7 +381,8 @@ // there are no dependencies continue; } - foreach($alldeps as $info) { + $fail = false; + foreach ($alldeps as $info) { if ($info['type'] != 'pkg') { continue; } @@ -389,11 +390,18 @@ if ($ret === false) { continue; } + if ($ret === 0) { + $fail = true; + continue; + } if (PEAR::isError($ret)) { return $ret; } $deppackages[] = $ret; } // foreach($alldeps + if ($fail) { + $deppackages = array(); + } } if (count($deppackages)) { @@ -404,7 +412,7 @@ // }}} // {{{ _downloadNonFile($pkgfile) - + /** * @return false|PEAR_Error|string false if loop should be broken out of, * string if the file was downloaded, @@ -456,9 +464,9 @@ if ($version == 0) { return $this->raiseError("No release with state '$state' found for '$pkgfile'"); } - // invalid postfix passed + // invalid suffix passed } else { - return $this->raiseError("Invalid postfix '-$version', be sure to pass a valid PEAR ". + return $this->raiseError("Invalid suffix '-$version', be sure to pass a valid PEAR ". "version number or release state"); } // Guess what to download @@ -466,17 +474,24 @@ $states = $this->betterStates($this->_preferredState, true); $possible = false; $version = 0; + $higher_version = 0; + $prev_hi_ver = 0; foreach ($releases as $ver => $inf) { if (in_array($inf['state'], $states) && version_compare("$version", "$ver") < 0) { $version = $ver; break; - } + } else { + $ver = (string)$ver; + if (version_compare($prev_hi_ver, $ver) < 0) { + $prev_hi_ver = $higher_version = $ver; + } + } } if ($version === 0 && !isset($this->_options['force'])) { return $this->raiseError('No release with state equal to: \'' . implode(', ', $states) . "' found for '$pkgfile'"); } elseif ($version === 0) { - $this->log(0, "Warning: $pkgfile is state '$inf[state]' which is less stable " . + $this->log(0, "Warning: $pkgfile is state '" . $releases[$higher_version]['state'] . "' which is less stable " . "than state '$this->_preferredState'"); } } @@ -494,10 +509,10 @@ $this->_toDownload[] = $pkgfile; return $this->_downloadFile($pkgfile, $version, $origpkgfile, $state); } - + // }}} // {{{ _processDependency($package, $info, $mywillinstall) - + /** * Process a dependency, download if necessary * @param array dependency information from PEAR_Remote call @@ -554,7 +569,7 @@ $savestate = array_shift($get); $this->pushError( "Release for '$package' dependency '$info[name]' " . "has state '$savestate', requires '$state'"); - return false; + return 0; } if (in_array(strtolower($info['name']), $this->_toDownload) || isset($mywillinstall[strtolower($info['name'])])) { @@ -587,7 +602,7 @@ } return $info['name']; } - + // }}} // {{{ _downloadCallback() @@ -634,7 +649,7 @@ } // }}} // {{{ pushError($errmsg, $code) - + /** * @param string * @param integer @@ -643,10 +658,10 @@ { array_push($this->_errorStack, array($errmsg, $code)); } - + // }}} // {{{ getErrorMsgs() - + function getErrorMsgs() { $msgs = array(); @@ -657,7 +672,7 @@ $this->_errorStack = array(); return $msgs; } - + // }}} } // }}} http://cvs.php.net/diff.php/php-src/pear/PEAR/ErrorStack.php?r1=1.1.2.2&r2=1.1.2.3&ty=u Index: php-src/pear/PEAR/ErrorStack.php diff -u php-src/pear/PEAR/ErrorStack.php:1.1.2.2 php-src/pear/PEAR/ErrorStack.php:1.1.2.3 --- php-src/pear/PEAR/ErrorStack.php:1.1.2.2 Sat Jun 12 01:50:51 2004 +++ php-src/pear/PEAR/ErrorStack.php Mon Mar 28 11:56:59 2005 @@ -17,7 +17,7 @@ // | | // +----------------------------------------------------------------------+ // -// $Id: ErrorStack.php,v 1.1.2.2 2004/06/12 05:50:51 cellog Exp $ +// $Id: ErrorStack.php,v 1.1.2.3 2005/03/28 16:56:59 cellog Exp $ /** * Error Stack Implementation @@ -35,8 +35,11 @@ * * Since version 0.3alpha, it is possible to specify the exception class * returned from {@link push()} + * + * Since version PEAR1.3.2, ErrorStack no longer instantiates an exception class. This can + * still be done quite handily in an error callback or by manipulating the returned array * @author Greg Beaver <cellog@php.net> - * @version 0.6alpha + * @version PEAR1.3.2 (beta) * @package PEAR_ErrorStack * @category Debugging * @license http://www.php.net/license/3_0.txt PHP License v3.0 @@ -119,6 +122,10 @@ * If this is returned, then the error is completely ignored. */ define('PEAR_ERRORSTACK_IGNORE', 4); +/** + * If this is returned, then the error is logged and die() is called. + */ +define('PEAR_ERRORSTACK_DIE', 5); /**#@-*/ /** @@ -156,7 +163,7 @@ * @access private */ var $_errors = array(); - + /** * Storage of errors by level. * @@ -221,13 +228,6 @@ var $_logger = false; /** - * Class name to use for a PHP 5 exception that will be returned - * @var string - * @access protected - */ - var $_exceptionClass = 'Exception'; - - /** * Error messages - designed to be overridden * @var array * @abstract @@ -242,20 +242,14 @@ * @param callback $contextCallback callback used for context generation, * defaults to {@link getFileLine()} * @param boolean $throwPEAR_Error - * @param string $exceptionClass exception class to instantiate if - * in PHP 5 */ function PEAR_ErrorStack($package, $msgCallback = false, $contextCallback = false, - $throwPEAR_Error = false, $exceptionClass = null) + $throwPEAR_Error = false) { $this->_package = $package; $this->setMessageCallback($msgCallback); $this->setContextCallback($contextCallback); $this->_compat = $throwPEAR_Error; - // this allows child classes to simply redefine $this->_exceptionClass - if (!is_null($exceptionClass)) { - $this->_exceptionClass = $exceptionClass; - } } /** @@ -268,29 +262,27 @@ * @param callback $contextCallback callback used for context generation, * defaults to {@link getFileLine()} * @param boolean $throwPEAR_Error - * @param string $exceptionClass exception class to instantiate if - * in PHP 5 * @param string $stackClass class to instantiate * @static * @return PEAR_ErrorStack */ function &singleton($package, $msgCallback = false, $contextCallback = false, - $throwPEAR_Error = false, $exceptionClass = null, - $stackClass = 'PEAR_ErrorStack') + $throwPEAR_Error = false, $stackClass = 'PEAR_ErrorStack') { if (isset($GLOBALS['_PEAR_ERRORSTACK_SINGLETON'][$package])) { return $GLOBALS['_PEAR_ERRORSTACK_SINGLETON'][$package]; } if (!class_exists($stackClass)) { - $trace = debug_backtrace(); + if (function_exists('debug_backtrace')) { + $trace = debug_backtrace(); + } PEAR_ErrorStack::staticPush('PEAR_ErrorStack', PEAR_ERRORSTACK_ERR_NONCLASS, 'exception', array('stackclass' => $stackClass), 'stack class "%stackclass%" is not a valid class name (should be like PEAR_ErrorStack)', false, $trace); } return $GLOBALS['_PEAR_ERRORSTACK_SINGLETON'][$package] = - &new $stackClass($package, $msgCallback, $contextCallback, $throwPEAR_Error, - $exceptionClass); + &new $stackClass($package, $msgCallback, $contextCallback, $throwPEAR_Error); } /** @@ -320,7 +312,11 @@ */ function setDefaultLogger(&$log) { - $GLOBALS['_PEAR_ERRORSTACK_DEFAULT_LOGGER'] = &$log; + if (is_object($log) && method_exists($log, 'log') ) { + $GLOBALS['_PEAR_ERRORSTACK_DEFAULT_LOGGER'] = &$log; + } elseif (is_callable($log)) { + $GLOBALS['_PEAR_ERRORSTACK_DEFAULT_LOGGER'] = &$log; + } } /** @@ -329,7 +325,11 @@ */ function setLogger(&$log) { - $this->_logger = &$log; + if (is_object($log) && method_exists($log, 'log') ) { + $this->_logger = &$log; + } elseif (is_callable($log)) { + $this->_logger = &$log; + } } /** @@ -381,14 +381,18 @@ } /** - * Set an error code => error message mapping callback + * Set a callback that generates context information (location of error) for an error stack * - * This method sets the callback that can be used to generate error - * messages for any PEAR_ErrorStack instance - * @param array|string Callback function/method + * This method sets the callback that can be used to generate context + * information for an error. Passing in NULL will disable context generation + * and remove the expensive call to debug_backtrace() + * @param array|string|null Callback function/method */ function setContextCallback($contextCallback) { + if ($contextCallback === null) { + return $this->_contextCallback = false; + } if (!$contextCallback) { $this->_contextCallback = array(&$this, 'getFileLine'); } else { @@ -454,10 +458,11 @@ */ function staticPopCallback() { - array_pop($GLOBALS['_PEAR_ERRORSTACK_OVERRIDE_CALLBACK']); + $ret = array_pop($GLOBALS['_PEAR_ERRORSTACK_OVERRIDE_CALLBACK']); if (!is_array($GLOBALS['_PEAR_ERRORSTACK_OVERRIDE_CALLBACK'])) { $GLOBALS['_PEAR_ERRORSTACK_OVERRIDE_CALLBACK'] = array(); } + return $ret; } /** @@ -504,7 +509,7 @@ * 'time' => time(), * 'context' => $context, * 'message' => $msg, - * //['repackage' => $err] repackaged error array + * //['repackage' => $err] repackaged error array/Exception class * ); * </code> */ @@ -538,13 +543,13 @@ $msg = call_user_func_array($this->_msgCallback, array(&$this, $err)); $err['message'] = $msg; - } - + } if ($repackage) { $err['repackage'] = $repackage; } $push = $log = true; + $die = false; // try the overriding callback first $callback = $this->staticPopCallback(); if ($callback) { @@ -552,9 +557,9 @@ } if (!is_callable($callback)) { // try the local callback next - $callback = $this->popCallback(); - if (is_callable($callback)) { - $this->pushCallback($callback); + $callback = $this->popCallback(); + if (is_callable($callback)) { + $this->pushCallback($callback); } else { // try the default callback $callback = isset($GLOBALS['_PEAR_ERRORSTACK_DEFAULT_CALLBACK'][$this->_package]) ? @@ -573,6 +578,9 @@ case PEAR_ERRORSTACK_LOG: $push = false; break; + case PEAR_ERRORSTACK_DIE: + $die = true; + break; // anything else returned has the same effect as pushandlog } } @@ -585,18 +593,12 @@ $this->_log($err); } } + if ($die) { + die(); + } if ($this->_compat && $push) { return $this->raiseError($msg, $code, null, null, $err); } - if (class_exists($this->_exceptionClass)) { - $exception = $this->_exceptionClass; - if (is_string($msg) && is_numeric($code)) { - $code = $code + 0; - } - $ret = new $exception($msg, $code); - $ret->errorData = $err; - return $ret; - } return $err; } @@ -630,7 +632,9 @@ $s = &PEAR_ErrorStack::singleton($package); if ($s->_contextCallback) { if (!$backtrace) { - $backtrace = debug_backtrace(); + if (function_exists('debug_backtrace')) { + $backtrace = debug_backtrace(); + } } } return $s->push($code, $level, $params, $msg, $repackage, $backtrace); @@ -642,7 +646,15 @@ * @param array $levels Error level => Log constant map * @access protected */ - function _log($err, $levels = array( + function _log($err) + { + if ($this->_logger) { + $logger = &$this->_logger; + } else { + $logger = &$GLOBALS['_PEAR_ERRORSTACK_DEFAULT_LOGGER']; + } + if (is_a($logger, 'Log')) { + $levels = array( 'exception' => PEAR_LOG_CRIT, 'alert' => PEAR_LOG_ALERT, 'critical' => PEAR_LOG_CRIT, @@ -650,17 +662,15 @@ 'warning' => PEAR_LOG_WARNING, 'notice' => PEAR_LOG_NOTICE, 'info' => PEAR_LOG_INFO, - 'debug' => PEAR_LOG_DEBUG)) - { - if (isset($levels[$err['level']])) { - $level = $levels[$err['level']]; - } else { - $level = PEAR_LOG_INFO; - } - if ($this->_logger) { - $this->_logger->log($err['message'], $level, $err); - } else { - $GLOBALS['_PEAR_ERRORSTACK_DEFAULT_LOGGER']->log($err['message'], $level, $err); + 'debug' => PEAR_LOG_DEBUG); + if (isset($levels[$err['level']])) { + $level = $levels[$err['level']]; + } else { + $level = PEAR_LOG_INFO; + } + $logger->log($err['message'], $level, $err); + } else { // support non-standard logs + call_user_func($logger, $err); } } @@ -708,8 +718,8 @@ return $this->_errorsByLevel[$level]; } } else { - return $this->_errors; - } + return $this->_errors; + } } if ($level) { $ret = $this->_errorsByLevel[$level]; @@ -757,7 +767,7 @@ /** * Get a list of all errors since last purge, organized by package * @since PEAR 1.4.0dev BC break! $level is now in the place $merge used to be - * @param boolean $clearStack Set to purge the error stack of existing errors + * @param boolean $purge Set to purge the error stack of existing errors * @param string $level Set to a level name in order to retrieve only errors of a particular level * @param boolean $merge Set to return a flat array, not organized by package * @param array $sortfunc Function used to sort a merged array - default @@ -765,7 +775,8 @@ * @static * @return array */ - function staticGetErrors($purge = false, $level = false, $merge = false, $sortfunc = array('PEAR_ErrorStack', '_sortErrors')) + function staticGetErrors($purge = false, $level = false, $merge = false, + $sortfunc = array('PEAR_ErrorStack', '_sortErrors')) { $ret = array(); if (!is_callable($sortfunc)) { @@ -915,7 +926,7 @@ $val = 'Object'; } } - $mainmsg = str_replace('%' . $name . '%', $val, $mainmsg); + $mainmsg = str_replace('%' . $name . '%', $val, $mainmsg); } } return $mainmsg; @@ -967,4 +978,4 @@ } $stack = &PEAR_ErrorStack::singleton('PEAR_ErrorStack'); $stack->pushCallback(array('PEAR_ErrorStack', '_handleError')); -?> +?> \ No newline at end of file http://cvs.php.net/diff.php/php-src/pear/PEAR/Installer.php?r1=1.81.2.26&r2=1.81.2.27&ty=u Index: php-src/pear/PEAR/Installer.php diff -u php-src/pear/PEAR/Installer.php:1.81.2.26 php-src/pear/PEAR/Installer.php:1.81.2.27 --- php-src/pear/PEAR/Installer.php:1.81.2.26 Sat Jun 12 01:50:51 2004 +++ php-src/pear/PEAR/Installer.php Mon Mar 28 11:56:59 2005 @@ -1,7 +1,7 @@ <?php // // +----------------------------------------------------------------------+ -// | PHP Version 4 | +// | PHP Version 5 | // +----------------------------------------------------------------------+ // | Copyright (c) 1997-2004 The PHP Group | // +----------------------------------------------------------------------+ @@ -18,7 +18,7 @@ // | Martin Jansen <mj@php.net> | // +----------------------------------------------------------------------+ // -// $Id: Installer.php,v 1.81.2.26 2004/06/12 05:50:51 cellog Exp $ +// $Id: Installer.php,v 1.81.2.27 2005/03/28 16:56:59 cellog Exp $ require_once 'PEAR/Downloader.php'; @@ -165,7 +165,14 @@ include_once "OS/Guess.php"; $os = new OS_Guess(); } - if (!$os->matchSignature($atts['platform'])) { + if (strlen($atts['platform']) && $atts['platform']{0} == '!') { + $negate = true; + $platform = substr($atts['platform'], 1); + } else { + $negate = false; + $platform = $atts['platform']; + } + if ((bool) $os->matchSignature($platform) === $negate) { $this->log(3, "skipped $file (meant for $atts[platform], we are ".$os->getSignature().")"); return PEAR_INSTALLER_SKIPPED; } @@ -790,28 +797,43 @@ $this->log(1, "\nBuild process completed successfully"); foreach ($built as $ext) { $bn = basename($ext['file']); - list($_ext_name, ) = explode('.', $bn); - if (extension_loaded($_ext_name)) { - $this->raiseError("Extension '$_ext_name' already loaded. Please unload it ". - "in your php.ini file prior to install or upgrade it."); - } - // extension dir must be created if it doesn't exist - // patch by Tomas Cox (modified by Greg Beaver) - $ext_dir = $this->config->get('ext_dir'); - if (!@is_dir($ext_dir) && !System::mkdir(array('-p', $ext_dir))) { - $this->log(3, "+ mkdir -p $ext_dir"); - return $this->raiseError("failed to create extension dir '$ext_dir'"); - } - $dest = $ext_dir . DIRECTORY_SEPARATOR . $bn; - $this->log(1, "Installing '$bn' at ext_dir ($dest)"); - $this->log(3, "+ cp $ext[file] ext_dir ($dest)"); + list($_ext_name, $_ext_suff) = explode('.', $bn); + if ($_ext_suff == '.so' || $_ext_suff == '.dll') { + if (extension_loaded($_ext_name)) { + $this->raiseError("Extension '$_ext_name' already loaded. " . + 'Please unload it in your php.ini file ' . + 'prior to install or upgrade'); + } + $role = 'ext'; + } else { + $role = 'src'; + } + $dest = $ext['dest']; + $this->log(1, "Installing '$ext[file]'"); $copyto = $this->_prependPath($dest, $this->installroot); + $copydir = dirname($copyto); + if (!@is_dir($copydir)) { + if (!$this->mkDirHier($copydir)) { + return $this->raiseError("failed to mkdir $copydir", + PEAR_INSTALLER_FAILED); + } + $this->log(3, "+ mkdir $copydir"); + } if (!@copy($ext['file'], $copyto)) { - $this->rollbackFileTransaction(); - return $this->raiseError("failed to copy $bn to $copyto"); + return $this->raiseError("failed to write $copyto", PEAR_INSTALLER_FAILED); } + $this->log(3, "+ cp $ext[file] $copyto"); + if (!OS_WINDOWS) { + $mode = 0666 & ~(int)octdec($this->config->get('umask')); + $this->addFileOperation('chmod', array($mode, $copyto)); + if (!@chmod($copyto, $mode)) { + $this->log(0, "failed to change mode of $copyto"); + } + } + $this->addFileOperation('rename', array($ext['file'], $copyto)); + $pkginfo['filelist'][$bn] = array( - 'role' => 'ext', + 'role' => $role, 'installed_as' => $dest, 'php_api' => $ext['php_api'], 'zend_mod_api' => $ext['zend_mod_api'], http://cvs.php.net/diff.php/php-src/pear/PEAR/Packager.php?r1=1.43.2.12&r2=1.43.2.13&ty=u Index: php-src/pear/PEAR/Packager.php diff -u php-src/pear/PEAR/Packager.php:1.43.2.12 php-src/pear/PEAR/Packager.php:1.43.2.13 --- php-src/pear/PEAR/Packager.php:1.43.2.12 Sun Jan 25 20:26:46 2004 +++ php-src/pear/PEAR/Packager.php Mon Mar 28 11:56:59 2005 @@ -1,7 +1,7 @@ <?php // // +----------------------------------------------------------------------+ -// | PHP Version 4 | +// | PHP Version 5 | // +----------------------------------------------------------------------+ // | Copyright (c) 1997-2004 The PHP Group | // +----------------------------------------------------------------------+ @@ -17,7 +17,7 @@ // | Tomas V.V.Cox <cox@idecnet.com> | // +----------------------------------------------------------------------+ // -// $Id: Packager.php,v 1.43.2.12 2004/01/26 01:26:46 pajoye Exp $ +// $Id: Packager.php,v 1.43.2.13 2005/03/28 16:56:59 cellog Exp $ require_once 'PEAR/Common.php'; require_once 'System.php'; @@ -94,7 +94,7 @@ $filelist[$i++] = $file; if (empty($pkginfo['filelist'][$fname]['md5sum'])) { $md5sum = md5_file($file); - $tpkginfo['filelist'][$fname]['md5sum'] = $md5sum; + $pkginfo['filelist'][$fname]['md5sum'] = $md5sum; } $this->log(2, "Adding file $fname"); } http://cvs.php.net/diff.php/php-src/pear/PEAR/Registry.php?r1=1.35.2.17&r2=1.35.2.18&ty=u Index: php-src/pear/PEAR/Registry.php diff -u php-src/pear/PEAR/Registry.php:1.35.2.17 php-src/pear/PEAR/Registry.php:1.35.2.18 --- php-src/pear/PEAR/Registry.php:1.35.2.17 Sun Jan 25 20:26:46 2004 +++ php-src/pear/PEAR/Registry.php Mon Mar 28 11:56:59 2005 @@ -1,7 +1,7 @@ <?php // // +----------------------------------------------------------------------+ -// | PHP Version 4 | +// | PHP Version 5 | // +----------------------------------------------------------------------+ // | Copyright (c) 1997-2004 The PHP Group | // +----------------------------------------------------------------------+ @@ -18,7 +18,7 @@ // | | // +----------------------------------------------------------------------+ // -// $Id: Registry.php,v 1.35.2.17 2004/01/26 01:26:46 pajoye Exp $ +// $Id: Registry.php,v 1.35.2.18 2005/03/28 16:56:59 cellog Exp $ /* TODO: @@ -286,7 +286,9 @@ $open_mode = 'r'; } - $this->lock_fp = @fopen($this->lockfile, $open_mode); + if (!is_resource($this->lock_fp)) { + $this->lock_fp = @fopen($this->lockfile, $open_mode); + } if (!is_resource($this->lock_fp)) { return $this->raiseError("could not create lock file" . @@ -312,6 +314,9 @@ function _unlock() { $ret = $this->_lock(LOCK_UN); + if (is_resource($this->lock_fp)) { + fclose($this->lock_fp); + } $this->lock_fp = null; return $ret; } http://cvs.php.net/diff.php/php-src/pear/PEAR/Remote.php?r1=1.34.2.14&r2=1.34.2.15&ty=u Index: php-src/pear/PEAR/Remote.php diff -u php-src/pear/PEAR/Remote.php:1.34.2.14 php-src/pear/PEAR/Remote.php:1.34.2.15 --- php-src/pear/PEAR/Remote.php:1.34.2.14 Tue Jun 8 14:04:00 2004 +++ php-src/pear/PEAR/Remote.php Mon Mar 28 11:57:00 2005 @@ -1,7 +1,7 @@ <?php // // +----------------------------------------------------------------------+ -// | PHP Version 4 | +// | PHP Version 5 | // +----------------------------------------------------------------------+ // | Copyright (c) 1997-2004 The PHP Group | // +----------------------------------------------------------------------+ @@ -16,7 +16,7 @@ // | Author: Stig Bakken <ssb@php.net> | // +----------------------------------------------------------------------+ // -// $Id: Remote.php,v 1.34.2.14 2004/06/08 18:04:00 cellog Exp $ +// $Id: Remote.php,v 1.34.2.15 2005/03/28 16:57:00 cellog Exp $ require_once 'PEAR.php'; require_once 'PEAR/Config.php'; http://cvs.php.net/diff.php/php-src/pear/PEAR/Command/Auth.php?r1=1.10.4.12&r2=1.10.4.13&ty=u Index: php-src/pear/PEAR/Command/Auth.php diff -u php-src/pear/PEAR/Command/Auth.php:1.10.4.12 php-src/pear/PEAR/Command/Auth.php:1.10.4.13 --- php-src/pear/PEAR/Command/Auth.php:1.10.4.12 Sun Jan 25 18:19:59 2004 +++ php-src/pear/PEAR/Command/Auth.php Mon Mar 28 11:57:00 2005 @@ -1,7 +1,7 @@ <?php // // +----------------------------------------------------------------------+ -// | PHP Version 4 | +// | PHP Version 5 | // +----------------------------------------------------------------------+ // | Copyright (c) 1997-2004 The PHP Group | // +----------------------------------------------------------------------+ @@ -16,7 +16,7 @@ // | Author: Stig Bakken <ssb@php.net> | // +----------------------------------------------------------------------+ // -// $Id: Auth.php,v 1.10.4.12 2004/01/25 23:19:59 pajoye Exp $ +// $Id: Auth.php,v 1.10.4.13 2005/03/28 16:57:00 cellog Exp $ require_once "PEAR/Command/Common.php"; require_once "PEAR/Remote.php"; @@ -152,4 +152,4 @@ // }}} } -?> +?> \ No newline at end of file http://cvs.php.net/diff.php/php-src/pear/PEAR/Command/Build.php?r1=1.3.4.12&r2=1.3.4.13&ty=u Index: php-src/pear/PEAR/Command/Build.php diff -u php-src/pear/PEAR/Command/Build.php:1.3.4.12 php-src/pear/PEAR/Command/Build.php:1.3.4.13 --- php-src/pear/PEAR/Command/Build.php:1.3.4.12 Sun Jan 25 18:19:59 2004 +++ php-src/pear/PEAR/Command/Build.php Mon Mar 28 11:57:00 2005 @@ -1,7 +1,7 @@ <?php // // +----------------------------------------------------------------------+ -// | PHP Version 4 | +// | PHP Version 5 | // +----------------------------------------------------------------------+ // | Copyright (c) 1997-2004 The PHP Group | // +----------------------------------------------------------------------+ @@ -18,7 +18,7 @@ // | | // +----------------------------------------------------------------------+ // -// $Id: Build.php,v 1.3.4.12 2004/01/25 23:19:59 pajoye Exp $ +// $Id: Build.php,v 1.3.4.13 2005/03/28 16:57:00 cellog Exp $ require_once "PEAR/Command/Common.php"; require_once "PEAR/Builder.php"; http://cvs.php.net/diff.php/php-src/pear/PEAR/Command/Common.php?r1=1.19.2.12&r2=1.19.2.13&ty=u Index: php-src/pear/PEAR/Command/Common.php diff -u php-src/pear/PEAR/Command/Common.php:1.19.2.12 php-src/pear/PEAR/Command/Common.php:1.19.2.13 --- php-src/pear/PEAR/Command/Common.php:1.19.2.12 Sun Jan 25 18:19:59 2004 +++ php-src/pear/PEAR/Command/Common.php Mon Mar 28 11:57:00 2005 @@ -1,7 +1,7 @@ <?php // // +----------------------------------------------------------------------+ -// | PHP Version 4 | +// | PHP Version 5 | // +----------------------------------------------------------------------+ // | Copyright (c) 1997-2004 The PHP Group | // +----------------------------------------------------------------------+ @@ -16,7 +16,7 @@ // | Author: Stig Sæther Bakken <ssb@php.net> | // +----------------------------------------------------------------------+ // -// $Id: Common.php,v 1.19.2.12 2004/01/25 23:19:59 pajoye Exp $ +// $Id: Common.php,v 1.19.2.13 2005/03/28 16:57:00 cellog Exp $ require_once "PEAR.php"; @@ -246,4 +246,4 @@ // }}} } -?> +?> \ No newline at end of file http://cvs.php.net/diff.php/php-src/pear/PEAR/Command/Config.php?r1=1.18.4.14&r2=1.18.4.15&ty=u Index: php-src/pear/PEAR/Command/Config.php diff -u php-src/pear/PEAR/Command/Config.php:1.18.4.14 php-src/pear/PEAR/Command/Config.php:1.18.4.15 --- php-src/pear/PEAR/Command/Config.php:1.18.4.14 Sun Jan 25 18:19:59 2004 +++ php-src/pear/PEAR/Command/Config.php Mon Mar 28 11:57:00 2005 @@ -1,7 +1,7 @@ <?php // // +----------------------------------------------------------------------+ -// | PHP Version 4 | +// | PHP Version 5 | // +----------------------------------------------------------------------+ // | Copyright (c) 1997-2004 The PHP Group | // +----------------------------------------------------------------------+ @@ -18,7 +18,7 @@ // | | // +----------------------------------------------------------------------+ // -// $Id: Config.php,v 1.18.4.14 2004/01/25 23:19:59 pajoye Exp $ +// $Id: Config.php,v 1.18.4.15 2005/03/28 16:57:00 cellog Exp $ require_once "PEAR/Command/Common.php"; require_once "PEAR/Config.php"; @@ -139,9 +139,9 @@ if (sizeof($params) < 1 || sizeof($params) > 2) { return $this->raiseError("config-get expects 1 or 2 parameters"); } elseif (sizeof($params) == 1) { - $this->ui->outputData("$params[0]=" . $this->config->get($params[0]), $command); + $this->ui->outputData($this->config->get($params[0]), $command); } else { - $data = "$params[1].$params[0]=" .$this->config->get($params[0], $params[1]); + $data = $this->config->get($params[0], $params[1]); $this->ui->outputData($data, $command); } return true; http://cvs.php.net/diff.php/php-src/pear/PEAR/Command/Install.php?r1=1.38.2.14&r2=1.38.2.15&ty=u Index: php-src/pear/PEAR/Command/Install.php diff -u php-src/pear/PEAR/Command/Install.php:1.38.2.14 php-src/pear/PEAR/Command/Install.php:1.38.2.15 --- php-src/pear/PEAR/Command/Install.php:1.38.2.14 Sun Jan 25 18:19:59 2004 +++ php-src/pear/PEAR/Command/Install.php Mon Mar 28 11:57:00 2005 @@ -1,7 +1,7 @@ <?php // // +----------------------------------------------------------------------+ -// | PHP Version 4 | +// | PHP Version 5 | // +----------------------------------------------------------------------+ // | Copyright (c) 1997-2004 The PHP Group | // +----------------------------------------------------------------------+ @@ -16,7 +16,7 @@ // | Author: Stig Sæther Bakken <ssb@php.net> | // +----------------------------------------------------------------------+ // -// $Id: Install.php,v 1.38.2.14 2004/01/25 23:19:59 pajoye Exp $ +// $Id: Install.php,v 1.38.2.15 2005/03/28 16:57:00 cellog Exp $ require_once "PEAR/Command/Common.php"; require_once "PEAR/Installer.php"; @@ -303,8 +303,13 @@ $downloaded = $this->downloader->getDownloadedPackages(); $this->installer->sortPkgDeps($downloaded); foreach ($downloaded as $pkg) { - $bn = basename($pkg['file']); + PEAR::pushErrorHandling(PEAR_ERROR_RETURN); $info = $this->installer->install($pkg['file'], $options, $this->config); + PEAR::popErrorHandling(); + if (PEAR::isError($info)) { + $this->ui->outputData('ERROR: ' .$info->getMessage()); + continue; + } if (is_array($info)) { if ($this->config->get('verbose') > 0) { $label = "$info[package] $info[version]"; http://cvs.php.net/diff.php/php-src/pear/PEAR/Command/Mirror.php?r1=1.2.2.4&r2=1.2.2.5&ty=u Index: php-src/pear/PEAR/Command/Mirror.php diff -u php-src/pear/PEAR/Command/Mirror.php:1.2.2.4 php-src/pear/PEAR/Command/Mirror.php:1.2.2.5 --- php-src/pear/PEAR/Command/Mirror.php:1.2.2.4 Sun Jan 25 18:19:59 2004 +++ php-src/pear/PEAR/Command/Mirror.php Mon Mar 28 11:57:00 2005 @@ -1,7 +1,7 @@ <?php // // +----------------------------------------------------------------------+ -// | PHP Version 4 | +// | PHP Version 5 | // +----------------------------------------------------------------------+ // | Copyright (c) 1997-2004 The PHP Group | // +----------------------------------------------------------------------+ @@ -17,7 +17,7 @@ // | | // +----------------------------------------------------------------------+ // -// $Id: Mirror.php,v 1.2.2.4 2004/01/25 23:19:59 pajoye Exp $ +// $Id: Mirror.php,v 1.2.2.5 2005/03/28 16:57:00 cellog Exp $ require_once "PEAR/Command/Common.php"; require_once "PEAR/Command.php"; @@ -34,13 +34,13 @@ var $commands = array( 'download-all' => array( - 'summary' => 'Downloads each avaible Package from master_server', + 'summary' => 'Downloads each available package from master_server', 'function' => 'doDownloadAll', 'shortcut' => 'da', 'options' => array(), 'doc' => ' - Request a list of avaible Packages from the Package-Server - (master_server) and downloads them to current working dir' + Requests a list of available packages from the package server + (master_server) and downloads them to current working directory' ), ); @@ -76,21 +76,23 @@ */ function doDownloadAll($command, $options, $params) { - $this->config->set("php_dir", "."); - $remote = &new PEAR_Remote($this->config); - $remoteInfo = $remote->call("package.listAll"); - if(PEAR::isError($remoteInfo)) { - return $remoteInfo; - } - $cmd = &PEAR_Command::factory("download", $this->config); - if(PEAR::isError($cmd)) { - return $cmd; - } - foreach($remoteInfo as $pkgn=>$pkg) { - // error handling not neccesary, because - // already done by the download command - $cmd->run("download", array(), array($pkgn)); - } + $this->config->set("php_dir", "."); + $remote = &new PEAR_Remote($this->config); + $remoteInfo = $remote->call("package.listAll"); + if (PEAR::isError($remoteInfo)) { + return $remoteInfo; + } + $cmd = &PEAR_Command::factory("download", $this->config); + if (PEAR::isError($cmd)) { + return $cmd; + } + foreach ($remoteInfo as $pkgn => $pkg) { + /** + * Error handling not neccesary, because already done by + * the download command + */ + $cmd->run("download", array(), array($pkgn)); + } return true; } http://cvs.php.net/diff.php/php-src/pear/PEAR/Command/Package.php?r1=1.42.2.17&r2=1.42.2.18&ty=u Index: php-src/pear/PEAR/Command/Package.php diff -u php-src/pear/PEAR/Command/Package.php:1.42.2.17 php-src/pear/PEAR/Command/Package.php:1.42.2.18 --- php-src/pear/PEAR/Command/Package.php:1.42.2.17 Tue Jun 8 14:26:32 2004 +++ php-src/pear/PEAR/Command/Package.php Mon Mar 28 11:57:00 2005 @@ -1,7 +1,7 @@ <?php // // +----------------------------------------------------------------------+ -// | PHP Version 4 | +// | PHP Version 5 | // +----------------------------------------------------------------------+ // | Copyright (c) 1997-2004 The PHP Group | // +----------------------------------------------------------------------+ @@ -15,9 +15,10 @@ // +----------------------------------------------------------------------+ // | Authors: Stig Bakken <ssb@php.net> | // | Martin Jansen <mj@php.net> | +// | Greg Beaver <cellog@php.net> | // +----------------------------------------------------------------------+ // -// $Id: Package.php,v 1.42.2.17 2004/06/08 18:26:32 cellog Exp $ +// $Id: Package.php,v 1.42.2.18 2005/03/28 16:57:00 cellog Exp $ require_once 'PEAR/Common.php'; require_once 'PEAR/Command/Common.php'; @@ -155,7 +156,21 @@ 'summary' => 'Run Regression Tests', 'function' => 'doRunTests', 'shortcut' => 'rt', - 'options' => array(), + 'options' => array( + 'recur' => array( + 'shortopt' => 'r', + 'doc' => 'Run tests in child directories, recursively. 4 dirs deep maximum', + ), + 'ini' => array( + 'shortopt' => 'i', + 'doc' => 'actual string of settings to pass to php in format " -d setting=blah"', + 'arg' => 'SETTINGS' + ), + 'realtimelog' => array( + 'shortopt' => 'l', + 'doc' => 'Log test runs/results as they are run', + ), + ), 'doc' => '[testfile|dir ...] Run regression tests with PHP\'s regression testing script (run-tests.php).', ), @@ -250,6 +265,9 @@ { $this->output = ''; include_once 'PEAR/Packager.php'; + if (sizeof($params) < 1) { + $params[0] = "package.xml"; + } $pkginfofile = isset($params[0]) ? $params[0] : 'package.xml'; $packager =& new PEAR_Packager(); $err = $warn = array(); @@ -264,12 +282,6 @@ if (isset($options['showname'])) { $this->output = $result; } - /* (cox) What is supposed to do that code? - $lines = explode("\n", $this->output); - foreach ($lines as $line) { - $this->output .= $line."n"; - } - */ if (PEAR::isError($result)) { $this->output .= "Package failed: ".$result->getMessage(); } @@ -434,34 +446,118 @@ function doRunTests($command, $options, $params) { - $cwd = getcwd(); - $php = $this->config->get('php_bin'); - putenv("TEST_PHP_EXECUTABLE=$php"); - // all core PEAR tests use this constant to determine whether they should be run or not - putenv("PHP_PEAR_RUNTESTS=1"); - $ip = ini_get("include_path"); - $ps = OS_WINDOWS ? ';' : ':'; - $run_tests = $rtsts = $this->config->get('php_dir') . DIRECTORY_SEPARATOR . 'run-tests.php'; - if (!file_exists($run_tests)) { - $run_tests = PEAR_INSTALL_DIR . DIRECTORY_SEPARATOR . 'run-tests.php'; - if (!file_exists($run_tests)) { - return $this->raiseError("No run-tests.php file found. Please copy this ". - "file from the sources of your PHP distribution to $rtsts"); - } - } - if (OS_WINDOWS) { - // note, this requires a slightly modified version of run-tests.php - // for some setups - // unofficial download location is in the pear-dev archives - $argv = $params; - array_unshift($argv, $run_tests); - $argc = count($argv); - include $run_tests; + include_once 'PEAR/RunTest.php'; + $log = new PEAR_Common; + $log->ui = &$this->ui; // slightly hacky, but it will work + $run = new PEAR_RunTest($log); + $tests = array(); + if (isset($options['recur'])) { + $depth = 4; } else { - $plist = implode(' ', $params); - $cmd = "$php -d include_path=$cwd$ps$ip -f $run_tests -- $plist"; - system($cmd); + $depth = 1; + } + if (!count($params)) { + $params[] = '.'; + } + foreach ($params as $p) { + if (is_dir($p)) { + $dir = System::find(array($p, '-type', 'f', + '-maxdepth', $depth, + '-name', '*.phpt')); + $tests = array_merge($tests, $dir); + } else { + if (!@file_exists($p)) { + if (!preg_match('/\.phpt$/', $p)) { + $p .= '.phpt'; + } + $dir = System::find(array(dirname($p), '-type', 'f', + '-maxdepth', $depth, + '-name', $p)); + $tests = array_merge($tests, $dir); + } else { + $tests[] = $p; + } + } } + $ini_settings = ''; + if (isset($options['ini'])) { + $ini_settings .= $options['ini']; + } + if (isset($_ENV['TEST_PHP_INCLUDE_PATH'])) { + $ini_settings .= " -d include_path={$_ENV['TEST_PHP_INCLUDE_PATH']}"; + } + if ($ini_settings) { + $this->ui->outputData('Using INI settings: "' . $ini_settings . '"'); + } + $skipped = $passed = $failed = array(); + $this->ui->outputData('Running ' . count($tests) . ' tests', $command); + $start = time(); + if (isset($options['realtimelog'])) { + @unlink('run-tests.log'); + } + foreach ($tests as $t) { + if (isset($options['realtimelog'])) { + $fp = @fopen('run-tests.log', 'a'); + if ($fp) { + fwrite($fp, "Running test $t..."); + fclose($fp); + } + } + $result = $run->run($t, $ini_settings); + if (OS_WINDOWS) { + for($i=0;$i<2000;$i++) { + $i = $i; // delay - race conditions on windows + } + } + if (isset($options['realtimelog'])) { + $fp = @fopen('run-tests.log', 'a'); + if ($fp) { + fwrite($fp, "$result\n"); + fclose($fp); + } + } + if ($result == 'FAILED') { + $failed[] = $t; + } + if ($result == 'PASSED') { + $passed[] = $t; + } + if ($result == 'SKIPPED') { + $skipped[] = $t; + } + } + $total = date('i:s', time() - $start); + if (count($failed)) { + $output = "TOTAL TIME: $total\n"; + $output .= count($passed) . " PASSED TESTS\n"; + $output .= count($skipped) . " SKIPPED TESTS\n"; + $output .= count($failed) . " FAILED TESTS:\n"; + foreach ($failed as $failure) { + $output .= $failure . "\n"; + } + if (isset($options['realtimelog'])) { + $fp = @fopen('run-tests.log', 'a'); + } else { + $fp = @fopen('run-tests.log', 'w'); + } + if ($fp) { + fwrite($fp, $output, strlen($output)); + fclose($fp); + $this->ui->outputData('wrote log to "' . realpath('run-tests.log') . '"', $command); + } + } elseif (@file_exists('run-tests.log') && !@is_dir('run-tests.log')) { + @unlink('run-tests.log'); + } + $this->ui->outputData('TOTAL TIME: ' . $total); + $this->ui->outputData(count($passed) . ' PASSED TESTS', $command); + $this->ui->outputData(count($skipped) . ' SKIPPED TESTS', $command); + if (count($failed)) { + $this->ui->outputData(count($failed) . ' FAILED TESTS:', $command); + foreach ($failed as $failure) { + $this->ui->outputData($failure, $command); + } + } + return true; } @@ -642,6 +738,7 @@ if (!isset($attr['role'])) { continue; } + $name = preg_replace('![/:\\\\]!', '/', $name); if ($attr['role'] == 'doc') { $info['doc_files'] .= " $name"; http://cvs.php.net/diff.php/php-src/pear/PEAR/Command/Registry.php?r1=1.24.4.13&r2=1.24.4.14&ty=u Index: php-src/pear/PEAR/Command/Registry.php diff -u php-src/pear/PEAR/Command/Registry.php:1.24.4.13 php-src/pear/PEAR/Command/Registry.php:1.24.4.14 --- php-src/pear/PEAR/Command/Registry.php:1.24.4.13 Mon Oct 20 11:51:45 2003 +++ php-src/pear/PEAR/Command/Registry.php Mon Mar 28 11:57:00 2005 @@ -1,9 +1,9 @@ <?php // /* vim: set expandtab tabstop=4 shiftwidth=4: */ // +----------------------------------------------------------------------+ -// | PHP Version 4 | +// | PHP Version 5 | // +----------------------------------------------------------------------+ -// | Copyright (c) 1997-2003 The PHP Group | +// | Copyright (c) 1997-2004 The PHP Group | // +----------------------------------------------------------------------+ // | This source file is subject to version 3.0 of the PHP license, | // | that is bundled with this package in the file LICENSE, and is | @@ -17,7 +17,7 @@ // | | // +----------------------------------------------------------------------+ // -// $Id: Registry.php,v 1.24.4.13 2003/10/20 15:51:45 cox Exp $ +// $Id: Registry.php,v 1.24.4.14 2005/03/28 16:57:00 cellog Exp $ require_once 'PEAR/Command/Common.php'; require_once 'PEAR/Registry.php'; http://cvs.php.net/diff.php/php-src/pear/PEAR/Command/Remote.php?r1=1.22.2.17&r2=1.22.2.18&ty=u Index: php-src/pear/PEAR/Command/Remote.php diff -u php-src/pear/PEAR/Command/Remote.php:1.22.2.17 php-src/pear/PEAR/Command/Remote.php:1.22.2.18 --- php-src/pear/PEAR/Command/Remote.php:1.22.2.17 Sat Apr 3 10:56:11 2004 +++ php-src/pear/PEAR/Command/Remote.php Mon Mar 28 11:57:00 2005 @@ -1,7 +1,7 @@ <?php // /* vim: set expandtab tabstop=4 shiftwidth=4: */ // +----------------------------------------------------------------------+ -// | PHP Version 4 | +// | PHP Version 5 | // +----------------------------------------------------------------------+ // | Copyright (c) 1997-2004 The PHP Group | // +----------------------------------------------------------------------+ @@ -17,7 +17,7 @@ // | | // +----------------------------------------------------------------------+ // -// $Id: Remote.php,v 1.22.2.17 2004/04/03 15:56:11 cellog Exp $ +// $Id: Remote.php,v 1.22.2.18 2005/03/28 16:57:00 cellog Exp $ require_once 'PEAR/Command/Common.php'; require_once 'PEAR/Common.php'; http://cvs.php.net/diff.php/php-src/pear/PEAR/Frontend/CLI.php?r1=1.25.2.15&r2=1.25.2.16&ty=u Index: php-src/pear/PEAR/Frontend/CLI.php diff -u php-src/pear/PEAR/Frontend/CLI.php:1.25.2.15 php-src/pear/PEAR/Frontend/CLI.php:1.25.2.16 --- php-src/pear/PEAR/Frontend/CLI.php:1.25.2.15 Sun Jan 25 20:26:47 2004 +++ php-src/pear/PEAR/Frontend/CLI.php Mon Mar 28 11:57:01 2005 @@ -1,7 +1,7 @@ <?php /* +----------------------------------------------------------------------+ - | PHP Version 4 | + | PHP Version 5 | +----------------------------------------------------------------------+ | Copyright (c) 1997-2004 The PHP Group | +----------------------------------------------------------------------+ @@ -16,7 +16,7 @@ | Author: Stig Sæther Bakken <ssb@php.net> | +----------------------------------------------------------------------+ - $Id: CLI.php,v 1.25.2.15 2004/01/26 01:26:47 pajoye Exp $ + $Id: CLI.php,v 1.25.2.16 2005/03/28 16:57:01 cellog Exp $ */ require_once "PEAR.php"; @@ -47,7 +47,9 @@ { parent::PEAR(); $term = getenv('TERM'); //(cox) $_ENV is empty for me in 4.1.1 - if ($term) { + if (function_exists('posix_isatty') && !posix_isatty(1)) { + // output is being redirected to a file or through a pipe + } elseif ($term) { // XXX can use ncurses extension here, if available if (preg_match('/^(xterm|vt220|linux)/', $term)) { $this->term['bold'] = sprintf("%c%c%c%c", 27, 91, 49, 109); @@ -219,7 +221,7 @@ for ($i = 0; $i < sizeof($columns); $i++) { $col = &$columns[$i]; if (isset($colparams[$i]) && !empty($colparams[$i]['wrap'])) { - $col = wordwrap($col, $colparams[$i]['wrap'], "\n", 1); + $col = wordwrap($col, $colparams[$i]['wrap'], "\n", 0); } if (strpos($col, "\n") !== false) { $multiline = explode("\n", $col); @@ -349,6 +351,9 @@ $rowtext .= $cellstart . $cell . $cellend; } + if (!$border) { + $rowtext = rtrim($rowtext); + } $rowtext .= $rowend; $this->_displayLine($rowtext); } http://cvs.php.net/diff.php/php-src/pear/scripts/pearcmd.php?r1=1.1.2.13&r2=1.1.2.14&ty=u Index: php-src/pear/scripts/pearcmd.php diff -u php-src/pear/scripts/pearcmd.php:1.1.2.13 php-src/pear/scripts/pearcmd.php:1.1.2.14 --- php-src/pear/scripts/pearcmd.php:1.1.2.13 Tue Jun 8 13:56:45 2004 +++ php-src/pear/scripts/pearcmd.php Mon Mar 28 11:57:01 2005 @@ -1,7 +1,7 @@ <?php // // +----------------------------------------------------------------------+ -// | PHP Version 4 | +// | PHP Version 5 | // +----------------------------------------------------------------------+ // | Copyright (c) 1997-2004 The PHP Group | // +----------------------------------------------------------------------+ @@ -18,7 +18,7 @@ // | | // +----------------------------------------------------------------------+ // -// $Id: pearcmd.php,v 1.1.2.13 2004/06/08 17:56:45 cellog Exp $ +// $Id: pearcmd.php,v 1.1.2.14 2005/03/28 16:57:01 cellog Exp $ ob_end_clean(); /** @@ -29,7 +29,7 @@ } ini_set('allow_url_fopen', true); if (!ini_get('safe_mode')) { - set_time_limit(0); + @set_time_limit(0); } ob_implicit_flush(true); ini_set('track_errors', true); @@ -75,6 +75,11 @@ PEAR_Command::setFrontendType($fetype); $ui = &PEAR_Command::getFrontendObject(); PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array($ui, "displayFatalError")); +if (ini_get('safe_mode')) { + $ui->outputData('WARNING: running in safe mode requires that all files created ' . + 'be the same uid as the current script. PHP reports this script is uid: ' . + @getmyuid() . ', and current user is: ' . @get_current_user()); +} $pear_user_config = ''; $pear_system_config = ''; @@ -212,9 +217,6 @@ $put = cmdHelp($helpsubject); } else { $put = - "Usage: $progname [options] command [command-options] <parameters>\n". - "Type \"$progname help options\" to list all options.\n". - "Type \"$progname help <command>\" to get the help for the specified command.\n". "Commands:\n"; $maxlen = max(array_map("strlen", $all_commands)); $formatstr = "%-{$maxlen}s %s\n"; @@ -222,6 +224,11 @@ foreach ($all_commands as $cmd => $class) { $put .= sprintf($formatstr, $cmd, PEAR_Command::getDescription($cmd)); } + $put .= + "Usage: $progname [options] command [command-options] <parameters>\n". + "Type \"$progname help options\" to list all options.\n". + "Type \"$progname help shortcuts\" to list all command shortcuts.\n". + "Type \"$progname help <command>\" to get the help for the specified command."; } fputs($stderr, "$put\n"); fclose($stderr); http://cvs.php.net/co.php/php-src/pear/PEAR/Exception.php?r=1.1&p=1 Index: php-src/pear/PEAR/Exception.php +++ php-src/pear/PEAR/Exception.php <?php /* vim: set expandtab tabstop=4 shiftwidth=4 foldmethod=marker: */ // +----------------------------------------------------------------------+ // | PEAR_Exception | // +----------------------------------------------------------------------+ // | Copyright (c) 2004 The PEAR Group | // +----------------------------------------------------------------------+ // | This source file is subject to version 3.0 of the PHP license, | // | that is bundled with this package in the file LICENSE, and is | // | available at through the world-wide-web at | // | http://www.php.net/license/3_0.txt. | // | If you did not receive a copy of the PHP license and are unable to | // | obtain it through the world-wide-web, please send a note to | // | license@php.net so we can mail you a copy immediately. | // +----------------------------------------------------------------------+ // | Authors: Tomas V.V.Cox <cox@idecnet.com> | // | Hans Lellelid <hans@velum.net> | // +----------------------------------------------------------------------+ // // $Id: Exception.php,v 1.1 2004/06/20 19:08:37 cox Exp $ define('PEAR_OBSERVER_PRINT', -2); define('PEAR_OBSERVER_TRIGGER', -4); define('PEAR_OBSERVER_DIE', -8); /** * Base PEAR_Exception Class * * Features: * * - Nestable exceptions (throw new PEAR_Exception($msg, $prev_exception)) * - Definable triggers, shot when exceptions occur * - Pretty and informative error messages * - Added more context info avaible (like class, method or cause) * * Ideas: * * - Maybe a way to define a 'template' for the output * * 1) Inherited properties from PHP Exception Class: * * protected $message * protected $code * protected $line * protected $file * private $trace * * 2) Inherited methods from PHP Exception Class: * * __clone * __construct * getMessage * getCode * getFile * getLine * getTrace * getTraceAsString * __toString * * 3) Usage example * * <code> * require_once 'PEAR/Exception.php'; * * class Test { * function foo() { * throw new PEAR_Exception('Error Message', ERROR_CODE); * } * } * * function myLogger($pear_exception) { * echo $pear_exception->getMessage(); * } * // each time a exception is thrown the 'myLogger' will be called * // (its use is completely optional) * PEAR_Exception::addObserver('mylogger', 'myLogger'); * $test = new Test; * try { * $test->foo(); * } catch (PEAR_Exception $e) { * print $e; * } * </code> * * @since PHP 5 * @package PEAR * @version $Rev:$ * @author Tomas V.V.Cox <cox@idecnet.com> * @author Hans Lellelid <hans@velum.net> * */ class PEAR_Exception extends Exception { protected $cause; protected $error_class; protected $error_method; private $method; private static $_observers = array(); /** * Supported signatures: * PEAR_Exception(string $message); * PEAR_Exception(string $message, int $code); * PEAR_Exception(string $message, Exception $cause); * PEAR_Exception(string $message, Exception $cause, int $code); */ public function __construct($message, $p2 = null, $p3 = null) { $code = null; $cause = null; if (is_int($p3) && $p2 instanceof Exception) { $code = $p3; $cause = $p2; } elseif (is_int($p2)) { $code = $p2; } elseif ($p2 instanceof Exception) { $cause = $p2; } $this->cause = $cause; $trace = parent::getTrace(); $this->error_class = $trace[0]['class']; $this->error_method = $trace[0]['function']; $this->method = $this->error_class.'::'.$this->error_method.'()'; parent::__construct($message, $code); $this->signal(); } public static function addObserver($label, $callback) { self::$_observers[$label] = $callback; } public static function delObserver($label) { unset(self::$_observers[$label]); } private function signal() { foreach (self::$_observers as $func) { if (is_callable($func)) { call_user_func($func, $this); continue; } settype($func, 'array'); switch ($func[0]) { case PEAR_OBSERVER_PRINT: $f = (isset($func[1])) ? $func[1] : '%s'; printf($f, $this->getMessage()); break; case PEAR_OBSERVER_TRIGGER: $f = (isset($func[1])) ? $func[1] : E_USER_NOTICE; trigger_error($this->getMessage(), $f); break; case PEAR_OBSERVER_DIE: $f = (isset($func[1])) ? $func[1] : '%s'; die(printf($f, $this->getMessage())); break; default: trigger_error('invalid observer type', E_USER_WARNING); } } } public function getCauseMessage($obj) { $msg = ' ' . $obj->method . " at {$obj->file} ({$obj->line})\n"; if ($obj->cause instanceof Exception) { return $msg.$obj->getCauseMessage($obj->cause); } return $msg; } /** * @return Exception_object The context of the exception */ public function getCause() { return $this->cause; } public function getErrorClass() { return $this->error_class; } public function getErrorMethod() { return $this->error_method; } public function __toString() { $str = get_class($this) . " occurred: \n" . ' Error message: ' . $this->message . "\n" . ' Error code : ' . $this->code . "\n" . ' File (Line) : ' . "{$this->file} ({$this->line})\n" . ' Method : ' . $this->method . "\n"; if ($this->cause instanceof Exception) { $str .= " Nested Error : \n".$this->getCauseMessage($this); } if (isset($_SERVER['REQUEST_URI'])) { return nl2br('<pre>'.htmlentities($str).'</pre>'); } return $str; } } ?> http://cvs.php.net/co.php/php-src/pear/PEAR/RunTest.php?r=1.1&p=1 Index: php-src/pear/PEAR/RunTest.php +++ php-src/pear/PEAR/RunTest.php
« previous php.cvs (#31142) next »