pax_global_header00006660000000000000000000000064126261467570014532gustar00rootroot0000000000000052 comment=914c8719c02cf7f4ae12cea1ee35bd5157e28859 php-pear-1.10.1+submodules+notgz/000077500000000000000000000000001262614675700166415ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/.gitignore000066400000000000000000000001241262614675700206260ustar00rootroot00000000000000go-pear-tarballs/ go-pear.phar /README.html /install-pear-nozlib.phar /*.tgz /dist/ php-pear-1.10.1+submodules+notgz/.gitmodules000066400000000000000000000007131262614675700210170ustar00rootroot00000000000000[submodule "submodules/Archive_Tar"] path = submodules/Archive_Tar url = https://github.com/pear/Archive_Tar [submodule "submodules/Console_Getopt"] path = submodules/Console_Getopt url = https://github.com/pear/Console_Getopt [submodule "submodules/Structures_Graph"] path = submodules/Structures_Graph url = https://github.com/pear/Structures_Graph [submodule "submodules/XML_Util"] path = submodules/XML_Util url = https://github.com/pear/XML_Util php-pear-1.10.1+submodules+notgz/.travis.yml000066400000000000000000000005411262614675700207520ustar00rootroot00000000000000language: php sudo: false php: - 7 - 5.6 - 5.5 - 5.4 install: - pear upgrade console_getopt archive_tar - pear install text_diff - sh scripts/pear.sh config-set umask 0022 - sh scripts/pear.sh config-set umask 0022 system script: - umask 0022 - sh scripts/pear.sh run-tests -q -d -r tests - sh scripts/pear.sh package package2.xml php-pear-1.10.1+submodules+notgz/CODING_STANDARDS000066400000000000000000000005051262614675700211320ustar00rootroot00000000000000=========================================================================== | PEAR Coding Standards | =========================================================================== This document is no longer maintained, see http://pear.php.net/manual/en/standards.php instead. php-pear-1.10.1+submodules+notgz/INSTALL000066400000000000000000000041701262614675700176740ustar00rootroot00000000000000PEAR - The PEAR Installer ========================= Installing the PEAR Installer. You should install PEAR on a local development machine first. Installing PEAR on a remote production machine should only be done after you are familiar with PEAR and have tested code using PEAR on your development machine. There are two methods of installing PEAR - PEAR bundled in PHP - go-pear We will first examine how to install PEAR that is bundled with PHP. Microsoft Windows ================= If you are running PHP 5.2.0 or newer, simply download and run the windows installer (.msi) and PEAR can be automatically installed. Otherwise, for older PHP versions, download the .zip of windows, there is a script included with your PHP distribution that is called "go-pear". You must open a command box in order to run it. Click "start" then click "Run..." and type "cmd.exe" to open a command box. Use "cd" to change directory to the location of PHP where you unzipped it, and run the go-pear command. Unix ==== When compiling PHP from source, you simply need to include the --with-pear directive on the "./configure" command. This is "on" by default in most PHP versions, but it doesn't hurt to list it explicitly. You should also consider enabling the zlib extension via --enable-zlib, so that the PEAR installer will be able to handle gzipped files (i.e. smaller package files for faster downloads). Later, when you run "make install" to install PHP itself, part of the process will be prompts that ask you where you want PEAR to be installed. go-pear ======= For users who cannot perform the above steps, or who wish to obtain the latest PEAR with a slightly higher risk of failure, use go-pear. go-pear is obtained by downloading http://pear.php.net/go-pear and saving it as go-pear.php. After downloading, simply run "php go-pear.php" or open it in a web browser (windows only) to download and install PEAR. You can always ask general installation questions on pear-general@lists.php.net, a public mailing list devoted to support for PEAR packages and installation- related issues. Happy PHPing, we hope PEAR will be a great tool for your development work! php-pear-1.10.1+submodules+notgz/LICENSE000066400000000000000000000027051262614675700176520ustar00rootroot00000000000000Copyright (c) 1997-2009, Stig Bakken , Gregory Beaver , Helgi Þormar Þorbjörnsson , Tomas V.V.Cox , Martin Jansen . All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. php-pear-1.10.1+submodules+notgz/Makefile.frag000066400000000000000000000014161262614675700212210ustar00rootroot00000000000000# -*- makefile -*- peardir=$(PEAR_INSTALLDIR) # Skip all php.ini files altogether PEAR_INSTALL_FLAGS = -n -dshort_open_tag=0 -dsafe_mode=0 install-pear-installer: $(top_builddir)/sapi/cli/php @$(top_builddir)/sapi/cli/php $(PEAR_INSTALL_FLAGS) $(srcdir)/install-pear.php -d "$(peardir)" -b "$(bindir)" $(srcdir)/package-*.xml install-pear-packages: $(top_builddir)/sapi/cli/php @$(top_builddir)/sapi/cli/php $(PEAR_INSTALL_FLAGS) $(srcdir)/install-pear.php -d "$(peardir)" -b "$(bindir)" $(srcdir)/packages/*.tar install-pear: @echo "Installing PEAR environment: $(INSTALL_ROOT)$(peardir)/" @if $(mkinstalldirs) $(INSTALL_ROOT)$(peardir); then \ $(MAKE) -s install-pear-installer install-pear-packages; \ else \ cat $(srcdir)/install-pear.txt; \ exit 5; \ fi php-pear-1.10.1+submodules+notgz/OS/000077500000000000000000000000001262614675700171625ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/OS/Guess.php000066400000000000000000000245451262614675700207730ustar00rootroot00000000000000 * @author Gregory Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @link http://pear.php.net/package/PEAR * @since File available since PEAR 0.1 */ // {{{ uname examples // php_uname() without args returns the same as 'uname -a', or a PHP-custom // string for Windows. // PHP versions prior to 4.3 return the uname of the host where PHP was built, // as of 4.3 it returns the uname of the host running the PHP code. // // PC RedHat Linux 7.1: // Linux host.example.com 2.4.2-2 #1 Sun Apr 8 20:41:30 EDT 2001 i686 unknown // // PC Debian Potato: // Linux host 2.4.17 #2 SMP Tue Feb 12 15:10:04 CET 2002 i686 unknown // // PC FreeBSD 3.3: // FreeBSD host.example.com 3.3-STABLE FreeBSD 3.3-STABLE #0: Mon Feb 21 00:42:31 CET 2000 root@example.com:/usr/src/sys/compile/CONFIG i386 // // PC FreeBSD 4.3: // FreeBSD host.example.com 4.3-RELEASE FreeBSD 4.3-RELEASE #1: Mon Jun 25 11:19:43 EDT 2001 root@example.com:/usr/src/sys/compile/CONFIG i386 // // PC FreeBSD 4.5: // FreeBSD host.example.com 4.5-STABLE FreeBSD 4.5-STABLE #0: Wed Feb 6 23:59:23 CET 2002 root@example.com:/usr/src/sys/compile/CONFIG i386 // // PC FreeBSD 4.5 w/uname from GNU shellutils: // FreeBSD host.example.com 4.5-STABLE FreeBSD 4.5-STABLE #0: Wed Feb i386 unknown // // HP 9000/712 HP-UX 10: // HP-UX iq B.10.10 A 9000/712 2008429113 two-user license // // HP 9000/712 HP-UX 10 w/uname from GNU shellutils: // HP-UX host B.10.10 A 9000/712 unknown // // IBM RS6000/550 AIX 4.3: // AIX host 3 4 000003531C00 // // AIX 4.3 w/uname from GNU shellutils: // AIX host 3 4 000003531C00 unknown // // SGI Onyx IRIX 6.5 w/uname from GNU shellutils: // IRIX64 host 6.5 01091820 IP19 mips // // SGI Onyx IRIX 6.5: // IRIX64 host 6.5 01091820 IP19 // // SparcStation 20 Solaris 8 w/uname from GNU shellutils: // SunOS host.example.com 5.8 Generic_108528-12 sun4m sparc // // 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 // // }}} /* TODO: * - define endianness, to allow matchSignature("bigend") etc. */ /** * Retrieves information about the current operating system * * This class uses php_uname() to grok information about the current OS * * @category pear * @package PEAR * @author Stig Bakken * @author Gregory Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version Release: @package_version@ * @link http://pear.php.net/package/PEAR * @since Class available since Release 0.1 */ class OS_Guess { var $sysname; var $nodename; var $cpu; var $release; var $extra; function __construct($uname = null) { list($this->sysname, $this->release, $this->cpu, $this->extra, $this->nodename) = $this->parseSignature($uname); } function parseSignature($uname = null) { static $sysmap = array( 'HP-UX' => 'hpux', 'IRIX64' => 'irix', ); static $cpumap = array( 'i586' => 'i386', 'i686' => 'i386', 'ppc' => 'powerpc', ); if ($uname === null) { $uname = php_uname(); } $parts = preg_split('/\s+/', trim($uname)); $n = count($parts); $release = $machine = $cpu = ''; $sysname = $parts[0]; $nodename = $parts[1]; $cpu = $parts[$n-1]; $extra = ''; if ($cpu == 'unknown') { $cpu = $parts[$n - 2]; } switch ($sysname) { case 'AIX' : $release = "$parts[3].$parts[2]"; break; case 'Windows' : switch ($parts[1]) { case '95/98': $release = '9x'; break; default: $release = $parts[1]; break; } $cpu = 'i386'; break; case 'Linux' : $extra = $this->_detectGlibcVersion(); // use only the first two digits from the kernel version $release = preg_replace('/^([0-9]+\.[0-9]+).*/', '\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 = preg_replace('/^([0-9]+\.[0-9]+).*/', '\1', $parts[2]); break; default: $release = preg_replace('/-.*/', '', $parts[2]); break; } if (isset($sysmap[$sysname])) { $sysname = $sysmap[$sysname]; } else { $sysname = strtolower($sysname); } if (isset($cpumap[$cpu])) { $cpu = $cpumap[$cpu]; } return array($sysname, $release, $cpu, $extra, $nodename); } function _detectGlibcVersion() { static $glibc = false; if ($glibc !== false) { return $glibc; // no need to run this multiple times } $major = $minor = 0; include_once "System.php"; // Use glibc's header file to // get major and minor version number: if (@file_exists('/usr/include/features.h') && @is_readable('/usr/include/features.h')) { if (!@file_exists('/usr/bin/cpp') || !@is_executable('/usr/bin/cpp')) { $features_file = fopen('/usr/include/features.h', 'rb'); while (!feof($features_file)) { $line = fgets($features_file, 8192); if (!$line || (strpos($line, '#define') === false)) { continue; } if (strpos($line, '__GLIBC__')) { // major version number #define __GLIBC__ version $line = preg_split('/\s+/', $line); $glibc_major = trim($line[2]); if (isset($glibc_minor)) { break; } continue; } if (strpos($line, '__GLIBC_MINOR__')) { // got the minor version number // #define __GLIBC_MINOR__ version $line = preg_split('/\s+/', $line); $glibc_minor = trim($line[2]); if (isset($glibc_major)) { break; } continue; } } fclose($features_file); if (!isset($glibc_major) || !isset($glibc_minor)) { return $glibc = ''; } return $glibc = 'glibc' . trim($glibc_major) . "." . trim($glibc_minor) ; } // no cpp $tmpfile = System::mktemp("glibctest"); $fp = fopen($tmpfile, "w"); fwrite($fp, "#include \n__GLIBC__ __GLIBC_MINOR__\n"); fclose($fp); $cpp = popen("/usr/bin/cpp $tmpfile", "r"); while ($line = fgets($cpp, 1024)) { if ($line{0} == '#' || trim($line) == '') { continue; } if (list($major, $minor) = explode(' ', trim($line))) { break; } } pclose($cpp); unlink($tmpfile); } // features.h if (!($major && $minor) && @is_link('/lib/libc.so.6')) { // Let's try reading the libc.so.6 symlink if (preg_match('/^libc-(.*)\.so$/', basename(readlink('/lib/libc.so.6')), $matches)) { list($major, $minor) = explode('.', $matches[1]); } } if (!($major && $minor)) { return $glibc = ''; } return $glibc = "glibc{$major}.{$minor}"; } function getSignature() { if (empty($this->extra)) { return "{$this->sysname}-{$this->release}-{$this->cpu}"; } return "{$this->sysname}-{$this->release}-{$this->cpu}-{$this->extra}"; } function getSysname() { return $this->sysname; } function getNodename() { return $this->nodename; } function getCpu() { return $this->cpu; } function getRelease() { return $this->release; } function getExtra() { return $this->extra; } function matchSignature($match) { $fragments = is_array($match) ? $match : explode('-', $match); $n = count($fragments); $matches = 0; if ($n > 0) { $matches += $this->_matchFragment($fragments[0], $this->sysname); } if ($n > 1) { $matches += $this->_matchFragment($fragments[1], $this->release); } if ($n > 2) { $matches += $this->_matchFragment($fragments[2], $this->cpu); } if ($n > 3) { $matches += $this->_matchFragment($fragments[3], $this->extra); } return ($matches == $n); } function _matchFragment($fragment, $value) { if (strcspn($fragment, '*?') < strlen($fragment)) { $reg = '/^' . str_replace(array('*', '?', '/'), array('.*', '.', '\\/'), $fragment) . '\\z/'; return preg_match($reg, $value); } return ($fragment == '*' || !strcasecmp($fragment, $value)); } } /* * Local Variables: * indent-tabs-mode: nil * c-basic-offset: 4 * End: */ php-pear-1.10.1+submodules+notgz/PEAR.php000066400000000000000000001052261262614675700201070ustar00rootroot00000000000000 * @author Stig Bakken * @author Tomas V.V.Cox * @author Greg Beaver * @copyright 1997-2010 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @link http://pear.php.net/package/PEAR * @since File available since Release 0.1 */ /**#@+ * ERROR constants */ define('PEAR_ERROR_RETURN', 1); define('PEAR_ERROR_PRINT', 2); define('PEAR_ERROR_TRIGGER', 4); define('PEAR_ERROR_DIE', 8); define('PEAR_ERROR_CALLBACK', 16); /** * WARNING: obsolete * @deprecated */ define('PEAR_ERROR_EXCEPTION', 32); /**#@-*/ if (substr(PHP_OS, 0, 3) == 'WIN') { define('OS_WINDOWS', true); define('OS_UNIX', false); define('PEAR_OS', 'Windows'); } else { define('OS_WINDOWS', false); define('OS_UNIX', true); define('PEAR_OS', 'Unix'); // blatant assumption } $GLOBALS['_PEAR_default_error_mode'] = PEAR_ERROR_RETURN; $GLOBALS['_PEAR_default_error_options'] = E_USER_NOTICE; $GLOBALS['_PEAR_destructor_object_list'] = array(); $GLOBALS['_PEAR_shutdown_funcs'] = array(); $GLOBALS['_PEAR_error_handler_stack'] = array(); @ini_set('track_errors', true); /** * Base class for other PEAR classes. Provides rudimentary * emulation of destructors. * * If you want a destructor in your class, inherit PEAR and make a * destructor method called _yourclassname (same name as the * constructor, but with a "_" prefix). Also, in your constructor you * have to call the PEAR constructor: $this->PEAR();. * The destructor method will be called without parameters. Note that * at in some SAPI implementations (such as Apache), any output during * the request shutdown (in which destructors are called) seems to be * discarded. If you need to get any debug information from your * destructor, use error_log(), syslog() or something similar. * * IMPORTANT! To use the emulated destructors you need to create the * objects by reference: $obj =& new PEAR_child; * * @category pear * @package PEAR * @author Stig Bakken * @author Tomas V.V. Cox * @author Greg Beaver * @copyright 1997-2006 The PHP Group * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version Release: @package_version@ * @link http://pear.php.net/package/PEAR * @see PEAR_Error * @since Class available since PHP 4.0.2 * @link http://pear.php.net/manual/en/core.pear.php#core.pear.pear */ class PEAR { /** * Whether to enable internal debug messages. * * @var bool * @access private */ var $_debug = false; /** * Default error mode for this object. * * @var int * @access private */ var $_default_error_mode = null; /** * Default error options used for this object when error mode * is PEAR_ERROR_TRIGGER. * * @var int * @access private */ var $_default_error_options = null; /** * Default error handler (callback) for this object, if error mode is * PEAR_ERROR_CALLBACK. * * @var string * @access private */ var $_default_error_handler = ''; /** * Which class to use for error objects. * * @var string * @access private */ var $_error_class = 'PEAR_Error'; /** * An array of expected errors. * * @var array * @access private */ var $_expected_errors = array(); /** * List of methods that can be called both statically and non-statically. * @var array */ protected static $bivalentMethods = array( 'setErrorHandling' => true, 'raiseError' => true, 'throwError' => true, 'pushErrorHandling' => true, 'popErrorHandling' => true, ); /** * Constructor. Registers this object in * $_PEAR_destructor_object_list for destructor emulation if a * destructor object exists. * * @param string $error_class (optional) which class to use for * error objects, defaults to PEAR_Error. * @access public * @return void */ function __construct($error_class = null) { $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 && 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); } } } /** * Only here for backwards compatibility. * E.g. Archive_Tar calls $this->PEAR() in its constructor. * * @param string $error_class Which class to use for error objects, * defaults to PEAR_Error. */ public function PEAR($error_class = null) { self::__construct($error_class); } /** * Destructor (the emulated type of...). Does nothing right now, * but is included for forward compatibility, so subclass * destructors should always call it. * * See the note in the class desciption about output from * destructors. * * @access public * @return void */ function _PEAR() { if ($this->_debug) { printf("PEAR destructor called, class=%s\n", strtolower(get_class($this))); } } public function __call($method, $arguments) { if (!isset(self::$bivalentMethods[$method])) { trigger_error( 'Call to undefined method PEAR::' . $method . '()', E_USER_ERROR ); } return call_user_func_array( array(get_class(), '_' . $method), array_merge(array($this), $arguments) ); } public static function __callStatic($method, $arguments) { if (!isset(self::$bivalentMethods[$method])) { trigger_error( 'Call to undefined method PEAR::' . $method . '()', E_USER_ERROR ); } return call_user_func_array( array(get_class(), '_' . $method), array_merge(array(null), $arguments) ); } /** * If you have a class that's mostly/entirely static, and you need static * properties, you can use this method to simulate them. Eg. in your method(s) * do this: $myVar = &PEAR::getStaticProperty('myclass', 'myVar'); * You MUST use a reference, or they will not persist! * * @param string $class The calling classname, to prevent clashes * @param string $var The variable to retrieve. * @return mixed A reference to the variable. If not set it will be * auto initialised to NULL. */ public static function &getStaticProperty($class, $var) { static $properties; if (!isset($properties[$class])) { $properties[$class] = array(); } if (!array_key_exists($var, $properties[$class])) { $properties[$class][$var] = null; } return $properties[$class][$var]; } /** * Use this function to register a shutdown method for static * classes. * * @param mixed $func The function name (or array of class/method) to call * @param mixed $args The arguments to pass to the function * * @return void */ public static function registerShutdownFunc($func, $args = array()) { // if we are called statically, there is a potential // that no shutdown func is registered. Bug #6445 if (!isset($GLOBALS['_PEAR_SHUTDOWN_REGISTERED'])) { register_shutdown_function("_PEAR_call_destructors"); $GLOBALS['_PEAR_SHUTDOWN_REGISTERED'] = true; } $GLOBALS['_PEAR_shutdown_funcs'][] = array($func, $args); } /** * Tell whether a value is a PEAR error. * * @param mixed $data the value to test * @param int $code if $data is an error object, return true * only if $code is a string and * $obj->getMessage() == $code or * $code is an integer and $obj->getCode() == $code * * @return bool true if parameter is an error */ public static function isError($data, $code = null) { if (!is_a($data, 'PEAR_Error')) { return false; } if (is_null($code)) { return true; } elseif (is_string($code)) { return $data->getMessage() == $code; } return $data->getCode() == $code; } /** * Sets how errors generated by this object should be handled. * Can be invoked both in objects and statically. If called * statically, setErrorHandling sets the default behaviour for all * PEAR objects. If called in an object, setErrorHandling sets * the default behaviour for that object. * * @param object $object * Object the method was called on (non-static mode) * * @param int $mode * One of PEAR_ERROR_RETURN, PEAR_ERROR_PRINT, * PEAR_ERROR_TRIGGER, PEAR_ERROR_DIE, * PEAR_ERROR_CALLBACK or PEAR_ERROR_EXCEPTION. * * @param mixed $options * When $mode is PEAR_ERROR_TRIGGER, this is the error level (one * of E_USER_NOTICE, E_USER_WARNING or E_USER_ERROR). * * When $mode is PEAR_ERROR_CALLBACK, this parameter is expected * to be the callback function or method. A callback * function is a string with the name of the function, a * callback method is an array of two elements: the element * at index 0 is the object, and the element at index 1 is * the name of the method to call in the object. * * When $mode is PEAR_ERROR_PRINT or PEAR_ERROR_DIE, this is * a printf format string used when printing the error * message. * * @access public * @return void * @see PEAR_ERROR_RETURN * @see PEAR_ERROR_PRINT * @see PEAR_ERROR_TRIGGER * @see PEAR_ERROR_DIE * @see PEAR_ERROR_CALLBACK * @see PEAR_ERROR_EXCEPTION * * @since PHP 4.0.5 */ protected static function _setErrorHandling( $object, $mode = null, $options = null ) { if ($object !== null) { $setmode = &$object->_default_error_mode; $setoptions = &$object->_default_error_options; } else { $setmode = &$GLOBALS['_PEAR_default_error_mode']; $setoptions = &$GLOBALS['_PEAR_default_error_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: $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; } } /** * This method is used to tell which errors you expect to get. * Expected errors are always returned with error mode * PEAR_ERROR_RETURN. Expected error codes are stored in a stack, * and this method pushes a new element onto it. The list of * expected errors are in effect until they are popped off the * stack with the popExpect() method. * * Note that this method can not be called statically * * @param mixed $code a single error code or an array of error codes to expect * * @return int the new depth of the "expected errors" stack * @access public */ function expectError($code = '*') { if (is_array($code)) { array_push($this->_expected_errors, $code); } else { array_push($this->_expected_errors, array($code)); } return count($this->_expected_errors); } /** * This method pops one element off the expected error codes * stack. * * @return array the list of error codes that were popped */ function popExpect() { return array_pop($this->_expected_errors); } /** * This method checks unsets an error code if available * * @param mixed error code * @return bool true if the error code was unset, false otherwise * @access private * @since PHP 4.3.0 */ function _checkDelExpect($error_code) { $deleted = false; foreach ($this->_expected_errors as $key => $error_array) { if (in_array($error_code, $error_array)) { unset($this->_expected_errors[$key][array_search($error_code, $error_array)]); $deleted = true; } // clean up empty arrays if (0 == count($this->_expected_errors[$key])) { unset($this->_expected_errors[$key]); } } return $deleted; } /** * This method deletes all occurences of the specified element from * the expected error codes stack. * * @param mixed $error_code error code that should be deleted * @return mixed list of error codes that were deleted or error * @access public * @since PHP 4.3.0 */ function delExpect($error_code) { $deleted = false; if ((is_array($error_code) && (0 != count($error_code)))) { // $error_code is a non-empty array here; we walk through it trying // to unset all values foreach ($error_code as $key => $error) { $deleted = $this->_checkDelExpect($error) ? true : false; } return $deleted ? true : PEAR::raiseError("The expected error you submitted does not exist"); // IMPROVE ME } elseif (!empty($error_code)) { // $error_code comes alone, trying to unset it if ($this->_checkDelExpect($error_code)) { return true; } return PEAR::raiseError("The expected error you submitted does not exist"); // IMPROVE ME } // $error_code is empty return PEAR::raiseError("The expected error you submitted is empty"); // IMPROVE ME } /** * This method is a wrapper that returns an instance of the * configured error class with this object's default error * handling applied. If the $mode and $options parameters are not * specified, the object's defaults are used. * * @param mixed $message a text error message or a PEAR error object * * @param int $code a numeric error code (it is up to your class * to define these if you want to use codes) * * @param int $mode One of PEAR_ERROR_RETURN, PEAR_ERROR_PRINT, * PEAR_ERROR_TRIGGER, PEAR_ERROR_DIE, * PEAR_ERROR_CALLBACK, PEAR_ERROR_EXCEPTION. * * @param mixed $options If $mode is PEAR_ERROR_TRIGGER, this parameter * specifies the PHP-internal error level (one of * E_USER_NOTICE, E_USER_WARNING or E_USER_ERROR). * If $mode is PEAR_ERROR_CALLBACK, this * parameter specifies the callback function or * method. In other error modes this parameter * is ignored. * * @param string $userinfo If you need to pass along for example debug * information, this parameter is meant for that. * * @param string $error_class The returned error object will be * instantiated from this class, if specified. * * @param bool $skipmsg If true, raiseError will only pass error codes, * the error message parameter will be dropped. * * @return object a PEAR error object * @see PEAR::setErrorHandling * @since PHP 4.0.5 */ protected static function _raiseError($object, $message = null, $code = null, $mode = null, $options = null, $userinfo = null, $error_class = null, $skipmsg = false) { // The error is yet a PEAR error object if (is_object($message)) { $code = $message->getCode(); $userinfo = $message->getUserInfo(); $error_class = $message->getType(); $message->error_message_prefix = ''; $message = $message->getMessage(); } if ( $object !== null && isset($object->_expected_errors) && count($object->_expected_errors) > 0 && count($exp = end($object->_expected_errors)) ) { if ($exp[0] == "*" || (is_int(reset($exp)) && in_array($code, $exp)) || (is_string(reset($exp)) && in_array($message, $exp)) ) { $mode = PEAR_ERROR_RETURN; } } // No mode given, try global ones if ($mode === null) { // Class error handler if ($object !== null && isset($object->_default_error_mode)) { $mode = $object->_default_error_mode; $options = $object->_default_error_options; // Global error handler } elseif (isset($GLOBALS['_PEAR_default_error_mode'])) { $mode = $GLOBALS['_PEAR_default_error_mode']; $options = $GLOBALS['_PEAR_default_error_options']; } } if ($error_class !== null) { $ec = $error_class; } elseif ($object !== null && isset($object->_error_class)) { $ec = $object->_error_class; } else { $ec = 'PEAR_Error'; } if ($skipmsg) { $a = new $ec($code, $mode, $options, $userinfo); } else { $a = new $ec($message, $code, $mode, $options, $userinfo); } return $a; } /** * Simpler form of raiseError with fewer options. In most cases * message, code and userinfo are enough. * * @param mixed $message a text error message or a PEAR error object * * @param int $code a numeric error code (it is up to your class * to define these if you want to use codes) * * @param string $userinfo If you need to pass along for example debug * information, this parameter is meant for that. * * @return object a PEAR error object * @see PEAR::raiseError */ protected static function _throwError($object, $message = null, $code = null, $userinfo = null) { if ($object !== null) { $a = &$object->raiseError($message, $code, null, null, $userinfo); return $a; } $a = &PEAR::raiseError($message, $code, null, null, $userinfo); return $a; } public static 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; } public static 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; } /** * Push a new error handler on top of the error handler options stack. With this * you can easily override the actual error handler for some code and restore * it later with popErrorHandling. * * @param mixed $mode (same as setErrorHandling) * @param mixed $options (same as setErrorHandling) * * @return bool Always true * * @see PEAR::setErrorHandling */ protected static function _pushErrorHandling($object, $mode, $options = null) { $stack = &$GLOBALS['_PEAR_error_handler_stack']; if ($object !== null) { $def_mode = &$object->_default_error_mode; $def_options = &$object->_default_error_options; } else { $def_mode = &$GLOBALS['_PEAR_default_error_mode']; $def_options = &$GLOBALS['_PEAR_default_error_options']; } $stack[] = array($def_mode, $def_options); if ($object !== null) { $object->setErrorHandling($mode, $options); } else { PEAR::setErrorHandling($mode, $options); } $stack[] = array($mode, $options); return true; } /** * Pop the last error handler used * * @return bool Always true * * @see PEAR::pushErrorHandling */ protected static function _popErrorHandling($object) { $stack = &$GLOBALS['_PEAR_error_handler_stack']; array_pop($stack); list($mode, $options) = $stack[sizeof($stack) - 1]; array_pop($stack); if ($object !== null) { $object->setErrorHandling($mode, $options); } else { PEAR::setErrorHandling($mode, $options); } return true; } /** * OS independent PHP extension load. Remember to take care * on the correct extension name for case sensitive OSes. * * @param string $ext The extension name * @return bool Success or not on the dl() call */ public static function loadExtension($ext) { if (extension_loaded($ext)) { return true; } // if either returns true dl() will produce a FATAL error, stop that if ( function_exists('dl') === false || ini_get('enable_dl') != 1 ) { return false; } if (OS_WINDOWS) { $suffix = '.dll'; } elseif (PHP_OS == 'HP-UX') { $suffix = '.sl'; } elseif (PHP_OS == 'AIX') { $suffix = '.a'; } elseif (PHP_OS == 'OSX') { $suffix = '.bundle'; } else { $suffix = '.so'; } return @dl('php_'.$ext.$suffix) || @dl($ext.$suffix); } } function _PEAR_call_destructors() { global $_PEAR_destructor_object_list; if (is_array($_PEAR_destructor_object_list) && sizeof($_PEAR_destructor_object_list)) { reset($_PEAR_destructor_object_list); $destructLifoExists = PEAR::getStaticProperty('PEAR', 'destructlifo'); if ($destructLifoExists) { $_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) { $destructor = "_$classname"; if (method_exists($objref, $destructor)) { $objref->$destructor(); break; } else { $classname = get_parent_class($classname); } } } // Empty the object list to ensure that destructors are // not called more than once. $_PEAR_destructor_object_list = array(); } // Now call the shutdown functions if ( isset($GLOBALS['_PEAR_shutdown_funcs']) && is_array($GLOBALS['_PEAR_shutdown_funcs']) && !empty($GLOBALS['_PEAR_shutdown_funcs']) ) { foreach ($GLOBALS['_PEAR_shutdown_funcs'] as $value) { call_user_func_array($value[0], $value[1]); } } } /** * Standard PEAR error class for PHP 4 * * This class is supserseded by {@link PEAR_Exception} in PHP 5 * * @category pear * @package PEAR * @author Stig Bakken * @author Tomas V.V. Cox * @author Gregory Beaver * @copyright 1997-2006 The PHP Group * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version Release: @package_version@ * @link http://pear.php.net/manual/en/core.pear.pear-error.php * @see PEAR::raiseError(), PEAR::throwError() * @since Class available since PHP 4.0.2 */ class PEAR_Error { var $error_message_prefix = ''; var $mode = PEAR_ERROR_RETURN; var $level = E_USER_NOTICE; var $code = -1; var $message = ''; var $userinfo = ''; var $backtrace = null; /** * PEAR_Error constructor * * @param string $message message * * @param int $code (optional) error code * * @param int $mode (optional) error mode, one of: PEAR_ERROR_RETURN, * PEAR_ERROR_PRINT, PEAR_ERROR_DIE, PEAR_ERROR_TRIGGER, * PEAR_ERROR_CALLBACK or PEAR_ERROR_EXCEPTION * * @param mixed $options (optional) error level, _OR_ in the case of * PEAR_ERROR_CALLBACK, the callback function or object/method * tuple. * * @param string $userinfo (optional) additional user/debug info * * @access public * */ function __construct($message = 'unknown error', $code = null, $mode = null, $options = null, $userinfo = null) { if ($mode === null) { $mode = PEAR_ERROR_RETURN; } $this->message = $message; $this->code = $code; $this->mode = $mode; $this->userinfo = $userinfo; $skiptrace = PEAR::getStaticProperty('PEAR_Error', 'skiptrace'); if (!$skiptrace) { $this->backtrace = debug_backtrace(); if (isset($this->backtrace[0]) && isset($this->backtrace[0]['object'])) { unset($this->backtrace[0]['object']); } } if ($mode & PEAR_ERROR_CALLBACK) { $this->level = E_USER_NOTICE; $this->callback = $options; } else { if ($options === null) { $options = E_USER_NOTICE; } $this->level = $options; $this->callback = null; } if ($this->mode & PEAR_ERROR_PRINT) { if (is_null($options) || is_int($options)) { $format = "%s"; } else { $format = $options; } printf($format, $this->getMessage()); } if ($this->mode & PEAR_ERROR_TRIGGER) { trigger_error($this->getMessage(), $this->level); } if ($this->mode & PEAR_ERROR_DIE) { $msg = $this->getMessage(); if (is_null($options) || is_int($options)) { $format = "%s"; if (substr($msg, -1) != "\n") { $msg .= "\n"; } } else { $format = $options; } die(sprintf($format, $msg)); } if ($this->mode & PEAR_ERROR_CALLBACK && is_callable($this->callback)) { call_user_func($this->callback, $this); } if ($this->mode & PEAR_ERROR_EXCEPTION) { trigger_error("PEAR_ERROR_EXCEPTION is obsolete, use class PEAR_Exception for exceptions", E_USER_WARNING); eval('$e = new Exception($this->message, $this->code);throw($e);'); } } /** * Only here for backwards compatibility. * * Class "Cache_Error" still uses it, among others. * * @param string $message Message * @param int $code Error code * @param int $mode Error mode * @param mixed $options See __construct() * @param string $userinfo Additional user/debug info */ public function PEAR_Error( $message = 'unknown error', $code = null, $mode = null, $options = null, $userinfo = null ) { self::__construct($message, $code, $mode, $options, $userinfo); } /** * Get the error mode from an error object. * * @return int error mode * @access public */ function getMode() { return $this->mode; } /** * Get the callback function/method from an error object. * * @return mixed callback function or object/method array * @access public */ function getCallback() { return $this->callback; } /** * Get the error message from an error object. * * @return string full error message * @access public */ function getMessage() { return ($this->error_message_prefix . $this->message); } /** * Get error code from an error object * * @return int error code * @access public */ function getCode() { return $this->code; } /** * Get the name of this error/exception. * * @return string error/exception name (type) * @access public */ function getType() { return get_class($this); } /** * Get additional user-supplied information. * * @return string user-supplied information * @access public */ function getUserInfo() { return $this->userinfo; } /** * Get additional debug information supplied by the application. * * @return string debug information * @access public */ function getDebugInfo() { return $this->getUserInfo(); } /** * 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 (defined('PEAR_IGNORE_BACKTRACE')) { return null; } if ($frame === null) { return $this->backtrace; } return $this->backtrace[$frame]; } function addUserInfo($info) { if (empty($this->userinfo)) { $this->userinfo = $info; } else { $this->userinfo .= " ** $info"; } } function __toString() { return $this->getMessage(); } /** * Make a string representation of this object. * * @return string a string with an object summary * @access public */ function toString() { $modes = array(); $levels = array(E_USER_NOTICE => 'notice', E_USER_WARNING => 'warning', E_USER_ERROR => 'error'); if ($this->mode & PEAR_ERROR_CALLBACK) { if (is_array($this->callback)) { $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"]', strtolower(get_class($this)), $this->message, $this->code, $callback, $this->error_message_prefix, $this->userinfo); } if ($this->mode & PEAR_ERROR_PRINT) { $modes[] = 'print'; } if ($this->mode & PEAR_ERROR_TRIGGER) { $modes[] = 'trigger'; } if ($this->mode & PEAR_ERROR_DIE) { $modes[] = 'die'; } if ($this->mode & PEAR_ERROR_RETURN) { $modes[] = 'return'; } return sprintf('[%s: message="%s" code=%d mode=%s level=%s '. 'prefix="%s" info="%s"]', strtolower(get_class($this)), $this->message, $this->code, implode("|", $modes), $levels[$this->level], $this->error_message_prefix, $this->userinfo); } } /* * Local Variables: * mode: php * tab-width: 4 * c-basic-offset: 4 * End: */ php-pear-1.10.1+submodules+notgz/PEAR/000077500000000000000000000000001262614675700173705ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/PEAR/Autoloader.php000066400000000000000000000145441262614675700222100ustar00rootroot00000000000000 * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @link http://pear.php.net/manual/en/core.ppm.php#core.ppm.pear-autoloader * @since File available since Release 0.1 * @deprecated File deprecated in Release 1.4.0a1 */ // /* vim: set expandtab tabstop=4 shiftwidth=4: */ if (!extension_loaded("overload")) { // die hard without ext/overload die("Rebuild PHP with the `overload' extension to use PEAR_Autoloader"); } /** * Include for PEAR_Error and PEAR classes */ require_once "PEAR.php"; /** * This class is for objects where you want to separate the code for * some methods into separate classes. This is useful if you have a * class with not-frequently-used methods that contain lots of code * that you would like to avoid always parsing. * * The PEAR_Autoloader class provides autoloading and aggregation. * The autoloading lets you set up in which classes the separated * methods are found. Aggregation is the technique used to import new * methods, an instance of each class providing separated methods is * stored and called every time the aggregated method is called. * * @category pear * @package PEAR * @author Stig Bakken * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version Release: @package_version@ * @link http://pear.php.net/manual/en/core.ppm.php#core.ppm.pear-autoloader * @since File available since Release 0.1 * @deprecated File deprecated in Release 1.4.0a1 */ class PEAR_Autoloader extends PEAR { // {{{ properties /** * Map of methods and classes where they are defined * * @var array * * @access private */ var $_autoload_map = array(); /** * Map of methods and aggregate objects * * @var array * * @access private */ var $_method_map = array(); // }}} // {{{ addAutoload() /** * Add one or more autoload entries. * * @param string $method which method to autoload * * @param string $classname (optional) which class to find the method in. * If the $method parameter is an array, this * parameter may be omitted (and will be ignored * if not), and the $method parameter will be * treated as an associative array with method * names as keys and class names as values. * * @return void * * @access public */ function addAutoload($method, $classname = null) { if (is_array($method)) { array_walk($method, create_function('$a,&$b', '$b = strtolower($b);')); $this->_autoload_map = array_merge($this->_autoload_map, $method); } else { $this->_autoload_map[strtolower($method)] = $classname; } } // }}} // {{{ removeAutoload() /** * Remove an autoload entry. * * @param string $method which method to remove the autoload entry for * * @return bool TRUE if an entry was removed, FALSE if not * * @access public */ function removeAutoload($method) { $method = strtolower($method); $ok = isset($this->_autoload_map[$method]); unset($this->_autoload_map[$method]); return $ok; } // }}} // {{{ addAggregateObject() /** * Add an aggregate object to this object. If the specified class * is not defined, loading it will be attempted following PEAR's * file naming scheme. All the methods in the class will be * aggregated, except private ones (name starting with an * underscore) and constructors. * * @param string $classname what class to instantiate for the object. * * @return void * * @access public */ function addAggregateObject($classname) { $classname = strtolower($classname); if (!class_exists($classname)) { $include_file = preg_replace('/[^a-z0-9]/i', '_', $classname); include_once $include_file; } $obj = new $classname; $methods = get_class_methods($classname); foreach ($methods as $method) { // don't import priviate methods and constructors if ($method{0} != '_' && $method != $classname) { $this->_method_map[$method] = $obj; } } } // }}} // {{{ removeAggregateObject() /** * Remove an aggregate object. * * @param string $classname the class of the object to remove * * @return bool TRUE if an object was removed, FALSE if not * * @access public */ function removeAggregateObject($classname) { $ok = false; $classname = strtolower($classname); reset($this->_method_map); while (list($method, $obj) = each($this->_method_map)) { if (is_a($obj, $classname)) { unset($this->_method_map[$method]); $ok = true; } } return $ok; } // }}} // {{{ __call() /** * Overloaded object call handler, called each time an * undefined/aggregated method is invoked. This method repeats * the call in the right aggregate object and passes on the return * value. * * @param string $method which method that was called * * @param string $args An array of the parameters passed in the * original call * * @return mixed The return value from the aggregated method, or a PEAR * error if the called method was unknown. */ function __call($method, $args, &$retval) { $method = strtolower($method); if (empty($this->_method_map[$method]) && isset($this->_autoload_map[$method])) { $this->addAggregateObject($this->_autoload_map[$method]); } if (isset($this->_method_map[$method])) { $retval = call_user_func_array(array($this->_method_map[$method], $method), $args); return true; } return false; } // }}} } overload("PEAR_Autoloader"); ?> php-pear-1.10.1+submodules+notgz/PEAR/Builder.php000066400000000000000000000413701262614675700214740ustar00rootroot00000000000000 * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @link http://pear.php.net/package/PEAR * @since File available since Release 0.1 * * TODO: log output parameters in PECL command line * TODO: msdev path in configuration */ /** * Needed for extending PEAR_Builder */ require_once 'PEAR/Common.php'; require_once 'PEAR/PackageFile.php'; require_once 'System.php'; /** * Class to handle building (compiling) extensions. * * @category pear * @package PEAR * @author Stig Bakken * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version Release: @PEAR-VER@ * @link http://pear.php.net/package/PEAR * @since Class available since PHP 4.0.2 * @see http://pear.php.net/manual/en/core.ppm.pear-builder.php */ class PEAR_Builder extends PEAR_Common { var $php_api_version = 0; var $zend_module_api_no = 0; var $zend_extension_api_no = 0; var $extensions_built = array(); /** * @var string Used for reporting when it is not possible to pass function * via extra parameter, e.g. log, msdevCallback */ var $current_callback = null; // used for msdev builds var $_lastline = null; var $_firstline = null; /** * PEAR_Builder constructor. * * @param object $ui user interface object (instance of PEAR_Frontend_*) * * @access public */ function __construct(&$ui) { parent::__construct(); $this->setFrontendObject($ui); } /** * Build an extension from source on windows. * requires msdev */ function _build_win32($descfile, $callback = null) { if (is_object($descfile)) { $pkg = $descfile; $descfile = $pkg->getPackageFile(); } else { $pf = new PEAR_PackageFile($this->config, $this->debug); $pkg = &$pf->fromPackageFile($descfile, PEAR_VALIDATE_NORMAL); if (PEAR::isError($pkg)) { return $pkg; } } $dir = dirname($descfile); $old_cwd = getcwd(); if (!file_exists($dir) || !is_dir($dir) || !chdir($dir)) { return $this->raiseError("could not chdir to $dir"); } // packages that were in a .tar have the packagefile in this directory $vdir = $pkg->getPackage() . '-' . $pkg->getVersion(); if (file_exists($dir) && is_dir($vdir)) { if (!chdir($vdir)) { return $this->raiseError("could not chdir to " . realpath($vdir)); } $dir = getcwd(); } $this->log(2, "building in $dir"); $dsp = $pkg->getPackage().'.dsp'; if (!file_exists("$dir/$dsp")) { return $this->raiseError("The DSP $dsp does not exist."); } // XXX TODO: make release build type configurable $command = 'msdev '.$dsp.' /MAKE "'.$pkg->getPackage(). ' - Release"'; $err = $this->_runCommand($command, array(&$this, 'msdevCallback')); if (PEAR::isError($err)) { return $err; } // figure out the build platform and type $platform = 'Win32'; $buildtype = 'Release'; if (preg_match('/.*?'.$pkg->getPackage().'\s-\s(\w+)\s(.*?)-+/i',$this->_firstline,$matches)) { $platform = $matches[1]; $buildtype = $matches[2]; } if (preg_match('/(.*)?\s-\s(\d+).*?(\d+)/', $this->_lastline, $matches)) { if ($matches[2]) { // there were errors in the build return $this->raiseError("There were errors during compilation."); } $out = $matches[1]; } else { return $this->raiseError("Did not understand the completion status returned from msdev.exe."); } // msdev doesn't tell us the output directory :/ // open the dsp, find /out and use that directory $dsptext = join(file($dsp),''); // this regex depends on the build platform and type having been // correctly identified above. $regex ='/.*?!IF\s+"\$\(CFG\)"\s+==\s+("'. $pkg->getPackage().'\s-\s'. $platform.'\s'. $buildtype.'").*?'. '\/out:"(.*?)"/is'; if ($dsptext && preg_match($regex, $dsptext, $matches)) { // what we get back is a relative path to the output file itself. $outfile = realpath($matches[2]); } else { return $this->raiseError("Could not retrieve output information from $dsp."); } // realpath returns false if the file doesn't exist if ($outfile && copy($outfile, "$dir/$out")) { $outfile = "$dir/$out"; } $built_files[] = array( 'file' => "$outfile", 'php_api' => $this->php_api_version, 'zend_mod_api' => $this->zend_module_api_no, 'zend_ext_api' => $this->zend_extension_api_no, ); return $built_files; } // }}} // {{{ msdevCallback() function msdevCallback($what, $data) { if (!$this->_firstline) $this->_firstline = $data; $this->_lastline = $data; call_user_func($this->current_callback, $what, $data); } /** * @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 an extension from source. Runs "phpize" in the source * directory, but compiles in a temporary directory * (TMPDIR/pear-build-USER/PACKAGE-VERSION). * * @param string|PEAR_PackageFile_v* $descfile path to XML package description file, or * a PEAR_PackageFile object * * @param mixed $callback callback function used to report output, * see PEAR_Builder::_runCommand for details * * @return array an array of associative arrays with built files, * format: * array( array( 'file' => '/path/to/ext.so', * 'php_api' => YYYYMMDD, * 'zend_mod_api' => YYYYMMDD, * 'zend_ext_api' => YYYYMMDD ), * ... ) * * @access public * * @see PEAR_Builder::_runCommand */ function build($descfile, $callback = null) { if (preg_match('/(\\/|\\\\|^)([^\\/\\\\]+)?php([^\\/\\\\]+)?$/', $this->config->get('php_bin'), $matches)) { if (isset($matches[2]) && strlen($matches[2]) && trim($matches[2]) != trim($this->config->get('php_prefix'))) { $this->log(0, 'WARNING: php_bin ' . $this->config->get('php_bin') . ' appears to have a prefix ' . $matches[2] . ', but' . ' config variable php_prefix does not match'); } if (isset($matches[3]) && strlen($matches[3]) && trim($matches[3]) != trim($this->config->get('php_suffix'))) { $this->log(0, 'WARNING: php_bin ' . $this->config->get('php_bin') . ' appears to have a suffix ' . $matches[3] . ', but' . ' config variable php_suffix does not match'); } } $this->current_callback = $callback; if (PEAR_OS == "Windows") { return $this->_build_win32($descfile, $callback); } if (PEAR_OS != 'Unix') { return $this->raiseError("building extensions not supported on this platform"); } if (is_object($descfile)) { $pkg = $descfile; $descfile = $pkg->getPackageFile(); if (is_a($pkg, 'PEAR_PackageFile_v1')) { $dir = dirname($descfile); } else { $dir = $pkg->_config->get('temp_dir') . '/' . $pkg->getName(); // automatically delete at session end $this->addTempFile($dir); } } else { $pf = new PEAR_PackageFile($this->config); $pkg = &$pf->fromPackageFile($descfile, PEAR_VALIDATE_NORMAL); if (PEAR::isError($pkg)) { return $pkg; } $dir = dirname($descfile); } // Find config. outside of normal path - e.g. config.m4 foreach (array_keys($pkg->getInstallationFileList()) as $item) { if (stristr(basename($item), 'config.m4') && dirname($item) != '.') { $dir .= DIRECTORY_SEPARATOR . dirname($item); break; } } $old_cwd = getcwd(); if (!file_exists($dir) || !is_dir($dir) || !chdir($dir)) { return $this->raiseError("could not chdir to $dir"); } $vdir = $pkg->getPackage() . '-' . $pkg->getVersion(); if (is_dir($vdir)) { chdir($vdir); } $dir = getcwd(); $this->log(2, "building in $dir"); putenv('PATH=' . $this->config->get('bin_dir') . ':' . getenv('PATH')); $err = $this->_runCommand($this->config->get('php_prefix') . "phpize" . $this->config->get('php_suffix'), array(&$this, 'phpizeCallback')); if (PEAR::isError($err)) { return $err; } if (!$err) { return $this->raiseError("`phpize' failed"); } // {{{ start of interactive part $configure_command = "$dir/configure"; $phpConfigName = $this->config->get('php_prefix') . 'php-config' . $this->config->get('php_suffix'); $phpConfigPath = System::which($phpConfigName); if ($phpConfigPath !== false) { $configure_command .= ' --with-php-config=' . $phpConfigPath; } $configure_options = $pkg->getConfigureOptions(); if ($configure_options) { foreach ($configure_options as $o) { $default = array_key_exists('default', $o) ? $o['default'] : null; list($r) = $this->ui->userDialog('build', array($o['prompt']), array('text'), array($default)); if (substr($o['name'], 0, 5) == 'with-' && ($r == 'yes' || $r == 'autodetect')) { $configure_command .= " --$o[name]"; } else { $configure_command .= " --$o[name]=".trim($r); } } } // }}} end of interactive part // FIXME make configurable if (!$user=getenv('USER')) { $user='defaultuser'; } $tmpdir = $this->config->get('temp_dir'); $build_basedir = System::mktemp(' -t "' . $tmpdir . '" -d "pear-build-' . $user . '"'); $build_dir = "$build_basedir/$vdir"; $inst_dir = "$build_basedir/install-$vdir"; $this->log(1, "building in $build_dir"); if (is_dir($build_dir)) { System::rm(array('-rf', $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); $make_command = getenv('MAKE') ? getenv('MAKE') : 'make'; $to_run = array( $configure_command, $make_command, "$make_command INSTALL_ROOT=\"$inst_dir\" install", "find \"$inst_dir\" | xargs ls -dils" ); if (!file_exists($build_dir) || !is_dir($build_dir) || !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)) { chdir($old_cwd); return $err; } if (!$err) { chdir($old_cwd); return $this->raiseError("`$cmd' failed"); } } if (!($dp = opendir("modules"))) { chdir($old_cwd); return $this->raiseError("no `modules' directory found"); } $built_files = array(); $prefix = exec($this->config->get('php_prefix') . "php-config" . $this->config->get('php_suffix') . " --prefix"); $this->_harvestInstDir($prefix, $inst_dir . DIRECTORY_SEPARATOR . $prefix, $built_files); chdir($old_cwd); return $built_files; } /** * Message callback function used when running the "phpize" * program. Extracts the API numbers used. Ignores other message * types than "cmdoutput". * * @param string $what the type of message * @param mixed $data the message * * @return void * * @access public */ function phpizeCallback($what, $data) { if ($what != 'cmdoutput') { return; } $this->log(1, rtrim($data)); if (preg_match('/You should update your .aclocal.m4/', $data)) { return; } $matches = array(); if (preg_match('/^\s+(\S[^:]+):\s+(\d{8})/', $data, $matches)) { $member = preg_replace('/[^a-z]/', '_', strtolower($matches[1])); $apino = (int)$matches[2]; if (isset($this->$member)) { $this->$member = $apino; //$msg = sprintf("%-22s : %d", $matches[1], $apino); //$this->log(1, $msg); } } } /** * Run an external command, using a message callback to report * output. The command will be run through popen and output is * reported for every line with a "cmdoutput" message with the * line string, including newlines, as payload. * * @param string $command the command to run * * @param mixed $callback (optional) function to use as message * callback * * @return bool whether the command was successful (exit code 0 * means success, any other means failure) * * @access private */ function _runCommand($command, $callback = null) { $this->log(1, "running: $command"); $pp = popen("$command 2>&1", "r"); if (!$pp) { return $this->raiseError("failed to run `$command'"); } if ($callback && $callback[0]->debug == 1) { $olddbg = $callback[0]->debug; $callback[0]->debug = 2; } while ($line = fgets($pp, 1024)) { if ($callback) { call_user_func($callback, 'cmdoutput', $line); } else { $this->log(2, rtrim($line)); } } if ($callback && isset($olddbg)) { $callback[0]->debug = $olddbg; } $exitcode = is_resource($pp) ? pclose($pp) : -1; return ($exitcode == 0); } function log($level, $msg, $append_crlf = true) { if ($this->current_callback) { if ($this->debug >= $level) { call_user_func($this->current_callback, 'output', $msg); } return; } return parent::log($level, $msg, $append_crlf); } } php-pear-1.10.1+submodules+notgz/PEAR/ChannelFile.php000066400000000000000000001432461262614675700222630ustar00rootroot00000000000000 * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ /** * Needed for error handling */ require_once 'PEAR/ErrorStack.php'; require_once 'PEAR/XMLParser.php'; require_once 'PEAR/Common.php'; /** * Error code if the channel.xml tag does not contain a valid version */ define('PEAR_CHANNELFILE_ERROR_NO_VERSION', 1); /** * Error code if the channel.xml tag version is not supported (version 1.0 is the only supported version, * currently */ define('PEAR_CHANNELFILE_ERROR_INVALID_VERSION', 2); /** * Error code if parsing is attempted with no xml extension */ define('PEAR_CHANNELFILE_ERROR_NO_XML_EXT', 3); /** * Error code if creating the xml parser resource fails */ define('PEAR_CHANNELFILE_ERROR_CANT_MAKE_PARSER', 4); /** * Error code used for all sax xml parsing errors */ define('PEAR_CHANNELFILE_ERROR_PARSER_ERROR', 5); /**#@+ * Validation errors */ /** * Error code when channel name is missing */ define('PEAR_CHANNELFILE_ERROR_NO_NAME', 6); /** * Error code when channel name is invalid */ define('PEAR_CHANNELFILE_ERROR_INVALID_NAME', 7); /** * Error code when channel summary is missing */ define('PEAR_CHANNELFILE_ERROR_NO_SUMMARY', 8); /** * Error code when channel summary is multi-line */ define('PEAR_CHANNELFILE_ERROR_MULTILINE_SUMMARY', 9); /** * Error code when channel server is missing for protocol */ define('PEAR_CHANNELFILE_ERROR_NO_HOST', 10); /** * Error code when channel server is invalid for protocol */ define('PEAR_CHANNELFILE_ERROR_INVALID_HOST', 11); /** * Error code when a mirror name is invalid */ define('PEAR_CHANNELFILE_ERROR_INVALID_MIRROR', 21); /** * Error code when a mirror type is invalid */ define('PEAR_CHANNELFILE_ERROR_INVALID_MIRRORTYPE', 22); /** * Error code when an attempt is made to generate xml, but the parsed content is invalid */ define('PEAR_CHANNELFILE_ERROR_INVALID', 23); /** * Error code when an empty package name validate regex is passed in */ define('PEAR_CHANNELFILE_ERROR_EMPTY_REGEX', 24); /** * Error code when a tag has no version */ define('PEAR_CHANNELFILE_ERROR_NO_FUNCTIONVERSION', 25); /** * Error code when a tag has no name */ define('PEAR_CHANNELFILE_ERROR_NO_FUNCTIONNAME', 26); /** * Error code when a tag has no name */ define('PEAR_CHANNELFILE_ERROR_NOVALIDATE_NAME', 27); /** * Error code when a tag has no version attribute */ define('PEAR_CHANNELFILE_ERROR_NOVALIDATE_VERSION', 28); /** * Error code when a mirror does not exist but is called for in one of the set* * methods. */ define('PEAR_CHANNELFILE_ERROR_MIRROR_NOT_FOUND', 32); /** * Error code when a server port is not numeric */ define('PEAR_CHANNELFILE_ERROR_INVALID_PORT', 33); /** * Error code when contains no version attribute */ define('PEAR_CHANNELFILE_ERROR_NO_STATICVERSION', 34); /** * Error code when contains no type attribute in a protocol definition */ define('PEAR_CHANNELFILE_ERROR_NOBASEURLTYPE', 35); /** * Error code when a mirror is defined and the channel.xml represents the __uri pseudo-channel */ define('PEAR_CHANNELFILE_URI_CANT_MIRROR', 36); /** * Error code when ssl attribute is present and is not "yes" */ define('PEAR_CHANNELFILE_ERROR_INVALID_SSL', 37); /**#@-*/ /** * Mirror types allowed. Currently only internet servers are recognized. */ $GLOBALS['_PEAR_CHANNELS_MIRROR_TYPES'] = array('server'); /** * The Channel handling class * * @category pear * @package PEAR * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version Release: @package_version@ * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ class PEAR_ChannelFile { /** * @access private * @var PEAR_ErrorStack * @access private */ var $_stack; /** * Supported channel.xml versions, for parsing * @var array * @access private */ var $_supportedVersions = array('1.0'); /** * Parsed channel information * @var array * @access private */ var $_channelInfo; /** * index into the subchannels array, used for parsing xml * @var int * @access private */ var $_subchannelIndex; /** * index into the mirrors array, used for parsing xml * @var int * @access private */ var $_mirrorIndex; /** * Flag used to determine the validity of parsed content * @var boolean * @access private */ var $_isValid = false; function __construct() { $this->_stack = new PEAR_ErrorStack('PEAR_ChannelFile'); $this->_stack->setErrorMessageTemplate($this->_getErrorMessage()); $this->_isValid = false; } /** * @return array * @access protected */ function _getErrorMessage() { return array( PEAR_CHANNELFILE_ERROR_INVALID_VERSION => 'While parsing channel.xml, an invalid version number "%version% was passed in, expecting one of %versions%', PEAR_CHANNELFILE_ERROR_NO_VERSION => 'No version number found in tag', PEAR_CHANNELFILE_ERROR_NO_XML_EXT => '%error%', PEAR_CHANNELFILE_ERROR_CANT_MAKE_PARSER => 'Unable to create XML parser', PEAR_CHANNELFILE_ERROR_PARSER_ERROR => '%error%', PEAR_CHANNELFILE_ERROR_NO_NAME => 'Missing channel name', PEAR_CHANNELFILE_ERROR_INVALID_NAME => 'Invalid channel %tag% "%name%"', PEAR_CHANNELFILE_ERROR_NO_SUMMARY => 'Missing channel summary', PEAR_CHANNELFILE_ERROR_MULTILINE_SUMMARY => 'Channel summary should be on one line, but is multi-line', PEAR_CHANNELFILE_ERROR_NO_HOST => 'Missing channel server for %type% server', PEAR_CHANNELFILE_ERROR_INVALID_HOST => 'Server name "%server%" is invalid for %type% server', PEAR_CHANNELFILE_ERROR_INVALID_MIRROR => 'Invalid mirror name "%name%", mirror type %type%', PEAR_CHANNELFILE_ERROR_INVALID_MIRRORTYPE => 'Invalid mirror type "%type%"', PEAR_CHANNELFILE_ERROR_INVALID => 'Cannot generate xml, contents are invalid', PEAR_CHANNELFILE_ERROR_EMPTY_REGEX => 'packagenameregex cannot be empty', PEAR_CHANNELFILE_ERROR_NO_FUNCTIONVERSION => '%parent% %protocol% function has no version', PEAR_CHANNELFILE_ERROR_NO_FUNCTIONNAME => '%parent% %protocol% function has no name', PEAR_CHANNELFILE_ERROR_NOBASEURLTYPE => '%parent% rest baseurl has no type', PEAR_CHANNELFILE_ERROR_NOVALIDATE_NAME => 'Validation package has no name in tag', PEAR_CHANNELFILE_ERROR_NOVALIDATE_VERSION => 'Validation package "%package%" has no version', PEAR_CHANNELFILE_ERROR_MIRROR_NOT_FOUND => 'Mirror "%mirror%" does not exist', PEAR_CHANNELFILE_ERROR_INVALID_PORT => 'Port "%port%" must be numeric', PEAR_CHANNELFILE_ERROR_NO_STATICVERSION => ' tag must contain version attribute', PEAR_CHANNELFILE_URI_CANT_MIRROR => 'The __uri pseudo-channel cannot have mirrors', PEAR_CHANNELFILE_ERROR_INVALID_SSL => '%server% has invalid ssl attribute "%ssl%" can only be yes or not present', ); } /** * @param string contents of package.xml file * @return bool success of parsing */ function fromXmlString($data) { if (preg_match('/_supportedVersions)) { $this->_stack->push(PEAR_CHANNELFILE_ERROR_INVALID_VERSION, 'error', array('version' => $channelversion[1])); return false; } $parser = new PEAR_XMLParser; $result = $parser->parse($data); if ($result !== true) { if ($result->getCode() == 1) { $this->_stack->push(PEAR_CHANNELFILE_ERROR_NO_XML_EXT, 'error', array('error' => $result->getMessage())); } else { $this->_stack->push(PEAR_CHANNELFILE_ERROR_CANT_MAKE_PARSER, 'error'); } return false; } $this->_channelInfo = $parser->getData(); return true; } else { $this->_stack->push(PEAR_CHANNELFILE_ERROR_NO_VERSION, 'error', array('xml' => $data)); return false; } } /** * @return array */ function toArray() { if (!$this->_isValid && !$this->validate()) { return false; } return $this->_channelInfo; } /** * @param array * * @return PEAR_ChannelFile|false false if invalid */ public static function &fromArray( $data, $compatibility = false, $stackClass = 'PEAR_ErrorStack' ) { $a = new PEAR_ChannelFile($compatibility, $stackClass); $a->_fromArray($data); if (!$a->validate()) { $a = false; return $a; } return $a; } /** * Unlike {@link fromArray()} this does not do any validation * * @param array * * @return PEAR_ChannelFile */ public static function &fromArrayWithErrors( $data, $compatibility = false, $stackClass = 'PEAR_ErrorStack' ) { $a = new PEAR_ChannelFile($compatibility, $stackClass); $a->_fromArray($data); return $a; } /** * @param array * @access private */ function _fromArray($data) { $this->_channelInfo = $data; } /** * Wrapper to {@link PEAR_ErrorStack::getErrors()} * @param boolean determines whether to purge the error stack after retrieving * @return array */ function getErrors($purge = false) { return $this->_stack->getErrors($purge); } /** * Unindent given string (?) * * @param string $str The string that has to be unindented. * @return string * @access private */ function _unIndent($str) { // remove leading newlines $str = preg_replace('/^[\r\n]+/', '', $str); // find whitespace at the beginning of the first line $indent_len = strspn($str, " \t"); $indent = substr($str, 0, $indent_len); $data = ''; // remove the same amount of whitespace from following lines foreach (explode("\n", $str) as $line) { if (substr($line, 0, $indent_len) == $indent) { $data .= substr($line, $indent_len) . "\n"; } } return $data; } /** * Parse a channel.xml file. Expects the name of * a channel xml file as input. * * @param string $descfile name of channel xml file * @return bool success of parsing */ function fromXmlFile($descfile) { if (!file_exists($descfile) || !is_file($descfile) || !is_readable($descfile) || (!$fp = fopen($descfile, 'r'))) { require_once 'PEAR.php'; return PEAR::raiseError("Unable to open $descfile"); } // read the whole thing so we only get one cdata callback // for each block of cdata fclose($fp); $data = file_get_contents($descfile); return $this->fromXmlString($data); } /** * Parse channel information from different sources * * This method is able to extract information about a channel * from an .xml file or a string * * @access public * @param string Filename of the source or the source itself * @return bool */ function fromAny($info) { if (is_string($info) && file_exists($info) && strlen($info) < 255) { $tmp = substr($info, -4); if ($tmp == '.xml') { $info = $this->fromXmlFile($info); } else { $fp = fopen($info, "r"); $test = fread($fp, 5); fclose($fp); if ($test == "fromXmlFile($info); } } if (PEAR::isError($info)) { require_once 'PEAR.php'; return PEAR::raiseError($info); } } if (is_string($info)) { $info = $this->fromXmlString($info); } return $info; } /** * Return an XML document based on previous parsing and modifications * * @return string XML data * * @access public */ function toXml() { if (!$this->_isValid && !$this->validate()) { $this->_validateError(PEAR_CHANNELFILE_ERROR_INVALID); return false; } if (!isset($this->_channelInfo['attribs']['version'])) { $this->_channelInfo['attribs']['version'] = '1.0'; } $channelInfo = $this->_channelInfo; $ret = "\n"; $ret .= " $channelInfo[name] " . htmlspecialchars($channelInfo['summary'])." "; if (isset($channelInfo['suggestedalias'])) { $ret .= ' ' . $channelInfo['suggestedalias'] . "\n"; } if (isset($channelInfo['validatepackage'])) { $ret .= ' ' . htmlspecialchars($channelInfo['validatepackage']['_content']) . "\n"; } $ret .= " \n"; $ret .= ' _makeRestXml($channelInfo['servers']['primary']['rest'], ' '); } $ret .= " \n"; if (isset($channelInfo['servers']['mirror'])) { $ret .= $this->_makeMirrorsXml($channelInfo); } $ret .= " \n"; $ret .= ""; return str_replace("\r", "\n", str_replace("\r\n", "\n", $ret)); } /** * Generate the tag * @access private */ function _makeRestXml($info, $indent) { $ret = $indent . "\n"; if (isset($info['baseurl']) && !isset($info['baseurl'][0])) { $info['baseurl'] = array($info['baseurl']); } if (isset($info['baseurl'])) { foreach ($info['baseurl'] as $url) { $ret .= "$indent \n"; } } $ret .= $indent . "\n"; return $ret; } /** * Generate the tag * @access private */ function _makeMirrorsXml($channelInfo) { $ret = ""; if (!isset($channelInfo['servers']['mirror'][0])) { $channelInfo['servers']['mirror'] = array($channelInfo['servers']['mirror']); } foreach ($channelInfo['servers']['mirror'] as $mirror) { $ret .= ' _makeRestXml($mirror['rest'], ' '); } $ret .= " \n"; } else { $ret .= "/>\n"; } } return $ret; } /** * Generate the tag * @access private */ function _makeFunctionsXml($functions, $indent, $rest = false) { $ret = ''; if (!isset($functions[0])) { $functions = array($functions); } foreach ($functions as $function) { $ret .= "$indent\n"; } return $ret; } /** * Validation error. Also marks the object contents as invalid * @param error code * @param array error information * @access private */ function _validateError($code, $params = array()) { $this->_stack->push($code, 'error', $params); $this->_isValid = false; } /** * Validation warning. Does not mark the object contents invalid. * @param error code * @param array error information * @access private */ function _validateWarning($code, $params = array()) { $this->_stack->push($code, 'warning', $params); } /** * Validate parsed file. * * @access public * @return boolean */ function validate() { $this->_isValid = true; $info = $this->_channelInfo; if (empty($info['name'])) { $this->_validateError(PEAR_CHANNELFILE_ERROR_NO_NAME); } elseif (!$this->validChannelServer($info['name'])) { if ($info['name'] != '__uri') { $this->_validateError(PEAR_CHANNELFILE_ERROR_INVALID_NAME, array('tag' => 'name', 'name' => $info['name'])); } } if (empty($info['summary'])) { $this->_validateError(PEAR_CHANNELFILE_ERROR_NO_SUMMARY); } elseif (strpos(trim($info['summary']), "\n") !== false) { $this->_validateWarning(PEAR_CHANNELFILE_ERROR_MULTILINE_SUMMARY, array('summary' => $info['summary'])); } if (isset($info['suggestedalias'])) { if (!$this->validChannelServer($info['suggestedalias'])) { $this->_validateError(PEAR_CHANNELFILE_ERROR_INVALID_NAME, array('tag' => 'suggestedalias', 'name' =>$info['suggestedalias'])); } } if (isset($info['localalias'])) { if (!$this->validChannelServer($info['localalias'])) { $this->_validateError(PEAR_CHANNELFILE_ERROR_INVALID_NAME, array('tag' => 'localalias', 'name' =>$info['localalias'])); } } if (isset($info['validatepackage'])) { if (!isset($info['validatepackage']['_content'])) { $this->_validateError(PEAR_CHANNELFILE_ERROR_NOVALIDATE_NAME); } if (!isset($info['validatepackage']['attribs']['version'])) { $content = isset($info['validatepackage']['_content']) ? $info['validatepackage']['_content'] : null; $this->_validateError(PEAR_CHANNELFILE_ERROR_NOVALIDATE_VERSION, array('package' => $content)); } } if (isset($info['servers']['primary']['attribs'], $info['servers']['primary']['attribs']['port']) && !is_numeric($info['servers']['primary']['attribs']['port'])) { $this->_validateError(PEAR_CHANNELFILE_ERROR_INVALID_PORT, array('port' => $info['servers']['primary']['attribs']['port'])); } if (isset($info['servers']['primary']['attribs'], $info['servers']['primary']['attribs']['ssl']) && $info['servers']['primary']['attribs']['ssl'] != 'yes') { $this->_validateError(PEAR_CHANNELFILE_ERROR_INVALID_SSL, array('ssl' => $info['servers']['primary']['attribs']['ssl'], 'server' => $info['name'])); } if (isset($info['servers']['primary']['rest']) && isset($info['servers']['primary']['rest']['baseurl'])) { $this->_validateFunctions('rest', $info['servers']['primary']['rest']['baseurl']); } if (isset($info['servers']['mirror'])) { if ($this->_channelInfo['name'] == '__uri') { $this->_validateError(PEAR_CHANNELFILE_URI_CANT_MIRROR); } if (!isset($info['servers']['mirror'][0])) { $info['servers']['mirror'] = array($info['servers']['mirror']); } foreach ($info['servers']['mirror'] as $mirror) { if (!isset($mirror['attribs']['host'])) { $this->_validateError(PEAR_CHANNELFILE_ERROR_NO_HOST, array('type' => 'mirror')); } elseif (!$this->validChannelServer($mirror['attribs']['host'])) { $this->_validateError(PEAR_CHANNELFILE_ERROR_INVALID_HOST, array('server' => $mirror['attribs']['host'], 'type' => 'mirror')); } if (isset($mirror['attribs']['ssl']) && $mirror['attribs']['ssl'] != 'yes') { $this->_validateError(PEAR_CHANNELFILE_ERROR_INVALID_SSL, array('ssl' => $info['ssl'], 'server' => $mirror['attribs']['host'])); } if (isset($mirror['rest'])) { $this->_validateFunctions('rest', $mirror['rest']['baseurl'], $mirror['attribs']['host']); } } } return $this->_isValid; } /** * @param string rest - protocol name this function applies to * @param array the functions * @param string the name of the parent element (mirror name, for instance) */ function _validateFunctions($protocol, $functions, $parent = '') { if (!isset($functions[0])) { $functions = array($functions); } foreach ($functions as $function) { if (!isset($function['_content']) || empty($function['_content'])) { $this->_validateError(PEAR_CHANNELFILE_ERROR_NO_FUNCTIONNAME, array('parent' => $parent, 'protocol' => $protocol)); } if ($protocol == 'rest') { if (!isset($function['attribs']['type']) || empty($function['attribs']['type'])) { $this->_validateError(PEAR_CHANNELFILE_ERROR_NOBASEURLTYPE, array('parent' => $parent, 'protocol' => $protocol)); } } else { if (!isset($function['attribs']['version']) || empty($function['attribs']['version'])) { $this->_validateError(PEAR_CHANNELFILE_ERROR_NO_FUNCTIONVERSION, array('parent' => $parent, 'protocol' => $protocol)); } } } } /** * Test whether a string contains a valid channel server. * @param string $ver the package version to test * @return bool */ function validChannelServer($server) { if ($server == '__uri') { return true; } return (bool) preg_match(PEAR_CHANNELS_SERVER_PREG, $server); } /** * @return string|false */ function getName() { if (isset($this->_channelInfo['name'])) { return $this->_channelInfo['name']; } return false; } /** * @return string|false */ function getServer() { if (isset($this->_channelInfo['name'])) { return $this->_channelInfo['name']; } return false; } /** * @return int|80 port number to connect to */ function getPort($mirror = false) { if ($mirror) { if ($mir = $this->getMirror($mirror)) { if (isset($mir['attribs']['port'])) { return $mir['attribs']['port']; } if ($this->getSSL($mirror)) { return 443; } return 80; } return false; } if (isset($this->_channelInfo['servers']['primary']['attribs']['port'])) { return $this->_channelInfo['servers']['primary']['attribs']['port']; } if ($this->getSSL()) { return 443; } return 80; } /** * @return bool Determines whether secure sockets layer (SSL) is used to connect to this channel */ function getSSL($mirror = false) { if ($mirror) { if ($mir = $this->getMirror($mirror)) { if (isset($mir['attribs']['ssl'])) { return true; } return false; } return false; } if (isset($this->_channelInfo['servers']['primary']['attribs']['ssl'])) { return true; } return false; } /** * @return string|false */ function getSummary() { if (isset($this->_channelInfo['summary'])) { return $this->_channelInfo['summary']; } return false; } /** * @param string protocol type * @param string Mirror name * @return array|false */ function getFunctions($protocol, $mirror = false) { if ($this->getName() == '__uri') { return false; } $function = $protocol == 'rest' ? 'baseurl' : 'function'; if ($mirror) { if ($mir = $this->getMirror($mirror)) { if (isset($mir[$protocol][$function])) { return $mir[$protocol][$function]; } } return false; } if (isset($this->_channelInfo['servers']['primary'][$protocol][$function])) { return $this->_channelInfo['servers']['primary'][$protocol][$function]; } return false; } /** * @param string Protocol type * @param string Function name (null to return the * first protocol of the type requested) * @param string Mirror name, if any * @return array */ function getFunction($type, $name = null, $mirror = false) { $protocols = $this->getFunctions($type, $mirror); if (!$protocols) { return false; } foreach ($protocols as $protocol) { if ($name === null) { return $protocol; } if ($protocol['_content'] != $name) { continue; } return $protocol; } return false; } /** * @param string protocol type * @param string protocol name * @param string version * @param string mirror name * @return boolean */ function supports($type, $name = null, $mirror = false, $version = '1.0') { $protocols = $this->getFunctions($type, $mirror); if (!$protocols) { return false; } foreach ($protocols as $protocol) { if ($protocol['attribs']['version'] != $version) { continue; } if ($name === null) { return true; } if ($protocol['_content'] != $name) { continue; } return true; } return false; } /** * Determines whether a channel supports Representational State Transfer (REST) protocols * for retrieving channel information * @param string * @return bool */ function supportsREST($mirror = false) { if ($mirror == $this->_channelInfo['name']) { $mirror = false; } if ($mirror) { if ($mir = $this->getMirror($mirror)) { return isset($mir['rest']); } return false; } return isset($this->_channelInfo['servers']['primary']['rest']); } /** * Get the URL to access a base resource. * * Hyperlinks in the returned xml will be used to retrieve the proper information * needed. This allows extreme extensibility and flexibility in implementation * @param string Resource Type to retrieve */ function getBaseURL($resourceType, $mirror = false) { if ($mirror == $this->_channelInfo['name']) { $mirror = false; } if ($mirror) { $mir = $this->getMirror($mirror); if (!$mir) { return false; } $rest = $mir['rest']; } else { $rest = $this->_channelInfo['servers']['primary']['rest']; } if (!isset($rest['baseurl'][0])) { $rest['baseurl'] = array($rest['baseurl']); } foreach ($rest['baseurl'] as $baseurl) { if (strtolower($baseurl['attribs']['type']) == strtolower($resourceType)) { return $baseurl['_content']; } } return false; } /** * Since REST does not implement RPC, provide this as a logical wrapper around * resetFunctions for REST * @param string|false mirror name, if any */ function resetREST($mirror = false) { return $this->resetFunctions('rest', $mirror); } /** * Empty all protocol definitions * @param string protocol type * @param string|false mirror name, if any */ function resetFunctions($type, $mirror = false) { if ($mirror) { if (isset($this->_channelInfo['servers']['mirror'])) { $mirrors = $this->_channelInfo['servers']['mirror']; if (!isset($mirrors[0])) { $mirrors = array($mirrors); } foreach ($mirrors as $i => $mir) { if ($mir['attribs']['host'] == $mirror) { if (isset($this->_channelInfo['servers']['mirror'][$i][$type])) { unset($this->_channelInfo['servers']['mirror'][$i][$type]); } return true; } } return false; } return false; } if (isset($this->_channelInfo['servers']['primary'][$type])) { unset($this->_channelInfo['servers']['primary'][$type]); } return true; } /** * Set a channel's protocols to the protocols supported by pearweb */ function setDefaultPEARProtocols($version = '1.0', $mirror = false) { switch ($version) { case '1.0' : $this->resetREST($mirror); if (!isset($this->_channelInfo['servers'])) { $this->_channelInfo['servers'] = array('primary' => array('rest' => array())); } elseif (!isset($this->_channelInfo['servers']['primary'])) { $this->_channelInfo['servers']['primary'] = array('rest' => array()); } return true; break; default : return false; break; } } /** * @return array */ function getMirrors() { if (isset($this->_channelInfo['servers']['mirror'])) { $mirrors = $this->_channelInfo['servers']['mirror']; if (!isset($mirrors[0])) { $mirrors = array($mirrors); } return $mirrors; } return array(); } /** * Get the unserialized XML representing a mirror * @return array|false */ function getMirror($server) { foreach ($this->getMirrors() as $mirror) { if ($mirror['attribs']['host'] == $server) { return $mirror; } } return false; } /** * @param string * @return string|false * @error PEAR_CHANNELFILE_ERROR_NO_NAME * @error PEAR_CHANNELFILE_ERROR_INVALID_NAME */ function setName($name) { return $this->setServer($name); } /** * Set the socket number (port) that is used to connect to this channel * @param integer * @param string|false name of the mirror server, or false for the primary */ function setPort($port, $mirror = false) { if ($mirror) { if (!isset($this->_channelInfo['servers']['mirror'])) { $this->_validateError(PEAR_CHANNELFILE_ERROR_MIRROR_NOT_FOUND, array('mirror' => $mirror)); return false; } if (isset($this->_channelInfo['servers']['mirror'][0])) { foreach ($this->_channelInfo['servers']['mirror'] as $i => $mir) { if ($mirror == $mir['attribs']['host']) { $this->_channelInfo['servers']['mirror'][$i]['attribs']['port'] = $port; return true; } } return false; } elseif ($this->_channelInfo['servers']['mirror']['attribs']['host'] == $mirror) { $this->_channelInfo['servers']['mirror']['attribs']['port'] = $port; $this->_isValid = false; return true; } } $this->_channelInfo['servers']['primary']['attribs']['port'] = $port; $this->_isValid = false; return true; } /** * Set the socket number (port) that is used to connect to this channel * @param bool Determines whether to turn on SSL support or turn it off * @param string|false name of the mirror server, or false for the primary */ function setSSL($ssl = true, $mirror = false) { if ($mirror) { if (!isset($this->_channelInfo['servers']['mirror'])) { $this->_validateError(PEAR_CHANNELFILE_ERROR_MIRROR_NOT_FOUND, array('mirror' => $mirror)); return false; } if (isset($this->_channelInfo['servers']['mirror'][0])) { foreach ($this->_channelInfo['servers']['mirror'] as $i => $mir) { if ($mirror == $mir['attribs']['host']) { if (!$ssl) { if (isset($this->_channelInfo['servers']['mirror'][$i] ['attribs']['ssl'])) { unset($this->_channelInfo['servers']['mirror'][$i]['attribs']['ssl']); } } else { $this->_channelInfo['servers']['mirror'][$i]['attribs']['ssl'] = 'yes'; } return true; } } return false; } elseif ($this->_channelInfo['servers']['mirror']['attribs']['host'] == $mirror) { if (!$ssl) { if (isset($this->_channelInfo['servers']['mirror']['attribs']['ssl'])) { unset($this->_channelInfo['servers']['mirror']['attribs']['ssl']); } } else { $this->_channelInfo['servers']['mirror']['attribs']['ssl'] = 'yes'; } $this->_isValid = false; return true; } } if ($ssl) { $this->_channelInfo['servers']['primary']['attribs']['ssl'] = 'yes'; } else { if (isset($this->_channelInfo['servers']['primary']['attribs']['ssl'])) { unset($this->_channelInfo['servers']['primary']['attribs']['ssl']); } } $this->_isValid = false; return true; } /** * @param string * @return string|false * @error PEAR_CHANNELFILE_ERROR_NO_SERVER * @error PEAR_CHANNELFILE_ERROR_INVALID_SERVER */ function setServer($server, $mirror = false) { if (empty($server)) { $this->_validateError(PEAR_CHANNELFILE_ERROR_NO_SERVER); return false; } elseif (!$this->validChannelServer($server)) { $this->_validateError(PEAR_CHANNELFILE_ERROR_INVALID_NAME, array('tag' => 'name', 'name' => $server)); return false; } if ($mirror) { $found = false; foreach ($this->_channelInfo['servers']['mirror'] as $i => $mir) { if ($mirror == $mir['attribs']['host']) { $found = true; break; } } if (!$found) { $this->_validateError(PEAR_CHANNELFILE_ERROR_MIRROR_NOT_FOUND, array('mirror' => $mirror)); return false; } $this->_channelInfo['mirror'][$i]['attribs']['host'] = $server; return true; } $this->_channelInfo['name'] = $server; return true; } /** * @param string * @return boolean success * @error PEAR_CHANNELFILE_ERROR_NO_SUMMARY * @warning PEAR_CHANNELFILE_ERROR_MULTILINE_SUMMARY */ function setSummary($summary) { if (empty($summary)) { $this->_validateError(PEAR_CHANNELFILE_ERROR_NO_SUMMARY); return false; } elseif (strpos(trim($summary), "\n") !== false) { $this->_validateWarning(PEAR_CHANNELFILE_ERROR_MULTILINE_SUMMARY, array('summary' => $summary)); } $this->_channelInfo['summary'] = $summary; return true; } /** * @param string * @param boolean determines whether the alias is in channel.xml or local * @return boolean success */ function setAlias($alias, $local = false) { if (!$this->validChannelServer($alias)) { $this->_validateError(PEAR_CHANNELFILE_ERROR_INVALID_NAME, array('tag' => 'suggestedalias', 'name' => $alias)); return false; } if ($local) { $this->_channelInfo['localalias'] = $alias; } else { $this->_channelInfo['suggestedalias'] = $alias; } return true; } /** * @return string */ function getAlias() { if (isset($this->_channelInfo['localalias'])) { return $this->_channelInfo['localalias']; } if (isset($this->_channelInfo['suggestedalias'])) { return $this->_channelInfo['suggestedalias']; } if (isset($this->_channelInfo['name'])) { return $this->_channelInfo['name']; } return ''; } /** * Set the package validation object if it differs from PEAR's default * The class must be includeable via changing _ in the classname to path separator, * but no checking of this is made. * @param string|false pass in false to reset to the default packagename regex * @return boolean success */ function setValidationPackage($validateclass, $version) { if (empty($validateclass)) { unset($this->_channelInfo['validatepackage']); } $this->_channelInfo['validatepackage'] = array('_content' => $validateclass); $this->_channelInfo['validatepackage']['attribs'] = array('version' => $version); } /** * Add a protocol to the provides section * @param string protocol type * @param string protocol version * @param string protocol name, if any * @param string mirror name, if this is a mirror's protocol * @return bool */ function addFunction($type, $version, $name = '', $mirror = false) { if ($mirror) { return $this->addMirrorFunction($mirror, $type, $version, $name); } $set = array('attribs' => array('version' => $version), '_content' => $name); if (!isset($this->_channelInfo['servers']['primary'][$type]['function'])) { if (!isset($this->_channelInfo['servers'])) { $this->_channelInfo['servers'] = array('primary' => array($type => array())); } elseif (!isset($this->_channelInfo['servers']['primary'])) { $this->_channelInfo['servers']['primary'] = array($type => array()); } $this->_channelInfo['servers']['primary'][$type]['function'] = $set; $this->_isValid = false; return true; } elseif (!isset($this->_channelInfo['servers']['primary'][$type]['function'][0])) { $this->_channelInfo['servers']['primary'][$type]['function'] = array( $this->_channelInfo['servers']['primary'][$type]['function']); } $this->_channelInfo['servers']['primary'][$type]['function'][] = $set; return true; } /** * Add a protocol to a mirror's provides section * @param string mirror name (server) * @param string protocol type * @param string protocol version * @param string protocol name, if any */ function addMirrorFunction($mirror, $type, $version, $name = '') { if (!isset($this->_channelInfo['servers']['mirror'])) { $this->_validateError(PEAR_CHANNELFILE_ERROR_MIRROR_NOT_FOUND, array('mirror' => $mirror)); return false; } $setmirror = false; if (isset($this->_channelInfo['servers']['mirror'][0])) { foreach ($this->_channelInfo['servers']['mirror'] as $i => $mir) { if ($mirror == $mir['attribs']['host']) { $setmirror = &$this->_channelInfo['servers']['mirror'][$i]; break; } } } else { if ($this->_channelInfo['servers']['mirror']['attribs']['host'] == $mirror) { $setmirror = &$this->_channelInfo['servers']['mirror']; } } if (!$setmirror) { $this->_validateError(PEAR_CHANNELFILE_ERROR_MIRROR_NOT_FOUND, array('mirror' => $mirror)); return false; } $set = array('attribs' => array('version' => $version), '_content' => $name); if (!isset($setmirror[$type]['function'])) { $setmirror[$type]['function'] = $set; $this->_isValid = false; return true; } elseif (!isset($setmirror[$type]['function'][0])) { $setmirror[$type]['function'] = array($setmirror[$type]['function']); } $setmirror[$type]['function'][] = $set; $this->_isValid = false; return true; } /** * @param string Resource Type this url links to * @param string URL * @param string|false mirror name, if this is not a primary server REST base URL */ function setBaseURL($resourceType, $url, $mirror = false) { if ($mirror) { if (!isset($this->_channelInfo['servers']['mirror'])) { $this->_validateError(PEAR_CHANNELFILE_ERROR_MIRROR_NOT_FOUND, array('mirror' => $mirror)); return false; } $setmirror = false; if (isset($this->_channelInfo['servers']['mirror'][0])) { foreach ($this->_channelInfo['servers']['mirror'] as $i => $mir) { if ($mirror == $mir['attribs']['host']) { $setmirror = &$this->_channelInfo['servers']['mirror'][$i]; break; } } } else { if ($this->_channelInfo['servers']['mirror']['attribs']['host'] == $mirror) { $setmirror = &$this->_channelInfo['servers']['mirror']; } } } else { $setmirror = &$this->_channelInfo['servers']['primary']; } $set = array('attribs' => array('type' => $resourceType), '_content' => $url); if (!isset($setmirror['rest'])) { $setmirror['rest'] = array(); } if (!isset($setmirror['rest']['baseurl'])) { $setmirror['rest']['baseurl'] = $set; $this->_isValid = false; return true; } elseif (!isset($setmirror['rest']['baseurl'][0])) { $setmirror['rest']['baseurl'] = array($setmirror['rest']['baseurl']); } foreach ($setmirror['rest']['baseurl'] as $i => $url) { if ($url['attribs']['type'] == $resourceType) { $this->_isValid = false; $setmirror['rest']['baseurl'][$i] = $set; return true; } } $setmirror['rest']['baseurl'][] = $set; $this->_isValid = false; return true; } /** * @param string mirror server * @param int mirror http port * @return boolean */ function addMirror($server, $port = null) { if ($this->_channelInfo['name'] == '__uri') { return false; // the __uri channel cannot have mirrors by definition } $set = array('attribs' => array('host' => $server)); if (is_numeric($port)) { $set['attribs']['port'] = $port; } if (!isset($this->_channelInfo['servers']['mirror'])) { $this->_channelInfo['servers']['mirror'] = $set; return true; } if (!isset($this->_channelInfo['servers']['mirror'][0])) { $this->_channelInfo['servers']['mirror'] = array($this->_channelInfo['servers']['mirror']); } $this->_channelInfo['servers']['mirror'][] = $set; return true; } /** * Retrieve the name of the validation package for this channel * @return string|false */ function getValidationPackage() { if (!$this->_isValid && !$this->validate()) { return false; } if (!isset($this->_channelInfo['validatepackage'])) { return array('attribs' => array('version' => 'default'), '_content' => 'PEAR_Validate'); } return $this->_channelInfo['validatepackage']; } /** * Retrieve the object that can be used for custom validation * @param string|false the name of the package to validate. If the package is * the channel validation package, PEAR_Validate is returned * @return PEAR_Validate|false false is returned if the validation package * cannot be located */ function &getValidationObject($package = false) { if (!class_exists('PEAR_Validate')) { require_once 'PEAR/Validate.php'; } if (!$this->_isValid) { if (!$this->validate()) { $a = false; return $a; } } if (isset($this->_channelInfo['validatepackage'])) { if ($package == $this->_channelInfo['validatepackage']) { // channel validation packages are always validated by PEAR_Validate $val = new PEAR_Validate; return $val; } if (!class_exists(str_replace('.', '_', $this->_channelInfo['validatepackage']['_content']))) { if ($this->isIncludeable(str_replace('_', '/', $this->_channelInfo['validatepackage']['_content']) . '.php')) { include_once str_replace('_', '/', $this->_channelInfo['validatepackage']['_content']) . '.php'; $vclass = str_replace('.', '_', $this->_channelInfo['validatepackage']['_content']); $val = new $vclass; } else { $a = false; return $a; } } else { $vclass = str_replace('.', '_', $this->_channelInfo['validatepackage']['_content']); $val = new $vclass; } } else { $val = new PEAR_Validate; } return $val; } function isIncludeable($path) { $possibilities = explode(PATH_SEPARATOR, ini_get('include_path')); foreach ($possibilities as $dir) { if (file_exists($dir . DIRECTORY_SEPARATOR . $path) && is_readable($dir . DIRECTORY_SEPARATOR . $path)) { return true; } } return false; } /** * This function is used by the channel updater and retrieves a value set by * the registry, or the current time if it has not been set * @return string */ function lastModified() { if (isset($this->_channelInfo['_lastmodified'])) { return $this->_channelInfo['_lastmodified']; } return time(); } } php-pear-1.10.1+submodules+notgz/PEAR/ChannelFile/000077500000000000000000000000001262614675700215405ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/PEAR/ChannelFile/Parser.php000066400000000000000000000032661262614675700235140ustar00rootroot00000000000000 * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ /** * base xml parser class */ require_once 'PEAR/XMLParser.php'; require_once 'PEAR/ChannelFile.php'; /** * Parser for channel.xml * @category pear * @package PEAR * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version Release: @package_version@ * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ class PEAR_ChannelFile_Parser extends PEAR_XMLParser { var $_config; var $_logger; var $_registry; function setConfig(&$c) { $this->_config = &$c; $this->_registry = &$c->getRegistry(); } function setLogger(&$l) { $this->_logger = &$l; } function parse($data, $file) { if (PEAR::isError($err = parent::parse($data, $file))) { return $err; } $ret = new PEAR_ChannelFile; $ret->setConfig($this->_config); if (isset($this->_logger)) { $ret->setLogger($this->_logger); } $ret->fromArray($this->_unserializedData); // make sure the filelist is in the easy to read format needed $ret->flattenFilelist(); $ret->setPackagefile($file, $archive); return $ret; } }php-pear-1.10.1+submodules+notgz/PEAR/Command.php000066400000000000000000000302251262614675700214610ustar00rootroot00000000000000 * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @link http://pear.php.net/package/PEAR * @since File available since Release 0.1 */ /** * Needed for error handling */ require_once 'PEAR.php'; require_once 'PEAR/Frontend.php'; require_once 'PEAR/XMLParser.php'; /** * List of commands and what classes they are implemented in. * @var array command => implementing class */ $GLOBALS['_PEAR_Command_commandlist'] = array(); /** * List of commands and their descriptions * @var array command => description */ $GLOBALS['_PEAR_Command_commanddesc'] = array(); /** * List of shortcuts to common commands. * @var array shortcut => command */ $GLOBALS['_PEAR_Command_shortcuts'] = array(); /** * Array of command objects * @var array class => object */ $GLOBALS['_PEAR_Command_objects'] = array(); /** * PEAR command class, a simple factory class for administrative * commands. * * How to implement command classes: * * - The class must be called PEAR_Command_Nnn, installed in the * "PEAR/Common" subdir, with a method called getCommands() that * returns an array of the commands implemented by the class (see * PEAR/Command/Install.php for an example). * * - The class must implement a run() function that is called with three * params: * * (string) command name * (array) assoc array with options, freely defined by each * command, for example: * array('force' => true) * (array) list of the other parameters * * The run() function returns a PEAR_CommandResponse object. Use * these methods to get information: * * int getStatus() Returns PEAR_COMMAND_(SUCCESS|FAILURE|PARTIAL) * *_PARTIAL means that you need to issue at least * one more command to complete the operation * (used for example for validation steps). * * string getMessage() Returns a message for the user. Remember, * no HTML or other interface-specific markup. * * If something unexpected happens, run() returns a PEAR error. * * - DON'T OUTPUT ANYTHING! Return text for output instead. * * - DON'T USE HTML! The text you return will be used from both Gtk, * web and command-line interfaces, so for now, keep everything to * plain text. * * - DON'T USE EXIT OR DIE! Always use pear errors. From static * classes do PEAR::raiseError(), from other classes do * $this->raiseError(). * @category pear * @package PEAR * @author Stig Bakken * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version Release: @package_version@ * @link http://pear.php.net/package/PEAR * @since Class available since Release 0.1 */ class PEAR_Command { // {{{ factory() /** * Get the right object for executing a command. * * @param string $command The name of the command * @param object $config Instance of PEAR_Config object * * @return object the command object or a PEAR error */ public static function &factory($command, &$config) { if (empty($GLOBALS['_PEAR_Command_commandlist'])) { PEAR_Command::registerCommands(); } if (isset($GLOBALS['_PEAR_Command_shortcuts'][$command])) { $command = $GLOBALS['_PEAR_Command_shortcuts'][$command]; } if (!isset($GLOBALS['_PEAR_Command_commandlist'][$command])) { $a = PEAR::raiseError("unknown command `$command'"); return $a; } $class = $GLOBALS['_PEAR_Command_commandlist'][$command]; if (!class_exists($class)) { require_once $GLOBALS['_PEAR_Command_objects'][$class]; } if (!class_exists($class)) { $a = PEAR::raiseError("unknown command `$command'"); return $a; } $ui =& PEAR_Command::getFrontendObject(); $obj = new $class($ui, $config); return $obj; } // }}} // {{{ & getObject() public static function &getObject($command) { $class = $GLOBALS['_PEAR_Command_commandlist'][$command]; if (!class_exists($class)) { require_once $GLOBALS['_PEAR_Command_objects'][$class]; } if (!class_exists($class)) { return PEAR::raiseError("unknown command `$command'"); } $ui =& PEAR_Command::getFrontendObject(); $config = &PEAR_Config::singleton(); $obj = new $class($ui, $config); return $obj; } // }}} // {{{ & getFrontendObject() /** * Get instance of frontend object. * * @return object|PEAR_Error */ public static function &getFrontendObject() { $a = &PEAR_Frontend::singleton(); return $a; } // }}} // {{{ & setFrontendClass() /** * Load current frontend class. * * @param string $uiclass Name of class implementing the frontend * * @return object the frontend object, or a PEAR error */ public static function &setFrontendClass($uiclass) { $a = &PEAR_Frontend::setFrontendClass($uiclass); return $a; } // }}} // {{{ setFrontendType() /** * Set current frontend. * * @param string $uitype Name of the frontend type (for example "CLI") * * @return object the frontend object, or a PEAR error */ public static function setFrontendType($uitype) { $uiclass = 'PEAR_Frontend_' . $uitype; return PEAR_Command::setFrontendClass($uiclass); } // }}} // {{{ registerCommands() /** * Scan through the Command directory looking for classes * and see what commands they implement. * * @param bool (optional) if FALSE (default), the new list of * commands should replace the current one. If TRUE, * new entries will be merged with old. * * @param string (optional) where (what directory) to look for * classes, defaults to the Command subdirectory of * the directory from where this file (__FILE__) is * included. * * @return bool TRUE on success, a PEAR error on failure */ public static function registerCommands($merge = false, $dir = null) { $parser = new PEAR_XMLParser; if ($dir === null) { $dir = dirname(__FILE__) . '/Command'; } if (!is_dir($dir)) { return PEAR::raiseError("registerCommands: opendir($dir) '$dir' does not exist or is not a directory"); } $dp = @opendir($dir); if (empty($dp)) { return PEAR::raiseError("registerCommands: opendir($dir) failed"); } if (!$merge) { $GLOBALS['_PEAR_Command_commandlist'] = array(); } while ($file = readdir($dp)) { if ($file{0} == '.' || substr($file, -4) != '.xml') { continue; } $f = substr($file, 0, -4); $class = "PEAR_Command_" . $f; // List of commands if (empty($GLOBALS['_PEAR_Command_objects'][$class])) { $GLOBALS['_PEAR_Command_objects'][$class] = "$dir/" . $f . '.php'; } $parser->parse(file_get_contents("$dir/$file")); $implements = $parser->getData(); foreach ($implements as $command => $desc) { if ($command == 'attribs') { continue; } if (isset($GLOBALS['_PEAR_Command_commandlist'][$command])) { return PEAR::raiseError('Command "' . $command . '" already registered in ' . 'class "' . $GLOBALS['_PEAR_Command_commandlist'][$command] . '"'); } $GLOBALS['_PEAR_Command_commandlist'][$command] = $class; $GLOBALS['_PEAR_Command_commanddesc'][$command] = $desc['summary']; if (isset($desc['shortcut'])) { $shortcut = $desc['shortcut']; if (isset($GLOBALS['_PEAR_Command_shortcuts'][$shortcut])) { return PEAR::raiseError('Command shortcut "' . $shortcut . '" already ' . 'registered to command "' . $command . '" in class "' . $GLOBALS['_PEAR_Command_commandlist'][$command] . '"'); } $GLOBALS['_PEAR_Command_shortcuts'][$shortcut] = $command; } if (isset($desc['options']) && $desc['options']) { foreach ($desc['options'] as $oname => $option) { if (isset($option['shortopt']) && strlen($option['shortopt']) > 1) { return PEAR::raiseError('Option "' . $oname . '" short option "' . $option['shortopt'] . '" must be ' . 'only 1 character in Command "' . $command . '" in class "' . $class . '"'); } } } } } ksort($GLOBALS['_PEAR_Command_shortcuts']); ksort($GLOBALS['_PEAR_Command_commandlist']); @closedir($dp); return true; } // }}} // {{{ getCommands() /** * Get the list of currently supported commands, and what * classes implement them. * * @return array command => implementing class */ public static function getCommands() { if (empty($GLOBALS['_PEAR_Command_commandlist'])) { PEAR_Command::registerCommands(); } return $GLOBALS['_PEAR_Command_commandlist']; } // }}} // {{{ getShortcuts() /** * Get the list of command shortcuts. * * @return array shortcut => command */ public static function getShortcuts() { if (empty($GLOBALS['_PEAR_Command_shortcuts'])) { PEAR_Command::registerCommands(); } return $GLOBALS['_PEAR_Command_shortcuts']; } // }}} // {{{ getGetoptArgs() /** * Compiles arguments for getopt. * * @param string $command command to get optstring for * @param string $short_args (reference) short getopt format * @param array $long_args (reference) long getopt format * * @return void */ public static function getGetoptArgs($command, &$short_args, &$long_args) { if (empty($GLOBALS['_PEAR_Command_commandlist'])) { PEAR_Command::registerCommands(); } if (isset($GLOBALS['_PEAR_Command_shortcuts'][$command])) { $command = $GLOBALS['_PEAR_Command_shortcuts'][$command]; } if (!isset($GLOBALS['_PEAR_Command_commandlist'][$command])) { return null; } $obj = &PEAR_Command::getObject($command); return $obj->getGetoptArgs($command, $short_args, $long_args); } // }}} // {{{ getDescription() /** * Get description for a command. * * @param string $command Name of the command * * @return string command description */ public static function getDescription($command) { if (!isset($GLOBALS['_PEAR_Command_commanddesc'][$command])) { return null; } return $GLOBALS['_PEAR_Command_commanddesc'][$command]; } // }}} // {{{ getHelp() /** * Get help for command. * * @param string $command Name of the command to return help for */ public static function getHelp($command) { $cmds = PEAR_Command::getCommands(); if (isset($GLOBALS['_PEAR_Command_shortcuts'][$command])) { $command = $GLOBALS['_PEAR_Command_shortcuts'][$command]; } if (isset($cmds[$command])) { $obj = &PEAR_Command::getObject($command); return $obj->getHelp($command); } return false; } // }}} }php-pear-1.10.1+submodules+notgz/PEAR/Command/000077500000000000000000000000001262614675700207465ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/PEAR/Command/Auth.php000066400000000000000000000050251262614675700223620ustar00rootroot00000000000000 * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @link http://pear.php.net/package/PEAR * @since File available since Release 0.1 * @deprecated since 1.8.0alpha1 */ /** * base class */ require_once 'PEAR/Command/Channels.php'; /** * PEAR commands for login/logout * * @category pear * @package PEAR * @author Stig Bakken * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version Release: @package_version@ * @link http://pear.php.net/package/PEAR * @since Class available since Release 0.1 * @deprecated since 1.8.0alpha1 */ class PEAR_Command_Auth extends PEAR_Command_Channels { var $commands = array( 'login' => array( 'summary' => 'Connects and authenticates to remote server [Deprecated in favor of channel-login]', 'shortcut' => 'li', 'function' => 'doLogin', 'options' => array(), 'doc' => ' WARNING: This function is deprecated in favor of using channel-login Log in to a remote channel server. If is not supplied, the default channel is used. To use remote functions in the installer that require any kind of privileges, you need to log in first. The username and password you enter here will be stored in your per-user PEAR configuration (~/.pearrc on Unix-like systems). After logging in, your username and password will be sent along in subsequent operations on the remote server.', ), 'logout' => array( 'summary' => 'Logs out from the remote server [Deprecated in favor of channel-logout]', 'shortcut' => 'lo', 'function' => 'doLogout', 'options' => array(), 'doc' => ' WARNING: This function is deprecated in favor of using channel-logout Logs out from the remote server. This command does not actually connect to the remote server, it only deletes the stored username and password from your user configuration.', ) ); /** * PEAR_Command_Auth constructor. * * @access public */ function __construct(&$ui, &$config) { parent::__construct($ui, $config); } } php-pear-1.10.1+submodules+notgz/PEAR/Command/Auth.xml000066400000000000000000000023141262614675700223710ustar00rootroot00000000000000 Connects and authenticates to remote server [Deprecated in favor of channel-login] doLogin li <channel name> WARNING: This function is deprecated in favor of using channel-login Log in to a remote channel server. If <channel name> is not supplied, the default channel is used. To use remote functions in the installer that require any kind of privileges, you need to log in first. The username and password you enter here will be stored in your per-user PEAR configuration (~/.pearrc on Unix-like systems). After logging in, your username and password will be sent along in subsequent operations on the remote server. Logs out from the remote server [Deprecated in favor of channel-logout] doLogout lo WARNING: This function is deprecated in favor of using channel-logout Logs out from the remote server. This command does not actually connect to the remote server, it only deletes the stored username and password from your user configuration. php-pear-1.10.1+submodules+notgz/PEAR/Command/Build.php000066400000000000000000000043411262614675700225200ustar00rootroot00000000000000 * @author Tomas V.V.Cox * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @link http://pear.php.net/package/PEAR * @since File available since Release 0.1 */ /** * base class */ require_once 'PEAR/Command/Common.php'; /** * PEAR commands for building extensions. * * @category pear * @package PEAR * @author Stig Bakken * @author Tomas V.V.Cox * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version Release: @package_version@ * @link http://pear.php.net/package/PEAR * @since Class available since Release 0.1 */ class PEAR_Command_Build extends PEAR_Command_Common { var $commands = array( 'build' => array( 'summary' => 'Build an Extension From C Source', 'function' => 'doBuild', 'shortcut' => 'b', 'options' => array(), 'doc' => '[package.xml] Builds one or more extensions contained in a package.' ), ); /** * PEAR_Command_Build constructor. * * @access public */ function __construct(&$ui, &$config) { parent::__construct($ui, $config); } function doBuild($command, $options, $params) { require_once 'PEAR/Builder.php'; if (sizeof($params) < 1) { $params[0] = 'package.xml'; } $builder = new PEAR_Builder($this->ui); $this->debug = $this->config->get('verbose'); $err = $builder->build($params[0], array(&$this, 'buildCallback')); if (PEAR::isError($err)) { return $err; } return true; } function buildCallback($what, $data) { if (($what == 'cmdoutput' && $this->debug > 1) || ($what == 'output' && $this->debug > 0)) { $this->ui->outputData(rtrim($data), 'build'); } } } php-pear-1.10.1+submodules+notgz/PEAR/Command/Build.xml000066400000000000000000000004041262614675700225250ustar00rootroot00000000000000 Build an Extension From C Source doBuild b [package.xml] Builds one or more extensions contained in a package. php-pear-1.10.1+submodules+notgz/PEAR/Command/Channels.php000066400000000000000000001012571262614675700232200ustar00rootroot00000000000000 * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ /** * base class */ require_once 'PEAR/Command/Common.php'; define('PEAR_COMMAND_CHANNELS_CHANNEL_EXISTS', -500); /** * PEAR commands for managing channels. * * @category pear * @package PEAR * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version Release: @package_version@ * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ class PEAR_Command_Channels extends PEAR_Command_Common { var $commands = array( 'list-channels' => array( 'summary' => 'List Available Channels', 'function' => 'doList', 'shortcut' => 'lc', 'options' => array(), 'doc' => ' List all available channels for installation. ', ), 'update-channels' => array( 'summary' => 'Update the Channel List', 'function' => 'doUpdateAll', 'shortcut' => 'uc', 'options' => array(), 'doc' => ' List all installed packages in all channels. ' ), 'channel-delete' => array( 'summary' => 'Remove a Channel From the List', 'function' => 'doDelete', 'shortcut' => 'cde', 'options' => array(), 'doc' => ' Delete a channel from the registry. You may not remove any channel that has installed packages. ' ), 'channel-add' => array( 'summary' => 'Add a Channel', 'function' => 'doAdd', 'shortcut' => 'ca', 'options' => array(), 'doc' => ' Add a private channel to the channel list. Note that all public channels should be synced using "update-channels". Parameter may be either a local file or remote URL to a channel.xml. ' ), 'channel-update' => array( 'summary' => 'Update an Existing Channel', 'function' => 'doUpdate', 'shortcut' => 'cu', 'options' => array( 'force' => array( 'shortopt' => 'f', 'doc' => 'will force download of new channel.xml if an existing channel name is used', ), 'channel' => array( 'shortopt' => 'c', 'arg' => 'CHANNEL', 'doc' => 'will force download of new channel.xml if an existing channel name is used', ), ), 'doc' => '[|] Update a channel in the channel list directly. Note that all public channels can be synced using "update-channels". Parameter may be a local or remote channel.xml, or the name of an existing channel. ' ), 'channel-info' => array( 'summary' => 'Retrieve Information on a Channel', 'function' => 'doInfo', 'shortcut' => 'ci', 'options' => array(), 'doc' => ' List the files in an installed package. ' ), 'channel-alias' => array( 'summary' => 'Specify an alias to a channel name', 'function' => 'doAlias', 'shortcut' => 'cha', 'options' => array(), 'doc' => ' Specify a specific alias to use for a channel name. The alias may not be an existing channel name or alias. ' ), 'channel-discover' => array( 'summary' => 'Initialize a Channel from its server', 'function' => 'doDiscover', 'shortcut' => 'di', 'options' => array(), 'doc' => '[|] Initialize a channel from its server and create a local channel.xml. If is in the format ":@" then and will be set as the login username/password for . Use caution when passing the username/password in this way, as it may allow other users on your computer to briefly view your username/ password via the system\'s process list. ' ), 'channel-login' => array( 'summary' => 'Connects and authenticates to remote channel server', 'shortcut' => 'cli', 'function' => 'doLogin', 'options' => array(), 'doc' => ' Log in to a remote channel server. If is not supplied, the default channel is used. To use remote functions in the installer that require any kind of privileges, you need to log in first. The username and password you enter here will be stored in your per-user PEAR configuration (~/.pearrc on Unix-like systems). After logging in, your username and password will be sent along in subsequent operations on the remote server.', ), 'channel-logout' => array( 'summary' => 'Logs out from the remote channel server', 'shortcut' => 'clo', 'function' => 'doLogout', 'options' => array(), 'doc' => ' Logs out from a remote channel server. If is not supplied, the default channel is used. This command does not actually connect to the remote server, it only deletes the stored username and password from your user configuration.', ), ); /** * PEAR_Command_Registry constructor. * * @access public */ function __construct(&$ui, &$config) { parent::__construct($ui, $config); } function _sortChannels($a, $b) { return strnatcasecmp($a->getName(), $b->getName()); } function doList($command, $options, $params) { $reg = &$this->config->getRegistry(); $registered = $reg->getChannels(); usort($registered, array(&$this, '_sortchannels')); $i = $j = 0; $data = array( 'caption' => 'Registered Channels:', 'border' => true, 'headline' => array('Channel', 'Alias', 'Summary') ); foreach ($registered as $channel) { $data['data'][] = array($channel->getName(), $channel->getAlias(), $channel->getSummary()); } if (count($registered) === 0) { $data = '(no registered channels)'; } $this->ui->outputData($data, $command); return true; } function doUpdateAll($command, $options, $params) { $reg = &$this->config->getRegistry(); $channels = $reg->getChannels(); $success = true; foreach ($channels as $channel) { if ($channel->getName() != '__uri') { PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); $err = $this->doUpdate('channel-update', $options, array($channel->getName())); if (PEAR::isError($err)) { $this->ui->outputData($err->getMessage(), $command); $success = false; } else { $success &= $err; } } } return $success; } function doInfo($command, $options, $params) { if (count($params) !== 1) { return $this->raiseError("No channel specified"); } $reg = &$this->config->getRegistry(); $channel = strtolower($params[0]); if ($reg->channelExists($channel)) { $chan = $reg->getChannel($channel); if (PEAR::isError($chan)) { return $this->raiseError($chan); } } else { if (strpos($channel, '://')) { $downloader = &$this->getDownloader(); $tmpdir = $this->config->get('temp_dir'); PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); $loc = $downloader->downloadHttp($channel, $this->ui, $tmpdir); PEAR::staticPopErrorHandling(); if (PEAR::isError($loc)) { return $this->raiseError('Cannot open "' . $channel . '" (' . $loc->getMessage() . ')'); } else { $contents = implode('', file($loc)); } } else { if (!file_exists($params[0])) { return $this->raiseError('Unknown channel "' . $channel . '"'); } $fp = fopen($params[0], 'r'); if (!$fp) { return $this->raiseError('Cannot open "' . $params[0] . '"'); } $contents = ''; while (!feof($fp)) { $contents .= fread($fp, 1024); } fclose($fp); } if (!class_exists('PEAR_ChannelFile')) { require_once 'PEAR/ChannelFile.php'; } $chan = new PEAR_ChannelFile; $chan->fromXmlString($contents); $chan->validate(); if ($errs = $chan->getErrors(true)) { foreach ($errs as $err) { $this->ui->outputData($err['level'] . ': ' . $err['message']); } return $this->raiseError('Channel file "' . $params[0] . '" is not valid'); } } if (!$chan) { return $this->raiseError('Serious error: Channel "' . $params[0] . '" has a corrupted registry entry'); } $channel = $chan->getName(); $caption = 'Channel ' . $channel . ' Information:'; $data1 = array( 'caption' => $caption, 'border' => true); $data1['data']['server'] = array('Name and Server', $chan->getName()); if ($chan->getAlias() != $chan->getName()) { $data1['data']['alias'] = array('Alias', $chan->getAlias()); } $data1['data']['summary'] = array('Summary', $chan->getSummary()); $validate = $chan->getValidationPackage(); $data1['data']['vpackage'] = array('Validation Package Name', $validate['_content']); $data1['data']['vpackageversion'] = array('Validation Package Version', $validate['attribs']['version']); $d = array(); $d['main'] = $data1; $data['data'] = array(); $data['caption'] = 'Server Capabilities'; $data['headline'] = array('Type', 'Version/REST type', 'Function Name/REST base'); if ($chan->supportsREST()) { if ($chan->supportsREST()) { $funcs = $chan->getFunctions('rest'); if (!isset($funcs[0])) { $funcs = array($funcs); } foreach ($funcs as $protocol) { $data['data'][] = array('rest', $protocol['attribs']['type'], $protocol['_content']); } } } else { $data['data'][] = array('No supported protocols'); } $d['protocols'] = $data; $data['data'] = array(); $mirrors = $chan->getMirrors(); if ($mirrors) { $data['caption'] = 'Channel ' . $channel . ' Mirrors:'; unset($data['headline']); foreach ($mirrors as $mirror) { $data['data'][] = array($mirror['attribs']['host']); $d['mirrors'] = $data; } foreach ($mirrors as $i => $mirror) { $data['data'] = array(); $data['caption'] = 'Mirror ' . $mirror['attribs']['host'] . ' Capabilities'; $data['headline'] = array('Type', 'Version/REST type', 'Function Name/REST base'); if ($chan->supportsREST($mirror['attribs']['host'])) { if ($chan->supportsREST($mirror['attribs']['host'])) { $funcs = $chan->getFunctions('rest', $mirror['attribs']['host']); if (!isset($funcs[0])) { $funcs = array($funcs); } foreach ($funcs as $protocol) { $data['data'][] = array('rest', $protocol['attribs']['type'], $protocol['_content']); } } } else { $data['data'][] = array('No supported protocols'); } $d['mirrorprotocols' . $i] = $data; } } $this->ui->outputData($d, 'channel-info'); } // }}} function doDelete($command, $options, $params) { if (count($params) !== 1) { return $this->raiseError('channel-delete: no channel specified'); } $reg = &$this->config->getRegistry(); if (!$reg->channelExists($params[0])) { return $this->raiseError('channel-delete: channel "' . $params[0] . '" does not exist'); } $channel = $reg->channelName($params[0]); if ($channel == 'pear.php.net') { return $this->raiseError('Cannot delete the pear.php.net channel'); } if ($channel == 'pecl.php.net') { return $this->raiseError('Cannot delete the pecl.php.net channel'); } if ($channel == 'doc.php.net') { return $this->raiseError('Cannot delete the doc.php.net channel'); } if ($channel == '__uri') { return $this->raiseError('Cannot delete the __uri pseudo-channel'); } if (PEAR::isError($err = $reg->listPackages($channel))) { return $err; } if (count($err)) { return $this->raiseError('Channel "' . $channel . '" has installed packages, cannot delete'); } if (!$reg->deleteChannel($channel)) { return $this->raiseError('Channel "' . $channel . '" deletion failed'); } else { $this->config->deleteChannel($channel); $this->ui->outputData('Channel "' . $channel . '" deleted', $command); } } function doAdd($command, $options, $params) { if (count($params) !== 1) { return $this->raiseError('channel-add: no channel file specified'); } if (strpos($params[0], '://')) { $downloader = &$this->getDownloader(); $tmpdir = $this->config->get('temp_dir'); if (!file_exists($tmpdir)) { require_once 'System.php'; PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); $err = System::mkdir(array('-p', $tmpdir)); PEAR::staticPopErrorHandling(); if (PEAR::isError($err)) { return $this->raiseError('channel-add: temp_dir does not exist: "' . $tmpdir . '" - You can change this location with "pear config-set temp_dir"'); } } if (!is_writable($tmpdir)) { return $this->raiseError('channel-add: temp_dir is not writable: "' . $tmpdir . '" - You can change this location with "pear config-set temp_dir"'); } PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); $loc = $downloader->downloadHttp($params[0], $this->ui, $tmpdir, null, false); PEAR::staticPopErrorHandling(); if (PEAR::isError($loc)) { return $this->raiseError('channel-add: Cannot open "' . $params[0] . '" (' . $loc->getMessage() . ')'); } list($loc, $lastmodified) = $loc; $contents = implode('', file($loc)); } else { $lastmodified = $fp = false; if (file_exists($params[0])) { $fp = fopen($params[0], 'r'); } if (!$fp) { return $this->raiseError('channel-add: cannot open "' . $params[0] . '"'); } $contents = ''; while (!feof($fp)) { $contents .= fread($fp, 1024); } fclose($fp); } if (!class_exists('PEAR_ChannelFile')) { require_once 'PEAR/ChannelFile.php'; } $channel = new PEAR_ChannelFile; PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); $result = $channel->fromXmlString($contents); PEAR::staticPopErrorHandling(); if (!$result) { $exit = false; if (count($errors = $channel->getErrors(true))) { foreach ($errors as $error) { $this->ui->outputData(ucfirst($error['level'] . ': ' . $error['message'])); if (!$exit) { $exit = $error['level'] == 'error' ? true : false; } } if ($exit) { return $this->raiseError('channel-add: invalid channel.xml file'); } } } $reg = &$this->config->getRegistry(); if ($reg->channelExists($channel->getName())) { return $this->raiseError('channel-add: Channel "' . $channel->getName() . '" exists, use channel-update to update entry', PEAR_COMMAND_CHANNELS_CHANNEL_EXISTS); } $ret = $reg->addChannel($channel, $lastmodified); if (PEAR::isError($ret)) { return $ret; } if (!$ret) { return $this->raiseError('channel-add: adding Channel "' . $channel->getName() . '" to registry failed'); } $this->config->setChannels($reg->listChannels()); $this->config->writeConfigFile(); $this->ui->outputData('Adding Channel "' . $channel->getName() . '" succeeded', $command); } function doUpdate($command, $options, $params) { if (count($params) !== 1) { return $this->raiseError("No channel file specified"); } $tmpdir = $this->config->get('temp_dir'); if (!file_exists($tmpdir)) { require_once 'System.php'; PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); $err = System::mkdir(array('-p', $tmpdir)); PEAR::staticPopErrorHandling(); if (PEAR::isError($err)) { return $this->raiseError('channel-add: temp_dir does not exist: "' . $tmpdir . '" - You can change this location with "pear config-set temp_dir"'); } } if (!is_writable($tmpdir)) { return $this->raiseError('channel-add: temp_dir is not writable: "' . $tmpdir . '" - You can change this location with "pear config-set temp_dir"'); } $reg = &$this->config->getRegistry(); $lastmodified = false; if ((!file_exists($params[0]) || is_dir($params[0])) && $reg->channelExists(strtolower($params[0]))) { $c = $reg->getChannel(strtolower($params[0])); if (PEAR::isError($c)) { return $this->raiseError($c); } $this->ui->outputData("Updating channel \"$params[0]\"", $command); $dl = &$this->getDownloader(array()); // if force is specified, use a timestamp of "1" to force retrieval $lastmodified = isset($options['force']) ? false : $c->lastModified(); PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); $contents = $dl->downloadHttp('http://' . $c->getName() . '/channel.xml', $this->ui, $tmpdir, null, $lastmodified); PEAR::staticPopErrorHandling(); if (PEAR::isError($contents)) { // Attempt to fall back to https $this->ui->outputData("Channel \"$params[0]\" is not responding over http://, failed with message: " . $contents->getMessage()); $this->ui->outputData("Trying channel \"$params[0]\" over https:// instead"); PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); $contents = $dl->downloadHttp('https://' . $c->getName() . '/channel.xml', $this->ui, $tmpdir, null, $lastmodified); PEAR::staticPopErrorHandling(); if (PEAR::isError($contents)) { return $this->raiseError('Cannot retrieve channel.xml for channel "' . $c->getName() . '" (' . $contents->getMessage() . ')'); } } list($contents, $lastmodified) = $contents; if (!$contents) { $this->ui->outputData("Channel \"$params[0]\" is up to date"); return; } $contents = implode('', file($contents)); if (!class_exists('PEAR_ChannelFile')) { require_once 'PEAR/ChannelFile.php'; } $channel = new PEAR_ChannelFile; $channel->fromXmlString($contents); if (!$channel->getErrors()) { // security check: is the downloaded file for the channel we got it from? if (strtolower($channel->getName()) != strtolower($c->getName())) { if (!isset($options['force'])) { return $this->raiseError('ERROR: downloaded channel definition file' . ' for channel "' . $channel->getName() . '" from channel "' . strtolower($c->getName()) . '"'); } $this->ui->log(0, 'WARNING: downloaded channel definition file' . ' for channel "' . $channel->getName() . '" from channel "' . strtolower($c->getName()) . '"'); } } } else { if (strpos($params[0], '://')) { $dl = &$this->getDownloader(); PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); $loc = $dl->downloadHttp($params[0], $this->ui, $tmpdir, null, $lastmodified); PEAR::staticPopErrorHandling(); if (PEAR::isError($loc)) { return $this->raiseError("Cannot open " . $params[0] . ' (' . $loc->getMessage() . ')'); } list($loc, $lastmodified) = $loc; $contents = implode('', file($loc)); } else { $fp = false; if (file_exists($params[0])) { $fp = fopen($params[0], 'r'); } if (!$fp) { return $this->raiseError("Cannot open " . $params[0]); } $contents = ''; while (!feof($fp)) { $contents .= fread($fp, 1024); } fclose($fp); } if (!class_exists('PEAR_ChannelFile')) { require_once 'PEAR/ChannelFile.php'; } $channel = new PEAR_ChannelFile; $channel->fromXmlString($contents); } $exit = false; if (count($errors = $channel->getErrors(true))) { foreach ($errors as $error) { $this->ui->outputData(ucfirst($error['level'] . ': ' . $error['message'])); if (!$exit) { $exit = $error['level'] == 'error' ? true : false; } } if ($exit) { return $this->raiseError('Invalid channel.xml file'); } } if (!$reg->channelExists($channel->getName())) { return $this->raiseError('Error: Channel "' . $channel->getName() . '" does not exist, use channel-add to add an entry'); } $ret = $reg->updateChannel($channel, $lastmodified); if (PEAR::isError($ret)) { return $ret; } if (!$ret) { return $this->raiseError('Updating Channel "' . $channel->getName() . '" in registry failed'); } $this->config->setChannels($reg->listChannels()); $this->config->writeConfigFile(); $this->ui->outputData('Update of Channel "' . $channel->getName() . '" succeeded'); } function &getDownloader() { if (!class_exists('PEAR_Downloader')) { require_once 'PEAR/Downloader.php'; } $a = new PEAR_Downloader($this->ui, array(), $this->config); return $a; } function doAlias($command, $options, $params) { if (count($params) === 1) { return $this->raiseError('No channel alias specified'); } if (count($params) !== 2 || (!empty($params[1]) && $params[1]{0} == '-')) { return $this->raiseError( 'Invalid format, correct is: channel-alias channel alias'); } $reg = &$this->config->getRegistry(); if (!$reg->channelExists($params[0], true)) { $extra = ''; if ($reg->isAlias($params[0])) { $extra = ' (use "channel-alias ' . $reg->channelName($params[0]) . ' ' . strtolower($params[1]) . '")'; } return $this->raiseError('"' . $params[0] . '" is not a valid channel' . $extra); } if ($reg->isAlias($params[1])) { return $this->raiseError('Channel "' . $reg->channelName($params[1]) . '" is ' . 'already aliased to "' . strtolower($params[1]) . '", cannot re-alias'); } $chan = $reg->getChannel($params[0]); if (PEAR::isError($chan)) { return $this->raiseError('Corrupt registry? Error retrieving channel "' . $params[0] . '" information (' . $chan->getMessage() . ')'); } // make it a local alias if (!$chan->setAlias(strtolower($params[1]), true)) { return $this->raiseError('Alias "' . strtolower($params[1]) . '" is not a valid channel alias'); } $reg->updateChannel($chan); $this->ui->outputData('Channel "' . $chan->getName() . '" aliased successfully to "' . strtolower($params[1]) . '"'); } /** * The channel-discover command * * @param string $command command name * @param array $options option_name => value * @param array $params list of additional parameters. * $params[0] should contain a string with either: * - or * - :@ * @return null|PEAR_Error */ function doDiscover($command, $options, $params) { if (count($params) !== 1) { return $this->raiseError("No channel server specified"); } // Look for the possible input format ":@" if (preg_match('/^(.+):(.+)@(.+)\\z/', $params[0], $matches)) { $username = $matches[1]; $password = $matches[2]; $channel = $matches[3]; } else { $channel = $params[0]; } $reg = &$this->config->getRegistry(); if ($reg->channelExists($channel)) { if (!$reg->isAlias($channel)) { return $this->raiseError("Channel \"$channel\" is already initialized", PEAR_COMMAND_CHANNELS_CHANNEL_EXISTS); } return $this->raiseError("A channel alias named \"$channel\" " . 'already exists, aliasing channel "' . $reg->channelName($channel) . '"'); } $this->pushErrorHandling(PEAR_ERROR_RETURN); $err = $this->doAdd($command, $options, array('http://' . $channel . '/channel.xml')); $this->popErrorHandling(); if (PEAR::isError($err)) { if ($err->getCode() === PEAR_COMMAND_CHANNELS_CHANNEL_EXISTS) { return $this->raiseError("Discovery of channel \"$channel\" failed (" . $err->getMessage() . ')'); } // Attempt fetch via https $this->ui->outputData("Discovering channel $channel over http:// failed with message: " . $err->getMessage()); $this->ui->outputData("Trying to discover channel $channel over https:// instead"); $this->pushErrorHandling(PEAR_ERROR_RETURN); $err = $this->doAdd($command, $options, array('https://' . $channel . '/channel.xml')); $this->popErrorHandling(); if (PEAR::isError($err)) { return $this->raiseError("Discovery of channel \"$channel\" failed (" . $err->getMessage() . ')'); } } // Store username/password if they were given // Arguably we should do a logintest on the channel here, but since // that's awkward on a REST-based channel (even "pear login" doesn't // do it for those), and XML-RPC is deprecated, it's fairly pointless. if (isset($username)) { $this->config->set('username', $username, 'user', $channel); $this->config->set('password', $password, 'user', $channel); $this->config->store(); $this->ui->outputData("Stored login for channel \"$channel\" using username \"$username\"", $command); } $this->ui->outputData("Discovery of channel \"$channel\" succeeded", $command); } /** * Execute the 'login' command. * * @param string $command command name * @param array $options option_name => value * @param array $params list of additional parameters * * @return bool TRUE on success or * a PEAR error on failure * * @access public */ function doLogin($command, $options, $params) { $reg = &$this->config->getRegistry(); // If a parameter is supplied, use that as the channel to log in to $channel = isset($params[0]) ? $params[0] : $this->config->get('default_channel'); $chan = $reg->getChannel($channel); if (PEAR::isError($chan)) { return $this->raiseError($chan); } $server = $this->config->get('preferred_mirror', null, $channel); $username = $this->config->get('username', null, $channel); if (empty($username)) { $username = isset($_ENV['USER']) ? $_ENV['USER'] : null; } $this->ui->outputData("Logging in to $server.", $command); list($username, $password) = $this->ui->userDialog( $command, array('Username', 'Password'), array('text', 'password'), array($username, '') ); $username = trim($username); $password = trim($password); $ourfile = $this->config->getConfFile('user'); if (!$ourfile) { $ourfile = $this->config->getConfFile('system'); } $this->config->set('username', $username, 'user', $channel); $this->config->set('password', $password, 'user', $channel); if ($chan->supportsREST()) { $ok = true; } if ($ok !== true) { return $this->raiseError('Login failed!'); } $this->ui->outputData("Logged in.", $command); // avoid changing any temporary settings changed with -d $ourconfig = new PEAR_Config($ourfile, $ourfile); $ourconfig->set('username', $username, 'user', $channel); $ourconfig->set('password', $password, 'user', $channel); $ourconfig->store(); return true; } /** * Execute the 'logout' command. * * @param string $command command name * @param array $options option_name => value * @param array $params list of additional parameters * * @return bool TRUE on success or * a PEAR error on failure * * @access public */ function doLogout($command, $options, $params) { $reg = &$this->config->getRegistry(); // If a parameter is supplied, use that as the channel to log in to $channel = isset($params[0]) ? $params[0] : $this->config->get('default_channel'); $chan = $reg->getChannel($channel); if (PEAR::isError($chan)) { return $this->raiseError($chan); } $server = $this->config->get('preferred_mirror', null, $channel); $this->ui->outputData("Logging out from $server.", $command); $this->config->remove('username', 'user', $channel); $this->config->remove('password', 'user', $channel); $this->config->store(); return true; } } php-pear-1.10.1+submodules+notgz/PEAR/Command/Channels.xml000066400000000000000000000101721262614675700232240ustar00rootroot00000000000000 List Available Channels doList lc List all available channels for installation. Update the Channel List doUpdateAll uc List all installed packages in all channels. Remove a Channel From the List doDelete cde <channel name> Delete a channel from the registry. You may not remove any channel that has installed packages. Add a Channel doAdd ca <channel.xml> Add a private channel to the channel list. Note that all public channels should be synced using "update-channels". Parameter may be either a local file or remote URL to a channel.xml. Update an Existing Channel doUpdate cu f will force download of new channel.xml if an existing channel name is used c will force download of new channel.xml if an existing channel name is used CHANNEL [<channel.xml>|<channel name>] Update a channel in the channel list directly. Note that all public channels can be synced using "update-channels". Parameter may be a local or remote channel.xml, or the name of an existing channel. Retrieve Information on a Channel doInfo ci <package> List the files in an installed package. Specify an alias to a channel name doAlias cha <channel> <alias> Specify a specific alias to use for a channel name. The alias may not be an existing channel name or alias. Initialize a Channel from its server doDiscover di [<channel.xml>|<channel name>] Initialize a channel from its server and create a local channel.xml. If <channel name> is in the format "<username>:<password>@<channel>" then <username> and <password> will be set as the login username/password for <channel>. Use caution when passing the username/password in this way, as it may allow other users on your computer to briefly view your username/ password via the system's process list. Connects and authenticates to remote channel server doLogin cli <channel name> Log in to a remote channel server. If <channel name> is not supplied, the default channel is used. To use remote functions in the installer that require any kind of privileges, you need to log in first. The username and password you enter here will be stored in your per-user PEAR configuration (~/.pearrc on Unix-like systems). After logging in, your username and password will be sent along in subsequent operations on the remote server. Logs out from the remote channel server doLogout clo <channel name> Logs out from a remote channel server. If <channel name> is not supplied, the default channel is used. This command does not actually connect to the remote server, it only deletes the stored username and password from your user configuration. php-pear-1.10.1+submodules+notgz/PEAR/Command/Common.php000066400000000000000000000200501262614675700227040ustar00rootroot00000000000000 * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @link http://pear.php.net/package/PEAR * @since File available since Release 0.1 */ /** * base class */ require_once 'PEAR.php'; /** * PEAR commands base class * * @category pear * @package PEAR * @author Stig Bakken * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version Release: @package_version@ * @link http://pear.php.net/package/PEAR * @since Class available since Release 0.1 */ class PEAR_Command_Common extends PEAR { /** * PEAR_Config object used to pass user system and configuration * on when executing commands * * @var PEAR_Config */ var $config; /** * @var PEAR_Registry * @access protected */ var $_registry; /** * User Interface object, for all interaction with the user. * @var object */ var $ui; var $_deps_rel_trans = array( 'lt' => '<', 'le' => '<=', 'eq' => '=', 'ne' => '!=', 'gt' => '>', 'ge' => '>=', 'has' => '==' ); var $_deps_type_trans = array( 'pkg' => 'package', 'ext' => 'extension', 'php' => 'PHP', 'prog' => 'external program', 'ldlib' => 'external library for linking', 'rtlib' => 'external runtime library', 'os' => 'operating system', 'websrv' => 'web server', 'sapi' => 'SAPI backend' ); /** * PEAR_Command_Common constructor. * * @access public */ function __construct(&$ui, &$config) { parent::__construct(); $this->config = &$config; $this->ui = &$ui; } /** * Return a list of all the commands defined by this class. * @return array list of commands * @access public */ function getCommands() { $ret = array(); foreach (array_keys($this->commands) as $command) { $ret[$command] = $this->commands[$command]['summary']; } return $ret; } /** * Return a list of all the command shortcuts defined by this class. * @return array shortcut => command * @access public */ function getShortcuts() { $ret = array(); foreach (array_keys($this->commands) as $command) { if (isset($this->commands[$command]['shortcut'])) { $ret[$this->commands[$command]['shortcut']] = $command; } } return $ret; } function getOptions($command) { $shortcuts = $this->getShortcuts(); if (isset($shortcuts[$command])) { $command = $shortcuts[$command]; } if (isset($this->commands[$command]) && isset($this->commands[$command]['options'])) { return $this->commands[$command]['options']; } return null; } function getGetoptArgs($command, &$short_args, &$long_args) { $short_args = ''; $long_args = array(); if (empty($this->commands[$command]) || empty($this->commands[$command]['options'])) { return; } reset($this->commands[$command]['options']); while (list($option, $info) = each($this->commands[$command]['options'])) { $larg = $sarg = ''; if (isset($info['arg'])) { if ($info['arg']{0} == '(') { $larg = '=='; $sarg = '::'; $arg = substr($info['arg'], 1, -1); } else { $larg = '='; $sarg = ':'; $arg = $info['arg']; } } if (isset($info['shortopt'])) { $short_args .= $info['shortopt'] . $sarg; } $long_args[] = $option . $larg; } } /** * Returns the help message for the given command * * @param string $command The command * @return mixed A fail string if the command does not have help or * a two elements array containing [0]=>help string, * [1]=> help string for the accepted cmd args */ function getHelp($command) { $config = &PEAR_Config::singleton(); if (!isset($this->commands[$command])) { return "No such command \"$command\""; } $help = null; if (isset($this->commands[$command]['doc'])) { $help = $this->commands[$command]['doc']; } if (empty($help)) { // XXX (cox) Fallback to summary if there is no doc (show both?) if (!isset($this->commands[$command]['summary'])) { return "No help for command \"$command\""; } $help = $this->commands[$command]['summary']; } if (preg_match_all('/{config\s+([^\}]+)}/e', $help, $matches)) { foreach($matches[0] as $k => $v) { $help = preg_replace("/$v/", $config->get($matches[1][$k]), $help); } } return array($help, $this->getHelpArgs($command)); } /** * Returns the help for the accepted arguments of a command * * @param string $command * @return string The help string */ function getHelpArgs($command) { if (isset($this->commands[$command]['options']) && count($this->commands[$command]['options'])) { $help = "Options:\n"; foreach ($this->commands[$command]['options'] as $k => $v) { if (isset($v['arg'])) { if ($v['arg'][0] == '(') { $arg = substr($v['arg'], 1, -1); $sapp = " [$arg]"; $lapp = "[=$arg]"; } else { $sapp = " $v[arg]"; $lapp = "=$v[arg]"; } } else { $sapp = $lapp = ""; } if (isset($v['shortopt'])) { $s = $v['shortopt']; $help .= " -$s$sapp, --$k$lapp\n"; } else { $help .= " --$k$lapp\n"; } $p = " "; $doc = rtrim(str_replace("\n", "\n$p", $v['doc'])); $help .= " $doc\n"; } return $help; } return null; } function run($command, $options, $params) { if (empty($this->commands[$command]['function'])) { // look for shortcuts foreach (array_keys($this->commands) as $cmd) { if (isset($this->commands[$cmd]['shortcut']) && $this->commands[$cmd]['shortcut'] == $command) { if (empty($this->commands[$cmd]['function'])) { return $this->raiseError("unknown command `$command'"); } else { $func = $this->commands[$cmd]['function']; } $command = $cmd; //$command = $this->commands[$cmd]['function']; break; } } } else { $func = $this->commands[$command]['function']; } return $this->$func($command, $options, $params); } } php-pear-1.10.1+submodules+notgz/PEAR/Command/Config.php000066400000000000000000000361651262614675700226770ustar00rootroot00000000000000 * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @link http://pear.php.net/package/PEAR * @since File available since Release 0.1 */ /** * base class */ require_once 'PEAR/Command/Common.php'; /** * PEAR commands for managing configuration data. * * @category pear * @package PEAR * @author Stig Bakken * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version Release: @package_version@ * @link http://pear.php.net/package/PEAR * @since Class available since Release 0.1 */ class PEAR_Command_Config extends PEAR_Command_Common { var $commands = array( 'config-show' => array( 'summary' => 'Show All Settings', 'function' => 'doConfigShow', 'shortcut' => 'csh', 'options' => array( 'channel' => array( 'shortopt' => 'c', 'doc' => 'show configuration variables for another channel', 'arg' => 'CHAN', ), ), 'doc' => '[layer] Displays all configuration values. An optional argument may be used to tell which configuration layer to display. Valid configuration layers are "user", "system" and "default". To display configurations for different channels, set the default_channel configuration variable and run config-show again. ', ), 'config-get' => array( 'summary' => 'Show One Setting', 'function' => 'doConfigGet', 'shortcut' => 'cg', 'options' => array( 'channel' => array( 'shortopt' => 'c', 'doc' => 'show configuration variables for another channel', 'arg' => 'CHAN', ), ), 'doc' => ' [layer] Displays the value of one configuration parameter. The first argument is the name of the parameter, an optional second argument may be used to tell which configuration layer to look in. Valid configuration layers are "user", "system" and "default". If no layer is specified, a value will be picked from the first layer that defines the parameter, in the order just specified. The configuration value will be retrieved for the channel specified by the default_channel configuration variable. ', ), 'config-set' => array( 'summary' => 'Change Setting', 'function' => 'doConfigSet', 'shortcut' => 'cs', 'options' => array( 'channel' => array( 'shortopt' => 'c', 'doc' => 'show configuration variables for another channel', 'arg' => 'CHAN', ), ), 'doc' => ' [layer] Sets the value of one configuration parameter. The first argument is the name of the parameter, the second argument is the new value. Some parameters are subject to validation, and the command will fail with an error message if the new value does not make sense. An optional third argument may be used to specify in which layer to set the configuration parameter. The default layer is "user". The configuration value will be set for the current channel, which is controlled by the default_channel configuration variable. ', ), 'config-help' => array( 'summary' => 'Show Information About Setting', 'function' => 'doConfigHelp', 'shortcut' => 'ch', 'options' => array(), 'doc' => '[parameter] Displays help for a configuration parameter. Without arguments it displays help for all configuration parameters. ', ), 'config-create' => array( 'summary' => 'Create a Default configuration file', 'function' => 'doConfigCreate', 'shortcut' => 'coc', 'options' => array( 'windows' => array( 'shortopt' => 'w', 'doc' => 'create a config file for a windows install', ), ), 'doc' => ' Create a default configuration file with all directory configuration variables set to subdirectories of , and save it as . This is useful especially for creating a configuration file for a remote PEAR installation (using the --remoteconfig option of install, upgrade, and uninstall). ', ), ); /** * PEAR_Command_Config constructor. * * @access public */ function __construct(&$ui, &$config) { parent::__construct($ui, $config); } function doConfigShow($command, $options, $params) { $layer = null; if (is_array($params)) { $layer = isset($params[0]) ? $params[0] : null; } // $params[0] -> the layer if ($error = $this->_checkLayer($layer)) { return $this->raiseError("config-show:$error"); } $keys = $this->config->getKeys(); sort($keys); $channel = isset($options['channel']) ? $options['channel'] : $this->config->get('default_channel'); $reg = &$this->config->getRegistry(); if (!$reg->channelExists($channel)) { return $this->raiseError('Channel "' . $channel . '" does not exist'); } $channel = $reg->channelName($channel); $data = array('caption' => 'Configuration (channel ' . $channel . '):'); foreach ($keys as $key) { $type = $this->config->getType($key); $value = $this->config->get($key, $layer, $channel); if ($type == 'password' && $value) { $value = '********'; } if ($value === false) { $value = 'false'; } elseif ($value === true) { $value = 'true'; } $data['data'][$this->config->getGroup($key)][] = array($this->config->getPrompt($key) , $key, $value); } foreach ($this->config->getLayers() as $layer) { $data['data']['Config Files'][] = array(ucfirst($layer) . ' Configuration File', 'Filename' , $this->config->getConfFile($layer)); } $this->ui->outputData($data, $command); return true; } function doConfigGet($command, $options, $params) { $args_cnt = is_array($params) ? count($params) : 0; switch ($args_cnt) { case 1: $config_key = $params[0]; $layer = null; break; case 2: $config_key = $params[0]; $layer = $params[1]; if ($error = $this->_checkLayer($layer)) { return $this->raiseError("config-get:$error"); } break; case 0: default: return $this->raiseError("config-get expects 1 or 2 parameters"); } $reg = &$this->config->getRegistry(); $channel = isset($options['channel']) ? $options['channel'] : $this->config->get('default_channel'); if (!$reg->channelExists($channel)) { return $this->raiseError('Channel "' . $channel . '" does not exist'); } $channel = $reg->channelName($channel); $this->ui->outputData($this->config->get($config_key, $layer, $channel), $command); return true; } function doConfigSet($command, $options, $params) { // $param[0] -> a parameter to set // $param[1] -> the value for the parameter // $param[2] -> the layer $failmsg = ''; if (count($params) < 2 || count($params) > 3) { $failmsg .= "config-set expects 2 or 3 parameters"; return PEAR::raiseError($failmsg); } if (isset($params[2]) && ($error = $this->_checkLayer($params[2]))) { $failmsg .= $error; return PEAR::raiseError("config-set:$failmsg"); } $channel = isset($options['channel']) ? $options['channel'] : $this->config->get('default_channel'); $reg = &$this->config->getRegistry(); if (!$reg->channelExists($channel)) { return $this->raiseError('Channel "' . $channel . '" does not exist'); } $channel = $reg->channelName($channel); if ($params[0] == 'default_channel' && !$reg->channelExists($params[1])) { return $this->raiseError('Channel "' . $params[1] . '" does not exist'); } if ($params[0] == 'preferred_mirror' && ( !$reg->mirrorExists($channel, $params[1]) && (!$reg->channelExists($params[1]) || $channel != $params[1]) ) ) { $msg = 'Channel Mirror "' . $params[1] . '" does not exist'; $msg .= ' in your registry for channel "' . $channel . '".'; $msg .= "\n" . 'Attempt to run "pear channel-update ' . $channel .'"'; $msg .= ' if you believe this mirror should exist as you may'; $msg .= ' have outdated channel information.'; return $this->raiseError($msg); } if (count($params) == 2) { array_push($params, 'user'); $layer = 'user'; } else { $layer = $params[2]; } array_push($params, $channel); if (!call_user_func_array(array(&$this->config, 'set'), $params)) { array_pop($params); $failmsg = "config-set (" . implode(", ", $params) . ") failed, channel $channel"; } else { $this->config->store($layer); } if ($failmsg) { return $this->raiseError($failmsg); } $this->ui->outputData('config-set succeeded', $command); return true; } function doConfigHelp($command, $options, $params) { if (empty($params)) { $params = $this->config->getKeys(); } $data['caption'] = "Config help" . ((count($params) == 1) ? " for $params[0]" : ''); $data['headline'] = array('Name', 'Type', 'Description'); $data['border'] = true; foreach ($params as $name) { $type = $this->config->getType($name); $docs = $this->config->getDocs($name); if ($type == 'set') { $docs = rtrim($docs) . "\nValid set: " . implode(' ', $this->config->getSetValues($name)); } $data['data'][] = array($name, $type, $docs); } $this->ui->outputData($data, $command); } function doConfigCreate($command, $options, $params) { if (count($params) != 2) { return PEAR::raiseError('config-create: must have 2 parameters, root path and ' . 'filename to save as'); } $root = $params[0]; // Clean up the DIRECTORY_SEPARATOR mess $ds2 = DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR; $root = preg_replace(array('!\\\\+!', '!/+!', "!$ds2+!"), array('/', '/', '/'), $root); if ($root{0} != '/') { if (!isset($options['windows'])) { return PEAR::raiseError('Root directory must be an absolute path beginning ' . 'with "/", was: "' . $root . '"'); } if (!preg_match('/^[A-Za-z]:/', $root)) { return PEAR::raiseError('Root directory must be an absolute path beginning ' . 'with "\\" or "C:\\", was: "' . $root . '"'); } } $windows = isset($options['windows']); if ($windows) { $root = str_replace('/', '\\', $root); } if (!file_exists($params[1]) && !@touch($params[1])) { return PEAR::raiseError('Could not create "' . $params[1] . '"'); } $params[1] = realpath($params[1]); $config = new PEAR_Config($params[1], '#no#system#config#', false, false); if ($root{strlen($root) - 1} == '/') { $root = substr($root, 0, strlen($root) - 1); } $config->noRegistry(); $config->set('php_dir', $windows ? "$root\\pear\\php" : "$root/pear/php", 'user'); $config->set('data_dir', $windows ? "$root\\pear\\data" : "$root/pear/data"); $config->set('www_dir', $windows ? "$root\\pear\\www" : "$root/pear/www"); $config->set('cfg_dir', $windows ? "$root\\pear\\cfg" : "$root/pear/cfg"); $config->set('ext_dir', $windows ? "$root\\pear\\ext" : "$root/pear/ext"); $config->set('doc_dir', $windows ? "$root\\pear\\docs" : "$root/pear/docs"); $config->set('test_dir', $windows ? "$root\\pear\\tests" : "$root/pear/tests"); $config->set('cache_dir', $windows ? "$root\\pear\\cache" : "$root/pear/cache"); $config->set('download_dir', $windows ? "$root\\pear\\download" : "$root/pear/download"); $config->set('temp_dir', $windows ? "$root\\pear\\temp" : "$root/pear/temp"); $config->set('bin_dir', $windows ? "$root\\pear" : "$root/pear"); $config->set('man_dir', $windows ? "$root\\pear\\man" : "$root/pear/man"); $config->writeConfigFile(); $this->_showConfig($config); $this->ui->outputData('Successfully created default configuration file "' . $params[1] . '"', $command); } function _showConfig(&$config) { $params = array('user'); $keys = $config->getKeys(); sort($keys); $channel = 'pear.php.net'; $data = array('caption' => 'Configuration (channel ' . $channel . '):'); foreach ($keys as $key) { $type = $config->getType($key); $value = $config->get($key, 'user', $channel); if ($type == 'password' && $value) { $value = '********'; } if ($value === false) { $value = 'false'; } elseif ($value === true) { $value = 'true'; } $data['data'][$config->getGroup($key)][] = array($config->getPrompt($key) , $key, $value); } foreach ($config->getLayers() as $layer) { $data['data']['Config Files'][] = array(ucfirst($layer) . ' Configuration File', 'Filename' , $config->getConfFile($layer)); } $this->ui->outputData($data, 'config-show'); return true; } /** * Checks if a layer is defined or not * * @param string $layer The layer to search for * @return mixed False on no error or the error message */ function _checkLayer($layer = null) { if (!empty($layer) && $layer != 'default') { $layers = $this->config->getLayers(); if (!in_array($layer, $layers)) { return " only the layers: \"" . implode('" or "', $layers) . "\" are supported"; } } return false; } } php-pear-1.10.1+submodules+notgz/PEAR/Command/Config.xml000066400000000000000000000064661262614675700227110ustar00rootroot00000000000000 Show All Settings doConfigShow csh c show configuration variables for another channel CHAN [layer] Displays all configuration values. An optional argument may be used to tell which configuration layer to display. Valid configuration layers are "user", "system" and "default". To display configurations for different channels, set the default_channel configuration variable and run config-show again. Show One Setting doConfigGet cg c show configuration variables for another channel CHAN <parameter> [layer] Displays the value of one configuration parameter. The first argument is the name of the parameter, an optional second argument may be used to tell which configuration layer to look in. Valid configuration layers are "user", "system" and "default". If no layer is specified, a value will be picked from the first layer that defines the parameter, in the order just specified. The configuration value will be retrieved for the channel specified by the default_channel configuration variable. Change Setting doConfigSet cs c show configuration variables for another channel CHAN <parameter> <value> [layer] Sets the value of one configuration parameter. The first argument is the name of the parameter, the second argument is the new value. Some parameters are subject to validation, and the command will fail with an error message if the new value does not make sense. An optional third argument may be used to specify in which layer to set the configuration parameter. The default layer is "user". The configuration value will be set for the current channel, which is controlled by the default_channel configuration variable. Show Information About Setting doConfigHelp ch [parameter] Displays help for a configuration parameter. Without arguments it displays help for all configuration parameters. Create a Default configuration file doConfigCreate coc w create a config file for a windows install <root path> <filename> Create a default configuration file with all directory configuration variables set to subdirectories of <root path>, and save it as <filename>. This is useful especially for creating a configuration file for a remote PEAR installation (using the --remoteconfig option of install, upgrade, and uninstall). php-pear-1.10.1+submodules+notgz/PEAR/Command/Install.php000066400000000000000000001431611262614675700230730ustar00rootroot00000000000000 * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @link http://pear.php.net/package/PEAR * @since File available since Release 0.1 */ /** * base class */ require_once 'PEAR/Command/Common.php'; /** * PEAR commands for installation or deinstallation/upgrading of * packages. * * @category pear * @package PEAR * @author Stig Bakken * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version Release: @package_version@ * @link http://pear.php.net/package/PEAR * @since Class available since Release 0.1 */ class PEAR_Command_Install extends PEAR_Command_Common { // {{{ properties var $commands = array( 'install' => array( 'summary' => 'Install Package', 'function' => 'doInstall', 'shortcut' => 'i', 'options' => array( 'force' => array( 'shortopt' => 'f', 'doc' => 'will overwrite newer installed packages', ), 'loose' => array( 'shortopt' => 'l', 'doc' => 'do not check for recommended dependency version', ), 'nodeps' => array( 'shortopt' => 'n', 'doc' => 'ignore dependencies, install anyway', ), 'register-only' => array( 'shortopt' => 'r', 'doc' => 'do not install files, only register the package as installed', ), 'soft' => array( 'shortopt' => 's', 'doc' => 'soft install, fail silently, or upgrade if already installed', ), 'nobuild' => array( 'shortopt' => 'B', 'doc' => 'don\'t build C extensions', ), 'nocompress' => array( 'shortopt' => 'Z', 'doc' => 'request uncompressed files when downloading', ), 'installroot' => array( 'shortopt' => 'R', 'arg' => 'DIR', 'doc' => 'root directory used when installing files (ala PHP\'s INSTALL_ROOT), use packagingroot for RPM', ), 'packagingroot' => array( 'shortopt' => 'P', 'arg' => 'DIR', 'doc' => 'root directory used when packaging files, like RPM packaging', ), 'ignore-errors' => array( 'doc' => 'force install even if there were errors', ), 'alldeps' => array( 'shortopt' => 'a', 'doc' => 'install all required and optional dependencies', ), 'onlyreqdeps' => array( 'shortopt' => 'o', 'doc' => 'install all required dependencies', ), 'offline' => array( 'shortopt' => 'O', 'doc' => 'do not attempt to download any urls or contact channels', ), 'pretend' => array( 'shortopt' => 'p', 'doc' => 'Only list the packages that would be downloaded', ), ), 'doc' => '[channel/] ... Installs one or more PEAR packages. You can specify a package to install in four ways: "Package-1.0.tgz" : installs from a local file "http://example.com/Package-1.0.tgz" : installs from anywhere on the net. "package.xml" : installs the package described in package.xml. Useful for testing, or for wrapping a PEAR package in another package manager such as RPM. "Package[-version/state][.tar]" : queries your default channel\'s server ({config master_server}) and downloads the newest package with the preferred quality/state ({config preferred_state}). To retrieve Package version 1.1, use "Package-1.1," to retrieve Package state beta, use "Package-beta." To retrieve an uncompressed file, append .tar (make sure there is no file by the same name first) To download a package from another channel, prefix with the channel name like "channel/Package" More than one package may be specified at once. It is ok to mix these four ways of specifying packages. '), 'upgrade' => array( 'summary' => 'Upgrade Package', 'function' => 'doInstall', 'shortcut' => 'up', 'options' => array( 'channel' => array( 'shortopt' => 'c', 'doc' => 'upgrade packages from a specific channel', 'arg' => 'CHAN', ), 'force' => array( 'shortopt' => 'f', 'doc' => 'overwrite newer installed packages', ), 'loose' => array( 'shortopt' => 'l', 'doc' => 'do not check for recommended dependency version', ), 'nodeps' => array( 'shortopt' => 'n', 'doc' => 'ignore dependencies, upgrade anyway', ), 'register-only' => array( 'shortopt' => 'r', 'doc' => 'do not install files, only register the package as upgraded', ), 'nobuild' => array( 'shortopt' => 'B', 'doc' => 'don\'t build C extensions', ), 'nocompress' => array( 'shortopt' => 'Z', 'doc' => 'request uncompressed files when downloading', ), 'installroot' => array( 'shortopt' => 'R', 'arg' => 'DIR', 'doc' => 'root directory used when installing files (ala PHP\'s INSTALL_ROOT)', ), 'ignore-errors' => array( 'doc' => 'force install even if there were errors', ), 'alldeps' => array( 'shortopt' => 'a', 'doc' => 'install all required and optional dependencies', ), 'onlyreqdeps' => array( 'shortopt' => 'o', 'doc' => 'install all required dependencies', ), 'offline' => array( 'shortopt' => 'O', 'doc' => 'do not attempt to download any urls or contact channels', ), 'pretend' => array( 'shortopt' => 'p', 'doc' => 'Only list the packages that would be downloaded', ), ), 'doc' => ' ... Upgrades one or more PEAR packages. See documentation for the "install" command for ways to specify a package. When upgrading, your package will be updated if the provided new package has a higher version number (use the -f option if you need to upgrade anyway). More than one package may be specified at once. '), 'upgrade-all' => array( 'summary' => 'Upgrade All Packages [Deprecated in favor of calling upgrade with no parameters]', 'function' => 'doUpgradeAll', 'shortcut' => 'ua', 'options' => array( 'channel' => array( 'shortopt' => 'c', 'doc' => 'upgrade packages from a specific channel', 'arg' => 'CHAN', ), 'nodeps' => array( 'shortopt' => 'n', 'doc' => 'ignore dependencies, upgrade anyway', ), 'register-only' => array( 'shortopt' => 'r', 'doc' => 'do not install files, only register the package as upgraded', ), 'nobuild' => array( 'shortopt' => 'B', 'doc' => 'don\'t build C extensions', ), 'nocompress' => array( 'shortopt' => 'Z', 'doc' => 'request uncompressed files when downloading', ), 'installroot' => array( 'shortopt' => 'R', 'arg' => 'DIR', 'doc' => 'root directory used when installing files (ala PHP\'s INSTALL_ROOT), use packagingroot for RPM', ), 'ignore-errors' => array( 'doc' => 'force install even if there were errors', ), 'loose' => array( 'doc' => 'do not check for recommended dependency version', ), ), 'doc' => ' WARNING: This function is deprecated in favor of using the upgrade command with no params Upgrades all packages that have a newer release available. Upgrades are done only if there is a release available of the state specified in "preferred_state" (currently {config preferred_state}), or a state considered more stable. '), 'uninstall' => array( 'summary' => 'Un-install Package', 'function' => 'doUninstall', 'shortcut' => 'un', 'options' => array( 'nodeps' => array( 'shortopt' => 'n', 'doc' => 'ignore dependencies, uninstall anyway', ), 'register-only' => array( 'shortopt' => 'r', 'doc' => 'do not remove files, only register the packages as not installed', ), 'installroot' => array( 'shortopt' => 'R', 'arg' => 'DIR', 'doc' => 'root directory used when installing files (ala PHP\'s INSTALL_ROOT)', ), 'ignore-errors' => array( 'doc' => 'force install even if there were errors', ), 'offline' => array( 'shortopt' => 'O', 'doc' => 'do not attempt to uninstall remotely', ), ), 'doc' => '[channel/] ... Uninstalls one or more PEAR packages. More than one package may be specified at once. Prefix with channel name to uninstall from a channel not in your default channel ({config default_channel}) '), 'bundle' => array( 'summary' => 'Unpacks a Pecl Package', 'function' => 'doBundle', 'shortcut' => 'bun', 'options' => array( 'destination' => array( 'shortopt' => 'd', 'arg' => 'DIR', 'doc' => 'Optional destination directory for unpacking (defaults to current path or "ext" if exists)', ), 'force' => array( 'shortopt' => 'f', 'doc' => 'Force the unpacking even if there were errors in the package', ), ), 'doc' => ' Unpacks a Pecl Package into the selected location. It will download the package if needed. '), 'run-scripts' => array( 'summary' => 'Run Post-Install Scripts bundled with a package', 'function' => 'doRunScripts', 'shortcut' => 'rs', 'options' => array( ), 'doc' => ' Run post-installation scripts in package , if any exist. '), ); // }}} // {{{ constructor /** * PEAR_Command_Install constructor. * * @access public */ function __construct(&$ui, &$config) { parent::__construct($ui, $config); } // }}} /** * For unit testing purposes */ function &getDownloader(&$ui, $options, &$config) { if (!class_exists('PEAR_Downloader')) { require_once 'PEAR/Downloader.php'; } $a = new PEAR_Downloader($ui, $options, $config); return $a; } /** * For unit testing purposes */ function &getInstaller(&$ui) { if (!class_exists('PEAR_Installer')) { require_once 'PEAR/Installer.php'; } $a = new PEAR_Installer($ui); return $a; } function enableExtension($binaries, $type) { if (!($phpini = $this->config->get('php_ini', null, 'pear.php.net'))) { return PEAR::raiseError('configuration option "php_ini" is not set to php.ini location'); } $ini = $this->_parseIni($phpini); if (PEAR::isError($ini)) { return $ini; } $line = 0; if ($type == 'extsrc' || $type == 'extbin') { $search = 'extensions'; $enable = 'extension'; } else { $search = 'zend_extensions'; ob_start(); phpinfo(INFO_GENERAL); $info = ob_get_contents(); ob_end_clean(); $debug = function_exists('leak') ? '_debug' : ''; $ts = preg_match('/Thread Safety.+enabled/', $info) ? '_ts' : ''; $enable = 'zend_extension' . $debug . $ts; } foreach ($ini[$search] as $line => $extension) { if (in_array($extension, $binaries, true) || in_array( $ini['extension_dir'] . DIRECTORY_SEPARATOR . $extension, $binaries, true)) { // already enabled - assume if one is, all are return true; } } if ($line) { $newini = array_slice($ini['all'], 0, $line); } else { $newini = array(); } foreach ($binaries as $binary) { if ($ini['extension_dir']) { $binary = basename($binary); } $newini[] = $enable . '="' . $binary . '"' . (OS_UNIX ? "\n" : "\r\n"); } $newini = array_merge($newini, array_slice($ini['all'], $line)); $fp = @fopen($phpini, 'wb'); if (!$fp) { return PEAR::raiseError('cannot open php.ini "' . $phpini . '" for writing'); } foreach ($newini as $line) { fwrite($fp, $line); } fclose($fp); return true; } function disableExtension($binaries, $type) { if (!($phpini = $this->config->get('php_ini', null, 'pear.php.net'))) { return PEAR::raiseError('configuration option "php_ini" is not set to php.ini location'); } $ini = $this->_parseIni($phpini); if (PEAR::isError($ini)) { return $ini; } $line = 0; if ($type == 'extsrc' || $type == 'extbin') { $search = 'extensions'; $enable = 'extension'; } else { $search = 'zend_extensions'; ob_start(); phpinfo(INFO_GENERAL); $info = ob_get_contents(); ob_end_clean(); $debug = function_exists('leak') ? '_debug' : ''; $ts = preg_match('/Thread Safety.+enabled/', $info) ? '_ts' : ''; $enable = 'zend_extension' . $debug . $ts; } $found = false; foreach ($ini[$search] as $line => $extension) { if (in_array($extension, $binaries, true) || in_array( $ini['extension_dir'] . DIRECTORY_SEPARATOR . $extension, $binaries, true)) { $found = true; break; } } if (!$found) { // not enabled return true; } $fp = @fopen($phpini, 'wb'); if (!$fp) { return PEAR::raiseError('cannot open php.ini "' . $phpini . '" for writing'); } if ($line) { $newini = array_slice($ini['all'], 0, $line); // delete the enable line $newini = array_merge($newini, array_slice($ini['all'], $line + 1)); } else { $newini = array_slice($ini['all'], 1); } foreach ($newini as $line) { fwrite($fp, $line); } fclose($fp); return true; } function _parseIni($filename) { if (!file_exists($filename)) { return PEAR::raiseError('php.ini "' . $filename . '" does not exist'); } if (filesize($filename) > 300000) { return PEAR::raiseError('php.ini "' . $filename . '" is too large, aborting'); } ob_start(); phpinfo(INFO_GENERAL); $info = ob_get_contents(); ob_end_clean(); $debug = function_exists('leak') ? '_debug' : ''; $ts = preg_match('/Thread Safety.+enabled/', $info) ? '_ts' : ''; $zend_extension_line = 'zend_extension' . $debug . $ts; $all = @file($filename); if ($all === false) { return PEAR::raiseError('php.ini "' . $filename .'" could not be read'); } $zend_extensions = $extensions = array(); // assume this is right, but pull from the php.ini if it is found $extension_dir = ini_get('extension_dir'); foreach ($all as $linenum => $line) { $line = trim($line); if (!$line) { continue; } if ($line[0] == ';') { continue; } if (strtolower(substr($line, 0, 13)) == 'extension_dir') { $line = trim(substr($line, 13)); if ($line[0] == '=') { $x = trim(substr($line, 1)); $x = explode(';', $x); $extension_dir = str_replace('"', '', array_shift($x)); continue; } } if (strtolower(substr($line, 0, 9)) == 'extension') { $line = trim(substr($line, 9)); if ($line[0] == '=') { $x = trim(substr($line, 1)); $x = explode(';', $x); $extensions[$linenum] = str_replace('"', '', array_shift($x)); continue; } } if (strtolower(substr($line, 0, strlen($zend_extension_line))) == $zend_extension_line) { $line = trim(substr($line, strlen($zend_extension_line))); if ($line[0] == '=') { $x = trim(substr($line, 1)); $x = explode(';', $x); $zend_extensions[$linenum] = str_replace('"', '', array_shift($x)); continue; } } } return array( 'extensions' => $extensions, 'zend_extensions' => $zend_extensions, 'extension_dir' => $extension_dir, 'all' => $all, ); } // {{{ doInstall() function doInstall($command, $options, $params) { if (!class_exists('PEAR_PackageFile')) { require_once 'PEAR/PackageFile.php'; } if (isset($options['installroot']) && isset($options['packagingroot'])) { return $this->raiseError('ERROR: cannot use both --installroot and --packagingroot'); } $reg = &$this->config->getRegistry(); $channel = isset($options['channel']) ? $options['channel'] : $this->config->get('default_channel'); if (!$reg->channelExists($channel)) { return $this->raiseError('Channel "' . $channel . '" does not exist'); } if (empty($this->installer)) { $this->installer = &$this->getInstaller($this->ui); } if ($command == 'upgrade' || $command == 'upgrade-all') { // If people run the upgrade command but pass nothing, emulate a upgrade-all if ($command == 'upgrade' && empty($params)) { return $this->doUpgradeAll($command, $options, $params); } $options['upgrade'] = true; } else { $packages = $params; } $instreg = &$reg; // instreg used to check if package is installed if (isset($options['packagingroot']) && !isset($options['upgrade'])) { $packrootphp_dir = $this->installer->_prependPath( $this->config->get('php_dir', null, 'pear.php.net'), $options['packagingroot']); $metadata_dir = $this->config->get('metadata_dir', null, 'pear.php.net'); if ($metadata_dir) { $metadata_dir = $this->installer->_prependPath( $metadata_dir, $options['packagingroot']); } $instreg = new PEAR_Registry($packrootphp_dir, false, false, $metadata_dir); // other instreg! if ($this->config->get('verbose') > 2) { $this->ui->outputData('using package root: ' . $options['packagingroot']); } } $abstractpackages = $otherpackages = array(); // parse params PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); foreach ($params as $param) { if (strpos($param, 'http://') === 0) { $otherpackages[] = $param; continue; } if (strpos($param, 'channel://') === false && @file_exists($param)) { if (isset($options['force'])) { $otherpackages[] = $param; continue; } $pkg = new PEAR_PackageFile($this->config); $pf = $pkg->fromAnyFile($param, PEAR_VALIDATE_DOWNLOADING); if (PEAR::isError($pf)) { $otherpackages[] = $param; continue; } $exists = $reg->packageExists($pf->getPackage(), $pf->getChannel()); $pversion = $reg->packageInfo($pf->getPackage(), 'version', $pf->getChannel()); $version_compare = version_compare($pf->getVersion(), $pversion, '<='); if ($exists && $version_compare) { if ($this->config->get('verbose')) { $this->ui->outputData('Ignoring installed package ' . $reg->parsedPackageNameToString( array('package' => $pf->getPackage(), 'channel' => $pf->getChannel()), true)); } continue; } $otherpackages[] = $param; continue; } $e = $reg->parsePackageName($param, $channel); if (PEAR::isError($e)) { $otherpackages[] = $param; } else { $abstractpackages[] = $e; } } PEAR::staticPopErrorHandling(); // if there are any local package .tgz or remote static url, we can't // filter. The filter only works for abstract packages if (count($abstractpackages) && !isset($options['force'])) { // when not being forced, only do necessary upgrades/installs if (isset($options['upgrade'])) { $abstractpackages = $this->_filterUptodatePackages($abstractpackages, $command); } else { $count = count($abstractpackages); foreach ($abstractpackages as $i => $package) { if (isset($package['group'])) { // do not filter out install groups continue; } if ($instreg->packageExists($package['package'], $package['channel'])) { if ($count > 1) { if ($this->config->get('verbose')) { $this->ui->outputData('Ignoring installed package ' . $reg->parsedPackageNameToString($package, true)); } unset($abstractpackages[$i]); } elseif ($count === 1) { // Lets try to upgrade it since it's already installed $options['upgrade'] = true; } } } } $abstractpackages = array_map(array($reg, 'parsedPackageNameToString'), $abstractpackages); } elseif (count($abstractpackages)) { $abstractpackages = array_map(array($reg, 'parsedPackageNameToString'), $abstractpackages); } $packages = array_merge($abstractpackages, $otherpackages); if (!count($packages)) { $c = ''; if (isset($options['channel'])){ $c .= ' in channel "' . $options['channel'] . '"'; } $this->ui->outputData('Nothing to ' . $command . $c); return true; } $this->downloader = &$this->getDownloader($this->ui, $options, $this->config); $errors = $downloaded = $binaries = array(); $downloaded = &$this->downloader->download($packages); if (PEAR::isError($downloaded)) { return $this->raiseError($downloaded); } $errors = $this->downloader->getErrorMsgs(); if (count($errors)) { $err = array(); $err['data'] = array(); foreach ($errors as $error) { if ($error !== null) { $err['data'][] = array($error); } } if (!empty($err['data'])) { $err['headline'] = 'Install Errors'; $this->ui->outputData($err); } if (!count($downloaded)) { return $this->raiseError("$command failed"); } } $data = array( 'headline' => 'Packages that would be Installed' ); if (isset($options['pretend'])) { foreach ($downloaded as $package) { $data['data'][] = array($reg->parsedPackageNameToString($package->getParsedPackage())); } $this->ui->outputData($data, 'pretend'); return true; } $this->installer->setOptions($options); $this->installer->sortPackagesForInstall($downloaded); if (PEAR::isError($err = $this->installer->setDownloadedPackages($downloaded))) { $this->raiseError($err->getMessage()); return true; } $binaries = $extrainfo = array(); foreach ($downloaded as $param) { PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); $info = $this->installer->install($param, $options); PEAR::staticPopErrorHandling(); if (PEAR::isError($info)) { $oldinfo = $info; $pkg = &$param->getPackageFile(); if ($info->getCode() != PEAR_INSTALLER_NOBINARY) { if (!($info = $pkg->installBinary($this->installer))) { $this->ui->outputData('ERROR: ' .$oldinfo->getMessage()); continue; } // we just installed a different package than requested, // let's change the param and info so that the rest of this works $param = $info[0]; $info = $info[1]; } } if (!is_array($info)) { return $this->raiseError("$command failed"); } if ($param->getPackageType() == 'extsrc' || $param->getPackageType() == 'extbin' || $param->getPackageType() == 'zendextsrc' || $param->getPackageType() == 'zendextbin' ) { $pkg = &$param->getPackageFile(); if ($instbin = $pkg->getInstalledBinary()) { $instpkg = &$instreg->getPackage($instbin, $pkg->getChannel()); } else { $instpkg = &$instreg->getPackage($pkg->getPackage(), $pkg->getChannel()); } foreach ($instpkg->getFilelist() as $name => $atts) { $pinfo = pathinfo($atts['installed_as']); if (!isset($pinfo['extension']) || in_array($pinfo['extension'], array('c', 'h')) ) { continue; // make sure we don't match php_blah.h } if ((strpos($pinfo['basename'], 'php_') === 0 && $pinfo['extension'] == 'dll') || // most unices $pinfo['extension'] == 'so' || // hp-ux $pinfo['extension'] == 'sl') { $binaries[] = array($atts['installed_as'], $pinfo); break; } } if (count($binaries)) { foreach ($binaries as $pinfo) { PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); $ret = $this->enableExtension(array($pinfo[0]), $param->getPackageType()); PEAR::staticPopErrorHandling(); if (PEAR::isError($ret)) { $extrainfo[] = $ret->getMessage(); if ($param->getPackageType() == 'extsrc' || $param->getPackageType() == 'extbin') { $exttype = 'extension'; $extpath = $pinfo[1]['basename']; } else { $exttype = 'zend_extension'; $extpath = $atts['installed_as']; } $extrainfo[] = 'You should add "' . $exttype . '=' . $extpath . '" to php.ini'; } else { $extrainfo[] = 'Extension ' . $instpkg->getProvidesExtension() . ' enabled in php.ini'; } } } } if ($this->config->get('verbose') > 0) { $chan = $param->getChannel(); $label = $reg->parsedPackageNameToString( array( 'channel' => $chan, 'package' => $param->getPackage(), 'version' => $param->getVersion(), )); $out = array('data' => "$command ok: $label"); if (isset($info['release_warnings'])) { $out['release_warnings'] = $info['release_warnings']; } $this->ui->outputData($out, $command); if (!isset($options['register-only']) && !isset($options['offline'])) { if ($this->config->isDefinedLayer('ftp')) { PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); $info = $this->installer->ftpInstall($param); PEAR::staticPopErrorHandling(); if (PEAR::isError($info)) { $this->ui->outputData($info->getMessage()); $this->ui->outputData("remote install failed: $label"); } else { $this->ui->outputData("remote install ok: $label"); } } } } $deps = $param->getDeps(); if ($deps) { if (isset($deps['group'])) { $groups = $deps['group']; if (!isset($groups[0])) { $groups = array($groups); } foreach ($groups as $group) { if ($group['attribs']['name'] == 'default') { // default group is always installed, unless the user // explicitly chooses to install another group continue; } $extrainfo[] = $param->getPackage() . ': Optional feature ' . $group['attribs']['name'] . ' available (' . $group['attribs']['hint'] . ')'; } $extrainfo[] = $param->getPackage() . ': To install optional features use "pear install ' . $reg->parsedPackageNameToString( array('package' => $param->getPackage(), 'channel' => $param->getChannel()), true) . '#featurename"'; } } $pkg = &$instreg->getPackage($param->getPackage(), $param->getChannel()); // $pkg may be NULL if install is a 'fake' install via --packagingroot if (is_object($pkg)) { $pkg->setConfig($this->config); if ($list = $pkg->listPostinstallScripts()) { $pn = $reg->parsedPackageNameToString(array('channel' => $param->getChannel(), 'package' => $param->getPackage()), true); $extrainfo[] = $pn . ' has post-install scripts:'; foreach ($list as $file) { $extrainfo[] = $file; } $extrainfo[] = $param->getPackage() . ': Use "pear run-scripts ' . $pn . '" to finish setup.'; $extrainfo[] = 'DO NOT RUN SCRIPTS FROM UNTRUSTED SOURCES'; } } } if (count($extrainfo)) { foreach ($extrainfo as $info) { $this->ui->outputData($info); } } return true; } // }}} // {{{ doUpgradeAll() function doUpgradeAll($command, $options, $params) { $reg = &$this->config->getRegistry(); $upgrade = array(); if (isset($options['channel'])) { $channels = array($options['channel']); } else { $channels = $reg->listChannels(); } foreach ($channels as $channel) { if ($channel == '__uri') { continue; } // parse name with channel foreach ($reg->listPackages($channel) as $name) { $upgrade[] = $reg->parsedPackageNameToString(array( 'channel' => $channel, 'package' => $name )); } } $err = $this->doInstall($command, $options, $upgrade); if (PEAR::isError($err)) { $this->ui->outputData($err->getMessage(), $command); } } // }}} // {{{ doUninstall() function doUninstall($command, $options, $params) { if (count($params) < 1) { return $this->raiseError("Please supply the package(s) you want to uninstall"); } if (empty($this->installer)) { $this->installer = &$this->getInstaller($this->ui); } if (isset($options['remoteconfig'])) { $e = $this->config->readFTPConfigFile($options['remoteconfig']); if (!PEAR::isError($e)) { $this->installer->setConfig($this->config); } } $reg = &$this->config->getRegistry(); $newparams = array(); $binaries = array(); $badparams = array(); foreach ($params as $pkg) { $channel = $this->config->get('default_channel'); PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); $parsed = $reg->parsePackageName($pkg, $channel); PEAR::staticPopErrorHandling(); if (!$parsed || PEAR::isError($parsed)) { $badparams[] = $pkg; continue; } $package = $parsed['package']; $channel = $parsed['channel']; $info = &$reg->getPackage($package, $channel); if ($info === null && ($channel == 'pear.php.net' || $channel == 'pecl.php.net')) { // make sure this isn't a package that has flipped from pear to pecl but // used a package.xml 1.0 $testc = ($channel == 'pear.php.net') ? 'pecl.php.net' : 'pear.php.net'; $info = &$reg->getPackage($package, $testc); if ($info !== null) { $channel = $testc; } } if ($info === null) { $badparams[] = $pkg; } else { $newparams[] = &$info; // check for binary packages (this is an alias for those packages if so) if ($installedbinary = $info->getInstalledBinary()) { $this->ui->log('adding binary package ' . $reg->parsedPackageNameToString(array('channel' => $channel, 'package' => $installedbinary), true)); $newparams[] = &$reg->getPackage($installedbinary, $channel); } // add the contents of a dependency group to the list of installed packages if (isset($parsed['group'])) { $group = $info->getDependencyGroup($parsed['group']); if ($group) { $installed = $reg->getInstalledGroup($group); if ($installed) { foreach ($installed as $i => $p) { $newparams[] = &$installed[$i]; } } } } } } $err = $this->installer->sortPackagesForUninstall($newparams); if (PEAR::isError($err)) { $this->ui->outputData($err->getMessage(), $command); return true; } $params = $newparams; // twist this to use it to check on whether dependent packages are also being uninstalled // for circular dependencies like subpackages $this->installer->setUninstallPackages($newparams); $params = array_merge($params, $badparams); $binaries = array(); foreach ($params as $pkg) { $this->installer->pushErrorHandling(PEAR_ERROR_RETURN); if ($err = $this->installer->uninstall($pkg, $options)) { $this->installer->popErrorHandling(); if (PEAR::isError($err)) { $this->ui->outputData($err->getMessage(), $command); continue; } if ($pkg->getPackageType() == 'extsrc' || $pkg->getPackageType() == 'extbin' || $pkg->getPackageType() == 'zendextsrc' || $pkg->getPackageType() == 'zendextbin') { if ($instbin = $pkg->getInstalledBinary()) { continue; // this will be uninstalled later } foreach ($pkg->getFilelist() as $name => $atts) { $pinfo = pathinfo($atts['installed_as']); if (!isset($pinfo['extension']) || in_array($pinfo['extension'], array('c', 'h'))) { continue; // make sure we don't match php_blah.h } if ((strpos($pinfo['basename'], 'php_') === 0 && $pinfo['extension'] == 'dll') || // most unices $pinfo['extension'] == 'so' || // hp-ux $pinfo['extension'] == 'sl') { $binaries[] = array($atts['installed_as'], $pinfo); break; } } if (count($binaries)) { foreach ($binaries as $pinfo) { PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); $ret = $this->disableExtension(array($pinfo[0]), $pkg->getPackageType()); PEAR::staticPopErrorHandling(); if (PEAR::isError($ret)) { $extrainfo[] = $ret->getMessage(); if ($pkg->getPackageType() == 'extsrc' || $pkg->getPackageType() == 'extbin') { $exttype = 'extension'; } else { ob_start(); phpinfo(INFO_GENERAL); $info = ob_get_contents(); ob_end_clean(); $debug = function_exists('leak') ? '_debug' : ''; $ts = preg_match('/Thread Safety.+enabled/', $info) ? '_ts' : ''; $exttype = 'zend_extension' . $debug . $ts; } $this->ui->outputData('Unable to remove "' . $exttype . '=' . $pinfo[1]['basename'] . '" from php.ini', $command); } else { $this->ui->outputData('Extension ' . $pkg->getProvidesExtension() . ' disabled in php.ini', $command); } } } } $savepkg = $pkg; if ($this->config->get('verbose') > 0) { if (is_object($pkg)) { $pkg = $reg->parsedPackageNameToString($pkg); } $this->ui->outputData("uninstall ok: $pkg", $command); } if (!isset($options['offline']) && is_object($savepkg) && defined('PEAR_REMOTEINSTALL_OK')) { if ($this->config->isDefinedLayer('ftp')) { $this->installer->pushErrorHandling(PEAR_ERROR_RETURN); $info = $this->installer->ftpUninstall($savepkg); $this->installer->popErrorHandling(); if (PEAR::isError($info)) { $this->ui->outputData($info->getMessage()); $this->ui->outputData("remote uninstall failed: $pkg"); } else { $this->ui->outputData("remote uninstall ok: $pkg"); } } } } else { $this->installer->popErrorHandling(); if (!is_object($pkg)) { return $this->raiseError("uninstall failed: $pkg"); } $pkg = $reg->parsedPackageNameToString($pkg); } } return true; } // }}} // }}} // {{{ doBundle() /* (cox) It just downloads and untars the package, does not do any check that the PEAR_Installer::_installFile() does. */ function doBundle($command, $options, $params) { $opts = array( 'force' => true, 'nodeps' => true, 'soft' => true, 'downloadonly' => true ); $downloader = &$this->getDownloader($this->ui, $opts, $this->config); $reg = &$this->config->getRegistry(); if (count($params) < 1) { return $this->raiseError("Please supply the package you want to bundle"); } if (isset($options['destination'])) { if (!is_dir($options['destination'])) { System::mkdir('-p ' . $options['destination']); } $dest = realpath($options['destination']); } else { $pwd = getcwd(); $dir = $pwd . DIRECTORY_SEPARATOR . 'ext'; $dest = is_dir($dir) ? $dir : $pwd; } PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); $err = $downloader->setDownloadDir($dest); PEAR::staticPopErrorHandling(); if (PEAR::isError($err)) { return PEAR::raiseError('download directory "' . $dest . '" is not writeable.'); } $result = &$downloader->download(array($params[0])); if (PEAR::isError($result)) { return $result; } if (!isset($result[0])) { return $this->raiseError('unable to unpack ' . $params[0]); } $pkgfile = &$result[0]->getPackageFile(); $pkgname = $pkgfile->getName(); $pkgversion = $pkgfile->getVersion(); // Unpacking ------------------------------------------------- $dest .= DIRECTORY_SEPARATOR . $pkgname; $orig = $pkgname . '-' . $pkgversion; $tar = new Archive_Tar($pkgfile->getArchiveFile()); if (!$tar->extractModify($dest, $orig)) { return $this->raiseError('unable to unpack ' . $pkgfile->getArchiveFile()); } $this->ui->outputData("Package ready at '$dest'"); // }}} } // }}} function doRunScripts($command, $options, $params) { if (!isset($params[0])) { return $this->raiseError('run-scripts expects 1 parameter: a package name'); } $reg = &$this->config->getRegistry(); PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); $parsed = $reg->parsePackageName($params[0], $this->config->get('default_channel')); PEAR::staticPopErrorHandling(); if (PEAR::isError($parsed)) { return $this->raiseError($parsed); } $package = &$reg->getPackage($parsed['package'], $parsed['channel']); if (!is_object($package)) { return $this->raiseError('Could not retrieve package "' . $params[0] . '" from registry'); } $package->setConfig($this->config); $package->runPostinstallScripts(); $this->ui->outputData('Install scripts complete', $command); return true; } /** * Given a list of packages, filter out those ones that are already up to date * * @param $packages: packages, in parsed array format ! * @return list of packages that can be upgraded */ function _filterUptodatePackages($packages, $command) { $reg = &$this->config->getRegistry(); $latestReleases = array(); $ret = array(); foreach ($packages as $package) { if (isset($package['group'])) { $ret[] = $package; continue; } $channel = $package['channel']; $name = $package['package']; if (!$reg->packageExists($name, $channel)) { $ret[] = $package; continue; } if (!isset($latestReleases[$channel])) { // fill in cache for this channel $chan = $reg->getChannel($channel); if (PEAR::isError($chan)) { return $this->raiseError($chan); } $base2 = false; $preferred_mirror = $this->config->get('preferred_mirror', null, $channel); if ($chan->supportsREST($preferred_mirror) && ( //($base2 = $chan->getBaseURL('REST1.4', $preferred_mirror)) || ($base = $chan->getBaseURL('REST1.0', $preferred_mirror)) ) ) { $dorest = true; } PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); if (!isset($package['state'])) { $state = $this->config->get('preferred_state', null, $channel); } else { $state = $package['state']; } if ($dorest) { if ($base2) { $rest = &$this->config->getREST('1.4', array()); $base = $base2; } else { $rest = &$this->config->getREST('1.0', array()); } $installed = array_flip($reg->listPackages($channel)); $latest = $rest->listLatestUpgrades($base, $state, $installed, $channel, $reg); } PEAR::staticPopErrorHandling(); if (PEAR::isError($latest)) { $this->ui->outputData('Error getting channel info from ' . $channel . ': ' . $latest->getMessage()); continue; } $latestReleases[$channel] = array_change_key_case($latest); } // check package for latest release $name_lower = strtolower($name); if (isset($latestReleases[$channel][$name_lower])) { // if not set, up to date $inst_version = $reg->packageInfo($name, 'version', $channel); $channel_version = $latestReleases[$channel][$name_lower]['version']; if (version_compare($channel_version, $inst_version, 'le')) { // installed version is up-to-date continue; } // maintain BC if ($command == 'upgrade-all') { $this->ui->outputData(array('data' => 'Will upgrade ' . $reg->parsedPackageNameToString($package)), $command); } $ret[] = $package; } } return $ret; } } php-pear-1.10.1+submodules+notgz/PEAR/Command/Install.xml000066400000000000000000000205761262614675700231100ustar00rootroot00000000000000 Install Package doInstall i f will overwrite newer installed packages l do not check for recommended dependency version n ignore dependencies, install anyway r do not install files, only register the package as installed s soft install, fail silently, or upgrade if already installed B don't build C extensions Z request uncompressed files when downloading R root directory used when installing files (ala PHP's INSTALL_ROOT), use packagingroot for RPM DIR P root directory used when packaging files, like RPM packaging DIR force install even if there were errors a install all required and optional dependencies o install all required dependencies O do not attempt to download any urls or contact channels p Only list the packages that would be downloaded [channel/]<package> ... Installs one or more PEAR packages. You can specify a package to install in four ways: "Package-1.0.tgz" : installs from a local file "http://example.com/Package-1.0.tgz" : installs from anywhere on the net. "package.xml" : installs the package described in package.xml. Useful for testing, or for wrapping a PEAR package in another package manager such as RPM. "Package[-version/state][.tar]" : queries your default channel's server ({config master_server}) and downloads the newest package with the preferred quality/state ({config preferred_state}). To retrieve Package version 1.1, use "Package-1.1," to retrieve Package state beta, use "Package-beta." To retrieve an uncompressed file, append .tar (make sure there is no file by the same name first) To download a package from another channel, prefix with the channel name like "channel/Package" More than one package may be specified at once. It is ok to mix these four ways of specifying packages. Upgrade Package doInstall up c upgrade packages from a specific channel CHAN f overwrite newer installed packages l do not check for recommended dependency version n ignore dependencies, upgrade anyway r do not install files, only register the package as upgraded B don't build C extensions Z request uncompressed files when downloading R root directory used when installing files (ala PHP's INSTALL_ROOT) DIR force install even if there were errors a install all required and optional dependencies o install all required dependencies O do not attempt to download any urls or contact channels p Only list the packages that would be downloaded <package> ... Upgrades one or more PEAR packages. See documentation for the "install" command for ways to specify a package. When upgrading, your package will be updated if the provided new package has a higher version number (use the -f option if you need to upgrade anyway). More than one package may be specified at once. Upgrade All Packages [Deprecated in favor of calling upgrade with no parameters] doUpgradeAll ua c upgrade packages from a specific channel CHAN n ignore dependencies, upgrade anyway r do not install files, only register the package as upgraded B don't build C extensions Z request uncompressed files when downloading R root directory used when installing files (ala PHP's INSTALL_ROOT), use packagingroot for RPM DIR force install even if there were errors do not check for recommended dependency version WARNING: This function is deprecated in favor of using the upgrade command with no params Upgrades all packages that have a newer release available. Upgrades are done only if there is a release available of the state specified in "preferred_state" (currently {config preferred_state}), or a state considered more stable. Un-install Package doUninstall un n ignore dependencies, uninstall anyway r do not remove files, only register the packages as not installed R root directory used when installing files (ala PHP's INSTALL_ROOT) DIR force install even if there were errors O do not attempt to uninstall remotely [channel/]<package> ... Uninstalls one or more PEAR packages. More than one package may be specified at once. Prefix with channel name to uninstall from a channel not in your default channel ({config default_channel}) Unpacks a Pecl Package doBundle bun d Optional destination directory for unpacking (defaults to current path or "ext" if exists) DIR f Force the unpacking even if there were errors in the package <package> Unpacks a Pecl Package into the selected location. It will download the package if needed. Run Post-Install Scripts bundled with a package doRunScripts rs <package> Run post-installation scripts in package <package>, if any exist. php-pear-1.10.1+submodules+notgz/PEAR/Command/Mirror.php000066400000000000000000000106501262614675700227330ustar00rootroot00000000000000 * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @link http://pear.php.net/package/PEAR * @since File available since Release 1.2.0 */ /** * base class */ require_once 'PEAR/Command/Common.php'; /** * PEAR commands for providing file mirrors * * @category pear * @package PEAR * @author Alexander Merz * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version Release: @package_version@ * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.2.0 */ class PEAR_Command_Mirror extends PEAR_Command_Common { var $commands = array( 'download-all' => array( 'summary' => 'Downloads each available package from the default channel', 'function' => 'doDownloadAll', 'shortcut' => 'da', 'options' => array( 'channel' => array( 'shortopt' => 'c', 'doc' => 'specify a channel other than the default channel', 'arg' => 'CHAN', ), ), 'doc' => ' Requests a list of available packages from the default channel ({config default_channel}) and downloads them to current working directory. Note: only packages within preferred_state ({config preferred_state}) will be downloaded' ), ); /** * PEAR_Command_Mirror constructor. * * @access public * @param object PEAR_Frontend a reference to an frontend * @param object PEAR_Config a reference to the configuration data */ function __construct(&$ui, &$config) { parent::__construct($ui, $config); } /** * For unit-testing */ function &factory($a) { $a = &PEAR_Command::factory($a, $this->config); return $a; } /** * retrieves a list of avaible Packages from master server * and downloads them * * @access public * @param string $command the command * @param array $options the command options before the command * @param array $params the stuff after the command name * @return bool true if successful * @throw PEAR_Error */ function doDownloadAll($command, $options, $params) { $savechannel = $this->config->get('default_channel'); $reg = &$this->config->getRegistry(); $channel = isset($options['channel']) ? $options['channel'] : $this->config->get('default_channel'); if (!$reg->channelExists($channel)) { $this->config->set('default_channel', $savechannel); return $this->raiseError('Channel "' . $channel . '" does not exist'); } $this->config->set('default_channel', $channel); $this->ui->outputData('Using Channel ' . $this->config->get('default_channel')); $chan = $reg->getChannel($channel); if (PEAR::isError($chan)) { return $this->raiseError($chan); } if ($chan->supportsREST($this->config->get('preferred_mirror')) && $base = $chan->getBaseURL('REST1.0', $this->config->get('preferred_mirror'))) { $rest = &$this->config->getREST('1.0', array()); $remoteInfo = array_flip($rest->listPackages($base, $channel)); } if (PEAR::isError($remoteInfo)) { return $remoteInfo; } $cmd = &$this->factory("download"); if (PEAR::isError($cmd)) { return $cmd; } $this->ui->outputData('Using Preferred State of ' . $this->config->get('preferred_state')); $this->ui->outputData('Gathering release information, please wait...'); /** * Error handling not necessary, because already done by * the download command */ PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); $err = $cmd->run('download', array('downloadonly' => true), array_keys($remoteInfo)); PEAR::staticPopErrorHandling(); $this->config->set('default_channel', $savechannel); if (PEAR::isError($err)) { $this->ui->outputData($err->getMessage()); } return true; } } php-pear-1.10.1+submodules+notgz/PEAR/Command/Mirror.xml000066400000000000000000000011511262614675700227400ustar00rootroot00000000000000 Downloads each available package from the default channel doDownloadAll da c specify a channel other than the default channel CHAN Requests a list of available packages from the default channel ({config default_channel}) and downloads them to current working directory. Note: only packages within preferred_state ({config preferred_state}) will be downloaded php-pear-1.10.1+submodules+notgz/PEAR/Command/Package.php000066400000000000000000001164311262614675700230200ustar00rootroot00000000000000 * @author Martin Jansen * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @link http://pear.php.net/package/PEAR * @since File available since Release 0.1 */ /** * base class */ require_once 'PEAR/Command/Common.php'; /** * PEAR commands for login/logout * * @category pear * @package PEAR * @author Stig Bakken * @author Martin Jansen * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version Release: @package_version@ * @link http://pear.php.net/package/PEAR * @since Class available since Release 0.1 */ class PEAR_Command_Package extends PEAR_Command_Common { var $commands = array( 'package' => array( 'summary' => 'Build Package', 'function' => 'doPackage', 'shortcut' => 'p', 'options' => array( 'nocompress' => array( 'shortopt' => 'Z', 'doc' => 'Do not gzip the package file' ), 'showname' => array( 'shortopt' => 'n', 'doc' => 'Print the name of the packaged file.', ), ), 'doc' => '[descfile] [descfile2] Creates a PEAR package from its description file (usually called package.xml). If a second packagefile is passed in, then the packager will check to make sure that one is a package.xml version 1.0, and the other is a package.xml version 2.0. The package.xml version 1.0 will be saved as "package.xml" in the archive, and the other as "package2.xml" in the archive" ' ), 'package-validate' => array( 'summary' => 'Validate Package Consistency', 'function' => 'doPackageValidate', '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. ', ), 'svntag' => array( 'summary' => 'Set SVN Release Tag', 'function' => 'doSvnTag', 'shortcut' => 'sv', 'options' => array( 'quiet' => array( 'shortopt' => 'q', 'doc' => 'Be quiet', ), 'slide' => array( 'shortopt' => 'F', 'doc' => 'Move (slide) tag if it exists', ), 'delete' => array( 'shortopt' => 'd', 'doc' => 'Remove tag', ), 'dry-run' => array( 'shortopt' => 'n', 'doc' => 'Don\'t do anything, just pretend', ), ), 'doc' => ' [files...] Sets a SVN 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 after running svntag once, but before the tarball is released to the public, use the "slide" option to move the release tag. to include files (such as a second package.xml, or tests not included in the release), pass them as additional parameters. ', ), 'cvstag' => array( 'summary' => 'Set CVS Release Tag', 'function' => 'doCvsTag', 'shortcut' => 'ct', 'options' => array( 'quiet' => array( 'shortopt' => 'q', 'doc' => 'Be quiet', ), 'reallyquiet' => array( 'shortopt' => 'Q', 'doc' => 'Be really quiet', ), 'slide' => array( 'shortopt' => 'F', 'doc' => 'Move (slide) tag if it exists', ), 'delete' => array( 'shortopt' => 'd', 'doc' => 'Remove tag', ), 'dry-run' => array( 'shortopt' => 'n', 'doc' => 'Don\'t do anything, just pretend', ), ), 'doc' => ' [files...] 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 after running cvstag once, but before the tarball is released to the public, use the "slide" option to move the release tag. to include files (such as a second package.xml, or tests not included in the release), pass them as additional parameters. ', ), 'package-dependencies' => array( 'summary' => 'Show package dependencies', 'function' => 'doPackageDependencies', 'shortcut' => 'pd', 'options' => array(), 'doc' => ' or or List all dependencies the package has. Can take a tgz / tar file, package.xml or a package name of an installed package.' ), 'sign' => array( 'summary' => 'Sign a package distribution file', 'function' => 'doSign', 'shortcut' => 'si', 'options' => array( 'verbose' => array( 'shortopt' => 'v', 'doc' => 'Display GnuPG output', ), ), 'doc' => ' Signs a package distribution (.tar or .tgz) file with GnuPG.', ), 'makerpm' => array( 'summary' => 'Builds an RPM spec file from a PEAR package', 'function' => 'doMakeRPM', 'shortcut' => 'rpm', 'options' => array( 'spec-template' => array( 'shortopt' => 't', 'arg' => 'FILE', 'doc' => 'Use FILE as RPM spec file template' ), 'rpm-pkgname' => array( 'shortopt' => 'p', 'arg' => 'FORMAT', 'doc' => 'Use FORMAT as format string for RPM package name, %s is replaced by the PEAR package name, defaults to "PEAR::%s".', ), ), 'doc' => ' Creates an RPM .spec file for wrapping a PEAR package inside an RPM package. Intended to be used from the SPECS directory, with the PEAR package tarball in the SOURCES directory: $ pear makerpm ../SOURCES/Net_Socket-1.0.tgz Wrote RPM spec file PEAR::Net_Geo-1.0.spec $ rpm -bb PEAR::Net_Socket-1.0.spec ... Wrote: /usr/src/redhat/RPMS/i386/PEAR::Net_Socket-1.0-1.i386.rpm ', ), 'convert' => array( 'summary' => 'Convert a package.xml 1.0 to package.xml 2.0 format', 'function' => 'doConvert', 'shortcut' => 'c2', 'options' => array( 'flat' => array( 'shortopt' => 'f', 'doc' => 'do not beautify the filelist.', ), ), 'doc' => '[descfile] [descfile2] Converts a package.xml in 1.0 format into a package.xml in 2.0 format. The new file will be named package2.xml by default, and package.xml will be used as the old file by default. This is not the most intelligent conversion, and should only be used for automated conversion or learning the format. ' ), ); var $output; /** * PEAR_Command_Package constructor. * * @access public */ function __construct(&$ui, &$config) { parent::__construct($ui, $config); } function _displayValidationResults($err, $warn, $strict = false) { foreach ($err as $e) { $this->output .= "Error: $e\n"; } foreach ($warn as $w) { $this->output .= "Warning: $w\n"; } $this->output .= sprintf('Validation: %d error(s), %d warning(s)'."\n", sizeof($err), sizeof($warn)); if ($strict && count($err) > 0) { $this->output .= "Fix these errors and try again."; return false; } return true; } function &getPackager() { if (!class_exists('PEAR_Packager')) { require_once 'PEAR/Packager.php'; } $a = new PEAR_Packager; return $a; } function &getPackageFile($config, $debug = false) { if (!class_exists('PEAR_Common')) { require_once 'PEAR/Common.php'; } if (!class_exists('PEAR_PackageFile')) { require_once 'PEAR/PackageFile.php'; } $a = new PEAR_PackageFile($config, $debug); $common = new PEAR_Common; $common->ui = $this->ui; $a->setLogger($common); return $a; } function doPackage($command, $options, $params) { $this->output = ''; $pkginfofile = isset($params[0]) ? $params[0] : 'package.xml'; $pkg2 = isset($params[1]) ? $params[1] : null; if (!$pkg2 && !isset($params[0]) && file_exists('package2.xml')) { $pkg2 = 'package2.xml'; } $packager = &$this->getPackager(); $compress = empty($options['nocompress']) ? true : false; $result = $packager->package($pkginfofile, $compress, $pkg2); if (PEAR::isError($result)) { return $this->raiseError($result); } // Don't want output, only the package file name just created if (isset($options['showname'])) { $this->output = $result; } if ($this->output) { $this->ui->outputData($this->output, $command); } return true; } function doPackageValidate($command, $options, $params) { $this->output = ''; if (count($params) < 1) { $params[0] = 'package.xml'; } $obj = &$this->getPackageFile($this->config, $this->_debug); $obj->rawReturn(); PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); $info = $obj->fromTgzFile($params[0], PEAR_VALIDATE_NORMAL); if (PEAR::isError($info)) { $info = $obj->fromPackageFile($params[0], PEAR_VALIDATE_NORMAL); } else { $archive = $info->getArchiveFile(); $tar = new Archive_Tar($archive); $tar->extract(dirname($info->getPackageFile())); $info->setPackageFile(dirname($info->getPackageFile()) . DIRECTORY_SEPARATOR . $info->getPackage() . '-' . $info->getVersion() . DIRECTORY_SEPARATOR . basename($info->getPackageFile())); } PEAR::staticPopErrorHandling(); if (PEAR::isError($info)) { return $this->raiseError($info); } $valid = false; if ($info->getPackagexmlVersion() == '2.0') { if ($valid = $info->validate(PEAR_VALIDATE_NORMAL)) { $info->flattenFileList(); $valid = $info->validate(PEAR_VALIDATE_PACKAGING); } } else { $valid = $info->validate(PEAR_VALIDATE_PACKAGING); } $err = $warn = array(); if ($errors = $info->getValidationWarnings()) { foreach ($errors as $error) { if ($error['level'] == 'warning') { $warn[] = $error['message']; } else { $err[] = $error['message']; } } } $this->_displayValidationResults($err, $warn); $this->ui->outputData($this->output, $command); return true; } function doSvnTag($command, $options, $params) { $this->output = ''; $_cmd = $command; if (count($params) < 1) { $help = $this->getHelp($command); return $this->raiseError("$command: missing parameter: $help[0]"); } $packageFile = realpath($params[0]); $dir = dirname($packageFile); $dir = substr($dir, strrpos($dir, DIRECTORY_SEPARATOR) + 1); $obj = &$this->getPackageFile($this->config, $this->_debug); $info = $obj->fromAnyFile($packageFile, PEAR_VALIDATE_NORMAL); if (PEAR::isError($info)) { return $this->raiseError($info); } $err = $warn = array(); if (!$info->validate()) { foreach ($info->getValidationWarnings() as $error) { if ($error['level'] == 'warning') { $warn[] = $error['message']; } else { $err[] = $error['message']; } } } if (!$this->_displayValidationResults($err, $warn, true)) { $this->ui->outputData($this->output, $command); return $this->raiseError('SVN tag failed'); } $version = $info->getVersion(); $package = $info->getName(); $svntag = "$package-$version"; if (isset($options['delete'])) { return $this->_svnRemoveTag($version, $package, $svntag, $packageFile, $options); } $path = $this->_svnFindPath($packageFile); // Check if there are any modified files $fp = popen('svn st --xml ' . dirname($packageFile), "r"); $out = ''; while ($line = fgets($fp, 1024)) { $out .= rtrim($line)."\n"; } pclose($fp); if (!isset($options['quiet']) && strpos($out, 'item="modified"')) { $params = array(array( 'name' => 'modified', 'type' => 'yesno', 'default' => 'no', 'prompt' => 'You have files in your SVN checkout (' . $path['from'] . ') that have been modified but not committed, do you still want to tag ' . $version . '?', )); $answers = $this->ui->confirmDialog($params); if (!in_array($answers['modified'], array('y', 'yes', 'on', '1'))) { return true; } } if (isset($options['slide'])) { $this->_svnRemoveTag($version, $package, $svntag, $packageFile, $options); } // Check if tag already exists $releaseTag = $path['local']['base'] . 'tags' . DIRECTORY_SEPARATOR . $svntag; $existsCommand = 'svn ls ' . $path['base'] . 'tags/'; $fp = popen($existsCommand, "r"); $out = ''; while ($line = fgets($fp, 1024)) { $out .= rtrim($line)."\n"; } pclose($fp); if (in_array($svntag . DIRECTORY_SEPARATOR, explode("\n", $out))) { $this->ui->outputData($this->output, $command); return $this->raiseError('SVN tag ' . $svntag . ' for ' . $package . ' already exists.'); } elseif (file_exists($path['local']['base'] . 'tags') === false) { return $this->raiseError('Can not locate the tags directory at ' . $path['local']['base'] . 'tags'); } elseif (is_writeable($path['local']['base'] . 'tags') === false) { return $this->raiseError('Can not write to the tag directory at ' . $path['local']['base'] . 'tags'); } else { $makeCommand = 'svn mkdir ' . $releaseTag; $this->output .= "+ $makeCommand\n"; if (empty($options['dry-run'])) { // We need to create the tag dir. $fp = popen($makeCommand, "r"); $out = ''; while ($line = fgets($fp, 1024)) { $out .= rtrim($line)."\n"; } pclose($fp); $this->output .= "$out\n"; } } $command = 'svn'; if (isset($options['quiet'])) { $command .= ' -q'; } $command .= ' copy --parents '; $dir = dirname($packageFile); $dir = substr($dir, strrpos($dir, DIRECTORY_SEPARATOR) + 1); $files = array_keys($info->getFilelist()); if (!in_array(basename($packageFile), $files)) { $files[] = basename($packageFile); } array_shift($params); if (count($params)) { // add in additional files to be tagged (package files and such) $files = array_merge($files, $params); } $commands = array(); foreach ($files as $file) { if (!file_exists($file)) { $file = $dir . DIRECTORY_SEPARATOR . $file; } $commands[] = $command . ' ' . escapeshellarg($file) . ' ' . escapeshellarg($releaseTag . DIRECTORY_SEPARATOR . $file); } $this->output .= implode("\n", $commands) . "\n"; if (empty($options['dry-run'])) { foreach ($commands as $command) { $fp = popen($command, "r"); while ($line = fgets($fp, 1024)) { $this->output .= rtrim($line)."\n"; } pclose($fp); } } $command = 'svn ci -m "Tagging the ' . $version . ' release" ' . $releaseTag . "\n"; $this->output .= "+ $command\n"; if (empty($options['dry-run'])) { $fp = popen($command, "r"); while ($line = fgets($fp, 1024)) { $this->output .= rtrim($line)."\n"; } pclose($fp); } $this->ui->outputData($this->output, $_cmd); return true; } function _svnFindPath($file) { $xml = ''; $command = "svn info --xml $file"; $fp = popen($command, "r"); while ($line = fgets($fp, 1024)) { $xml .= rtrim($line)."\n"; } pclose($fp); $url_tag = strpos($xml, ''); $url = substr($xml, $url_tag + 5, strpos($xml, '', $url_tag + 5) - ($url_tag + 5)); $path = array(); $path['from'] = substr($url, 0, strrpos($url, '/')); $path['base'] = substr($path['from'], 0, strrpos($path['from'], '/') + 1); // Figure out the local paths - see http://pear.php.net/bugs/17463 $pos = strpos($file, DIRECTORY_SEPARATOR . 'trunk' . DIRECTORY_SEPARATOR); if ($pos === false) { $pos = strpos($file, DIRECTORY_SEPARATOR . 'branches' . DIRECTORY_SEPARATOR); } $path['local']['base'] = substr($file, 0, $pos + 1); return $path; } function _svnRemoveTag($version, $package, $tag, $packageFile, $options) { $command = 'svn'; if (isset($options['quiet'])) { $command .= ' -q'; } $command .= ' remove'; $command .= ' -m "Removing tag for the ' . $version . ' release."'; $path = $this->_svnFindPath($packageFile); $command .= ' ' . $path['base'] . 'tags/' . $tag; if ($this->config->get('verbose') > 1) { $this->output .= "+ $command\n"; } $this->output .= "+ $command\n"; if (empty($options['dry-run'])) { $fp = popen($command, "r"); while ($line = fgets($fp, 1024)) { $this->output .= rtrim($line)."\n"; } pclose($fp); } $this->ui->outputData($this->output, $command); return true; } function doCvsTag($command, $options, $params) { $this->output = ''; $_cmd = $command; if (count($params) < 1) { $help = $this->getHelp($command); return $this->raiseError("$command: missing parameter: $help[0]"); } $packageFile = realpath($params[0]); $obj = &$this->getPackageFile($this->config, $this->_debug); $info = $obj->fromAnyFile($packageFile, PEAR_VALIDATE_NORMAL); if (PEAR::isError($info)) { return $this->raiseError($info); } $err = $warn = array(); if (!$info->validate()) { foreach ($info->getValidationWarnings() as $error) { if ($error['level'] == 'warning') { $warn[] = $error['message']; } else { $err[] = $error['message']; } } } if (!$this->_displayValidationResults($err, $warn, true)) { $this->ui->outputData($this->output, $command); return $this->raiseError('CVS tag failed'); } $version = $info->getVersion(); $cvsversion = preg_replace('/[^a-z0-9]/i', '_', $version); $cvstag = "RELEASE_$cvsversion"; $files = array_keys($info->getFilelist()); $command = 'cvs'; if (isset($options['quiet'])) { $command .= ' -q'; } if (isset($options['reallyquiet'])) { $command .= ' -Q'; } $command .= ' tag'; if (isset($options['slide'])) { $command .= ' -F'; } if (isset($options['delete'])) { $command .= ' -d'; } $command .= ' ' . $cvstag . ' ' . escapeshellarg($params[0]); array_shift($params); if (count($params)) { // add in additional files to be tagged $files = array_merge($files, $params); } $dir = dirname($packageFile); $dir = substr($dir, strrpos($dir, '/') + 1); foreach ($files as $file) { if (!file_exists($file)) { $file = $dir . DIRECTORY_SEPARATOR . $file; } $command .= ' ' . escapeshellarg($file); } if ($this->config->get('verbose') > 1) { $this->output .= "+ $command\n"; } $this->output .= "+ $command\n"; if (empty($options['dry-run'])) { $fp = popen($command, "r"); while ($line = fgets($fp, 1024)) { $this->output .= rtrim($line)."\n"; } pclose($fp); } $this->ui->outputData($this->output, $_cmd); return true; } function doCvsDiff($command, $options, $params) { $this->output = ''; if (sizeof($params) < 1) { $help = $this->getHelp($command); return $this->raiseError("$command: missing parameter: $help[0]"); } $file = realpath($params[0]); $obj = &$this->getPackageFile($this->config, $this->_debug); $info = $obj->fromAnyFile($file, PEAR_VALIDATE_NORMAL); if (PEAR::isError($info)) { return $this->raiseError($info); } $err = $warn = array(); if (!$info->validate()) { foreach ($info->getValidationWarnings() as $error) { if ($error['level'] == 'warning') { $warn[] = $error['message']; } else { $err[] = $error['message']; } } } if (!$this->_displayValidationResults($err, $warn, true)) { $this->ui->outputData($this->output, $command); return $this->raiseError('CVS diff failed'); } $info1 = $info->getFilelist(); $files = $info1; $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 = $short = false; if (isset($this->commands[$command]['options'][$option])) { $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['name']); } 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; } function doPackageDependencies($command, $options, $params) { // $params[0] -> the PEAR package to list its information if (count($params) !== 1) { return $this->raiseError("bad parameter(s), try \"help $command\""); } $obj = &$this->getPackageFile($this->config, $this->_debug); if (is_file($params[0]) || strpos($params[0], '.xml') > 0) { $info = $obj->fromAnyFile($params[0], PEAR_VALIDATE_NORMAL); } else { $reg = $this->config->getRegistry(); $info = $obj->fromArray($reg->packageInfo($params[0])); } if (PEAR::isError($info)) { return $this->raiseError($info); } $deps = $info->getDeps(); if (is_array($deps)) { if ($info->getPackagexmlVersion() == '1.0') { $data = array( 'caption' => 'Dependencies for pear/' . $info->getPackage(), 'border' => true, 'headline' => array("Required?", "Type", "Name", "Relation", "Version"), ); foreach ($deps as $d) { if (isset($d['optional'])) { if ($d['optional'] == 'yes') { $req = 'No'; } else { $req = 'Yes'; } } else { $req = 'Yes'; } if (isset($this->_deps_rel_trans[$d['rel']])) { $rel = $this->_deps_rel_trans[$d['rel']]; } else { $rel = $d['rel']; } if (isset($this->_deps_type_trans[$d['type']])) { $type = ucfirst($this->_deps_type_trans[$d['type']]); } else { $type = $d['type']; } if (isset($d['name'])) { $name = $d['name']; } else { $name = ''; } if (isset($d['version'])) { $version = $d['version']; } else { $version = ''; } $data['data'][] = array($req, $type, $name, $rel, $version); } } else { // package.xml 2.0 dependencies display require_once 'PEAR/Dependency2.php'; $deps = $info->getDependencies(); $reg = &$this->config->getRegistry(); if (is_array($deps)) { $d = new PEAR_Dependency2($this->config, array(), ''); $data = array( 'caption' => 'Dependencies for ' . $info->getPackage(), 'border' => true, 'headline' => array("Required?", "Type", "Name", 'Versioning', 'Group'), ); foreach ($deps as $type => $subd) { $req = ($type == 'required') ? 'Yes' : 'No'; if ($type == 'group' && isset($subd['attribs']['name'])) { $group = $subd['attribs']['name']; } else { $group = ''; } if (!isset($subd[0])) { $subd = array($subd); } foreach ($subd as $groupa) { foreach ($groupa as $deptype => $depinfo) { if ($deptype == 'attribs') { continue; } if ($deptype == 'pearinstaller') { $deptype = 'pear Installer'; } if (!isset($depinfo[0])) { $depinfo = array($depinfo); } foreach ($depinfo as $inf) { $name = ''; if (isset($inf['channel'])) { $alias = $reg->channelAlias($inf['channel']); if (!$alias) { $alias = '(channel?) ' .$inf['channel']; } $name = $alias . '/'; } if (isset($inf['name'])) { $name .= $inf['name']; } elseif (isset($inf['pattern'])) { $name .= $inf['pattern']; } else { $name .= ''; } if (isset($inf['uri'])) { $name .= ' [' . $inf['uri'] . ']'; } if (isset($inf['conflicts'])) { $ver = 'conflicts'; } else { $ver = $d->_getExtraString($inf); } $data['data'][] = array($req, ucfirst($deptype), $name, $ver, $group); } } } } } } $this->ui->outputData($data, $command); return true; } // Fallback $this->ui->outputData("This package does not have any dependencies.", $command); } function doSign($command, $options, $params) { // should move most of this code into PEAR_Packager // so it'll be easy to implement "pear package --sign" if (count($params) !== 1) { return $this->raiseError("bad parameter(s), try \"help $command\""); } require_once 'System.php'; require_once 'Archive/Tar.php'; if (!file_exists($params[0])) { return $this->raiseError("file does not exist: $params[0]"); } $obj = $this->getPackageFile($this->config, $this->_debug); $info = $obj->fromTgzFile($params[0], PEAR_VALIDATE_NORMAL); if (PEAR::isError($info)) { return $this->raiseError($info); } $tar = new Archive_Tar($params[0]); $tmpdir = $this->config->get('temp_dir'); $tmpdir = System::mktemp(' -t "' . $tmpdir . '" -d pearsign'); if (!$tar->extractList('package2.xml package.xml package.sig', $tmpdir)) { return $this->raiseError("failed to extract tar file"); } if (file_exists("$tmpdir/package.sig")) { return $this->raiseError("package already signed"); } $packagexml = 'package.xml'; if (file_exists("$tmpdir/package2.xml")) { $packagexml = 'package2.xml'; } if (file_exists("$tmpdir/package.sig")) { unlink("$tmpdir/package.sig"); } if (!file_exists("$tmpdir/$packagexml")) { return $this->raiseError("Extracted file $tmpdir/$packagexml not found."); } $input = $this->ui->userDialog($command, array('GnuPG Passphrase'), array('password')); if (!isset($input[0])) { //use empty passphrase $input[0] = ''; } $devnull = (isset($options['verbose'])) ? '' : ' 2>/dev/null'; $gpg = popen("gpg --batch --passphrase-fd 0 --armor --detach-sign --output $tmpdir/package.sig $tmpdir/$packagexml" . $devnull, "w"); if (!$gpg) { return $this->raiseError("gpg command failed"); } fwrite($gpg, "$input[0]\n"); if (pclose($gpg) || !file_exists("$tmpdir/package.sig")) { return $this->raiseError("gpg sign failed"); } if (!$tar->addModify("$tmpdir/package.sig", '', $tmpdir)) { return $this->raiseError('failed adding signature to file'); } $this->ui->outputData("Package signed.", $command); return true; } /** * For unit testing purposes */ function &getInstaller(&$ui) { if (!class_exists('PEAR_Installer')) { require_once 'PEAR/Installer.php'; } $a = new PEAR_Installer($ui); return $a; } /** * For unit testing purposes */ function &getCommandPackaging(&$ui, &$config) { if (!class_exists('PEAR_Command_Packaging')) { if ($fp = @fopen('PEAR/Command/Packaging.php', 'r', true)) { fclose($fp); include_once 'PEAR/Command/Packaging.php'; } } if (class_exists('PEAR_Command_Packaging')) { $a = new PEAR_Command_Packaging($ui, $config); } else { $a = null; } return $a; } function doMakeRPM($command, $options, $params) { // Check to see if PEAR_Command_Packaging is installed, and // transparently switch to use the "make-rpm-spec" command from it // instead, if it does. Otherwise, continue to use the old version // of "makerpm" supplied with this package (PEAR). $packaging_cmd = $this->getCommandPackaging($this->ui, $this->config); if ($packaging_cmd !== null) { $this->ui->outputData('PEAR_Command_Packaging is installed; using '. 'newer "make-rpm-spec" command instead'); return $packaging_cmd->run('make-rpm-spec', $options, $params); } $this->ui->outputData('WARNING: "pear makerpm" is no longer available; an '. 'improved version is available via "pear make-rpm-spec", which '. 'is available by installing PEAR_Command_Packaging'); return true; } function doConvert($command, $options, $params) { $packagexml = isset($params[0]) ? $params[0] : 'package.xml'; $newpackagexml = isset($params[1]) ? $params[1] : dirname($packagexml) . DIRECTORY_SEPARATOR . 'package2.xml'; $pkg = &$this->getPackageFile($this->config, $this->_debug); PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); $pf = $pkg->fromPackageFile($packagexml, PEAR_VALIDATE_NORMAL); PEAR::staticPopErrorHandling(); if (PEAR::isError($pf)) { if (is_array($pf->getUserInfo())) { foreach ($pf->getUserInfo() as $warning) { $this->ui->outputData($warning['message']); } } return $this->raiseError($pf); } if (is_a($pf, 'PEAR_PackageFile_v2')) { $this->ui->outputData($packagexml . ' is already a package.xml version 2.0'); return true; } $gen = &$pf->getDefaultGenerator(); $newpf = &$gen->toV2(); $newpf->setPackagefile($newpackagexml); $gen = &$newpf->getDefaultGenerator(); PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); $state = (isset($options['flat']) ? PEAR_VALIDATE_PACKAGING : PEAR_VALIDATE_NORMAL); $saved = $gen->toPackageFile(dirname($newpackagexml), $state, basename($newpackagexml)); PEAR::staticPopErrorHandling(); if (PEAR::isError($saved)) { if (is_array($saved->getUserInfo())) { foreach ($saved->getUserInfo() as $warning) { $this->ui->outputData($warning['message']); } } $this->ui->outputData($saved->getMessage()); return true; } $this->ui->outputData('Wrote new version 2.0 package.xml to "' . $saved . '"'); return true; } } php-pear-1.10.1+submodules+notgz/PEAR/Command/Package.xml000066400000000000000000000160661262614675700230340ustar00rootroot00000000000000 Build Package doPackage p Z Do not gzip the package file n Print the name of the packaged file. [descfile] [descfile2] Creates a PEAR package from its description file (usually called package.xml). If a second packagefile is passed in, then the packager will check to make sure that one is a package.xml version 1.0, and the other is a package.xml version 2.0. The package.xml version 1.0 will be saved as "package.xml" in the archive, and the other as "package2.xml" in the archive" Validate Package Consistency doPackageValidate pv Run a "cvs diff" for all files in a package doCvsDiff cd q Be quiet Q Be really quiet D Diff against revision of DATE DATE R Diff against tag for package release REL REL r Diff against revision REV REV c Generate context diff u Generate unified diff i Ignore case, consider upper- and lower-case letters equivalent b Ignore changes in amount of white space B Ignore changes that insert or delete blank lines Report only whether the files differ, no details n Don't do anything, just pretend <package.xml> 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. Set SVN Release Tag doSvnTag sv q Be quiet F Move (slide) tag if it exists d Remove tag n Don't do anything, just pretend <package.xml> [files...] Sets a SVN 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 after running svntag once, but before the tarball is released to the public, use the "slide" option to move the release tag. to include files (such as a second package.xml, or tests not included in the release), pass them as additional parameters. Set CVS Release Tag doCvsTag ct q Be quiet Q Be really quiet F Move (slide) tag if it exists d Remove tag n Don't do anything, just pretend <package.xml> [files...] 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 after running cvstag once, but before the tarball is released to the public, use the "slide" option to move the release tag. to include files (such as a second package.xml, or tests not included in the release), pass them as additional parameters. Show package dependencies doPackageDependencies pd <package-file> or <package.xml> or <install-package-name> List all dependencies the package has. Can take a tgz / tar file, package.xml or a package name of an installed package. Sign a package distribution file doSign si v Display GnuPG output <package-file> Signs a package distribution (.tar or .tgz) file with GnuPG. Builds an RPM spec file from a PEAR package doMakeRPM rpm t Use FILE as RPM spec file template FILE p Use FORMAT as format string for RPM package name, %s is replaced by the PEAR package name, defaults to "PEAR::%s". FORMAT <package-file> Creates an RPM .spec file for wrapping a PEAR package inside an RPM package. Intended to be used from the SPECS directory, with the PEAR package tarball in the SOURCES directory: $ pear makerpm ../SOURCES/Net_Socket-1.0.tgz Wrote RPM spec file PEAR::Net_Geo-1.0.spec $ rpm -bb PEAR::Net_Socket-1.0.spec ... Wrote: /usr/src/redhat/RPMS/i386/PEAR::Net_Socket-1.0-1.i386.rpm Convert a package.xml 1.0 to package.xml 2.0 format doConvert c2 f do not beautify the filelist. [descfile] [descfile2] Converts a package.xml in 1.0 format into a package.xml in 2.0 format. The new file will be named package2.xml by default, and package.xml will be used as the old file by default. This is not the most intelligent conversion, and should only be used for automated conversion or learning the format. php-pear-1.10.1+submodules+notgz/PEAR/Command/Pickle.php000066400000000000000000000370411262614675700226730ustar00rootroot00000000000000 * @copyright 2005-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.1 */ /** * base class */ require_once 'PEAR/Command/Common.php'; /** * PEAR commands for login/logout * * @category pear * @package PEAR * @author Greg Beaver * @copyright 2005-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version Release: @package_version@ * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.1 */ class PEAR_Command_Pickle extends PEAR_Command_Common { var $commands = array( 'pickle' => array( 'summary' => 'Build PECL Package', 'function' => 'doPackage', 'shortcut' => 'pi', 'options' => array( 'nocompress' => array( 'shortopt' => 'Z', 'doc' => 'Do not gzip the package file' ), 'showname' => array( 'shortopt' => 'n', 'doc' => 'Print the name of the packaged file.', ), ), 'doc' => '[descfile] Creates a PECL package from its package2.xml file. An automatic conversion will be made to a package.xml 1.0 and written out to disk in the current directory as "package.xml". Note that only simple package.xml 2.0 will be converted. package.xml 2.0 with: - dependency types other than required/optional PECL package/ext/php/pearinstaller - more than one extsrcrelease or zendextsrcrelease - zendextbinrelease, extbinrelease, phprelease, or bundle release type - dependency groups - ignore tags in release filelist - tasks other than replace - custom roles will cause pickle to fail, and output an error message. If your package2.xml uses any of these features, you are best off using PEAR_PackageFileManager to generate both package.xml. ' ), ); /** * PEAR_Command_Package constructor. * * @access public */ function __construct(&$ui, &$config) { parent::__construct($ui, $config); } /** * For unit-testing ease * * @return PEAR_Packager */ function &getPackager() { if (!class_exists('PEAR_Packager')) { require_once 'PEAR/Packager.php'; } $a = new PEAR_Packager; return $a; } /** * For unit-testing ease * * @param PEAR_Config $config * @param bool $debug * @param string|null $tmpdir * @return PEAR_PackageFile */ function &getPackageFile($config, $debug = false) { if (!class_exists('PEAR_Common')) { require_once 'PEAR/Common.php'; } if (!class_exists('PEAR_PackageFile')) { require_once 'PEAR/PackageFile.php'; } $a = new PEAR_PackageFile($config, $debug); $common = new PEAR_Common; $common->ui = $this->ui; $a->setLogger($common); return $a; } function doPackage($command, $options, $params) { $this->output = ''; $pkginfofile = isset($params[0]) ? $params[0] : 'package2.xml'; $packager = &$this->getPackager(); if (PEAR::isError($err = $this->_convertPackage($pkginfofile))) { return $err; } $compress = empty($options['nocompress']) ? true : false; $result = $packager->package($pkginfofile, $compress, 'package.xml'); if (PEAR::isError($result)) { return $this->raiseError($result); } // Don't want output, only the package file name just created if (isset($options['showname'])) { $this->ui->outputData($result, $command); } return true; } function _convertPackage($packagexml) { $pkg = &$this->getPackageFile($this->config); $pf2 = &$pkg->fromPackageFile($packagexml, PEAR_VALIDATE_NORMAL); if (!is_a($pf2, 'PEAR_PackageFile_v2')) { return $this->raiseError('Cannot process "' . $packagexml . '", is not a package.xml 2.0'); } require_once 'PEAR/PackageFile/v1.php'; $pf = new PEAR_PackageFile_v1; $pf->setConfig($this->config); if ($pf2->getPackageType() != 'extsrc' && $pf2->getPackageType() != 'zendextsrc') { return $this->raiseError('Cannot safely convert "' . $packagexml . '", is not an extension source package. Using a PEAR_PackageFileManager-based ' . 'script is an option'); } if (is_array($pf2->getUsesRole())) { return $this->raiseError('Cannot safely convert "' . $packagexml . '", contains custom roles. Using a PEAR_PackageFileManager-based script or ' . 'the convert command is an option'); } if (is_array($pf2->getUsesTask())) { return $this->raiseError('Cannot safely convert "' . $packagexml . '", contains custom tasks. Using a PEAR_PackageFileManager-based script or ' . 'the convert command is an option'); } $deps = $pf2->getDependencies(); if (isset($deps['group'])) { return $this->raiseError('Cannot safely convert "' . $packagexml . '", contains dependency groups. Using a PEAR_PackageFileManager-based script ' . 'or the convert command is an option'); } if (isset($deps['required']['subpackage']) || isset($deps['optional']['subpackage'])) { return $this->raiseError('Cannot safely convert "' . $packagexml . '", contains subpackage dependencies. Using a PEAR_PackageFileManager-based '. 'script is an option'); } if (isset($deps['required']['os'])) { return $this->raiseError('Cannot safely convert "' . $packagexml . '", contains os dependencies. Using a PEAR_PackageFileManager-based '. 'script is an option'); } if (isset($deps['required']['arch'])) { return $this->raiseError('Cannot safely convert "' . $packagexml . '", contains arch dependencies. Using a PEAR_PackageFileManager-based '. 'script is an option'); } $pf->setPackage($pf2->getPackage()); $pf->setSummary($pf2->getSummary()); $pf->setDescription($pf2->getDescription()); foreach ($pf2->getMaintainers() as $maintainer) { $pf->addMaintainer($maintainer['role'], $maintainer['handle'], $maintainer['name'], $maintainer['email']); } $pf->setVersion($pf2->getVersion()); $pf->setDate($pf2->getDate()); $pf->setLicense($pf2->getLicense()); $pf->setState($pf2->getState()); $pf->setNotes($pf2->getNotes()); $pf->addPhpDep($deps['required']['php']['min'], 'ge'); if (isset($deps['required']['php']['max'])) { $pf->addPhpDep($deps['required']['php']['max'], 'le'); } if (isset($deps['required']['package'])) { if (!isset($deps['required']['package'][0])) { $deps['required']['package'] = array($deps['required']['package']); } foreach ($deps['required']['package'] as $dep) { if (!isset($dep['channel'])) { return $this->raiseError('Cannot safely convert "' . $packagexml . '"' . ' contains uri-based dependency on a package. Using a ' . 'PEAR_PackageFileManager-based script is an option'); } if ($dep['channel'] != 'pear.php.net' && $dep['channel'] != 'pecl.php.net' && $dep['channel'] != 'doc.php.net') { return $this->raiseError('Cannot safely convert "' . $packagexml . '"' . ' contains dependency on a non-standard channel package. Using a ' . 'PEAR_PackageFileManager-based script is an option'); } if (isset($dep['conflicts'])) { return $this->raiseError('Cannot safely convert "' . $packagexml . '"' . ' contains conflicts dependency. Using a ' . 'PEAR_PackageFileManager-based script is an option'); } if (isset($dep['exclude'])) { $this->ui->outputData('WARNING: exclude tags are ignored in conversion'); } if (isset($dep['min'])) { $pf->addPackageDep($dep['name'], $dep['min'], 'ge'); } if (isset($dep['max'])) { $pf->addPackageDep($dep['name'], $dep['max'], 'le'); } } } if (isset($deps['required']['extension'])) { if (!isset($deps['required']['extension'][0])) { $deps['required']['extension'] = array($deps['required']['extension']); } foreach ($deps['required']['extension'] as $dep) { if (isset($dep['conflicts'])) { return $this->raiseError('Cannot safely convert "' . $packagexml . '"' . ' contains conflicts dependency. Using a ' . 'PEAR_PackageFileManager-based script is an option'); } if (isset($dep['exclude'])) { $this->ui->outputData('WARNING: exclude tags are ignored in conversion'); } if (isset($dep['min'])) { $pf->addExtensionDep($dep['name'], $dep['min'], 'ge'); } if (isset($dep['max'])) { $pf->addExtensionDep($dep['name'], $dep['max'], 'le'); } } } if (isset($deps['optional']['package'])) { if (!isset($deps['optional']['package'][0])) { $deps['optional']['package'] = array($deps['optional']['package']); } foreach ($deps['optional']['package'] as $dep) { if (!isset($dep['channel'])) { return $this->raiseError('Cannot safely convert "' . $packagexml . '"' . ' contains uri-based dependency on a package. Using a ' . 'PEAR_PackageFileManager-based script is an option'); } if ($dep['channel'] != 'pear.php.net' && $dep['channel'] != 'pecl.php.net' && $dep['channel'] != 'doc.php.net') { return $this->raiseError('Cannot safely convert "' . $packagexml . '"' . ' contains dependency on a non-standard channel package. Using a ' . 'PEAR_PackageFileManager-based script is an option'); } if (isset($dep['exclude'])) { $this->ui->outputData('WARNING: exclude tags are ignored in conversion'); } if (isset($dep['min'])) { $pf->addPackageDep($dep['name'], $dep['min'], 'ge', 'yes'); } if (isset($dep['max'])) { $pf->addPackageDep($dep['name'], $dep['max'], 'le', 'yes'); } } } if (isset($deps['optional']['extension'])) { if (!isset($deps['optional']['extension'][0])) { $deps['optional']['extension'] = array($deps['optional']['extension']); } foreach ($deps['optional']['extension'] as $dep) { if (isset($dep['exclude'])) { $this->ui->outputData('WARNING: exclude tags are ignored in conversion'); } if (isset($dep['min'])) { $pf->addExtensionDep($dep['name'], $dep['min'], 'ge', 'yes'); } if (isset($dep['max'])) { $pf->addExtensionDep($dep['name'], $dep['max'], 'le', 'yes'); } } } $contents = $pf2->getContents(); $release = $pf2->getReleases(); if (isset($releases[0])) { return $this->raiseError('Cannot safely process "' . $packagexml . '" contains ' . 'multiple extsrcrelease/zendextsrcrelease tags. Using a PEAR_PackageFileManager-based script ' . 'or the convert command is an option'); } if ($configoptions = $pf2->getConfigureOptions()) { foreach ($configoptions as $option) { $default = isset($option['default']) ? $option['default'] : false; $pf->addConfigureOption($option['name'], $option['prompt'], $default); } } if (isset($release['filelist']['ignore'])) { return $this->raiseError('Cannot safely process "' . $packagexml . '" contains ' . 'ignore tags. Using a PEAR_PackageFileManager-based script or the convert' . ' command is an option'); } if (isset($release['filelist']['install']) && !isset($release['filelist']['install'][0])) { $release['filelist']['install'] = array($release['filelist']['install']); } if (isset($contents['dir']['attribs']['baseinstalldir'])) { $baseinstalldir = $contents['dir']['attribs']['baseinstalldir']; } else { $baseinstalldir = false; } if (!isset($contents['dir']['file'][0])) { $contents['dir']['file'] = array($contents['dir']['file']); } foreach ($contents['dir']['file'] as $file) { if ($baseinstalldir && !isset($file['attribs']['baseinstalldir'])) { $file['attribs']['baseinstalldir'] = $baseinstalldir; } $processFile = $file; unset($processFile['attribs']); if (count($processFile)) { foreach ($processFile as $name => $task) { if ($name != $pf2->getTasksNs() . ':replace') { return $this->raiseError('Cannot safely process "' . $packagexml . '" contains tasks other than replace. Using a ' . 'PEAR_PackageFileManager-based script is an option.'); } $file['attribs']['replace'][] = $task; } } if (!in_array($file['attribs']['role'], PEAR_Common::getFileRoles())) { return $this->raiseError('Cannot safely convert "' . $packagexml . '", contains custom roles. Using a PEAR_PackageFileManager-based script ' . 'or the convert command is an option'); } if (isset($release['filelist']['install'])) { foreach ($release['filelist']['install'] as $installas) { if ($installas['attribs']['name'] == $file['attribs']['name']) { $file['attribs']['install-as'] = $installas['attribs']['as']; } } } $pf->addFile('/', $file['attribs']['name'], $file['attribs']); } if ($pf2->getChangeLog()) { $this->ui->outputData('WARNING: changelog is not translated to package.xml ' . '1.0, use PEAR_PackageFileManager-based script if you need changelog-' . 'translation for package.xml 1.0'); } $gen = &$pf->getDefaultGenerator(); $gen->toPackageFile('.'); } } php-pear-1.10.1+submodules+notgz/PEAR/Command/Pickle.xml000066400000000000000000000022331262614675700226770ustar00rootroot00000000000000 Build PECL Package doPackage pi Z Do not gzip the package file n Print the name of the packaged file. [descfile] Creates a PECL package from its package2.xml file. An automatic conversion will be made to a package.xml 1.0 and written out to disk in the current directory as "package.xml". Note that only simple package.xml 2.0 will be converted. package.xml 2.0 with: - dependency types other than required/optional PECL package/ext/php/pearinstaller - more than one extsrcrelease or zendextsrcrelease - zendextbinrelease, extbinrelease, phprelease, or bundle release type - dependency groups - ignore tags in release filelist - tasks other than replace - custom roles will cause pickle to fail, and output an error message. If your package2.xml uses any of these features, you are best off using PEAR_PackageFileManager to generate both package.xml. php-pear-1.10.1+submodules+notgz/PEAR/Command/Registry.php000066400000000000000000001322751262614675700233010ustar00rootroot00000000000000 * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @link http://pear.php.net/package/PEAR * @since File available since Release 0.1 */ /** * base class */ require_once 'PEAR/Command/Common.php'; /** * PEAR commands for registry manipulation * * @category pear * @package PEAR * @author Stig Bakken * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version Release: @package_version@ * @link http://pear.php.net/package/PEAR * @since Class available since Release 0.1 */ class PEAR_Command_Registry extends PEAR_Command_Common { var $commands = array( 'list' => array( 'summary' => 'List Installed Packages In The Default Channel', 'function' => 'doList', 'shortcut' => 'l', 'options' => array( 'channel' => array( 'shortopt' => 'c', 'doc' => 'list installed packages from this channel', 'arg' => 'CHAN', ), 'allchannels' => array( 'shortopt' => 'a', 'doc' => 'list installed packages from all channels', ), 'channelinfo' => array( 'shortopt' => 'i', 'doc' => 'output fully channel-aware data, even on failure', ), ), 'doc' => ' If invoked without parameters, this command lists the PEAR packages installed in your php_dir ({config php_dir}). With a parameter, it lists the files in a package. ', ), 'list-files' => array( 'summary' => 'List Files In Installed Package', 'function' => 'doFileList', 'shortcut' => 'fl', 'options' => array(), 'doc' => ' List the files in an installed package. ' ), 'shell-test' => array( 'summary' => 'Shell Script Test', 'function' => 'doShellTest', 'shortcut' => 'st', 'options' => array(), 'doc' => ' [[relation] version] Tests if a package is installed in the system. Will exit(1) if it is not. The version comparison operator. One of: <, lt, <=, le, >, gt, >=, ge, ==, =, eq, !=, <>, ne The version to compare with '), 'info' => array( 'summary' => 'Display information about a package', 'function' => 'doInfo', 'shortcut' => 'in', 'options' => array(), 'doc' => ' Displays information about a package. The package argument may be a local package file, an URL to a package file, or the name of an installed package.' ) ); /** * PEAR_Command_Registry constructor. * * @access public */ function __construct(&$ui, &$config) { parent::__construct($ui, $config); } function _sortinfo($a, $b) { $apackage = isset($a['package']) ? $a['package'] : $a['name']; $bpackage = isset($b['package']) ? $b['package'] : $b['name']; return strcmp($apackage, $bpackage); } function doList($command, $options, $params) { $reg = &$this->config->getRegistry(); $channelinfo = isset($options['channelinfo']); if (isset($options['allchannels']) && !$channelinfo) { return $this->doListAll($command, array(), $params); } if (isset($options['allchannels']) && $channelinfo) { // allchannels with $channelinfo unset($options['allchannels']); $channels = $reg->getChannels(); $errors = array(); PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); foreach ($channels as $channel) { $options['channel'] = $channel->getName(); $ret = $this->doList($command, $options, $params); if (PEAR::isError($ret)) { $errors[] = $ret; } } PEAR::staticPopErrorHandling(); if (count($errors)) { // for now, only give first error return PEAR::raiseError($errors[0]); } return true; } if (count($params) === 1) { return $this->doFileList($command, $options, $params); } if (isset($options['channel'])) { if (!$reg->channelExists($options['channel'])) { return $this->raiseError('Channel "' . $options['channel'] .'" does not exist'); } $channel = $reg->channelName($options['channel']); } else { $channel = $this->config->get('default_channel'); } $installed = $reg->packageInfo(null, null, $channel); usort($installed, array(&$this, '_sortinfo')); $data = array( 'caption' => 'Installed packages, channel ' . $channel . ':', 'border' => true, 'headline' => array('Package', 'Version', 'State'), 'channel' => $channel, ); if ($channelinfo) { $data['headline'] = array('Channel', 'Package', 'Version', 'State'); } if (count($installed) && !isset($data['data'])) { $data['data'] = array(); } foreach ($installed as $package) { $pobj = $reg->getPackage(isset($package['package']) ? $package['package'] : $package['name'], $channel); if ($channelinfo) { $packageinfo = array($pobj->getChannel(), $pobj->getPackage(), $pobj->getVersion(), $pobj->getState() ? $pobj->getState() : null); } else { $packageinfo = array($pobj->getPackage(), $pobj->getVersion(), $pobj->getState() ? $pobj->getState() : null); } $data['data'][] = $packageinfo; } if (count($installed) === 0) { if (!$channelinfo) { $data = '(no packages installed from channel ' . $channel . ')'; } else { $data = array( 'caption' => 'Installed packages, channel ' . $channel . ':', 'border' => true, 'channel' => $channel, 'data' => array(array('(no packages installed)')), ); } } $this->ui->outputData($data, $command); return true; } function doListAll($command, $options, $params) { // This duplicate code is deprecated over // list --channelinfo, which gives identical // output for list and list --allchannels. $reg = &$this->config->getRegistry(); $installed = $reg->packageInfo(null, null, null); foreach ($installed as $channel => $packages) { usort($packages, array($this, '_sortinfo')); $data = array( 'caption' => 'Installed packages, channel ' . $channel . ':', 'border' => true, 'headline' => array('Package', 'Version', 'State'), 'channel' => $channel ); foreach ($packages as $package) { $p = isset($package['package']) ? $package['package'] : $package['name']; $pobj = $reg->getPackage($p, $channel); $data['data'][] = array($pobj->getPackage(), $pobj->getVersion(), $pobj->getState() ? $pobj->getState() : null); } // Adds a blank line after each section $data['data'][] = array(); if (count($packages) === 0) { $data = array( 'caption' => 'Installed packages, channel ' . $channel . ':', 'border' => true, 'data' => array(array('(no packages installed)'), array()), 'channel' => $channel ); } $this->ui->outputData($data, $command); } return true; } function doFileList($command, $options, $params) { if (count($params) !== 1) { return $this->raiseError('list-files expects 1 parameter'); } $reg = &$this->config->getRegistry(); $fp = false; if (!is_dir($params[0]) && (file_exists($params[0]) || $fp = @fopen($params[0], 'r'))) { if ($fp) { fclose($fp); } if (!class_exists('PEAR_PackageFile')) { require_once 'PEAR/PackageFile.php'; } $pkg = new PEAR_PackageFile($this->config, $this->_debug); PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); $info = &$pkg->fromAnyFile($params[0], PEAR_VALIDATE_NORMAL); PEAR::staticPopErrorHandling(); $headings = array('Package File', 'Install Path'); $installed = false; } else { PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); $parsed = $reg->parsePackageName($params[0], $this->config->get('default_channel')); PEAR::staticPopErrorHandling(); if (PEAR::isError($parsed)) { return $this->raiseError($parsed); } $info = &$reg->getPackage($parsed['package'], $parsed['channel']); $headings = array('Type', 'Install Path'); $installed = true; } if (PEAR::isError($info)) { return $this->raiseError($info); } if ($info === null) { return $this->raiseError("`$params[0]' not installed"); } $list = ($info->getPackagexmlVersion() == '1.0' || $installed) ? $info->getFilelist() : $info->getContents(); if ($installed) { $caption = 'Installed Files For ' . $params[0]; } else { $caption = 'Contents of ' . basename($params[0]); } $data = array( 'caption' => $caption, 'border' => true, 'headline' => $headings); if ($info->getPackagexmlVersion() == '1.0' || $installed) { foreach ($list as $file => $att) { if ($installed) { if (empty($att['installed_as'])) { continue; } $data['data'][] = array($att['role'], $att['installed_as']); } else { if (isset($att['baseinstalldir']) && !in_array($att['role'], array('test', 'data', 'doc'))) { $dest = $att['baseinstalldir'] . DIRECTORY_SEPARATOR . $file; } else { $dest = $file; } switch ($att['role']) { case 'test': case 'data': case 'doc': $role = $att['role']; if ($role == 'test') { $role .= 's'; } $dest = $this->config->get($role . '_dir') . DIRECTORY_SEPARATOR . $info->getPackage() . DIRECTORY_SEPARATOR . $dest; break; case 'php': default: $dest = $this->config->get('php_dir') . DIRECTORY_SEPARATOR . $dest; } $ds2 = DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR; $dest = preg_replace(array('!\\\\+!', '!/!', "!$ds2+!"), array(DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR), $dest); $file = preg_replace('!/+!', '/', $file); $data['data'][] = array($file, $dest); } } } else { // package.xml 2.0, not installed if (!isset($list['dir']['file'][0])) { $list['dir']['file'] = array($list['dir']['file']); } foreach ($list['dir']['file'] as $att) { $att = $att['attribs']; $file = $att['name']; $role = &PEAR_Installer_Role::factory($info, $att['role'], $this->config); $role->setup($this, $info, $att, $file); if (!$role->isInstallable()) { $dest = '(not installable)'; } else { $dest = $role->processInstallation($info, $att, $file, ''); if (PEAR::isError($dest)) { $dest = '(Unknown role "' . $att['role'] . ')'; } else { list(,, $dest) = $dest; } } $data['data'][] = array($file, $dest); } } $this->ui->outputData($data, $command); return true; } function doShellTest($command, $options, $params) { if (count($params) < 1) { return PEAR::raiseError('ERROR, usage: pear shell-test packagename [[relation] version]'); } PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); $reg = &$this->config->getRegistry(); $info = $reg->parsePackageName($params[0], $this->config->get('default_channel')); if (PEAR::isError($info)) { exit(1); // invalid package name } $package = $info['package']; $channel = $info['channel']; // "pear shell-test Foo" if (!$reg->packageExists($package, $channel)) { if ($channel == 'pecl.php.net') { if ($reg->packageExists($package, 'pear.php.net')) { $channel = 'pear.php.net'; // magically change channels for extensions } } } if (count($params) === 1) { if (!$reg->packageExists($package, $channel)) { exit(1); } // "pear shell-test Foo 1.0" } elseif (count($params) === 2) { $v = $reg->packageInfo($package, 'version', $channel); if (!$v || !version_compare("$v", "{$params[1]}", "ge")) { exit(1); } // "pear shell-test Foo ge 1.0" } elseif (count($params) === 3) { $v = $reg->packageInfo($package, 'version', $channel); if (!$v || !version_compare("$v", "{$params[2]}", $params[1])) { exit(1); } } else { PEAR::staticPopErrorHandling(); $this->raiseError("$command: expects 1 to 3 parameters"); exit(1); } } function doInfo($command, $options, $params) { if (count($params) !== 1) { return $this->raiseError('pear info expects 1 parameter'); } $info = $fp = false; $reg = &$this->config->getRegistry(); if (is_file($params[0]) && !is_dir($params[0]) && (file_exists($params[0]) || $fp = @fopen($params[0], 'r')) ) { if ($fp) { fclose($fp); } if (!class_exists('PEAR_PackageFile')) { require_once 'PEAR/PackageFile.php'; } $pkg = new PEAR_PackageFile($this->config, $this->_debug); PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); $obj = &$pkg->fromAnyFile($params[0], PEAR_VALIDATE_NORMAL); PEAR::staticPopErrorHandling(); if (PEAR::isError($obj)) { $uinfo = $obj->getUserInfo(); if (is_array($uinfo)) { foreach ($uinfo as $message) { if (is_array($message)) { $message = $message['message']; } $this->ui->outputData($message); } } return $this->raiseError($obj); } if ($obj->getPackagexmlVersion() != '1.0') { return $this->_doInfo2($command, $options, $params, $obj, false); } $info = $obj->toArray(); } else { $parsed = $reg->parsePackageName($params[0], $this->config->get('default_channel')); if (PEAR::isError($parsed)) { return $this->raiseError($parsed); } $package = $parsed['package']; $channel = $parsed['channel']; $info = $reg->packageInfo($package, null, $channel); if (isset($info['old'])) { $obj = $reg->getPackage($package, $channel); return $this->_doInfo2($command, $options, $params, $obj, true); } } if (PEAR::isError($info)) { return $info; } if (empty($info)) { $this->raiseError("No information found for `$params[0]'"); return; } unset($info['filelist']); unset($info['dirtree']); unset($info['changelog']); if (isset($info['xsdversion'])) { $info['package.xml version'] = $info['xsdversion']; unset($info['xsdversion']); } if (isset($info['packagerversion'])) { $info['packaged with PEAR version'] = $info['packagerversion']; unset($info['packagerversion']); } $keys = array_keys($info); $longtext = array('description', 'summary'); foreach ($keys as $key) { if (is_array($info[$key])) { switch ($key) { case 'maintainers': { $i = 0; $mstr = ''; foreach ($info[$key] as $m) { if ($i++ > 0) { $mstr .= "\n"; } $mstr .= $m['name'] . " <"; if (isset($m['email'])) { $mstr .= $m['email']; } else { $mstr .= $m['handle'] . '@php.net'; } $mstr .= "> ($m[role])"; } $info[$key] = $mstr; break; } case 'release_deps': { $i = 0; $dstr = ''; foreach ($info[$key] as $d) { if (isset($this->_deps_rel_trans[$d['rel']])) { $rel = $this->_deps_rel_trans[$d['rel']]; } else { $rel = $d['rel']; } if (isset($this->_deps_type_trans[$d['type']])) { $type = ucfirst($this->_deps_type_trans[$d['type']]); } else { $type = $d['type']; } if (isset($d['name'])) { $name = $d['name'] . ' '; } else { $name = ''; } if (isset($d['version'])) { $version = $d['version'] . ' '; } else { $version = ''; } if (isset($d['optional']) && $d['optional'] == 'yes') { $optional = ' (optional)'; } else { $optional = ''; } $dstr .= "$type $name$rel $version$optional\n"; } $info[$key] = $dstr; break; } case 'provides' : { $debug = $this->config->get('verbose'); if ($debug < 2) { $pstr = 'Classes: '; } else { $pstr = ''; } $i = 0; foreach ($info[$key] as $p) { if ($debug < 2 && $p['type'] != "class") { continue; } // Only print classes when verbosity mode is < 2 if ($debug < 2) { if ($i++ > 0) { $pstr .= ", "; } $pstr .= $p['name']; } else { if ($i++ > 0) { $pstr .= "\n"; } $pstr .= ucfirst($p['type']) . " " . $p['name']; if (isset($p['explicit']) && $p['explicit'] == 1) { $pstr .= " (explicit)"; } } } $info[$key] = $pstr; break; } case 'configure_options' : { foreach ($info[$key] as $i => $p) { $info[$key][$i] = array_map(null, array_keys($p), array_values($p)); $info[$key][$i] = array_map(create_function('$a', 'return join(" = ",$a);'), $info[$key][$i]); $info[$key][$i] = implode(', ', $info[$key][$i]); } $info[$key] = implode("\n", $info[$key]); break; } default: { $info[$key] = implode(", ", $info[$key]); break; } } } if ($key == '_lastmodified') { $hdate = date('Y-m-d', $info[$key]); unset($info[$key]); $info['Last Modified'] = $hdate; } elseif ($key == '_lastversion') { $info['Previous Installed Version'] = $info[$key] ? $info[$key] : '- None -'; unset($info[$key]); } else { $info[$key] = trim($info[$key]); if (in_array($key, $longtext)) { $info[$key] = preg_replace('/ +/', ' ', $info[$key]); } } } $caption = 'About ' . $info['package'] . '-' . $info['version']; $data = array( 'caption' => $caption, 'border' => true); foreach ($info as $key => $value) { $key = ucwords(trim(str_replace('_', ' ', $key))); $data['data'][] = array($key, $value); } $data['raw'] = $info; $this->ui->outputData($data, 'package-info'); } /** * @access private */ function _doInfo2($command, $options, $params, &$obj, $installed) { $reg = &$this->config->getRegistry(); $caption = 'About ' . $obj->getChannel() . '/' .$obj->getPackage() . '-' . $obj->getVersion(); $data = array( 'caption' => $caption, 'border' => true); switch ($obj->getPackageType()) { case 'php' : $release = 'PEAR-style PHP-based Package'; break; case 'extsrc' : $release = 'PECL-style PHP extension (source code)'; break; case 'zendextsrc' : $release = 'PECL-style Zend extension (source code)'; break; case 'extbin' : $release = 'PECL-style PHP extension (binary)'; break; case 'zendextbin' : $release = 'PECL-style Zend extension (binary)'; break; case 'bundle' : $release = 'Package bundle (collection of packages)'; break; } $extends = $obj->getExtends(); $extends = $extends ? $obj->getPackage() . ' (extends ' . $extends . ')' : $obj->getPackage(); if ($src = $obj->getSourcePackage()) { $extends .= ' (source package ' . $src['channel'] . '/' . $src['package'] . ')'; } $info = array( 'Release Type' => $release, 'Name' => $extends, 'Channel' => $obj->getChannel(), 'Summary' => preg_replace('/ +/', ' ', $obj->getSummary()), 'Description' => preg_replace('/ +/', ' ', $obj->getDescription()), ); $info['Maintainers'] = ''; foreach (array('lead', 'developer', 'contributor', 'helper') as $role) { $leads = $obj->{"get{$role}s"}(); if (!$leads) { continue; } if (isset($leads['active'])) { $leads = array($leads); } foreach ($leads as $lead) { if (!empty($info['Maintainers'])) { $info['Maintainers'] .= "\n"; } $active = $lead['active'] == 'no' ? ', inactive' : ''; $info['Maintainers'] .= $lead['name'] . ' <'; $info['Maintainers'] .= $lead['email'] . "> ($role$active)"; } } $info['Release Date'] = $obj->getDate(); if ($time = $obj->getTime()) { $info['Release Date'] .= ' ' . $time; } $info['Release Version'] = $obj->getVersion() . ' (' . $obj->getState() . ')'; $info['API Version'] = $obj->getVersion('api') . ' (' . $obj->getState('api') . ')'; $info['License'] = $obj->getLicense(); $uri = $obj->getLicenseLocation(); if ($uri) { if (isset($uri['uri'])) { $info['License'] .= ' (' . $uri['uri'] . ')'; } else { $extra = $obj->getInstalledLocation($info['filesource']); if ($extra) { $info['License'] .= ' (' . $uri['filesource'] . ')'; } } } $info['Release Notes'] = $obj->getNotes(); if ($compat = $obj->getCompatible()) { if (!isset($compat[0])) { $compat = array($compat); } $info['Compatible with'] = ''; foreach ($compat as $package) { $info['Compatible with'] .= $package['channel'] . '/' . $package['name'] . "\nVersions >= " . $package['min'] . ', <= ' . $package['max']; if (isset($package['exclude'])) { if (is_array($package['exclude'])) { $package['exclude'] = implode(', ', $package['exclude']); } if (!isset($info['Not Compatible with'])) { $info['Not Compatible with'] = ''; } else { $info['Not Compatible with'] .= "\n"; } $info['Not Compatible with'] .= $package['channel'] . '/' . $package['name'] . "\nVersions " . $package['exclude']; } } } $usesrole = $obj->getUsesrole(); if ($usesrole) { if (!isset($usesrole[0])) { $usesrole = array($usesrole); } foreach ($usesrole as $roledata) { if (isset($info['Uses Custom Roles'])) { $info['Uses Custom Roles'] .= "\n"; } else { $info['Uses Custom Roles'] = ''; } if (isset($roledata['package'])) { $rolepackage = $reg->parsedPackageNameToString($roledata, true); } else { $rolepackage = $roledata['uri']; } $info['Uses Custom Roles'] .= $roledata['role'] . ' (' . $rolepackage . ')'; } } $usestask = $obj->getUsestask(); if ($usestask) { if (!isset($usestask[0])) { $usestask = array($usestask); } foreach ($usestask as $taskdata) { if (isset($info['Uses Custom Tasks'])) { $info['Uses Custom Tasks'] .= "\n"; } else { $info['Uses Custom Tasks'] = ''; } if (isset($taskdata['package'])) { $taskpackage = $reg->parsedPackageNameToString($taskdata, true); } else { $taskpackage = $taskdata['uri']; } $info['Uses Custom Tasks'] .= $taskdata['task'] . ' (' . $taskpackage . ')'; } } $deps = $obj->getDependencies(); $info['Required Dependencies'] = 'PHP version ' . $deps['required']['php']['min']; if (isset($deps['required']['php']['max'])) { $info['Required Dependencies'] .= '-' . $deps['required']['php']['max'] . "\n"; } else { $info['Required Dependencies'] .= "\n"; } if (isset($deps['required']['php']['exclude'])) { if (!isset($info['Not Compatible with'])) { $info['Not Compatible with'] = ''; } else { $info['Not Compatible with'] .= "\n"; } if (is_array($deps['required']['php']['exclude'])) { $deps['required']['php']['exclude'] = implode(', ', $deps['required']['php']['exclude']); } $info['Not Compatible with'] .= "PHP versions\n " . $deps['required']['php']['exclude']; } $info['Required Dependencies'] .= 'PEAR installer version'; if (isset($deps['required']['pearinstaller']['max'])) { $info['Required Dependencies'] .= 's ' . $deps['required']['pearinstaller']['min'] . '-' . $deps['required']['pearinstaller']['max']; } else { $info['Required Dependencies'] .= ' ' . $deps['required']['pearinstaller']['min'] . ' or newer'; } if (isset($deps['required']['pearinstaller']['exclude'])) { if (!isset($info['Not Compatible with'])) { $info['Not Compatible with'] = ''; } else { $info['Not Compatible with'] .= "\n"; } if (is_array($deps['required']['pearinstaller']['exclude'])) { $deps['required']['pearinstaller']['exclude'] = implode(', ', $deps['required']['pearinstaller']['exclude']); } $info['Not Compatible with'] .= "PEAR installer\n Versions " . $deps['required']['pearinstaller']['exclude']; } foreach (array('Package', 'Extension') as $type) { $index = strtolower($type); if (isset($deps['required'][$index])) { if (isset($deps['required'][$index]['name'])) { $deps['required'][$index] = array($deps['required'][$index]); } foreach ($deps['required'][$index] as $package) { if (isset($package['conflicts'])) { $infoindex = 'Not Compatible with'; if (!isset($info['Not Compatible with'])) { $info['Not Compatible with'] = ''; } else { $info['Not Compatible with'] .= "\n"; } } else { $infoindex = 'Required Dependencies'; $info[$infoindex] .= "\n"; } if ($index == 'extension') { $name = $package['name']; } else { if (isset($package['channel'])) { $name = $package['channel'] . '/' . $package['name']; } else { $name = '__uri/' . $package['name'] . ' (static URI)'; } } $info[$infoindex] .= "$type $name"; if (isset($package['uri'])) { $info[$infoindex] .= "\n Download URI: $package[uri]"; continue; } if (isset($package['max']) && isset($package['min'])) { $info[$infoindex] .= " \n Versions " . $package['min'] . '-' . $package['max']; } elseif (isset($package['min'])) { $info[$infoindex] .= " \n Version " . $package['min'] . ' or newer'; } elseif (isset($package['max'])) { $info[$infoindex] .= " \n Version " . $package['max'] . ' or older'; } if (isset($package['recommended'])) { $info[$infoindex] .= "\n Recommended version: $package[recommended]"; } if (isset($package['exclude'])) { if (!isset($info['Not Compatible with'])) { $info['Not Compatible with'] = ''; } else { $info['Not Compatible with'] .= "\n"; } if (is_array($package['exclude'])) { $package['exclude'] = implode(', ', $package['exclude']); } $package['package'] = $package['name']; // for parsedPackageNameToString if (isset($package['conflicts'])) { $info['Not Compatible with'] .= '=> except '; } $info['Not Compatible with'] .= 'Package ' . $reg->parsedPackageNameToString($package, true); $info['Not Compatible with'] .= "\n Versions " . $package['exclude']; } } } } if (isset($deps['required']['os'])) { if (isset($deps['required']['os']['name'])) { $dep['required']['os']['name'] = array($dep['required']['os']['name']); } foreach ($dep['required']['os'] as $os) { if (isset($os['conflicts']) && $os['conflicts'] == 'yes') { if (!isset($info['Not Compatible with'])) { $info['Not Compatible with'] = ''; } else { $info['Not Compatible with'] .= "\n"; } $info['Not Compatible with'] .= "$os[name] Operating System"; } else { $info['Required Dependencies'] .= "\n"; $info['Required Dependencies'] .= "$os[name] Operating System"; } } } if (isset($deps['required']['arch'])) { if (isset($deps['required']['arch']['pattern'])) { $dep['required']['arch']['pattern'] = array($dep['required']['os']['pattern']); } foreach ($dep['required']['arch'] as $os) { if (isset($os['conflicts']) && $os['conflicts'] == 'yes') { if (!isset($info['Not Compatible with'])) { $info['Not Compatible with'] = ''; } else { $info['Not Compatible with'] .= "\n"; } $info['Not Compatible with'] .= "OS/Arch matching pattern '/$os[pattern]/'"; } else { $info['Required Dependencies'] .= "\n"; $info['Required Dependencies'] .= "OS/Arch matching pattern '/$os[pattern]/'"; } } } if (isset($deps['optional'])) { foreach (array('Package', 'Extension') as $type) { $index = strtolower($type); if (isset($deps['optional'][$index])) { if (isset($deps['optional'][$index]['name'])) { $deps['optional'][$index] = array($deps['optional'][$index]); } foreach ($deps['optional'][$index] as $package) { if (isset($package['conflicts']) && $package['conflicts'] == 'yes') { $infoindex = 'Not Compatible with'; if (!isset($info['Not Compatible with'])) { $info['Not Compatible with'] = ''; } else { $info['Not Compatible with'] .= "\n"; } } else { $infoindex = 'Optional Dependencies'; if (!isset($info['Optional Dependencies'])) { $info['Optional Dependencies'] = ''; } else { $info['Optional Dependencies'] .= "\n"; } } if ($index == 'extension') { $name = $package['name']; } else { if (isset($package['channel'])) { $name = $package['channel'] . '/' . $package['name']; } else { $name = '__uri/' . $package['name'] . ' (static URI)'; } } $info[$infoindex] .= "$type $name"; if (isset($package['uri'])) { $info[$infoindex] .= "\n Download URI: $package[uri]"; continue; } if ($infoindex == 'Not Compatible with') { // conflicts is only used to say that all versions conflict continue; } if (isset($package['max']) && isset($package['min'])) { $info[$infoindex] .= " \n Versions " . $package['min'] . '-' . $package['max']; } elseif (isset($package['min'])) { $info[$infoindex] .= " \n Version " . $package['min'] . ' or newer'; } elseif (isset($package['max'])) { $info[$infoindex] .= " \n Version " . $package['min'] . ' or older'; } if (isset($package['recommended'])) { $info[$infoindex] .= "\n Recommended version: $package[recommended]"; } if (isset($package['exclude'])) { if (!isset($info['Not Compatible with'])) { $info['Not Compatible with'] = ''; } else { $info['Not Compatible with'] .= "\n"; } if (is_array($package['exclude'])) { $package['exclude'] = implode(', ', $package['exclude']); } $info['Not Compatible with'] .= "Package $package\n Versions " . $package['exclude']; } } } } } if (isset($deps['group'])) { if (!isset($deps['group'][0])) { $deps['group'] = array($deps['group']); } foreach ($deps['group'] as $group) { $info['Dependency Group ' . $group['attribs']['name']] = $group['attribs']['hint']; $groupindex = $group['attribs']['name'] . ' Contents'; $info[$groupindex] = ''; foreach (array('Package', 'Extension') as $type) { $index = strtolower($type); if (isset($group[$index])) { if (isset($group[$index]['name'])) { $group[$index] = array($group[$index]); } foreach ($group[$index] as $package) { if (!empty($info[$groupindex])) { $info[$groupindex] .= "\n"; } if ($index == 'extension') { $name = $package['name']; } else { if (isset($package['channel'])) { $name = $package['channel'] . '/' . $package['name']; } else { $name = '__uri/' . $package['name'] . ' (static URI)'; } } if (isset($package['uri'])) { if (isset($package['conflicts']) && $package['conflicts'] == 'yes') { $info[$groupindex] .= "Not Compatible with $type $name"; } else { $info[$groupindex] .= "$type $name"; } $info[$groupindex] .= "\n Download URI: $package[uri]"; continue; } if (isset($package['conflicts']) && $package['conflicts'] == 'yes') { $info[$groupindex] .= "Not Compatible with $type $name"; continue; } $info[$groupindex] .= "$type $name"; if (isset($package['max']) && isset($package['min'])) { $info[$groupindex] .= " \n Versions " . $package['min'] . '-' . $package['max']; } elseif (isset($package['min'])) { $info[$groupindex] .= " \n Version " . $package['min'] . ' or newer'; } elseif (isset($package['max'])) { $info[$groupindex] .= " \n Version " . $package['min'] . ' or older'; } if (isset($package['recommended'])) { $info[$groupindex] .= "\n Recommended version: $package[recommended]"; } if (isset($package['exclude'])) { if (!isset($info['Not Compatible with'])) { $info['Not Compatible with'] = ''; } else { $info[$groupindex] .= "Not Compatible with\n"; } if (is_array($package['exclude'])) { $package['exclude'] = implode(', ', $package['exclude']); } $info[$groupindex] .= " Package $package\n Versions " . $package['exclude']; } } } } } } if ($obj->getPackageType() == 'bundle') { $info['Bundled Packages'] = ''; foreach ($obj->getBundledPackages() as $package) { if (!empty($info['Bundled Packages'])) { $info['Bundled Packages'] .= "\n"; } if (isset($package['uri'])) { $info['Bundled Packages'] .= '__uri/' . $package['name']; $info['Bundled Packages'] .= "\n (URI: $package[uri]"; } else { $info['Bundled Packages'] .= $package['channel'] . '/' . $package['name']; } } } $info['package.xml version'] = '2.0'; if ($installed) { if ($obj->getLastModified()) { $info['Last Modified'] = date('Y-m-d H:i', $obj->getLastModified()); } $v = $obj->getLastInstalledVersion(); $info['Previous Installed Version'] = $v ? $v : '- None -'; } foreach ($info as $key => $value) { $data['data'][] = array($key, $value); } $data['raw'] = $obj->getArray(); // no validation needed $this->ui->outputData($data, 'package-info'); } } php-pear-1.10.1+submodules+notgz/PEAR/Command/Registry.xml000066400000000000000000000033761262614675700233110ustar00rootroot00000000000000 List Installed Packages In The Default Channel doList l c list installed packages from this channel CHAN a list installed packages from all channels i output fully channel-aware data, even on failure <package> If invoked without parameters, this command lists the PEAR packages installed in your php_dir ({config php_dir}). With a parameter, it lists the files in a package. List Files In Installed Package doFileList fl <package> List the files in an installed package. Shell Script Test doShellTest st <package> [[relation] version] Tests if a package is installed in the system. Will exit(1) if it is not. <relation> The version comparison operator. One of: <, lt, <=, le, >, gt, >=, ge, ==, =, eq, !=, <>, ne <version> The version to compare with Display information about a package doInfo in <package> Displays information about a package. The package argument may be a local package file, an URL to a package file, or the name of an installed package. php-pear-1.10.1+submodules+notgz/PEAR/Command/Remote.php000066400000000000000000000724501262614675700227220ustar00rootroot00000000000000 * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @link http://pear.php.net/package/PEAR * @since File available since Release 0.1 */ /** * base class */ require_once 'PEAR/Command/Common.php'; require_once 'PEAR/REST.php'; /** * PEAR commands for remote server querying * * @category pear * @package PEAR * @author Stig Bakken * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version Release: @package_version@ * @link http://pear.php.net/package/PEAR * @since Class available since Release 0.1 */ class PEAR_Command_Remote extends PEAR_Command_Common { var $commands = array( 'remote-info' => array( 'summary' => 'Information About Remote Packages', 'function' => 'doRemoteInfo', 'shortcut' => 'ri', 'options' => array(), 'doc' => ' Get details on a package from the server.', ), 'list-upgrades' => array( 'summary' => 'List Available Upgrades', 'function' => 'doListUpgrades', 'shortcut' => 'lu', 'options' => array( 'channelinfo' => array( 'shortopt' => 'i', 'doc' => 'output fully channel-aware data, even on failure', ), ), 'doc' => '[preferred_state] List releases on the server of packages you have installed where a newer version is available with the same release state (stable etc.) or the state passed as the second parameter.' ), 'remote-list' => array( 'summary' => 'List Remote Packages', 'function' => 'doRemoteList', 'shortcut' => 'rl', 'options' => array( 'channel' => array( 'shortopt' => 'c', 'doc' => 'specify a channel other than the default channel', 'arg' => 'CHAN', ) ), 'doc' => ' Lists the packages available on the configured server along with the latest stable release of each package.', ), 'search' => array( 'summary' => 'Search remote package database', 'function' => 'doSearch', 'shortcut' => 'sp', 'options' => array( 'channel' => array( 'shortopt' => 'c', 'doc' => 'specify a channel other than the default channel', 'arg' => 'CHAN', ), 'allchannels' => array( 'shortopt' => 'a', 'doc' => 'search packages from all known channels', ), 'channelinfo' => array( 'shortopt' => 'i', 'doc' => 'output fully channel-aware data, even on failure', ), ), 'doc' => '[packagename] [packageinfo] Lists all packages which match the search parameters. The first parameter is a fragment of a packagename. The default channel will be used unless explicitly overridden. The second parameter will be used to match any portion of the summary/description', ), 'list-all' => array( 'summary' => 'List All Packages', 'function' => 'doListAll', 'shortcut' => 'la', 'options' => array( 'channel' => array( 'shortopt' => 'c', 'doc' => 'specify a channel other than the default channel', 'arg' => 'CHAN', ), 'channelinfo' => array( 'shortopt' => 'i', 'doc' => 'output fully channel-aware data, even on failure', ), ), 'doc' => ' Lists the packages available on the configured server along with the latest stable release of each package.', ), 'download' => array( 'summary' => 'Download Package', 'function' => 'doDownload', 'shortcut' => 'd', 'options' => array( 'nocompress' => array( 'shortopt' => 'Z', 'doc' => 'download an uncompressed (.tar) file', ), ), 'doc' => '... Download package tarballs. The files 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.6.5, the downloaded file will be DB-1.6.5.tgz.', ), 'clear-cache' => array( 'summary' => 'Clear Web Services Cache', 'function' => 'doClearCache', 'shortcut' => 'cc', 'options' => array(), 'doc' => ' Clear the REST cache. See also the cache_ttl configuration parameter. ', ), ); /** * PEAR_Command_Remote constructor. * * @access public */ function __construct(&$ui, &$config) { parent::__construct($ui, $config); } function _checkChannelForStatus($channel, $chan) { if (PEAR::isError($chan)) { $this->raiseError($chan); } if (!is_a($chan, 'PEAR_ChannelFile')) { return $this->raiseError('Internal corruption error: invalid channel "' . $channel . '"'); } $rest = new PEAR_REST($this->config); PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); $mirror = $this->config->get('preferred_mirror', null, $channel); $a = $rest->downloadHttp('http://' . $channel . '/channel.xml', $chan->lastModified()); PEAR::staticPopErrorHandling(); if (!PEAR::isError($a) && $a) { $this->ui->outputData('WARNING: channel "' . $channel . '" has ' . 'updated its protocols, use "' . PEAR_RUNTYPE . ' channel-update ' . $channel . '" to update'); } } function doRemoteInfo($command, $options, $params) { if (sizeof($params) != 1) { return $this->raiseError("$command expects one param: the remote package name"); } $savechannel = $channel = $this->config->get('default_channel'); $reg = &$this->config->getRegistry(); $package = $params[0]; $parsed = $reg->parsePackageName($package, $channel); if (PEAR::isError($parsed)) { return $this->raiseError('Invalid package name "' . $package . '"'); } $channel = $parsed['channel']; $this->config->set('default_channel', $channel); $chan = $reg->getChannel($channel); if (PEAR::isError($e = $this->_checkChannelForStatus($channel, $chan))) { return $e; } $mirror = $this->config->get('preferred_mirror'); if ($chan->supportsREST($mirror) && $base = $chan->getBaseURL('REST1.0', $mirror)) { $rest = &$this->config->getREST('1.0', array()); $info = $rest->packageInfo($base, $parsed['package'], $channel); } if (!isset($info)) { return $this->raiseError('No supported protocol was found'); } if (PEAR::isError($info)) { $this->config->set('default_channel', $savechannel); return $this->raiseError($info); } if (!isset($info['name'])) { return $this->raiseError('No remote package "' . $package . '" was found'); } $installed = $reg->packageInfo($info['name'], null, $channel); $info['installed'] = $installed['version'] ? $installed['version'] : '- no -'; if (is_array($info['installed'])) { $info['installed'] = $info['installed']['release']; } $this->ui->outputData($info, $command); $this->config->set('default_channel', $savechannel); return true; } function doRemoteList($command, $options, $params) { $savechannel = $channel = $this->config->get('default_channel'); $reg = &$this->config->getRegistry(); if (isset($options['channel'])) { $channel = $options['channel']; if (!$reg->channelExists($channel)) { return $this->raiseError('Channel "' . $channel . '" does not exist'); } $this->config->set('default_channel', $channel); } $chan = $reg->getChannel($channel); if (PEAR::isError($e = $this->_checkChannelForStatus($channel, $chan))) { return $e; } $list_options = false; if ($this->config->get('preferred_state') == 'stable') { $list_options = true; } $available = array(); if ($chan->supportsREST($this->config->get('preferred_mirror')) && $base = $chan->getBaseURL('REST1.1', $this->config->get('preferred_mirror')) ) { // use faster list-all if available $rest = &$this->config->getREST('1.1', array()); $available = $rest->listAll($base, $list_options, true, false, false, $chan->getName()); } elseif ($chan->supportsREST($this->config->get('preferred_mirror')) && $base = $chan->getBaseURL('REST1.0', $this->config->get('preferred_mirror'))) { $rest = &$this->config->getREST('1.0', array()); $available = $rest->listAll($base, $list_options, true, false, false, $chan->getName()); } if (PEAR::isError($available)) { $this->config->set('default_channel', $savechannel); return $this->raiseError($available); } $i = $j = 0; $data = array( 'caption' => 'Channel ' . $channel . ' Available packages:', 'border' => true, 'headline' => array('Package', 'Version'), 'channel' => $channel ); if (count($available) == 0) { $data = '(no packages available yet)'; } else { foreach ($available as $name => $info) { $version = (isset($info['stable']) && $info['stable']) ? $info['stable'] : '-n/a-'; $data['data'][] = array($name, $version); } } $this->ui->outputData($data, $command); $this->config->set('default_channel', $savechannel); return true; } function doListAll($command, $options, $params) { $savechannel = $channel = $this->config->get('default_channel'); $reg = &$this->config->getRegistry(); if (isset($options['channel'])) { $channel = $options['channel']; if (!$reg->channelExists($channel)) { return $this->raiseError("Channel \"$channel\" does not exist"); } $this->config->set('default_channel', $channel); } $list_options = false; if ($this->config->get('preferred_state') == 'stable') { $list_options = true; } $chan = $reg->getChannel($channel); if (PEAR::isError($e = $this->_checkChannelForStatus($channel, $chan))) { return $e; } if ($chan->supportsREST($this->config->get('preferred_mirror')) && $base = $chan->getBaseURL('REST1.1', $this->config->get('preferred_mirror'))) { // use faster list-all if available $rest = &$this->config->getREST('1.1', array()); $available = $rest->listAll($base, $list_options, false, false, false, $chan->getName()); } elseif ($chan->supportsREST($this->config->get('preferred_mirror')) && $base = $chan->getBaseURL('REST1.0', $this->config->get('preferred_mirror'))) { $rest = &$this->config->getREST('1.0', array()); $available = $rest->listAll($base, $list_options, false, false, false, $chan->getName()); } if (PEAR::isError($available)) { $this->config->set('default_channel', $savechannel); return $this->raiseError('The package list could not be fetched from the remote server. Please try again. (Debug info: "' . $available->getMessage() . '")'); } $data = array( 'caption' => 'All packages [Channel ' . $channel . ']:', 'border' => true, 'headline' => array('Package', 'Latest', 'Local'), 'channel' => $channel, ); if (isset($options['channelinfo'])) { // add full channelinfo $data['caption'] = 'Channel ' . $channel . ' All packages:'; $data['headline'] = array('Channel', 'Package', 'Latest', 'Local', 'Description', 'Dependencies'); } $local_pkgs = $reg->listPackages($channel); foreach ($available as $name => $info) { $installed = $reg->packageInfo($name, null, $channel); if (is_array($installed['version'])) { $installed['version'] = $installed['version']['release']; } $desc = $info['summary']; if (isset($params[$name])) { $desc .= "\n\n".$info['description']; } if (isset($options['mode'])) { if ($options['mode'] == 'installed' && !isset($installed['version'])) { continue; } if ($options['mode'] == 'notinstalled' && isset($installed['version'])) { continue; } if ($options['mode'] == 'upgrades' && (!isset($installed['version']) || version_compare($installed['version'], $info['stable'], '>='))) { continue; } } $pos = array_search(strtolower($name), $local_pkgs); if ($pos !== false) { unset($local_pkgs[$pos]); } if (isset($info['stable']) && !$info['stable']) { $info['stable'] = null; } if (isset($options['channelinfo'])) { // add full channelinfo if ($info['stable'] === $info['unstable']) { $state = $info['state']; } else { $state = 'stable'; } $latest = $info['stable'].' ('.$state.')'; $local = ''; if (isset($installed['version'])) { $inst_state = $reg->packageInfo($name, 'release_state', $channel); $local = $installed['version'].' ('.$inst_state.')'; } $packageinfo = array( $channel, $name, $latest, $local, isset($desc) ? $desc : null, isset($info['deps']) ? $info['deps'] : null, ); } else { $packageinfo = array( $reg->channelAlias($channel) . '/' . $name, isset($info['stable']) ? $info['stable'] : null, isset($installed['version']) ? $installed['version'] : null, isset($desc) ? $desc : null, isset($info['deps']) ? $info['deps'] : null, ); } $data['data'][$info['category']][] = $packageinfo; } if (isset($options['mode']) && in_array($options['mode'], array('notinstalled', 'upgrades'))) { $this->config->set('default_channel', $savechannel); $this->ui->outputData($data, $command); return true; } foreach ($local_pkgs as $name) { $info = &$reg->getPackage($name, $channel); $data['data']['Local'][] = array( $reg->channelAlias($channel) . '/' . $info->getPackage(), '', $info->getVersion(), $info->getSummary(), $info->getDeps() ); } $this->config->set('default_channel', $savechannel); $this->ui->outputData($data, $command); return true; } function doSearch($command, $options, $params) { if ((!isset($params[0]) || empty($params[0])) && (!isset($params[1]) || empty($params[1]))) { return $this->raiseError('no valid search string supplied'); } $channelinfo = isset($options['channelinfo']); $reg = &$this->config->getRegistry(); if (isset($options['allchannels'])) { // search all channels unset($options['allchannels']); $channels = $reg->getChannels(); $errors = array(); PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); foreach ($channels as $channel) { if ($channel->getName() != '__uri') { $options['channel'] = $channel->getName(); $ret = $this->doSearch($command, $options, $params); if (PEAR::isError($ret)) { $errors[] = $ret; } } } PEAR::staticPopErrorHandling(); if (count($errors) !== 0) { // for now, only give first error return PEAR::raiseError($errors[0]); } return true; } $savechannel = $channel = $this->config->get('default_channel'); $package = strtolower($params[0]); $summary = isset($params[1]) ? $params[1] : false; if (isset($options['channel'])) { $reg = &$this->config->getRegistry(); $channel = $options['channel']; if (!$reg->channelExists($channel)) { return $this->raiseError('Channel "' . $channel . '" does not exist'); } $this->config->set('default_channel', $channel); } $chan = $reg->getChannel($channel); if (PEAR::isError($e = $this->_checkChannelForStatus($channel, $chan))) { return $e; } if ($chan->supportsREST($this->config->get('preferred_mirror')) && $base = $chan->getBaseURL('REST1.0', $this->config->get('preferred_mirror'))) { $rest = &$this->config->getREST('1.0', array()); $available = $rest->listAll($base, false, false, $package, $summary, $chan->getName()); } if (PEAR::isError($available)) { $this->config->set('default_channel', $savechannel); return $this->raiseError($available); } if (!$available && !$channelinfo) { // clean exit when not found, no error ! $data = 'no packages found that match pattern "' . $package . '", for channel '.$channel.'.'; $this->ui->outputData($data); $this->config->set('default_channel', $channel); return true; } if ($channelinfo) { $data = array( 'caption' => 'Matched packages, channel ' . $channel . ':', 'border' => true, 'headline' => array('Channel', 'Package', 'Stable/(Latest)', 'Local'), 'channel' => $channel ); } else { $data = array( 'caption' => 'Matched packages, channel ' . $channel . ':', 'border' => true, 'headline' => array('Package', 'Stable/(Latest)', 'Local'), 'channel' => $channel ); } if (!$available && $channelinfo) { unset($data['headline']); $data['data'] = 'No packages found that match pattern "' . $package . '".'; $available = array(); } foreach ($available as $name => $info) { $installed = $reg->packageInfo($name, null, $channel); $desc = $info['summary']; if (isset($params[$name])) $desc .= "\n\n".$info['description']; if (!isset($info['stable']) || !$info['stable']) { $version_remote = 'none'; } else { if ($info['unstable']) { $version_remote = $info['unstable']; } else { $version_remote = $info['stable']; } $version_remote .= ' ('.$info['state'].')'; } $version = is_array($installed['version']) ? $installed['version']['release'] : $installed['version']; if ($channelinfo) { $packageinfo = array( $channel, $name, $version_remote, $version, $desc, ); } else { $packageinfo = array( $name, $version_remote, $version, $desc, ); } $data['data'][$info['category']][] = $packageinfo; } $this->ui->outputData($data, $command); $this->config->set('default_channel', $channel); return true; } function &getDownloader($options) { if (!class_exists('PEAR_Downloader')) { require_once 'PEAR/Downloader.php'; } $a = new PEAR_Downloader($this->ui, $options, $this->config); return $a; } function doDownload($command, $options, $params) { // make certain that dependencies are ignored $options['downloadonly'] = 1; // eliminate error messages for preferred_state-related errors /* TODO: Should be an option, but until now download does respect prefered state */ /* $options['ignorepreferred_state'] = 1; */ // eliminate error messages for preferred_state-related errors $downloader = &$this->getDownloader($options); PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); $e = $downloader->setDownloadDir(getcwd()); PEAR::staticPopErrorHandling(); if (PEAR::isError($e)) { return $this->raiseError('Current directory is not writeable, cannot download'); } $errors = array(); $downloaded = array(); $err = $downloader->download($params); if (PEAR::isError($err)) { return $err; } $errors = $downloader->getErrorMsgs(); if (count($errors)) { foreach ($errors as $error) { if ($error !== null) { $this->ui->outputData($error); } } return $this->raiseError("$command failed"); } $downloaded = $downloader->getDownloadedPackages(); foreach ($downloaded as $pkg) { $this->ui->outputData("File $pkg[file] downloaded", $command); } return true; } function downloadCallback($msg, $params = null) { if ($msg == 'done') { $this->bytes_downloaded = $params; } } function doListUpgrades($command, $options, $params) { require_once 'PEAR/Common.php'; if (isset($params[0]) && !is_array(PEAR_Common::betterStates($params[0]))) { return $this->raiseError($params[0] . ' is not a valid state (stable/beta/alpha/devel/etc.) try "pear help list-upgrades"'); } $savechannel = $channel = $this->config->get('default_channel'); $reg = &$this->config->getRegistry(); foreach ($reg->listChannels() as $channel) { $inst = array_flip($reg->listPackages($channel)); if (!count($inst)) { continue; } if ($channel == '__uri') { continue; } $this->config->set('default_channel', $channel); $state = empty($params[0]) ? $this->config->get('preferred_state') : $params[0]; $caption = $channel . ' Available Upgrades'; $chan = $reg->getChannel($channel); if (PEAR::isError($e = $this->_checkChannelForStatus($channel, $chan))) { return $e; } $latest = array(); $base2 = false; $preferred_mirror = $this->config->get('preferred_mirror'); if ($chan->supportsREST($preferred_mirror) && ( ($base2 = $chan->getBaseURL('REST1.3', $preferred_mirror)) || ($base = $chan->getBaseURL('REST1.0', $preferred_mirror)) ) ) { if ($base2) { $rest = &$this->config->getREST('1.3', array()); $base = $base2; } else { $rest = &$this->config->getREST('1.0', array()); } if (empty($state) || $state == 'any') { $state = false; } else { $caption .= ' (' . implode(', ', PEAR_Common::betterStates($state, true)) . ')'; } PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); $latest = $rest->listLatestUpgrades($base, $state, $inst, $channel, $reg); PEAR::staticPopErrorHandling(); } if (PEAR::isError($latest)) { $this->ui->outputData($latest->getMessage()); continue; } $caption .= ':'; if (PEAR::isError($latest)) { $this->config->set('default_channel', $savechannel); return $latest; } $data = array( 'caption' => $caption, 'border' => 1, 'headline' => array('Channel', 'Package', 'Local', 'Remote', 'Size'), 'channel' => $channel ); foreach ((array)$latest as $pkg => $info) { $package = strtolower($pkg); if (!isset($inst[$package])) { // skip packages we don't have installed continue; } extract($info); $inst_version = $reg->packageInfo($package, 'version', $channel); $inst_state = $reg->packageInfo($package, 'release_state', $channel); if (version_compare("$version", "$inst_version", "le")) { // installed version is up-to-date continue; } if ($filesize >= 20480) { $filesize += 1024 - ($filesize % 1024); $fs = sprintf("%dkB", $filesize / 1024); } elseif ($filesize > 0) { $filesize += 103 - ($filesize % 103); $fs = sprintf("%.1fkB", $filesize / 1024.0); } else { $fs = " -"; // XXX center instead } $data['data'][] = array($channel, $pkg, "$inst_version ($inst_state)", "$version ($state)", $fs); } if (isset($options['channelinfo'])) { if (empty($data['data'])) { unset($data['headline']); if (count($inst) == 0) { $data['data'] = '(no packages installed)'; } else { $data['data'] = '(no upgrades available)'; } } $this->ui->outputData($data, $command); } else { if (empty($data['data'])) { $this->ui->outputData('Channel ' . $channel . ': No upgrades available'); } else { $this->ui->outputData($data, $command); } } } $this->config->set('default_channel', $savechannel); return true; } function doClearCache($command, $options, $params) { $cache_dir = $this->config->get('cache_dir'); $verbose = $this->config->get('verbose'); $output = ''; if (!file_exists($cache_dir) || !is_dir($cache_dir)) { return $this->raiseError("$cache_dir does not exist or is not a directory"); } 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('/rest.cache(file|id)\\z/', $ent)) { $path = $cache_dir . DIRECTORY_SEPARATOR . $ent; if (file_exists($path)) { $ok = @unlink($path); } else { $ok = false; $php_errormsg = ''; } if ($ok) { if ($verbose >= 2) { $output .= "deleted $path\n"; } $num++; } elseif ($verbose >= 1) { $output .= "failed to delete $path $php_errormsg\n"; } } } closedir($dp); if ($verbose >= 1) { $output .= "$num cache entries cleared\n"; } $this->ui->outputData(rtrim($output), $command); return $num; } } php-pear-1.10.1+submodules+notgz/PEAR/Command/Remote.xml000066400000000000000000000063571262614675700227360ustar00rootroot00000000000000 Information About Remote Packages doRemoteInfo ri <package> Get details on a package from the server. List Available Upgrades doListUpgrades lu i output fully channel-aware data, even on failure [preferred_state] List releases on the server of packages you have installed where a newer version is available with the same release state (stable etc.) or the state passed as the second parameter. List Remote Packages doRemoteList rl c specify a channel other than the default channel CHAN Lists the packages available on the configured server along with the latest stable release of each package. Search remote package database doSearch sp c specify a channel other than the default channel CHAN a search packages from all known channels i output fully channel-aware data, even on failure [packagename] [packageinfo] Lists all packages which match the search parameters. The first parameter is a fragment of a packagename. The default channel will be used unless explicitly overridden. The second parameter will be used to match any portion of the summary/description List All Packages doListAll la c specify a channel other than the default channel CHAN i output fully channel-aware data, even on failure Lists the packages available on the configured server along with the latest stable release of each package. Download Package doDownload d Z download an uncompressed (.tar) file <package>... Download package tarballs. The files 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.6.5, the downloaded file will be DB-1.6.5.tgz. Clear Web Services Cache doClearCache cc Clear the XML-RPC/REST cache. See also the cache_ttl configuration parameter. php-pear-1.10.1+submodules+notgz/PEAR/Command/Test.php000066400000000000000000000275621262614675700224120ustar00rootroot00000000000000 * @author Martin Jansen * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @link http://pear.php.net/package/PEAR * @since File available since Release 0.1 */ /** * base class */ require_once 'PEAR/Command/Common.php'; /** * PEAR commands for login/logout * * @category pear * @package PEAR * @author Stig Bakken * @author Martin Jansen * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version Release: @package_version@ * @link http://pear.php.net/package/PEAR * @since Class available since Release 0.1 */ class PEAR_Command_Test extends PEAR_Command_Common { var $commands = array( 'run-tests' => array( 'summary' => 'Run Regression Tests', 'function' => 'doRunTests', 'shortcut' => 'rt', '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', ), 'quiet' => array( 'shortopt' => 'q', 'doc' => 'Only display detail for failed tests', ), 'simple' => array( 'shortopt' => 's', 'doc' => 'Display simple output for all tests', ), 'package' => array( 'shortopt' => 'p', 'doc' => 'Treat parameters as installed packages from which to run tests', ), 'phpunit' => array( 'shortopt' => 'u', 'doc' => 'Search parameters for AllTests.php, and use that to run phpunit-based tests If none is found, all .phpt tests will be tried instead.', ), 'tapoutput' => array( 'shortopt' => 't', 'doc' => 'Output run-tests.log in TAP-compliant format', ), 'cgi' => array( 'shortopt' => 'c', 'doc' => 'CGI php executable (needed for tests with POST/GET section)', 'arg' => 'PHPCGI', ), 'coverage' => array( 'shortopt' => 'x', 'doc' => 'Generate a code coverage report (requires Xdebug 2.0.0+)', ), 'showdiff' => array( 'shortopt' => 'd', 'doc' => 'Output diff on test failure', ), ), 'doc' => '[testfile|dir ...] Run regression tests with PHP\'s regression testing script (run-tests.php).', ), ); var $output; /** * PEAR_Command_Test constructor. * * @access public */ function __construct(&$ui, &$config) { parent::__construct($ui, $config); } function doRunTests($command, $options, $params) { if (isset($options['phpunit']) && isset($options['tapoutput'])) { return $this->raiseError('ERROR: cannot use both --phpunit and --tapoutput at the same time'); } require_once 'PEAR/Common.php'; require_once 'System.php'; $log = new PEAR_Common; $log->ui = &$this->ui; // slightly hacky, but it will work $tests = array(); $depth = isset($options['recur']) ? 14 : 1; if (!count($params)) { $params[] = '.'; } if (isset($options['package'])) { $oldparams = $params; $params = array(); $reg = &$this->config->getRegistry(); foreach ($oldparams as $param) { $pname = $reg->parsePackageName($param, $this->config->get('default_channel')); if (PEAR::isError($pname)) { return $this->raiseError($pname); } $package = &$reg->getPackage($pname['package'], $pname['channel']); if (!$package) { return PEAR::raiseError('Unknown package "' . $reg->parsedPackageNameToString($pname) . '"'); } $filelist = $package->getFilelist(); foreach ($filelist as $name => $atts) { if (isset($atts['role']) && $atts['role'] != 'test') { continue; } if (isset($options['phpunit']) && preg_match('/AllTests\.php\\z/i', $name)) { $params[] = $atts['installed_as']; continue; } elseif (!preg_match('/\.phpt\\z/', $name)) { continue; } $params[] = $atts['installed_as']; } } } foreach ($params as $p) { if (is_dir($p)) { if (isset($options['phpunit'])) { $dir = System::find(array($p, '-type', 'f', '-maxdepth', $depth, '-name', 'AllTests.php')); if (count($dir)) { foreach ($dir as $p) { $p = realpath($p); if (!count($tests) || (count($tests) && strlen($p) < strlen($tests[0]))) { // this is in a higher-level directory, use this one instead. $tests = array($p); } } } continue; } $args = array($p, '-type', 'f', '-name', '*.phpt'); } else { if (isset($options['phpunit'])) { if (preg_match('/AllTests\.php\\z/i', $p)) { $p = realpath($p); if (!count($tests) || (count($tests) && strlen($p) < strlen($tests[0]))) { // this is in a higher-level directory, use this one instead. $tests = array($p); } } continue; } if (file_exists($p) && preg_match('/\.phpt$/', $p)) { $tests[] = $p; continue; } if (!preg_match('/\.phpt\\z/', $p)) { $p .= '.phpt'; } $args = array(dirname($p), '-type', 'f', '-name', $p); } if (!isset($options['recur'])) { $args[] = '-maxdepth'; $args[] = 1; } $dir = System::find($args); $tests = array_merge($tests, $dir); } $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(); $tests_count = count($tests); $this->ui->outputData('Running ' . $tests_count . ' tests', $command); $start = time(); if (isset($options['realtimelog']) && file_exists('run-tests.log')) { unlink('run-tests.log'); } if (isset($options['tapoutput'])) { $tap = '1..' . $tests_count . "\n"; } require_once 'PEAR/RunTest.php'; $run = new PEAR_RunTest($log, $options); $run->tests_count = $tests_count; if (isset($options['coverage']) && extension_loaded('xdebug')){ $run->xdebug_loaded = true; } else { $run->xdebug_loaded = false; } $j = $i = 1; foreach ($tests as $t) { if (isset($options['realtimelog'])) { $fp = @fopen('run-tests.log', 'a'); if ($fp) { fwrite($fp, "Running test [$i / $tests_count] $t..."); fclose($fp); } } PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); if (isset($options['phpunit'])) { $result = $run->runPHPUnit($t, $ini_settings); } else { $result = $run->run($t, $ini_settings, $j); } PEAR::staticPopErrorHandling(); if (PEAR::isError($result)) { $this->ui->log($result->getMessage()); continue; } if (isset($options['tapoutput'])) { $tap .= $result[0] . ' ' . $i . $result[1] . "\n"; continue; } 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; } $j++; } $total = date('i:s', time() - $start); if (isset($options['tapoutput'])) { $fp = @fopen('run-tests.log', 'w'); if ($fp) { fwrite($fp, $tap, strlen($tap)); fclose($fp); $this->ui->outputData('wrote TAP-format log to "' .realpath('run-tests.log') . '"', $command); } } else { 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"; } $mode = isset($options['realtimelog']) ? 'a' : 'w'; $fp = @fopen('run-tests.log', $mode); 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); } } if (count($failed) == 0) { return true; } return $this->raiseError('Some tests failed'); } } php-pear-1.10.1+submodules+notgz/PEAR/Command/Test.xml000066400000000000000000000031511262614675700224070ustar00rootroot00000000000000 Run Regression Tests doRunTests rt r Run tests in child directories, recursively. 4 dirs deep maximum i actual string of settings to pass to php in format " -d setting=blah" SETTINGS l Log test runs/results as they are run q Only display detail for failed tests s Display simple output for all tests p Treat parameters as installed packages from which to run tests u Search parameters for AllTests.php, and use that to run phpunit-based tests If none is found, all .phpt tests will be tried instead. t Output run-tests.log in TAP-compliant format c CGI php executable (needed for tests with POST/GET section) PHPCGI x Generate a code coverage report (requires Xdebug 2.0.0+) [testfile|dir ...] Run regression tests with PHP's regression testing script (run-tests.php). php-pear-1.10.1+submodules+notgz/PEAR/Common.php000066400000000000000000000635301262614675700213400ustar00rootroot00000000000000 * @author Tomas V. V. Cox * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @link http://pear.php.net/package/PEAR * @since File available since Release 0.1.0 * @deprecated File deprecated since Release 1.4.0a1 */ /** * Include error handling */ require_once 'PEAR.php'; /** * PEAR_Common error when an invalid PHP file is passed to PEAR_Common::analyzeSourceCode() */ define('PEAR_COMMON_ERROR_INVALIDPHP', 1); define('_PEAR_COMMON_PACKAGE_NAME_PREG', '[A-Za-z][a-zA-Z0-9_]+'); define('PEAR_COMMON_PACKAGE_NAME_PREG', '/^' . _PEAR_COMMON_PACKAGE_NAME_PREG . '\\z/'); // 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-zA-Z]+\d*)?'); define('PEAR_COMMON_PACKAGE_VERSION_PREG', '/^' . _PEAR_COMMON_PACKAGE_VERSION_PREG . '\\z/i'); // XXX far from perfect :-) define('_PEAR_COMMON_PACKAGE_DOWNLOAD_PREG', '(' . _PEAR_COMMON_PACKAGE_NAME_PREG . ')(-([.0-9a-zA-Z]+))?'); define('PEAR_COMMON_PACKAGE_DOWNLOAD_PREG', '/^' . _PEAR_COMMON_PACKAGE_DOWNLOAD_PREG . '\\z/'); define('_PEAR_CHANNELS_NAME_PREG', '[A-Za-z][a-zA-Z0-9\.]+'); define('PEAR_CHANNELS_NAME_PREG', '/^' . _PEAR_CHANNELS_NAME_PREG . '\\z/'); // this should allow any dns or IP address, plus a path - NO UNDERSCORES ALLOWED define('_PEAR_CHANNELS_SERVER_PREG', '[a-zA-Z0-9\-]+(?:\.[a-zA-Z0-9\-]+)*(\/[a-zA-Z0-9\-]+)*'); define('PEAR_CHANNELS_SERVER_PREG', '/^' . _PEAR_CHANNELS_SERVER_PREG . '\\z/i'); define('_PEAR_CHANNELS_PACKAGE_PREG', '(' ._PEAR_CHANNELS_SERVER_PREG . ')\/(' . _PEAR_COMMON_PACKAGE_NAME_PREG . ')'); define('PEAR_CHANNELS_PACKAGE_PREG', '/^' . _PEAR_CHANNELS_PACKAGE_PREG . '\\z/i'); define('_PEAR_COMMON_CHANNEL_DOWNLOAD_PREG', '(' . _PEAR_CHANNELS_NAME_PREG . ')::(' . _PEAR_COMMON_PACKAGE_NAME_PREG . ')(-([.0-9a-zA-Z]+))?'); define('PEAR_COMMON_CHANNEL_DOWNLOAD_PREG', '/^' . _PEAR_COMMON_CHANNEL_DOWNLOAD_PREG . '\\z/'); /** * List of temporary files and directories registered by * PEAR_Common::addTempFile(). * @var array */ $GLOBALS['_PEAR_Common_tempfiles'] = array(); /** * Valid maintainer roles * @var array */ $GLOBALS['_PEAR_Common_maintainer_roles'] = array('lead','developer','contributor','helper'); /** * Valid release states * @var array */ $GLOBALS['_PEAR_Common_release_states'] = array('alpha','beta','stable','snapshot','devel'); /** * Valid dependency types * @var array */ $GLOBALS['_PEAR_Common_dependency_types'] = array('pkg','ext','php','prog','ldlib','rtlib','os','websrv','sapi'); /** * Valid dependency relations * @var array */ $GLOBALS['_PEAR_Common_dependency_relations'] = array('has','eq','lt','le','gt','ge','not', 'ne'); /** * Valid file roles * @var array */ $GLOBALS['_PEAR_Common_file_roles'] = array('php','ext','test','doc','data','src','script'); /** * Valid replacement types * @var array */ $GLOBALS['_PEAR_Common_replacement_types'] = array('php-const', 'pear-config', 'package-info'); /** * Valid "provide" types * @var array */ $GLOBALS['_PEAR_Common_provide_types'] = array('ext', 'prog', 'class', 'function', 'feature', 'api'); /** * Valid "provide" types * @var array */ $GLOBALS['_PEAR_Common_script_phases'] = array('pre-install', 'post-install', 'pre-uninstall', 'post-uninstall', 'pre-build', 'post-build', 'pre-configure', 'post-configure', 'pre-setup', 'post-setup'); /** * Class providing common functionality for PEAR administration classes. * @category pear * @package PEAR * @author Stig Bakken * @author Tomas V. V. Cox * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version Release: @package_version@ * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 * @deprecated This class will disappear, and its components will be spread * into smaller classes, like the AT&T breakup, as of Release 1.4.0a1 */ class PEAR_Common extends PEAR { /** * User Interface object (PEAR_Frontend_* class). If null, * the log() method uses print. * @var object */ var $ui = null; /** * Configuration object (PEAR_Config). * @var PEAR_Config */ var $config = null; /** stack of elements, gives some sort of XML context */ var $element_stack = array(); /** name of currently parsed XML element */ var $current_element; /** array of attributes of the currently parsed XML element */ var $current_attributes = array(); /** assoc with information about a package */ var $pkginfo = array(); var $current_path = null; /** * Flag variable used to mark a valid package file * @var boolean * @access private */ var $_validPackageFile; /** * PEAR_Common constructor * * @access public */ function __construct() { parent::__construct(); $this->config = &PEAR_Config::singleton(); $this->debug = $this->config->get('verbose'); } /** * PEAR_Common destructor * * @access private */ function _PEAR_Common() { // doesn't work due to bug #14744 //$tempfiles = $this->_tempfiles; $tempfiles =& $GLOBALS['_PEAR_Common_tempfiles']; while ($file = array_shift($tempfiles)) { if (@is_dir($file)) { if (!class_exists('System')) { require_once 'System.php'; } System::rm(array('-rf', $file)); } elseif (file_exists($file)) { unlink($file); } } } /** * Register a temporary file or directory. When the destructor is * executed, all registered temporary files and directories are * removed. * * @param string $file name of file or directory * * @return void * * @access public */ function addTempFile($file) { if (!class_exists('PEAR_Frontend')) { require_once 'PEAR/Frontend.php'; } PEAR_Frontend::addTempFile($file); } /** * Wrapper to System::mkDir(), creates a directory as well as * any necessary parent directories. * * @param string $dir directory name * * @return bool TRUE on success, or a PEAR error * * @access public */ function mkDirHier($dir) { // Only used in Installer - move it there ? $this->log(2, "+ create dir $dir"); if (!class_exists('System')) { require_once 'System.php'; } return System::mkDir(array('-p', $dir)); } /** * Logging method. * * @param int $level log level (0 is quiet, higher is noisier) * @param string $msg message to write to the log * * @return void */ public function log($level, $msg, $append_crlf = true) { if ($this->debug >= $level) { if (!class_exists('PEAR_Frontend')) { require_once 'PEAR/Frontend.php'; } $ui = &PEAR_Frontend::singleton(); if (is_a($ui, 'PEAR_Frontend')) { $ui->log($msg, $append_crlf); } else { print "$msg\n"; } } } /** * Create and register a temporary directory. * * @param string $tmpdir (optional) Directory to use as tmpdir. * Will use system defaults (for example * /tmp or c:\windows\temp) if not specified * * @return string name of created directory * * @access public */ function mkTempDir($tmpdir = '') { $topt = $tmpdir ? array('-t', $tmpdir) : array(); $topt = array_merge($topt, array('-d', 'pear')); if (!class_exists('System')) { require_once 'System.php'; } if (!$tmpdir = System::mktemp($topt)) { return false; } $this->addTempFile($tmpdir); return $tmpdir; } /** * Set object that represents the frontend to be used. * * @param object Reference of the frontend object * @return void * @access public */ function setFrontendObject(&$ui) { $this->ui = &$ui; } /** * Return an array containing all of the states that are more stable than * or equal to the passed in state * * @param string Release state * @param boolean Determines whether to include $state in the list * @return false|array False if $state is not a valid release state */ function betterStates($state, $include = false) { static $states = array('snapshot', 'devel', 'alpha', 'beta', 'stable'); $i = array_search($state, $states); if ($i === false) { return false; } if ($include) { $i--; } return array_slice($states, $i + 1); } /** * Get the valid roles for a PEAR package maintainer * * @return array */ public static function getUserRoles() { return $GLOBALS['_PEAR_Common_maintainer_roles']; } /** * Get the valid package release states of packages * * @return array */ public static function getReleaseStates() { return $GLOBALS['_PEAR_Common_release_states']; } /** * Get the implemented dependency types (php, ext, pkg etc.) * * @return array */ public static function getDependencyTypes() { return $GLOBALS['_PEAR_Common_dependency_types']; } /** * Get the implemented dependency relations (has, lt, ge etc.) * * @return array */ public static function getDependencyRelations() { return $GLOBALS['_PEAR_Common_dependency_relations']; } /** * Get the implemented file roles * * @return array */ public static function getFileRoles() { return $GLOBALS['_PEAR_Common_file_roles']; } /** * Get the implemented file replacement types in * * @return array */ public static function getReplacementTypes() { return $GLOBALS['_PEAR_Common_replacement_types']; } /** * Get the implemented file replacement types in * * @return array */ public static function getProvideTypes() { return $GLOBALS['_PEAR_Common_provide_types']; } /** * Get the implemented file replacement types in * * @return array */ public static function getScriptPhases() { return $GLOBALS['_PEAR_Common_script_phases']; } /** * Test whether a string contains a valid package name. * * @param string $name the package name to test * * @return bool * * @access public */ function validPackageName($name) { return (bool)preg_match(PEAR_COMMON_PACKAGE_NAME_PREG, $name); } /** * Test whether a string contains a valid package version. * * @param string $ver the package version to test * * @return bool * * @access public */ function validPackageVersion($ver) { return (bool)preg_match(PEAR_COMMON_PACKAGE_VERSION_PREG, $ver); } /** * @param string $path relative or absolute include path * @return boolean */ public static function isIncludeable($path) { if (file_exists($path) && is_readable($path)) { return true; } $ipath = explode(PATH_SEPARATOR, ini_get('include_path')); foreach ($ipath as $include) { $test = realpath($include . DIRECTORY_SEPARATOR . $path); if (file_exists($test) && is_readable($test)) { return true; } } return false; } function _postProcessChecks($pf) { if (!PEAR::isError($pf)) { return $this->_postProcessValidPackagexml($pf); } $errs = $pf->getUserinfo(); if (is_array($errs)) { foreach ($errs as $error) { $e = $this->raiseError($error['message'], $error['code'], null, null, $error); } } return $pf; } /** * Returns information about a package file. Expects the name of * a gzipped tar file as input. * * @param string $file name of .tgz file * * @return array array with package information * * @access public * @deprecated use PEAR_PackageFile->fromTgzFile() instead * */ function infoFromTgzFile($file) { $packagefile = new PEAR_PackageFile($this->config); $pf = &$packagefile->fromTgzFile($file, PEAR_VALIDATE_NORMAL); return $this->_postProcessChecks($pf); } /** * Returns information about a package file. Expects the name of * a package xml file as input. * * @param string $descfile name of package xml file * * @return array array with package information * * @access public * @deprecated use PEAR_PackageFile->fromPackageFile() instead * */ function infoFromDescriptionFile($descfile) { $packagefile = new PEAR_PackageFile($this->config); $pf = &$packagefile->fromPackageFile($descfile, PEAR_VALIDATE_NORMAL); return $this->_postProcessChecks($pf); } /** * Returns information about a package file. Expects the contents * of a package xml file as input. * * @param string $data contents of package.xml file * * @return array array with package information * * @access public * @deprecated use PEAR_PackageFile->fromXmlstring() instead * */ function infoFromString($data) { $packagefile = new PEAR_PackageFile($this->config); $pf = &$packagefile->fromXmlString($data, PEAR_VALIDATE_NORMAL, false); return $this->_postProcessChecks($pf); } /** * @param PEAR_PackageFile_v1|PEAR_PackageFile_v2 * @return array */ function _postProcessValidPackagexml(&$pf) { if (!is_a($pf, 'PEAR_PackageFile_v2')) { $this->pkginfo = $pf->toArray(); return $this->pkginfo; } // sort of make this into a package.xml 1.0-style array // changelog is not converted to old format. $arr = $pf->toArray(true); $arr = array_merge($arr, $arr['old']); unset($arr['old'], $arr['xsdversion'], $arr['contents'], $arr['compatible'], $arr['channel'], $arr['uri'], $arr['dependencies'], $arr['phprelease'], $arr['extsrcrelease'], $arr['zendextsrcrelease'], $arr['extbinrelease'], $arr['zendextbinrelease'], $arr['bundle'], $arr['lead'], $arr['developer'], $arr['helper'], $arr['contributor']); $arr['filelist'] = $pf->getFilelist(); $this->pkginfo = $arr; return $arr; } /** * Returns package information from different sources * * This method is able to extract information about a package * from a .tgz archive or from a XML package definition file. * * @access public * @param string Filename of the source ('package.xml', '.tgz') * @return string * @deprecated use PEAR_PackageFile->fromAnyFile() instead */ function infoFromAny($info) { if (is_string($info) && file_exists($info)) { $packagefile = new PEAR_PackageFile($this->config); $pf = &$packagefile->fromAnyFile($info, PEAR_VALIDATE_NORMAL); if (PEAR::isError($pf)) { $errs = $pf->getUserinfo(); if (is_array($errs)) { foreach ($errs as $error) { $e = $this->raiseError($error['message'], $error['code'], null, null, $error); } } return $pf; } return $this->_postProcessValidPackagexml($pf); } return $info; } /** * Return an XML document based on the package info (as returned * by the PEAR_Common::infoFrom* methods). * * @param array $pkginfo package info * * @return string XML data * * @access public * @deprecated use a PEAR_PackageFile_v* object's generator instead */ function xmlFromInfo($pkginfo) { $config = &PEAR_Config::singleton(); $packagefile = new PEAR_PackageFile($config); $pf = &$packagefile->fromArray($pkginfo); $gen = &$pf->getDefaultGenerator(); return $gen->toXml(PEAR_VALIDATE_PACKAGING); } /** * Validate XML package definition file. * * @param string $info Filename of the package archive or of the * package definition file * @param array $errors Array that will contain the errors * @param array $warnings Array that will contain the warnings * @param string $dir_prefix (optional) directory where source files * may be found, or empty if they are not available * @access public * @return boolean * @deprecated use the validation of PEAR_PackageFile objects */ function validatePackageInfo($info, &$errors, &$warnings, $dir_prefix = '') { $config = &PEAR_Config::singleton(); $packagefile = new PEAR_PackageFile($config); PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); if (strpos($info, 'fromXmlString($info, PEAR_VALIDATE_NORMAL, ''); } else { $pf = &$packagefile->fromAnyFile($info, PEAR_VALIDATE_NORMAL); } PEAR::staticPopErrorHandling(); if (PEAR::isError($pf)) { $errs = $pf->getUserinfo(); if (is_array($errs)) { foreach ($errs as $error) { if ($error['level'] == 'error') { $errors[] = $error['message']; } else { $warnings[] = $error['message']; } } } return false; } return true; } /** * Build a "provides" array from data returned by * analyzeSourceCode(). The format of the built array is like * this: * * array( * 'class;MyClass' => 'array('type' => 'class', 'name' => 'MyClass'), * ... * ) * * * @param array $srcinfo array with information about a source file * as returned by the analyzeSourceCode() method. * * @return void * * @access public * */ function buildProvidesArray($srcinfo) { $file = basename($srcinfo['source_file']); $pn = ''; if (isset($this->_packageName)) { $pn = $this->_packageName; } $pnl = strlen($pn); foreach ($srcinfo['declared_classes'] as $class) { $key = "class;$class"; if (isset($this->pkginfo['provides'][$key])) { continue; } $this->pkginfo['provides'][$key] = array('file'=> $file, 'type' => 'class', 'name' => $class); if (isset($srcinfo['inheritance'][$class])) { $this->pkginfo['provides'][$key]['extends'] = $srcinfo['inheritance'][$class]; } } foreach ($srcinfo['declared_methods'] as $class => $methods) { foreach ($methods as $method) { $function = "$class::$method"; $key = "function;$function"; if ($method{0} == '_' || !strcasecmp($method, $class) || isset($this->pkginfo['provides'][$key])) { continue; } $this->pkginfo['provides'][$key] = array('file'=> $file, 'type' => 'function', 'name' => $function); } } foreach ($srcinfo['declared_functions'] as $function) { $key = "function;$function"; if ($function{0} == '_' || isset($this->pkginfo['provides'][$key])) { continue; } if (!strstr($function, '::') && strncasecmp($function, $pn, $pnl)) { $warnings[] = "in1 " . $file . ": function \"$function\" not prefixed with package name \"$pn\""; } $this->pkginfo['provides'][$key] = array('file'=> $file, 'type' => 'function', 'name' => $function); } } /** * Analyze the source code of the given PHP file * * @param string Filename of the PHP file * @return mixed * @access public */ function analyzeSourceCode($file) { if (!class_exists('PEAR_PackageFile_v2_Validator')) { require_once 'PEAR/PackageFile/v2/Validator.php'; } $a = new PEAR_PackageFile_v2_Validator; return $a->analyzeSourceCode($file); } function detectDependencies($any, $status_callback = null) { if (!function_exists("token_get_all")) { return false; } if (PEAR::isError($info = $this->infoFromAny($any))) { return $this->raiseError($info); } if (!is_array($info)) { return false; } $deps = array(); $used_c = $decl_c = $decl_f = $decl_m = array(); foreach ($info['filelist'] as $file => $fa) { $tmp = $this->analyzeSourceCode($file); $used_c = @array_merge($used_c, $tmp['used_classes']); $decl_c = @array_merge($decl_c, $tmp['declared_classes']); $decl_f = @array_merge($decl_f, $tmp['declared_functions']); $decl_m = @array_merge($decl_m, $tmp['declared_methods']); $inheri = @array_merge($inheri, $tmp['inheritance']); } $used_c = array_unique($used_c); $decl_c = array_unique($decl_c); $undecl_c = array_diff($used_c, $decl_c); return array('used_classes' => $used_c, 'declared_classes' => $decl_c, 'declared_methods' => $decl_m, 'declared_functions' => $decl_f, 'undeclared_classes' => $undecl_c, 'inheritance' => $inheri, ); } /** * Download a file through HTTP. Considers suggested file name in * Content-disposition: header and can run a callback function for * different events. The callback will be called with two * parameters: the callback type, and parameters. The implemented * callback types are: * * 'setup' called at the very beginning, parameter is a UI object * that should be used for all output * 'message' the parameter is a string with an informational message * 'saveas' may be used to save with a different file name, the * parameter is the filename that is about to be used. * If a 'saveas' callback returns a non-empty string, * that file name will be used as the filename instead. * Note that $save_dir will not be affected by this, only * the basename of the file. * 'start' download is starting, parameter is number of bytes * that are expected, or -1 if unknown * 'bytesread' parameter is the number of bytes read so far * 'done' download is complete, parameter is the total number * of bytes read * 'connfailed' if the TCP connection fails, this callback is called * with array(host,port,errno,errmsg) * 'writefailed' if writing to disk fails, this callback is called * with array(destfile,errmsg) * * If an HTTP proxy has been configured (http_proxy PEAR_Config * setting), the proxy will be used. * * @param string $url the URL to download * @param object $ui PEAR_Frontend_* instance * @param object $config PEAR_Config instance * @param string $save_dir (optional) directory to save file in * @param mixed $callback (optional) function/method to call for status * updates * @param false|string|array $lastmodified header values to check against * for caching * use false to return the header * values from this download * @param false|array $accept Accept headers to send * @param false|string $channel Channel to use for retrieving * authentication * * @return mixed Returns the full path of the downloaded file or a PEAR * error on failure. If the error is caused by * socket-related errors, the error object will * have the fsockopen error code available through * getCode(). If caching is requested, then return the header * values. * If $lastmodified was given and the there are no changes, * boolean false is returned. * * @access public */ function downloadHttp( $url, &$ui, $save_dir = '.', $callback = null, $lastmodified = null, $accept = false, $channel = false ) { if (!class_exists('PEAR_Downloader')) { require_once 'PEAR/Downloader.php'; } return PEAR_Downloader::_downloadHttp( $this, $url, $ui, $save_dir, $callback, $lastmodified, $accept, $channel ); } } require_once 'PEAR/Config.php'; require_once 'PEAR/PackageFile.php'; php-pear-1.10.1+submodules+notgz/PEAR/Config.php000066400000000000000000002075541262614675700213230ustar00rootroot00000000000000 * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @link http://pear.php.net/package/PEAR * @since File available since Release 0.1 */ /** * Required for error handling */ require_once 'PEAR.php'; require_once 'PEAR/Registry.php'; require_once 'PEAR/Installer/Role.php'; require_once 'System.php'; /** * Last created PEAR_Config instance. * @var object */ $GLOBALS['_PEAR_Config_instance'] = null; if (!defined('PEAR_INSTALL_DIR') || !PEAR_INSTALL_DIR) { $PEAR_INSTALL_DIR = PHP_LIBDIR . DIRECTORY_SEPARATOR . 'pear'; } else { $PEAR_INSTALL_DIR = PEAR_INSTALL_DIR; } // Below we define constants with default values for all configuration // parameters except username/password. All of them can have their // defaults set through environment variables. The reason we use the // PHP_ prefix is for some security, PHP protects environment // variables starting with PHP_*. // default channel and preferred mirror is based on whether we are invoked through // the "pear" or the "pecl" command if (!defined('PEAR_RUNTYPE')) { define('PEAR_RUNTYPE', 'pear'); } if (PEAR_RUNTYPE == 'pear') { define('PEAR_CONFIG_DEFAULT_CHANNEL', 'pear.php.net'); } else { define('PEAR_CONFIG_DEFAULT_CHANNEL', 'pecl.php.net'); } 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 (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 (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 (getenv('PHP_PEAR_INSTALL_DIR')) { define('PEAR_CONFIG_DEFAULT_PHP_DIR', getenv('PHP_PEAR_INSTALL_DIR')); } else { if (@file_exists($PEAR_INSTALL_DIR) && is_dir($PEAR_INSTALL_DIR)) { define('PEAR_CONFIG_DEFAULT_PHP_DIR', $PEAR_INSTALL_DIR); } else { define('PEAR_CONFIG_DEFAULT_PHP_DIR', $PEAR_INSTALL_DIR); } } // Default for metadata_dir if (getenv('PHP_PEAR_METADATA_DIR')) { define('PEAR_CONFIG_DEFAULT_METADATA_DIR', getenv('PHP_PEAR_METADATA_DIR')); } else { define('PEAR_CONFIG_DEFAULT_METADATA_DIR', ''); } // Default for ext_dir if (getenv('PHP_PEAR_EXTENSION_DIR')) { define('PEAR_CONFIG_DEFAULT_EXT_DIR', getenv('PHP_PEAR_EXTENSION_DIR')); } else { if (ini_get('extension_dir')) { define('PEAR_CONFIG_DEFAULT_EXT_DIR', ini_get('extension_dir')); } elseif (defined('PEAR_EXTENSION_DIR') && file_exists(PEAR_EXTENSION_DIR) && is_dir(PEAR_EXTENSION_DIR)) { define('PEAR_CONFIG_DEFAULT_EXT_DIR', PEAR_EXTENSION_DIR); } elseif (defined('PHP_EXTENSION_DIR')) { define('PEAR_CONFIG_DEFAULT_EXT_DIR', PHP_EXTENSION_DIR); } else { define('PEAR_CONFIG_DEFAULT_EXT_DIR', '.'); } } // Default for 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 (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 (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 cfg_dir if (getenv('PHP_PEAR_CFG_DIR')) { define('PEAR_CONFIG_DEFAULT_CFG_DIR', getenv('PHP_PEAR_CFG_DIR')); } else { define('PEAR_CONFIG_DEFAULT_CFG_DIR', $PEAR_INSTALL_DIR.DIRECTORY_SEPARATOR.'cfg'); } // Default for www_dir if (getenv('PHP_PEAR_WWW_DIR')) { define('PEAR_CONFIG_DEFAULT_WWW_DIR', getenv('PHP_PEAR_WWW_DIR')); } else { define('PEAR_CONFIG_DEFAULT_WWW_DIR', $PEAR_INSTALL_DIR.DIRECTORY_SEPARATOR.'www'); } // Default for man_dir if (getenv('PHP_PEAR_MAN_DIR')) { define('PEAR_CONFIG_DEFAULT_MAN_DIR', getenv('PHP_PEAR_MAN_DIR')); } else { if (defined('PHP_MANDIR')) { // Added in PHP5.3.7 define('PEAR_CONFIG_DEFAULT_MAN_DIR', PHP_MANDIR); } else { define('PEAR_CONFIG_DEFAULT_MAN_DIR', PHP_PREFIX . DIRECTORY_SEPARATOR . 'local' . DIRECTORY_SEPARATOR .'man'); } } // Default for 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 temp_dir if (getenv('PHP_PEAR_TEMP_DIR')) { define('PEAR_CONFIG_DEFAULT_TEMP_DIR', getenv('PHP_PEAR_TEMP_DIR')); } else { define('PEAR_CONFIG_DEFAULT_TEMP_DIR', System::tmpdir() . DIRECTORY_SEPARATOR . 'pear' . DIRECTORY_SEPARATOR . 'temp'); } // Default for 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' . DIRECTORY_SEPARATOR . 'cache'); } // Default for download_dir if (getenv('PHP_PEAR_DOWNLOAD_DIR')) { define('PEAR_CONFIG_DEFAULT_DOWNLOAD_DIR', getenv('PHP_PEAR_DOWNLOAD_DIR')); } else { define('PEAR_CONFIG_DEFAULT_DOWNLOAD_DIR', System::tmpdir() . DIRECTORY_SEPARATOR . 'pear' . DIRECTORY_SEPARATOR . 'download'); } // Default for 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 (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 (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 (getenv('PHP_PEAR_UMASK')) { define('PEAR_CONFIG_DEFAULT_UMASK', getenv('PHP_PEAR_UMASK')); } else { define('PEAR_CONFIG_DEFAULT_UMASK', decoct(umask())); } // Default for 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 (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 (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( 'gpg', OS_WINDOWS ? 'c:\gnupg\gpg.exe' : '/usr/local/bin/gpg')); } // Default for 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'); } /** * This is a class for storing configuration data, keeping track of * which are system-defined, user-defined or defaulted. * @category pear * @package PEAR * @author Stig Bakken * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version Release: @package_version@ * @link http://pear.php.net/package/PEAR * @since Class available since Release 0.1 */ class PEAR_Config extends PEAR { /** * Array of config files used. * * @var array layer => config file */ var $files = array( 'system' => '', 'user' => '', ); var $layers = array(); /** * Configuration data, two-dimensional array where the first * dimension is the config layer ('user', 'system' and 'default'), * and the second dimension is keyname => value. * * The order in the first dimension is important! Earlier * layers will shadow later ones when a config value is * requested (if a 'user' value exists, it will be returned first, * then 'system' and finally 'default'). * * @var array layer => array(keyname => value, ...) */ var $configuration = array( 'user' => array(), 'system' => array(), 'default' => array(), ); /** * Configuration values that can be set for a channel * * All other configuration values can only have a global value * @var array * @access private */ var $_channelConfigInfo = array( 'php_dir', 'ext_dir', 'doc_dir', 'bin_dir', 'data_dir', 'cfg_dir', 'test_dir', 'www_dir', 'php_bin', 'php_prefix', 'php_suffix', 'username', 'password', 'verbose', 'preferred_state', 'umask', 'preferred_mirror', 'php_ini' ); /** * Channels that can be accessed * @see setChannels() * @var array * @access private */ var $_channels = array('pear.php.net', 'pecl.php.net', '__uri'); /** * This variable is used to control the directory values returned * @see setInstallRoot(); * @var string|false * @access private */ var $_installRoot = false; /** * If requested, this will always refer to the registry * contained in php_dir * @var PEAR_Registry */ var $_registry = array(); /** * @var array * @access private */ var $_regInitialized = array(); /** * @var bool * @access private */ var $_noRegistry = false; /** * amount of errors found while parsing config * @var integer * @access private */ var $_errorsFound = 0; var $_lastError = null; /** * Information about the configuration data. Stores the type, * default value and a documentation string for each configuration * value. * * @var array layer => array(infotype => value, ...) */ var $configuration_info = array( // Channels/Internet Access 'default_channel' => array( 'type' => 'string', 'default' => PEAR_CONFIG_DEFAULT_CHANNEL, 'doc' => 'the default channel to use for all non explicit commands', 'prompt' => 'Default Channel', 'group' => 'Internet Access', ), 'preferred_mirror' => array( 'type' => 'string', 'default' => PEAR_CONFIG_DEFAULT_CHANNEL, 'doc' => 'the default server or mirror to use for channel actions', 'prompt' => 'Default Channel Mirror', 'group' => 'Internet Access', ), 'remote_config' => array( 'type' => 'password', 'default' => '', 'doc' => 'ftp url of remote configuration file to use for synchronized install', 'prompt' => 'Remote Configuration File', 'group' => 'Internet Access', ), 'auto_discover' => array( 'type' => 'integer', 'default' => 0, 'doc' => 'whether to automatically discover new channels', 'prompt' => 'Auto-discover new Channels', 'group' => 'Internet Access', ), // Internet Access 'master_server' => array( 'type' => 'string', 'default' => 'pear.php.net', 'doc' => 'name of the main PEAR server [NOT USED IN THIS VERSION]', 'prompt' => 'PEAR server [DEPRECATED]', 'group' => 'Internet Access', ), 'http_proxy' => array( 'type' => 'string', 'default' => PEAR_CONFIG_DEFAULT_HTTP_PROXY, 'doc' => 'HTTP proxy (host:port) to use when downloading packages', 'prompt' => 'HTTP Proxy Server Address', 'group' => 'Internet Access', ), // File Locations 'php_dir' => array( 'type' => 'directory', 'default' => PEAR_CONFIG_DEFAULT_PHP_DIR, 'doc' => 'directory where .php files are installed', 'prompt' => 'PEAR directory', 'group' => 'File Locations', ), 'ext_dir' => array( 'type' => 'directory', 'default' => PEAR_CONFIG_DEFAULT_EXT_DIR, 'doc' => 'directory where loadable extensions are installed', 'prompt' => 'PHP extension directory', 'group' => 'File Locations', ), 'doc_dir' => array( 'type' => 'directory', 'default' => PEAR_CONFIG_DEFAULT_DOC_DIR, 'doc' => 'directory where documentation is installed', 'prompt' => 'PEAR documentation directory', 'group' => 'File Locations', ), 'bin_dir' => array( 'type' => 'directory', 'default' => PEAR_CONFIG_DEFAULT_BIN_DIR, 'doc' => 'directory where executables are installed', 'prompt' => 'PEAR executables directory', 'group' => 'File Locations', ), 'data_dir' => array( 'type' => 'directory', 'default' => PEAR_CONFIG_DEFAULT_DATA_DIR, 'doc' => 'directory where data files are installed', 'prompt' => 'PEAR data directory', 'group' => 'File Locations (Advanced)', ), 'cfg_dir' => array( 'type' => 'directory', 'default' => PEAR_CONFIG_DEFAULT_CFG_DIR, 'doc' => 'directory where modifiable configuration files are installed', 'prompt' => 'PEAR configuration file directory', 'group' => 'File Locations (Advanced)', ), 'www_dir' => array( 'type' => 'directory', 'default' => PEAR_CONFIG_DEFAULT_WWW_DIR, 'doc' => 'directory where www frontend files (html/js) are installed', 'prompt' => 'PEAR www files directory', 'group' => 'File Locations (Advanced)', ), 'man_dir' => array( 'type' => 'directory', 'default' => PEAR_CONFIG_DEFAULT_MAN_DIR, 'doc' => 'directory where unix manual pages are installed', 'prompt' => 'Systems manpage files directory', 'group' => 'File Locations (Advanced)', ), 'test_dir' => array( 'type' => 'directory', 'default' => PEAR_CONFIG_DEFAULT_TEST_DIR, 'doc' => 'directory where regression tests are installed', 'prompt' => 'PEAR test directory', 'group' => 'File Locations (Advanced)', ), 'cache_dir' => array( 'type' => 'directory', 'default' => PEAR_CONFIG_DEFAULT_CACHE_DIR, 'doc' => 'directory which is used for web service cache', 'prompt' => 'PEAR Installer cache directory', 'group' => 'File Locations (Advanced)', ), 'temp_dir' => array( 'type' => 'directory', 'default' => PEAR_CONFIG_DEFAULT_TEMP_DIR, 'doc' => 'directory which is used for all temp files', 'prompt' => 'PEAR Installer temp directory', 'group' => 'File Locations (Advanced)', ), 'download_dir' => array( 'type' => 'directory', 'default' => PEAR_CONFIG_DEFAULT_DOWNLOAD_DIR, 'doc' => 'directory which is used for all downloaded files', 'prompt' => 'PEAR Installer download directory', 'group' => 'File Locations (Advanced)', ), 'php_bin' => array( 'type' => 'file', 'default' => PEAR_CONFIG_DEFAULT_PHP_BIN, 'doc' => 'PHP CLI/CGI binary for executing scripts', 'prompt' => 'PHP CLI/CGI binary', 'group' => 'File Locations (Advanced)', ), 'php_prefix' => array( 'type' => 'string', 'default' => '', 'doc' => '--program-prefix for php_bin\'s ./configure, used for pecl installs', 'prompt' => '--program-prefix passed to PHP\'s ./configure', 'group' => 'File Locations (Advanced)', ), 'php_suffix' => array( 'type' => 'string', 'default' => '', 'doc' => '--program-suffix for php_bin\'s ./configure, used for pecl installs', 'prompt' => '--program-suffix passed to PHP\'s ./configure', 'group' => 'File Locations (Advanced)', ), 'php_ini' => array( 'type' => 'file', 'default' => '', 'doc' => 'location of php.ini in which to enable PECL extensions on install', 'prompt' => 'php.ini location', 'group' => 'File Locations (Advanced)', ), 'metadata_dir' => array( 'type' => 'directory', 'default' => PEAR_CONFIG_DEFAULT_METADATA_DIR, 'doc' => 'directory where metadata files are installed (registry, filemap, channels, ...)', 'prompt' => 'PEAR metadata directory', 'group' => 'File Locations (Advanced)', ), // Maintainers 'username' => array( 'type' => 'string', 'default' => '', 'doc' => '(maintainers) your PEAR account name', 'prompt' => 'PEAR username (for maintainers)', 'group' => 'Maintainers', ), 'password' => array( 'type' => 'password', 'default' => '', 'doc' => '(maintainers) your PEAR account password', 'prompt' => 'PEAR password (for maintainers)', 'group' => 'Maintainers', ), // Advanced 'verbose' => array( 'type' => 'integer', 'default' => PEAR_CONFIG_DEFAULT_VERBOSE, 'doc' => 'verbosity level 0: really quiet 1: somewhat quiet 2: verbose 3: debug', 'prompt' => 'Debug Log Level', 'group' => 'Advanced', ), 'preferred_state' => array( 'type' => 'set', 'default' => PEAR_CONFIG_DEFAULT_PREFERRED_STATE, 'doc' => 'the installer will prefer releases with this state when installing packages without a version or state specified', 'valid_set' => array( 'stable', 'beta', 'alpha', 'devel', 'snapshot'), 'prompt' => 'Preferred Package State', 'group' => 'Advanced', ), 'umask' => array( 'type' => 'mask', 'default' => PEAR_CONFIG_DEFAULT_UMASK, 'doc' => 'umask used when creating files (Unix-like systems only)', 'prompt' => 'Unix file mask', 'group' => 'Advanced', ), 'cache_ttl' => array( 'type' => 'integer', 'default' => PEAR_CONFIG_DEFAULT_CACHE_TTL, 'doc' => 'amount of secs where the local cache is used and not updated', 'prompt' => 'Cache TimeToLive', 'group' => 'Advanced', ), 'sig_type' => array( 'type' => 'set', 'default' => PEAR_CONFIG_DEFAULT_SIG_TYPE, 'doc' => 'which package signature mechanism to use', 'valid_set' => array('gpg'), 'prompt' => 'Package Signature Type', 'group' => 'Maintainers', ), 'sig_bin' => array( 'type' => 'string', 'default' => PEAR_CONFIG_DEFAULT_SIG_BIN, 'doc' => 'which package signature mechanism to use', 'prompt' => 'Signature Handling Program', 'group' => 'Maintainers', ), 'sig_keyid' => array( 'type' => 'string', 'default' => '', 'doc' => 'which key to use for signing with', 'prompt' => 'Signature Key Id', 'group' => 'Maintainers', ), 'sig_keydir' => array( 'type' => 'directory', 'default' => PEAR_CONFIG_DEFAULT_SIG_KEYDIR, 'doc' => 'directory where signature keys are located', 'prompt' => 'Signature Key Directory', 'group' => 'Maintainers', ), // __channels is reserved - used for channel-specific configuration ); /** * Constructor. * * @param string file to read user-defined options from * @param string file to read system-wide defaults from * @param bool determines whether a registry object "follows" * the value of php_dir (is automatically created * and moved when php_dir is changed) * @param bool if true, fails if configuration files cannot be loaded * * @access public * * @see PEAR_Config::singleton */ function __construct($user_file = '', $system_file = '', $ftp_file = false, $strict = true) { parent::__construct(); PEAR_Installer_Role::initializeConfig($this); $sl = DIRECTORY_SEPARATOR; if (empty($user_file)) { if (OS_WINDOWS) { $user_file = PEAR_CONFIG_SYSCONFDIR . $sl . 'pear.ini'; } else { $user_file = getenv('HOME') . $sl . '.pearrc'; } } if (empty($system_file)) { $system_file = PEAR_CONFIG_SYSCONFDIR . $sl; if (OS_WINDOWS) { $system_file .= 'pearsys.ini'; } else { $system_file .= 'pear.conf'; } } $this->layers = array_keys($this->configuration); $this->files['user'] = $user_file; $this->files['system'] = $system_file; if ($user_file && file_exists($user_file)) { $this->pushErrorHandling(PEAR_ERROR_RETURN); $this->readConfigFile($user_file, 'user', $strict); $this->popErrorHandling(); if ($this->_errorsFound > 0) { return; } } if ($system_file && @file_exists($system_file)) { $this->mergeConfigFile($system_file, false, 'system', $strict); if ($this->_errorsFound > 0) { return; } } if (!$ftp_file) { $ftp_file = $this->get('remote_config'); } if ($ftp_file && defined('PEAR_REMOTEINSTALL_OK')) { $this->readFTPConfigFile($ftp_file); } foreach ($this->configuration_info as $key => $info) { $this->configuration['default'][$key] = $info['default']; } $this->_registry['default'] = new PEAR_Registry( $this->configuration['default']['php_dir'], false, false, $this->configuration['default']['metadata_dir']); $this->_registry['default']->setConfig($this, false); $this->_regInitialized['default'] = false; //$GLOBALS['_PEAR_Config_instance'] = &$this; } /** * Return the default locations of user and system configuration files */ public static function getDefaultConfigFiles() { $sl = DIRECTORY_SEPARATOR; if (OS_WINDOWS) { return array( 'user' => PEAR_CONFIG_SYSCONFDIR . $sl . 'pear.ini', 'system' => PEAR_CONFIG_SYSCONFDIR . $sl . 'pearsys.ini' ); } return array( 'user' => getenv('HOME') . $sl . '.pearrc', 'system' => PEAR_CONFIG_SYSCONFDIR . $sl . 'pear.conf' ); } /** * Static singleton method. If you want to keep only one instance * of this class in use, this method will give you a reference to * the last created PEAR_Config object if one exists, or create a * new object. * * @param string (optional) file to read user-defined options from * @param string (optional) file to read system-wide defaults from * * @return object an existing or new PEAR_Config instance * * @see PEAR_Config::PEAR_Config */ public static function &singleton($user_file = '', $system_file = '', $strict = true) { if (is_object($GLOBALS['_PEAR_Config_instance'])) { return $GLOBALS['_PEAR_Config_instance']; } $t_conf = new PEAR_Config($user_file, $system_file, false, $strict); if ($t_conf->_errorsFound > 0) { return $t_conf->lastError; } $GLOBALS['_PEAR_Config_instance'] = &$t_conf; return $GLOBALS['_PEAR_Config_instance']; } /** * Determine whether any configuration files have been detected, and whether a * registry object can be retrieved from this configuration. * @return bool * @since PEAR 1.4.0a1 */ function validConfiguration() { if ($this->isDefinedLayer('user') || $this->isDefinedLayer('system')) { return true; } return false; } /** * Reads configuration data from a file. All existing values in * the config layer are discarded and replaced with data from the * file. * @param string file to read from, if NULL or not specified, the * last-used file for the same layer (second param) is used * @param string config layer to insert data into ('user' or 'system') * @return bool TRUE on success or a PEAR error on failure */ function readConfigFile($file = null, $layer = 'user', $strict = true) { if (empty($this->files[$layer])) { return $this->raiseError("unknown config layer `$layer'"); } if ($file === null) { $file = $this->files[$layer]; } $data = $this->_readConfigDataFrom($file); if (PEAR::isError($data)) { if (!$strict) { return true; } $this->_errorsFound++; $this->lastError = $data; return $data; } $this->files[$layer] = $file; $this->_decodeInput($data); $this->configuration[$layer] = $data; $this->_setupChannels(); if (!$this->_noRegistry && ($phpdir = $this->get('php_dir', $layer, 'pear.php.net'))) { $this->_registry[$layer] = new PEAR_Registry( $phpdir, false, false, $this->get('metadata_dir', $layer, 'pear.php.net')); $this->_registry[$layer]->setConfig($this, false); $this->_regInitialized[$layer] = false; } else { unset($this->_registry[$layer]); } return true; } /** * @param string url to the remote config file, like ftp://www.example.com/pear/config.ini * @return true|PEAR_Error */ function readFTPConfigFile($path) { do { // poor man's try if (!class_exists('PEAR_FTP')) { if (!class_exists('PEAR_Common')) { require_once 'PEAR/Common.php'; } if (PEAR_Common::isIncludeable('PEAR/FTP.php')) { require_once 'PEAR/FTP.php'; } } if (!class_exists('PEAR_FTP')) { return PEAR::raiseError('PEAR_RemoteInstaller must be installed to use remote config'); } $this->_ftp = new PEAR_FTP; $this->_ftp->pushErrorHandling(PEAR_ERROR_RETURN); $e = $this->_ftp->init($path); if (PEAR::isError($e)) { $this->_ftp->popErrorHandling(); return $e; } $tmp = System::mktemp('-d'); PEAR_Common::addTempFile($tmp); $e = $this->_ftp->get(basename($path), $tmp . DIRECTORY_SEPARATOR . 'pear.ini', false, FTP_BINARY); if (PEAR::isError($e)) { $this->_ftp->popErrorHandling(); return $e; } PEAR_Common::addTempFile($tmp . DIRECTORY_SEPARATOR . 'pear.ini'); $this->_ftp->disconnect(); $this->_ftp->popErrorHandling(); $this->files['ftp'] = $tmp . DIRECTORY_SEPARATOR . 'pear.ini'; $e = $this->readConfigFile(null, 'ftp'); if (PEAR::isError($e)) { return $e; } $fail = array(); foreach ($this->configuration_info as $key => $val) { if (in_array($this->getGroup($key), array('File Locations', 'File Locations (Advanced)')) && $this->getType($key) == 'directory') { // any directory configs must be set for this to work if (!isset($this->configuration['ftp'][$key])) { $fail[] = $key; } } } if (!count($fail)) { return true; } $fail = '"' . implode('", "', $fail) . '"'; unset($this->files['ftp']); unset($this->configuration['ftp']); return PEAR::raiseError('ERROR: Ftp configuration file must set all ' . 'directory configuration variables. These variables were not set: ' . $fail); } while (false); // poor man's catch unset($this->files['ftp']); return PEAR::raiseError('no remote host specified'); } /** * Reads the existing configurations and creates the _channels array from it */ function _setupChannels() { $set = array_flip(array_values($this->_channels)); foreach ($this->configuration as $layer => $data) { $i = 1000; if (isset($data['__channels']) && is_array($data['__channels'])) { foreach ($data['__channels'] as $channel => $info) { $set[$channel] = $i++; } } } $this->_channels = array_values(array_flip($set)); $this->setChannels($this->_channels); } function deleteChannel($channel) { $ch = strtolower($channel); foreach ($this->configuration as $layer => $data) { if (isset($data['__channels']) && isset($data['__channels'][$ch])) { unset($this->configuration[$layer]['__channels'][$ch]); } } $this->_channels = array_flip($this->_channels); unset($this->_channels[$ch]); $this->_channels = array_flip($this->_channels); } /** * Merges data into a config layer from a file. Does the same * thing as readConfigFile, except it does not replace all * existing values in the config layer. * @param string file to read from * @param bool whether to overwrite existing data (default TRUE) * @param string config layer to insert data into ('user' or 'system') * @param string if true, errors are returned if file opening fails * @return bool TRUE on success or a PEAR error on failure */ function mergeConfigFile($file, $override = true, $layer = 'user', $strict = true) { if (empty($this->files[$layer])) { return $this->raiseError("unknown config layer `$layer'"); } if ($file === null) { $file = $this->files[$layer]; } $data = $this->_readConfigDataFrom($file); if (PEAR::isError($data)) { if (!$strict) { return true; } $this->_errorsFound++; $this->lastError = $data; return $data; } $this->_decodeInput($data); if ($override) { $this->configuration[$layer] = PEAR_Config::arrayMergeRecursive($this->configuration[$layer], $data); } else { $this->configuration[$layer] = PEAR_Config::arrayMergeRecursive($data, $this->configuration[$layer]); } $this->_setupChannels(); if (!$this->_noRegistry && ($phpdir = $this->get('php_dir', $layer, 'pear.php.net'))) { $this->_registry[$layer] = new PEAR_Registry( $phpdir, false, false, $this->get('metadata_dir', $layer, 'pear.php.net')); $this->_registry[$layer]->setConfig($this, false); $this->_regInitialized[$layer] = false; } else { unset($this->_registry[$layer]); } return true; } /** * @param array * @param array * @return array */ public static function arrayMergeRecursive($arr2, $arr1) { $ret = array(); foreach ($arr2 as $key => $data) { if (!isset($arr1[$key])) { $ret[$key] = $data; unset($arr1[$key]); continue; } if (is_array($data)) { if (!is_array($arr1[$key])) { $ret[$key] = $arr1[$key]; unset($arr1[$key]); continue; } $ret[$key] = PEAR_Config::arrayMergeRecursive($arr1[$key], $arr2[$key]); unset($arr1[$key]); } } return array_merge($ret, $arr1); } /** * Writes data into a config layer from a file. * * @param string|null file to read from, or null for default * @param string config layer to insert data into ('user' or * 'system') * @param string|null data to write to config file or null for internal data [DEPRECATED] * @return bool TRUE on success or a PEAR error on failure */ function writeConfigFile($file = null, $layer = 'user', $data = null) { $this->_lazyChannelSetup($layer); if ($layer == 'both' || $layer == 'all') { foreach ($this->files as $type => $file) { $err = $this->writeConfigFile($file, $type, $data); if (PEAR::isError($err)) { return $err; } } return true; } if (empty($this->files[$layer])) { return $this->raiseError("unknown config file type `$layer'"); } if ($file === null) { $file = $this->files[$layer]; } $data = ($data === null) ? $this->configuration[$layer] : $data; $this->_encodeOutput($data); $opt = array('-p', dirname($file)); if (!@System::mkDir($opt)) { return $this->raiseError("could not create directory: " . dirname($file)); } if (file_exists($file) && is_file($file) && !is_writeable($file)) { return $this->raiseError("no write access to $file!"); } $fp = @fopen($file, "w"); if (!$fp) { return $this->raiseError("PEAR_Config::writeConfigFile fopen('$file','w') failed ($php_errormsg)"); } $contents = "#PEAR_Config 0.9\n" . serialize($data); if (!@fwrite($fp, $contents)) { return $this->raiseError("PEAR_Config::writeConfigFile: fwrite failed ($php_errormsg)"); } return true; } /** * Reads configuration data from a file and returns the parsed data * in an array. * * @param string file to read from * @return array configuration data or a PEAR error on failure * @access private */ function _readConfigDataFrom($file) { $fp = false; if (file_exists($file)) { $fp = @fopen($file, "r"); } if (!$fp) { return $this->raiseError("PEAR_Config::readConfigFile fopen('$file','r') failed"); } $size = filesize($file); fclose($fp); $contents = file_get_contents($file); if (empty($contents)) { return $this->raiseError('Configuration file "' . $file . '" is empty'); } $version = false; if (preg_match('/^#PEAR_Config\s+(\S+)\s+/si', $contents, $matches)) { $version = $matches[1]; $contents = substr($contents, strlen($matches[0])); } else { // Museum config file if (substr($contents,0,2) == 'a:') { $version = '0.1'; } } if ($version && version_compare("$version", '1', '<')) { // no '@', it is possible that unserialize // raises a notice but it seems to block IO to // STDOUT if a '@' is used and a notice is raise $data = unserialize($contents); if (!is_array($data) && !$data) { if ($contents == serialize(false)) { $data = array(); } else { $err = $this->raiseError("PEAR_Config: bad data in $file"); return $err; } } if (!is_array($data)) { if (strlen(trim($contents)) > 0) { $error = "PEAR_Config: bad data in $file"; $err = $this->raiseError($error); return $err; } $data = array(); } // add parsing of newer formats here... } else { $err = $this->raiseError("$file: unknown version `$version'"); return $err; } return $data; } /** * Gets the file used for storing the config for a layer * * @param string $layer 'user' or 'system' */ function getConfFile($layer) { return $this->files[$layer]; } /** * @param string Configuration class name, used for detecting duplicate calls * @param array information on a role as parsed from its xml file * @return true|PEAR_Error * @access private */ function _addConfigVars($class, $vars) { static $called = array(); if (isset($called[$class])) { return; } $called[$class] = 1; if (count($vars) > 3) { return $this->raiseError('Roles can only define 3 new config variables or less'); } foreach ($vars as $name => $var) { if (!is_array($var)) { return $this->raiseError('Configuration information must be an array'); } if (!isset($var['type'])) { return $this->raiseError('Configuration information must contain a type'); } elseif (!in_array($var['type'], array('string', 'mask', 'password', 'directory', 'file', 'set'))) { return $this->raiseError( 'Configuration type must be one of directory, file, string, ' . 'mask, set, or password'); } if (!isset($var['default'])) { return $this->raiseError( 'Configuration information must contain a default value ("default" index)'); } if (is_array($var['default'])) { $real_default = ''; foreach ($var['default'] as $config_var => $val) { if (strpos($config_var, 'text') === 0) { $real_default .= $val; } elseif (strpos($config_var, 'constant') === 0) { if (!defined($val)) { return $this->raiseError( 'Unknown constant "' . $val . '" requested in ' . 'default value for configuration variable "' . $name . '"'); } $real_default .= constant($val); } elseif (isset($this->configuration_info[$config_var])) { $real_default .= $this->configuration_info[$config_var]['default']; } else { return $this->raiseError( 'Unknown request for "' . $config_var . '" value in ' . 'default value for configuration variable "' . $name . '"'); } } $var['default'] = $real_default; } if ($var['type'] == 'integer') { $var['default'] = (integer) $var['default']; } if (!isset($var['doc'])) { return $this->raiseError( 'Configuration information must contain a summary ("doc" index)'); } if (!isset($var['prompt'])) { return $this->raiseError( 'Configuration information must contain a simple prompt ("prompt" index)'); } if (!isset($var['group'])) { return $this->raiseError( 'Configuration information must contain a simple group ("group" index)'); } if (isset($this->configuration_info[$name])) { return $this->raiseError('Configuration variable "' . $name . '" already exists'); } $this->configuration_info[$name] = $var; // fix bug #7351: setting custom config variable in a channel fails $this->_channelConfigInfo[] = $name; } return true; } /** * Encodes/scrambles configuration data before writing to files. * Currently, 'password' values will be base64-encoded as to avoid * that people spot cleartext passwords by accident. * * @param array (reference) array to encode values in * @return bool TRUE on success * @access private */ function _encodeOutput(&$data) { foreach ($data as $key => $value) { if ($key == '__channels') { foreach ($data['__channels'] as $channel => $blah) { $this->_encodeOutput($data['__channels'][$channel]); } } if (!isset($this->configuration_info[$key])) { continue; } $type = $this->configuration_info[$key]['type']; switch ($type) { // we base64-encode passwords so they are at least // not shown in plain by accident case 'password': { $data[$key] = base64_encode($data[$key]); break; } case 'mask': { $data[$key] = octdec($data[$key]); break; } } } return true; } /** * Decodes/unscrambles configuration data after reading from files. * * @param array (reference) array to encode values in * @return bool TRUE on success * @access private * * @see PEAR_Config::_encodeOutput */ function _decodeInput(&$data) { if (!is_array($data)) { return true; } foreach ($data as $key => $value) { if ($key == '__channels') { foreach ($data['__channels'] as $channel => $blah) { $this->_decodeInput($data['__channels'][$channel]); } } if (!isset($this->configuration_info[$key])) { continue; } $type = $this->configuration_info[$key]['type']; switch ($type) { case 'password': { $data[$key] = base64_decode($data[$key]); break; } case 'mask': { $data[$key] = decoct($data[$key]); break; } } } return true; } /** * Retrieve the default channel. * * On startup, channels are not initialized, so if the default channel is not * pear.php.net, then initialize the config. * @param string registry layer * @return string|false */ function getDefaultChannel($layer = null) { $ret = false; if ($layer === null) { foreach ($this->layers as $layer) { if (isset($this->configuration[$layer]['default_channel'])) { $ret = $this->configuration[$layer]['default_channel']; break; } } } elseif (isset($this->configuration[$layer]['default_channel'])) { $ret = $this->configuration[$layer]['default_channel']; } if ($ret == 'pear.php.net' && defined('PEAR_RUNTYPE') && PEAR_RUNTYPE == 'pecl') { $ret = 'pecl.php.net'; } if ($ret) { if ($ret != 'pear.php.net') { $this->_lazyChannelSetup(); } return $ret; } return PEAR_CONFIG_DEFAULT_CHANNEL; } /** * Returns a configuration value, prioritizing layers as per the * layers property. * * @param string config key * @return mixed the config value, or NULL if not found * @access public */ function get($key, $layer = null, $channel = false) { if (!isset($this->configuration_info[$key])) { return null; } if ($key == '__channels') { return null; } if ($key == 'default_channel') { return $this->getDefaultChannel($layer); } if (!$channel) { $channel = $this->getDefaultChannel(); } elseif ($channel != 'pear.php.net') { $this->_lazyChannelSetup(); } $channel = strtolower($channel); $test = (in_array($key, $this->_channelConfigInfo)) ? $this->_getChannelValue($key, $layer, $channel) : null; if ($test !== null) { if ($this->_installRoot) { if (in_array($this->getGroup($key), array('File Locations', 'File Locations (Advanced)')) && $this->getType($key) == 'directory') { return $this->_prependPath($test, $this->_installRoot); } } return $test; } if ($layer === null) { foreach ($this->layers as $layer) { if (isset($this->configuration[$layer][$key])) { $test = $this->configuration[$layer][$key]; if ($this->_installRoot) { if (in_array($this->getGroup($key), array('File Locations', 'File Locations (Advanced)')) && $this->getType($key) == 'directory') { return $this->_prependPath($test, $this->_installRoot); } } if ($key == 'preferred_mirror') { $reg = &$this->getRegistry(); if (is_object($reg)) { $chan = $reg->getChannel($channel); if (PEAR::isError($chan)) { return $channel; } if (!$chan->getMirror($test) && $chan->getName() != $test) { return $channel; // mirror does not exist } } } return $test; } } } elseif (isset($this->configuration[$layer][$key])) { $test = $this->configuration[$layer][$key]; if ($this->_installRoot) { if (in_array($this->getGroup($key), array('File Locations', 'File Locations (Advanced)')) && $this->getType($key) == 'directory') { return $this->_prependPath($test, $this->_installRoot); } } if ($key == 'preferred_mirror') { $reg = &$this->getRegistry(); if (is_object($reg)) { $chan = $reg->getChannel($channel); if (PEAR::isError($chan)) { return $channel; } if (!$chan->getMirror($test) && $chan->getName() != $test) { return $channel; // mirror does not exist } } } return $test; } return null; } /** * Returns a channel-specific configuration value, prioritizing layers as per the * layers property. * * @param string config key * @return mixed the config value, or NULL if not found * @access private */ function _getChannelValue($key, $layer, $channel) { if ($key == '__channels' || $channel == 'pear.php.net') { return null; } $ret = null; if ($layer === null) { foreach ($this->layers as $ilayer) { if (isset($this->configuration[$ilayer]['__channels'][$channel][$key])) { $ret = $this->configuration[$ilayer]['__channels'][$channel][$key]; break; } } } elseif (isset($this->configuration[$layer]['__channels'][$channel][$key])) { $ret = $this->configuration[$layer]['__channels'][$channel][$key]; } if ($key != 'preferred_mirror') { return $ret; } if ($ret !== null) { $reg = &$this->getRegistry($layer); if (is_object($reg)) { $chan = $reg->getChannel($channel); if (PEAR::isError($chan)) { return $channel; } if (!$chan->getMirror($ret) && $chan->getName() != $ret) { return $channel; // mirror does not exist } } return $ret; } if ($channel != $this->getDefaultChannel($layer)) { return $channel; // we must use the channel name as the preferred mirror // if the user has not chosen an alternate } return $this->getDefaultChannel($layer); } /** * Set a config value in a specific layer (defaults to 'user'). * Enforces the types defined in the configuration_info array. An * integer config variable will be cast to int, and a set config * variable will be validated against its legal values. * * @param string config key * @param string config value * @param string (optional) config layer * @param string channel to set this value for, or null for global value * @return bool TRUE on success, FALSE on failure */ function set($key, $value, $layer = 'user', $channel = false) { if ($key == '__channels') { return false; } if (!isset($this->configuration[$layer])) { return false; } if ($key == 'default_channel') { // can only set this value globally $channel = 'pear.php.net'; if ($value != 'pear.php.net') { $this->_lazyChannelSetup($layer); } } if ($key == 'preferred_mirror') { if ($channel == '__uri') { return false; // can't set the __uri pseudo-channel's mirror } $reg = &$this->getRegistry($layer); if (is_object($reg)) { $chan = $reg->getChannel($channel ? $channel : 'pear.php.net'); if (PEAR::isError($chan)) { return false; } if (!$chan->getMirror($value) && $chan->getName() != $value) { return false; // mirror does not exist } } } if (!isset($this->configuration_info[$key])) { return false; } extract($this->configuration_info[$key]); switch ($type) { case 'integer': $value = (int)$value; break; case 'set': { // If a valid_set is specified, require the value to // be in the set. If there is no valid_set, accept // any value. if ($valid_set) { reset($valid_set); if ((key($valid_set) === 0 && !in_array($value, $valid_set)) || (key($valid_set) !== 0 && empty($valid_set[$value]))) { return false; } } break; } } if (!$channel) { $channel = $this->get('default_channel', null, 'pear.php.net'); } if (!in_array($channel, $this->_channels)) { $this->_lazyChannelSetup($layer); $reg = &$this->getRegistry($layer); if ($reg) { $channel = $reg->channelName($channel); } if (!in_array($channel, $this->_channels)) { return false; } } if ($channel != 'pear.php.net') { if (in_array($key, $this->_channelConfigInfo)) { $this->configuration[$layer]['__channels'][$channel][$key] = $value; return true; } return false; } if ($key == 'default_channel') { if (!isset($reg)) { $reg = &$this->getRegistry($layer); if (!$reg) { $reg = &$this->getRegistry(); } } if ($reg) { $value = $reg->channelName($value); } if (!$value) { return false; } } $this->configuration[$layer][$key] = $value; if ($key == 'php_dir' && !$this->_noRegistry) { if (!isset($this->_registry[$layer]) || $value != $this->_registry[$layer]->install_dir) { $this->_registry[$layer] = new PEAR_Registry($value); $this->_regInitialized[$layer] = false; $this->_registry[$layer]->setConfig($this, false); } } return true; } function _lazyChannelSetup($uselayer = false) { if ($this->_noRegistry) { return; } $merge = false; foreach ($this->_registry as $layer => $p) { if ($uselayer && $uselayer != $layer) { continue; } if (!$this->_regInitialized[$layer]) { if ($layer == 'default' && isset($this->_registry['user']) || isset($this->_registry['system'])) { // only use the default registry if there are no alternatives continue; } if (!is_object($this->_registry[$layer])) { if ($phpdir = $this->get('php_dir', $layer, 'pear.php.net')) { $this->_registry[$layer] = new PEAR_Registry( $phpdir, false, false, $this->get('metadata_dir', $layer, 'pear.php.net')); $this->_registry[$layer]->setConfig($this, false); $this->_regInitialized[$layer] = false; } else { unset($this->_registry[$layer]); return; } } $this->setChannels($this->_registry[$layer]->listChannels(), $merge); $this->_regInitialized[$layer] = true; $merge = true; } } } /** * Set the list of channels. * * This should be set via a call to {@link PEAR_Registry::listChannels()} * @param array * @param bool * @return bool success of operation */ function setChannels($channels, $merge = false) { if (!is_array($channels)) { return false; } if ($merge) { $this->_channels = array_merge($this->_channels, $channels); } else { $this->_channels = $channels; } foreach ($channels as $channel) { $channel = strtolower($channel); if ($channel == 'pear.php.net') { continue; } foreach ($this->layers as $layer) { if (!isset($this->configuration[$layer]['__channels'])) { $this->configuration[$layer]['__channels'] = array(); } if (!isset($this->configuration[$layer]['__channels'][$channel]) || !is_array($this->configuration[$layer]['__channels'][$channel])) { $this->configuration[$layer]['__channels'][$channel] = array(); } } } return true; } /** * Get the type of a config value. * * @param string config key * * @return string type, one of "string", "integer", "file", * "directory", "set" or "password". * * @access public * */ function getType($key) { if (isset($this->configuration_info[$key])) { return $this->configuration_info[$key]['type']; } return false; } /** * Get the documentation for a config value. * * @param string config key * @return string documentation string * * @access public * */ function getDocs($key) { if (isset($this->configuration_info[$key])) { return $this->configuration_info[$key]['doc']; } return false; } /** * Get the short documentation for a config value. * * @param string config key * @return string short documentation string * * @access public * */ function getPrompt($key) { if (isset($this->configuration_info[$key])) { return $this->configuration_info[$key]['prompt']; } return false; } /** * Get the parameter group for a config key. * * @param string config key * @return string parameter group * * @access public * */ function getGroup($key) { if (isset($this->configuration_info[$key])) { return $this->configuration_info[$key]['group']; } return false; } /** * Get the list of parameter groups. * * @return array list of parameter groups * * @access public * */ function getGroups() { $tmp = array(); foreach ($this->configuration_info as $key => $info) { $tmp[$info['group']] = 1; } return array_keys($tmp); } /** * Get the list of the parameters in a group. * * @param string $group parameter group * @return array list of parameters in $group * * @access public * */ function getGroupKeys($group) { $keys = array(); foreach ($this->configuration_info as $key => $info) { if ($info['group'] == $group) { $keys[] = $key; } } return $keys; } /** * Get the list of allowed set values for a config value. Returns * NULL for config values that are not sets. * * @param string config key * @return array enumerated array of set values, or NULL if the * config key is unknown or not a set * * @access public * */ function getSetValues($key) { if (isset($this->configuration_info[$key]) && isset($this->configuration_info[$key]['type']) && $this->configuration_info[$key]['type'] == 'set') { $valid_set = $this->configuration_info[$key]['valid_set']; reset($valid_set); if (key($valid_set) === 0) { return $valid_set; } return array_keys($valid_set); } return null; } /** * Get all the current config keys. * * @return array simple array of config keys * * @access public */ function getKeys() { $keys = array(); foreach ($this->layers as $layer) { $test = $this->configuration[$layer]; if (isset($test['__channels'])) { foreach ($test['__channels'] as $channel => $configs) { $keys = array_merge($keys, $configs); } } unset($test['__channels']); $keys = array_merge($keys, $test); } return array_keys($keys); } /** * Remove the a config key from a specific config layer. * * @param string config key * @param string (optional) config layer * @param string (optional) channel (defaults to default channel) * @return bool TRUE on success, FALSE on failure * * @access public */ function remove($key, $layer = 'user', $channel = null) { if ($channel === null) { $channel = $this->getDefaultChannel(); } if ($channel !== 'pear.php.net') { if (isset($this->configuration[$layer]['__channels'][$channel][$key])) { unset($this->configuration[$layer]['__channels'][$channel][$key]); return true; } } if (isset($this->configuration[$layer][$key])) { unset($this->configuration[$layer][$key]); return true; } return false; } /** * Temporarily remove an entire config layer. USE WITH CARE! * * @param string config key * @param string (optional) config layer * @return bool TRUE on success, FALSE on failure * * @access public */ function removeLayer($layer) { if (isset($this->configuration[$layer])) { $this->configuration[$layer] = array(); return true; } return false; } /** * Stores configuration data in a layer. * * @param string config layer to store * @return bool TRUE on success, or PEAR error on failure * * @access public */ function store($layer = 'user', $data = null) { return $this->writeConfigFile(null, $layer, $data); } /** * Tells what config layer that gets to define a key. * * @param string config key * @param boolean return the defining channel * * @return string|array the config layer, or an empty string if not found. * * if $returnchannel, the return is an array array('layer' => layername, * 'channel' => channelname), or an empty string if not found * * @access public */ function definedBy($key, $returnchannel = false) { foreach ($this->layers as $layer) { $channel = $this->getDefaultChannel(); if ($channel !== 'pear.php.net') { if (isset($this->configuration[$layer]['__channels'][$channel][$key])) { if ($returnchannel) { return array('layer' => $layer, 'channel' => $channel); } return $layer; } } if (isset($this->configuration[$layer][$key])) { if ($returnchannel) { return array('layer' => $layer, 'channel' => 'pear.php.net'); } return $layer; } } return ''; } /** * Tells whether a given key exists as a config value. * * @param string config key * @return bool whether exists in this object * * @access public */ function isDefined($key) { foreach ($this->layers as $layer) { if (isset($this->configuration[$layer][$key])) { return true; } } return false; } /** * Tells whether a given config layer exists. * * @param string config layer * @return bool whether exists in this object * * @access public */ function isDefinedLayer($layer) { return isset($this->configuration[$layer]); } /** * Returns the layers defined (except the 'default' one) * * @return array of the defined layers */ function getLayers() { $cf = $this->configuration; unset($cf['default']); return array_keys($cf); } function apiVersion() { return '1.1'; } /** * @return PEAR_Registry */ function &getRegistry($use = null) { $layer = $use === null ? 'user' : $use; if (isset($this->_registry[$layer])) { return $this->_registry[$layer]; } elseif ($use === null && isset($this->_registry['system'])) { return $this->_registry['system']; } elseif ($use === null && isset($this->_registry['default'])) { return $this->_registry['default']; } elseif ($use) { $a = false; return $a; } // only go here if null was passed in echo "CRITICAL ERROR: Registry could not be initialized from any value"; exit(1); } /** * This is to allow customization like the use of installroot * @param PEAR_Registry * @return bool */ function setRegistry(&$reg, $layer = 'user') { if ($this->_noRegistry) { return false; } if (!in_array($layer, array('user', 'system'))) { return false; } $this->_registry[$layer] = &$reg; if (is_object($reg)) { $this->_registry[$layer]->setConfig($this, false); } return true; } function noRegistry() { $this->_noRegistry = true; } /** * @return PEAR_REST */ function &getREST($version, $options = array()) { $version = str_replace('.', '', $version); if (!class_exists($class = 'PEAR_REST_' . $version)) { require_once 'PEAR/REST/' . $version . '.php'; } $remote = new $class($this, $options); return $remote; } /** * The ftp server is set in {@link readFTPConfigFile()}. It exists only if a * remote configuration file has been specified * @return PEAR_FTP|false */ function &getFTP() { if (isset($this->_ftp)) { return $this->_ftp; } $a = false; return $a; } function _prependPath($path, $prepend) { if (strlen($prepend) > 0) { if (OS_WINDOWS && preg_match('/^[a-z]:/i', $path)) { if (preg_match('/^[a-z]:/i', $prepend)) { $prepend = substr($prepend, 2); } elseif ($prepend{0} != '\\') { $prepend = "\\$prepend"; } $path = substr($path, 0, 2) . $prepend . substr($path, 2); } else { $path = $prepend . $path; } } return $path; } /** * @param string|false installation directory to prepend to all _dir variables, or false to * disable */ function setInstallRoot($root) { if (substr($root, -1) == DIRECTORY_SEPARATOR) { $root = substr($root, 0, -1); } $old = $this->_installRoot; $this->_installRoot = $root; if (($old != $root) && !$this->_noRegistry) { foreach (array_keys($this->_registry) as $layer) { if ($layer == 'ftp' || !isset($this->_registry[$layer])) { continue; } $this->_registry[$layer] = new PEAR_Registry( $this->get('php_dir', $layer, 'pear.php.net'), false, false, $this->get('metadata_dir', $layer, 'pear.php.net')); $this->_registry[$layer]->setConfig($this, false); $this->_regInitialized[$layer] = false; } } } } php-pear-1.10.1+submodules+notgz/PEAR/Dependency2.php000066400000000000000000001424051262614675700222470ustar00rootroot00000000000000 * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ /** * Required for the PEAR_VALIDATE_* constants */ require_once 'PEAR/Validate.php'; /** * Dependency check for PEAR packages * * This class handles both version 1.0 and 2.0 dependencies * WARNING: *any* changes to this class must be duplicated in the * test_PEAR_Dependency2 class found in tests/PEAR_Dependency2/setup.php.inc, * or unit tests will not actually validate the changes * @category pear * @package PEAR * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version Release: @PEAR-VER@ * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ class PEAR_Dependency2 { /** * One of the PEAR_VALIDATE_* states * @see PEAR_VALIDATE_NORMAL * @var integer */ var $_state; /** * Command-line options to install/upgrade/uninstall commands * @param array */ var $_options; /** * @var OS_Guess */ var $_os; /** * @var PEAR_Registry */ var $_registry; /** * @var PEAR_Config */ var $_config; /** * @var PEAR_DependencyDB */ var $_dependencydb; /** * Output of PEAR_Registry::parsedPackageName() * @var array */ var $_currentPackage; /** * @param PEAR_Config * @param array installation options * @param array format of PEAR_Registry::parsedPackageName() * @param int installation state (one of PEAR_VALIDATE_*) */ function __construct(&$config, $installoptions, $package, $state = PEAR_VALIDATE_INSTALLING) { $this->_config = &$config; if (!class_exists('PEAR_DependencyDB')) { require_once 'PEAR/DependencyDB.php'; } if (isset($installoptions['packagingroot'])) { // make sure depdb is in the right location $config->setInstallRoot($installoptions['packagingroot']); } $this->_registry = &$config->getRegistry(); $this->_dependencydb = &PEAR_DependencyDB::singleton($config); if (isset($installoptions['packagingroot'])) { $config->setInstallRoot(false); } $this->_options = $installoptions; $this->_state = $state; if (!class_exists('OS_Guess')) { require_once 'OS/Guess.php'; } $this->_os = new OS_Guess; $this->_currentPackage = $package; } function _getExtraString($dep) { $extra = ' ('; if (isset($dep['uri'])) { return ''; } if (isset($dep['recommended'])) { $extra .= 'recommended version ' . $dep['recommended']; } else { if (isset($dep['min'])) { $extra .= 'version >= ' . $dep['min']; } if (isset($dep['max'])) { if ($extra != ' (') { $extra .= ', '; } $extra .= 'version <= ' . $dep['max']; } if (isset($dep['exclude'])) { if (!is_array($dep['exclude'])) { $dep['exclude'] = array($dep['exclude']); } if ($extra != ' (') { $extra .= ', '; } $extra .= 'excluded versions: '; foreach ($dep['exclude'] as $i => $exclude) { if ($i) { $extra .= ', '; } $extra .= $exclude; } } } $extra .= ')'; if ($extra == ' ()') { $extra = ''; } return $extra; } /** * This makes unit-testing a heck of a lot easier */ function getPHP_OS() { return PHP_OS; } /** * This makes unit-testing a heck of a lot easier */ function getsysname() { return $this->_os->getSysname(); } /** * Specify a dependency on an OS. Use arch for detailed os/processor information * * There are two generic OS dependencies that will be the most common, unix and windows. * Other options are linux, freebsd, darwin (OS X), sunos, irix, hpux, aix */ function validateOsDependency($dep) { if ($this->_state != PEAR_VALIDATE_INSTALLING && $this->_state != PEAR_VALIDATE_DOWNLOADING) { return true; } if ($dep['name'] == '*') { return true; } $not = isset($dep['conflicts']) ? true : false; switch (strtolower($dep['name'])) { case 'windows' : if ($not) { if (strtolower(substr($this->getPHP_OS(), 0, 3)) == 'win') { if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) { return $this->raiseError("Cannot install %s on Windows"); } return $this->warning("warning: Cannot install %s on Windows"); } } else { if (strtolower(substr($this->getPHP_OS(), 0, 3)) != 'win') { if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) { return $this->raiseError("Can only install %s on Windows"); } return $this->warning("warning: Can only install %s on Windows"); } } break; case 'unix' : $unices = array('linux', 'freebsd', 'darwin', 'sunos', 'irix', 'hpux', 'aix'); if ($not) { if (in_array($this->getSysname(), $unices)) { if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) { return $this->raiseError("Cannot install %s on any Unix system"); } return $this->warning( "warning: Cannot install %s on any Unix system"); } } else { if (!in_array($this->getSysname(), $unices)) { if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) { return $this->raiseError("Can only install %s on a Unix system"); } return $this->warning("warning: Can only install %s on a Unix system"); } } break; default : if ($not) { if (strtolower($dep['name']) == strtolower($this->getSysname())) { if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) { return $this->raiseError('Cannot install %s on ' . $dep['name'] . ' operating system'); } return $this->warning('warning: Cannot install %s on ' . $dep['name'] . ' operating system'); } } else { if (strtolower($dep['name']) != strtolower($this->getSysname())) { if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) { return $this->raiseError('Cannot install %s on ' . $this->getSysname() . ' operating system, can only install on ' . $dep['name']); } return $this->warning('warning: Cannot install %s on ' . $this->getSysname() . ' operating system, can only install on ' . $dep['name']); } } } return true; } /** * This makes unit-testing a heck of a lot easier */ function matchSignature($pattern) { return $this->_os->matchSignature($pattern); } /** * Specify a complex dependency on an OS/processor/kernel version, * Use OS for simple operating system dependency. * * This is the only dependency that accepts an eregable pattern. The pattern * will be matched against the php_uname() output parsed by OS_Guess */ function validateArchDependency($dep) { if ($this->_state != PEAR_VALIDATE_INSTALLING) { return true; } $not = isset($dep['conflicts']) ? true : false; if (!$this->matchSignature($dep['pattern'])) { if (!$not) { if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) { return $this->raiseError('%s Architecture dependency failed, does not ' . 'match "' . $dep['pattern'] . '"'); } return $this->warning('warning: %s Architecture dependency failed, does ' . 'not match "' . $dep['pattern'] . '"'); } return true; } if ($not) { if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) { return $this->raiseError('%s Architecture dependency failed, required "' . $dep['pattern'] . '"'); } return $this->warning('warning: %s Architecture dependency failed, ' . 'required "' . $dep['pattern'] . '"'); } return true; } /** * This makes unit-testing a heck of a lot easier */ function extension_loaded($name) { return extension_loaded($name); } /** * This makes unit-testing a heck of a lot easier */ function phpversion($name = null) { if ($name !== null) { return phpversion($name); } return phpversion(); } function validateExtensionDependency($dep, $required = true) { if ($this->_state != PEAR_VALIDATE_INSTALLING && $this->_state != PEAR_VALIDATE_DOWNLOADING) { return true; } $loaded = $this->extension_loaded($dep['name']); $extra = $this->_getExtraString($dep); if (isset($dep['exclude'])) { if (!is_array($dep['exclude'])) { $dep['exclude'] = array($dep['exclude']); } } if (!isset($dep['min']) && !isset($dep['max']) && !isset($dep['recommended']) && !isset($dep['exclude']) ) { if ($loaded) { if (isset($dep['conflicts'])) { if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) { return $this->raiseError('%s conflicts with PHP extension "' . $dep['name'] . '"' . $extra); } return $this->warning('warning: %s conflicts with PHP extension "' . $dep['name'] . '"' . $extra); } return true; } if (isset($dep['conflicts'])) { return true; } if ($required) { if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) { return $this->raiseError('%s requires PHP extension "' . $dep['name'] . '"' . $extra); } return $this->warning('warning: %s requires PHP extension "' . $dep['name'] . '"' . $extra); } return $this->warning('%s can optionally use PHP extension "' . $dep['name'] . '"' . $extra); } if (!$loaded) { if (isset($dep['conflicts'])) { return true; } if (!$required) { return $this->warning('%s can optionally use PHP extension "' . $dep['name'] . '"' . $extra); } if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) { return $this->raiseError('%s requires PHP extension "' . $dep['name'] . '"' . $extra); } return $this->warning('warning: %s requires PHP extension "' . $dep['name'] . '"' . $extra); } $version = (string) $this->phpversion($dep['name']); if (empty($version)) { $version = '0'; } $fail = false; if (isset($dep['min']) && !version_compare($version, $dep['min'], '>=')) { $fail = true; } if (isset($dep['max']) && !version_compare($version, $dep['max'], '<=')) { $fail = true; } if ($fail && !isset($dep['conflicts'])) { if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) { return $this->raiseError('%s requires PHP extension "' . $dep['name'] . '"' . $extra . ', installed version is ' . $version); } return $this->warning('warning: %s requires PHP extension "' . $dep['name'] . '"' . $extra . ', installed version is ' . $version); } elseif ((isset($dep['min']) || isset($dep['max'])) && !$fail && isset($dep['conflicts'])) { if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) { return $this->raiseError('%s conflicts with PHP extension "' . $dep['name'] . '"' . $extra . ', installed version is ' . $version); } return $this->warning('warning: %s conflicts with PHP extension "' . $dep['name'] . '"' . $extra . ', installed version is ' . $version); } if (isset($dep['exclude'])) { foreach ($dep['exclude'] as $exclude) { if (version_compare($version, $exclude, '==')) { if (isset($dep['conflicts'])) { continue; } if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) { return $this->raiseError('%s is not compatible with PHP extension "' . $dep['name'] . '" version ' . $exclude); } return $this->warning('warning: %s is not compatible with PHP extension "' . $dep['name'] . '" version ' . $exclude); } elseif (version_compare($version, $exclude, '!=') && isset($dep['conflicts'])) { if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) { return $this->raiseError('%s conflicts with PHP extension "' . $dep['name'] . '"' . $extra . ', installed version is ' . $version); } return $this->warning('warning: %s conflicts with PHP extension "' . $dep['name'] . '"' . $extra . ', installed version is ' . $version); } } } if (isset($dep['recommended'])) { if (version_compare($version, $dep['recommended'], '==')) { return true; } if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) { return $this->raiseError('%s dependency: PHP extension ' . $dep['name'] . ' version "' . $version . '"' . ' is not the recommended version "' . $dep['recommended'] . '", but may be compatible, use --force to install'); } return $this->warning('warning: %s dependency: PHP extension ' . $dep['name'] . ' version "' . $version . '"' . ' is not the recommended version "' . $dep['recommended'].'"'); } return true; } function validatePhpDependency($dep) { if ($this->_state != PEAR_VALIDATE_INSTALLING && $this->_state != PEAR_VALIDATE_DOWNLOADING) { return true; } $version = $this->phpversion(); $extra = $this->_getExtraString($dep); if (isset($dep['exclude'])) { if (!is_array($dep['exclude'])) { $dep['exclude'] = array($dep['exclude']); } } if (isset($dep['min'])) { if (!version_compare($version, $dep['min'], '>=')) { if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) { return $this->raiseError('%s requires PHP' . $extra . ', installed version is ' . $version); } return $this->warning('warning: %s requires PHP' . $extra . ', installed version is ' . $version); } } if (isset($dep['max'])) { if (!version_compare($version, $dep['max'], '<=')) { if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) { return $this->raiseError('%s requires PHP' . $extra . ', installed version is ' . $version); } return $this->warning('warning: %s requires PHP' . $extra . ', installed version is ' . $version); } } if (isset($dep['exclude'])) { foreach ($dep['exclude'] as $exclude) { if (version_compare($version, $exclude, '==')) { if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) { return $this->raiseError('%s is not compatible with PHP version ' . $exclude); } return $this->warning( 'warning: %s is not compatible with PHP version ' . $exclude); } } } return true; } /** * This makes unit-testing a heck of a lot easier */ function getPEARVersion() { return '@PEAR-VER@'; } function validatePearinstallerDependency($dep) { $pearversion = $this->getPEARVersion(); $extra = $this->_getExtraString($dep); if (isset($dep['exclude'])) { if (!is_array($dep['exclude'])) { $dep['exclude'] = array($dep['exclude']); } } if (version_compare($pearversion, $dep['min'], '<')) { if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) { return $this->raiseError('%s requires PEAR Installer' . $extra . ', installed version is ' . $pearversion); } return $this->warning('warning: %s requires PEAR Installer' . $extra . ', installed version is ' . $pearversion); } if (isset($dep['max'])) { if (version_compare($pearversion, $dep['max'], '>')) { if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) { return $this->raiseError('%s requires PEAR Installer' . $extra . ', installed version is ' . $pearversion); } return $this->warning('warning: %s requires PEAR Installer' . $extra . ', installed version is ' . $pearversion); } } if (isset($dep['exclude'])) { if (!isset($dep['exclude'][0])) { $dep['exclude'] = array($dep['exclude']); } foreach ($dep['exclude'] as $exclude) { if (version_compare($exclude, $pearversion, '==')) { if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) { return $this->raiseError('%s is not compatible with PEAR Installer ' . 'version ' . $exclude); } return $this->warning('warning: %s is not compatible with PEAR ' . 'Installer version ' . $exclude); } } } return true; } function validateSubpackageDependency($dep, $required, $params) { return $this->validatePackageDependency($dep, $required, $params); } /** * @param array dependency information (2.0 format) * @param boolean whether this is a required dependency * @param array a list of downloaded packages to be installed, if any * @param boolean if true, then deps on pear.php.net that fail will also check * against pecl.php.net packages to accommodate extensions that have * moved to pecl.php.net from pear.php.net */ function validatePackageDependency($dep, $required, $params, $depv1 = false) { if ($this->_state != PEAR_VALIDATE_INSTALLING && $this->_state != PEAR_VALIDATE_DOWNLOADING) { return true; } if (isset($dep['providesextension'])) { if ($this->extension_loaded($dep['providesextension'])) { $save = $dep; $subdep = $dep; $subdep['name'] = $subdep['providesextension']; PEAR::pushErrorHandling(PEAR_ERROR_RETURN); $ret = $this->validateExtensionDependency($subdep, $required); PEAR::popErrorHandling(); if (!PEAR::isError($ret)) { return true; } } } if ($this->_state == PEAR_VALIDATE_INSTALLING) { return $this->_validatePackageInstall($dep, $required, $depv1); } if ($this->_state == PEAR_VALIDATE_DOWNLOADING) { return $this->_validatePackageDownload($dep, $required, $params, $depv1); } } function _validatePackageDownload($dep, $required, $params, $depv1 = false) { $dep['package'] = $dep['name']; if (isset($dep['uri'])) { $dep['channel'] = '__uri'; } $depname = $this->_registry->parsedPackageNameToString($dep, true); $found = false; foreach ($params as $param) { if ($param->isEqual( array('package' => $dep['name'], 'channel' => $dep['channel']))) { $found = true; break; } if ($depv1 && $dep['channel'] == 'pear.php.net') { if ($param->isEqual( array('package' => $dep['name'], 'channel' => 'pecl.php.net'))) { $found = true; break; } } } if (!$found && isset($dep['providesextension'])) { foreach ($params as $param) { if ($param->isExtension($dep['providesextension'])) { $found = true; break; } } } if ($found) { $version = $param->getVersion(); $installed = false; $downloaded = true; } else { if ($this->_registry->packageExists($dep['name'], $dep['channel'])) { $installed = true; $downloaded = false; $version = $this->_registry->packageinfo($dep['name'], 'version', $dep['channel']); } else { if ($dep['channel'] == 'pecl.php.net' && $this->_registry->packageExists($dep['name'], 'pear.php.net')) { $installed = true; $downloaded = false; $version = $this->_registry->packageinfo($dep['name'], 'version', 'pear.php.net'); } else { $version = 'not installed or downloaded'; $installed = false; $downloaded = false; } } } $extra = $this->_getExtraString($dep); if (isset($dep['exclude']) && !is_array($dep['exclude'])) { $dep['exclude'] = array($dep['exclude']); } if (!isset($dep['min']) && !isset($dep['max']) && !isset($dep['recommended']) && !isset($dep['exclude']) ) { if ($installed || $downloaded) { $installed = $installed ? 'installed' : 'downloaded'; if (isset($dep['conflicts'])) { $rest = ''; if ($version) { $rest = ", $installed version is " . $version; } if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) { return $this->raiseError('%s conflicts with package "' . $depname . '"' . $extra . $rest); } return $this->warning('warning: %s conflicts with package "' . $depname . '"' . $extra . $rest); } return true; } if (isset($dep['conflicts'])) { return true; } if ($required) { if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) { return $this->raiseError('%s requires package "' . $depname . '"' . $extra); } return $this->warning('warning: %s requires package "' . $depname . '"' . $extra); } return $this->warning('%s can optionally use package "' . $depname . '"' . $extra); } if (!$installed && !$downloaded) { if (isset($dep['conflicts'])) { return true; } if ($required) { if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) { return $this->raiseError('%s requires package "' . $depname . '"' . $extra); } return $this->warning('warning: %s requires package "' . $depname . '"' . $extra); } return $this->warning('%s can optionally use package "' . $depname . '"' . $extra); } $fail = false; if (isset($dep['min']) && version_compare($version, $dep['min'], '<')) { $fail = true; } if (isset($dep['max']) && version_compare($version, $dep['max'], '>')) { $fail = true; } if ($fail && !isset($dep['conflicts'])) { $installed = $installed ? 'installed' : 'downloaded'; $dep['package'] = $dep['name']; $dep = $this->_registry->parsedPackageNameToString($dep, true); if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) { return $this->raiseError('%s requires package "' . $depname . '"' . $extra . ", $installed version is " . $version); } return $this->warning('warning: %s requires package "' . $depname . '"' . $extra . ", $installed version is " . $version); } elseif ((isset($dep['min']) || isset($dep['max'])) && !$fail && isset($dep['conflicts']) && !isset($dep['exclude'])) { $installed = $installed ? 'installed' : 'downloaded'; if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) { return $this->raiseError('%s conflicts with package "' . $depname . '"' . $extra . ", $installed version is " . $version); } return $this->warning('warning: %s conflicts with package "' . $depname . '"' . $extra . ", $installed version is " . $version); } if (isset($dep['exclude'])) { $installed = $installed ? 'installed' : 'downloaded'; foreach ($dep['exclude'] as $exclude) { if (version_compare($version, $exclude, '==') && !isset($dep['conflicts'])) { if (!isset($this->_options['nodeps']) && !isset($this->_options['force']) ) { return $this->raiseError('%s is not compatible with ' . $installed . ' package "' . $depname . '" version ' . $exclude); } return $this->warning('warning: %s is not compatible with ' . $installed . ' package "' . $depname . '" version ' . $exclude); } elseif (version_compare($version, $exclude, '!=') && isset($dep['conflicts'])) { $installed = $installed ? 'installed' : 'downloaded'; if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) { return $this->raiseError('%s conflicts with package "' . $depname . '"' . $extra . ", $installed version is " . $version); } return $this->warning('warning: %s conflicts with package "' . $depname . '"' . $extra . ", $installed version is " . $version); } } } if (isset($dep['recommended'])) { $installed = $installed ? 'installed' : 'downloaded'; if (version_compare($version, $dep['recommended'], '==')) { return true; } if (!$found && $installed) { $param = $this->_registry->getPackage($dep['name'], $dep['channel']); } if ($param) { $found = false; foreach ($params as $parent) { if ($parent->isEqual($this->_currentPackage)) { $found = true; break; } } if ($found) { if ($param->isCompatible($parent)) { return true; } } else { // this is for validPackage() calls $parent = $this->_registry->getPackage($this->_currentPackage['package'], $this->_currentPackage['channel']); if ($parent !== null && $param->isCompatible($parent)) { return true; } } } if (!isset($this->_options['nodeps']) && !isset($this->_options['force']) && !isset($this->_options['loose']) ) { return $this->raiseError('%s dependency package "' . $depname . '" ' . $installed . ' version ' . $version . ' is not the recommended version ' . $dep['recommended'] . ', but may be compatible, use --force to install'); } return $this->warning('warning: %s dependency package "' . $depname . '" ' . $installed . ' version ' . $version . ' is not the recommended version ' . $dep['recommended']); } return true; } function _validatePackageInstall($dep, $required, $depv1 = false) { return $this->_validatePackageDownload($dep, $required, array(), $depv1); } /** * Verify that uninstalling packages passed in to command line is OK. * * @param PEAR_Installer $dl * @return PEAR_Error|true */ function validatePackageUninstall(&$dl) { if (PEAR::isError($this->_dependencydb)) { return $this->_dependencydb; } $params = array(); // construct an array of "downloaded" packages to fool the package dependency checker // into using these to validate uninstalls of circular dependencies $downloaded = &$dl->getUninstallPackages(); foreach ($downloaded as $i => $pf) { if (!class_exists('PEAR_Downloader_Package')) { require_once 'PEAR/Downloader/Package.php'; } $dp = new PEAR_Downloader_Package($dl); $dp->setPackageFile($downloaded[$i]); $params[$i] = $dp; } // check cache $memyselfandI = strtolower($this->_currentPackage['channel']) . '/' . strtolower($this->_currentPackage['package']); if (isset($dl->___uninstall_package_cache)) { $badpackages = $dl->___uninstall_package_cache; if (isset($badpackages[$memyselfandI]['warnings'])) { foreach ($badpackages[$memyselfandI]['warnings'] as $warning) { $dl->log(0, $warning[0]); } } if (isset($badpackages[$memyselfandI]['errors'])) { foreach ($badpackages[$memyselfandI]['errors'] as $error) { if (is_array($error)) { $dl->log(0, $error[0]); } else { $dl->log(0, $error->getMessage()); } } if (isset($this->_options['nodeps']) || isset($this->_options['force'])) { return $this->warning( 'warning: %s should not be uninstalled, other installed packages depend ' . 'on this package'); } return $this->raiseError( '%s cannot be uninstalled, other installed packages depend on this package'); } return true; } // first, list the immediate parents of each package to be uninstalled $perpackagelist = array(); $allparents = array(); foreach ($params as $i => $param) { $a = array( 'channel' => strtolower($param->getChannel()), 'package' => strtolower($param->getPackage()) ); $deps = $this->_dependencydb->getDependentPackages($a); if ($deps) { foreach ($deps as $d) { $pardeps = $this->_dependencydb->getDependencies($d); foreach ($pardeps as $dep) { if (strtolower($dep['dep']['channel']) == $a['channel'] && strtolower($dep['dep']['name']) == $a['package']) { if (!isset($perpackagelist[$a['channel'] . '/' . $a['package']])) { $perpackagelist[$a['channel'] . '/' . $a['package']] = array(); } $perpackagelist[$a['channel'] . '/' . $a['package']][] = array($d['channel'] . '/' . $d['package'], $dep); if (!isset($allparents[$d['channel'] . '/' . $d['package']])) { $allparents[$d['channel'] . '/' . $d['package']] = array(); } if (!isset($allparents[$d['channel'] . '/' . $d['package']][$a['channel'] . '/' . $a['package']])) { $allparents[$d['channel'] . '/' . $d['package']][$a['channel'] . '/' . $a['package']] = array(); } $allparents[$d['channel'] . '/' . $d['package']] [$a['channel'] . '/' . $a['package']][] = array($d, $dep); } } } } } // next, remove any packages from the parents list that are not installed $remove = array(); foreach ($allparents as $parent => $d1) { foreach ($d1 as $d) { if ($this->_registry->packageExists($d[0][0]['package'], $d[0][0]['channel'])) { continue; } $remove[$parent] = true; } } // next remove any packages from the parents list that are not passed in for // uninstallation foreach ($allparents as $parent => $d1) { foreach ($d1 as $d) { foreach ($params as $param) { if (strtolower($param->getChannel()) == $d[0][0]['channel'] && strtolower($param->getPackage()) == $d[0][0]['package']) { // found it continue 3; } } $remove[$parent] = true; } } // remove all packages whose dependencies fail // save which ones failed for error reporting $badchildren = array(); do { $fail = false; foreach ($remove as $package => $unused) { if (!isset($allparents[$package])) { continue; } foreach ($allparents[$package] as $kid => $d1) { foreach ($d1 as $depinfo) { if ($depinfo[1]['type'] != 'optional') { if (isset($badchildren[$kid])) { continue; } $badchildren[$kid] = true; $remove[$kid] = true; $fail = true; continue 2; } } } if ($fail) { // start over, we removed some children continue 2; } } } while ($fail); // next, construct the list of packages that can't be uninstalled $badpackages = array(); $save = $this->_currentPackage; foreach ($perpackagelist as $package => $packagedeps) { foreach ($packagedeps as $parent) { if (!isset($remove[$parent[0]])) { continue; } $packagename = $this->_registry->parsePackageName($parent[0]); $packagename['channel'] = $this->_registry->channelAlias($packagename['channel']); $pa = $this->_registry->getPackage($packagename['package'], $packagename['channel']); $packagename['package'] = $pa->getPackage(); $this->_currentPackage = $packagename; // parent is not present in uninstall list, make sure we can actually // uninstall it (parent dep is optional) $parentname['channel'] = $this->_registry->channelAlias($parent[1]['dep']['channel']); $pa = $this->_registry->getPackage($parent[1]['dep']['name'], $parent[1]['dep']['channel']); $parentname['package'] = $pa->getPackage(); $parent[1]['dep']['package'] = $parentname['package']; $parent[1]['dep']['channel'] = $parentname['channel']; if ($parent[1]['type'] == 'optional') { $test = $this->_validatePackageUninstall($parent[1]['dep'], false, $dl); if ($test !== true) { $badpackages[$package]['warnings'][] = $test; } } else { $test = $this->_validatePackageUninstall($parent[1]['dep'], true, $dl); if ($test !== true) { $badpackages[$package]['errors'][] = $test; } } } } $this->_currentPackage = $save; $dl->___uninstall_package_cache = $badpackages; if (isset($badpackages[$memyselfandI])) { if (isset($badpackages[$memyselfandI]['warnings'])) { foreach ($badpackages[$memyselfandI]['warnings'] as $warning) { $dl->log(0, $warning[0]); } } if (isset($badpackages[$memyselfandI]['errors'])) { foreach ($badpackages[$memyselfandI]['errors'] as $error) { if (is_array($error)) { $dl->log(0, $error[0]); } else { $dl->log(0, $error->getMessage()); } } if (isset($this->_options['nodeps']) || isset($this->_options['force'])) { return $this->warning( 'warning: %s should not be uninstalled, other installed packages depend ' . 'on this package'); } return $this->raiseError( '%s cannot be uninstalled, other installed packages depend on this package'); } } return true; } function _validatePackageUninstall($dep, $required, $dl) { $depname = $this->_registry->parsedPackageNameToString($dep, true); $version = $this->_registry->packageinfo($dep['package'], 'version', $dep['channel']); if (!$version) { return true; } $extra = $this->_getExtraString($dep); if (isset($dep['exclude']) && !is_array($dep['exclude'])) { $dep['exclude'] = array($dep['exclude']); } if (isset($dep['conflicts'])) { return true; // uninstall OK - these packages conflict (probably installed with --force) } if (!isset($dep['min']) && !isset($dep['max'])) { if (!$required) { return $this->warning('"' . $depname . '" can be optionally used by ' . 'installed package %s' . $extra); } if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) { return $this->raiseError('"' . $depname . '" is required by ' . 'installed package %s' . $extra); } return $this->warning('warning: "' . $depname . '" is required by ' . 'installed package %s' . $extra); } $fail = false; if (isset($dep['min']) && version_compare($version, $dep['min'], '>=')) { $fail = true; } if (isset($dep['max']) && version_compare($version, $dep['max'], '<=')) { $fail = true; } // we re-use this variable, preserve the original value $saverequired = $required; if (!$required) { return $this->warning($depname . $extra . ' can be optionally used by installed package' . ' "%s"'); } if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) { return $this->raiseError($depname . $extra . ' is required by installed package' . ' "%s"'); } return $this->raiseError('warning: ' . $depname . $extra . ' is required by installed package "%s"'); } /** * validate a downloaded package against installed packages * * As of PEAR 1.4.3, this will only validate * * @param array|PEAR_Downloader_Package|PEAR_PackageFile_v1|PEAR_PackageFile_v2 * $pkg package identifier (either * array('package' => blah, 'channel' => blah) or an array with * index 'info' referencing an object) * @param PEAR_Downloader $dl * @param array $params full list of packages to install * @return true|PEAR_Error */ function validatePackage($pkg, &$dl, $params = array()) { if (is_array($pkg) && isset($pkg['info'])) { $deps = $this->_dependencydb->getDependentPackageDependencies($pkg['info']); } else { $deps = $this->_dependencydb->getDependentPackageDependencies($pkg); } $fail = false; if ($deps) { if (!class_exists('PEAR_Downloader_Package')) { require_once 'PEAR/Downloader/Package.php'; } $dp = new PEAR_Downloader_Package($dl); if (is_object($pkg)) { $dp->setPackageFile($pkg); } else { $dp->setDownloadURL($pkg); } PEAR::pushErrorHandling(PEAR_ERROR_RETURN); foreach ($deps as $channel => $info) { foreach ($info as $package => $ds) { foreach ($params as $packd) { if (strtolower($packd->getPackage()) == strtolower($package) && $packd->getChannel() == $channel) { $dl->log(3, 'skipping installed package check of "' . $this->_registry->parsedPackageNameToString( array('channel' => $channel, 'package' => $package), true) . '", version "' . $packd->getVersion() . '" will be ' . 'downloaded and installed'); continue 2; // jump to next package } } foreach ($ds as $d) { $checker = new PEAR_Dependency2($this->_config, $this->_options, array('channel' => $channel, 'package' => $package), $this->_state); $dep = $d['dep']; $required = $d['type'] == 'required'; $ret = $checker->_validatePackageDownload($dep, $required, array(&$dp)); if (is_array($ret)) { $dl->log(0, $ret[0]); } elseif (PEAR::isError($ret)) { $dl->log(0, $ret->getMessage()); $fail = true; } } } } PEAR::popErrorHandling(); } if ($fail) { return $this->raiseError( '%s cannot be installed, conflicts with installed packages'); } return true; } /** * validate a package.xml 1.0 dependency */ function validateDependency1($dep, $params = array()) { if (!isset($dep['optional'])) { $dep['optional'] = 'no'; } list($newdep, $type) = $this->normalizeDep($dep); if (!$newdep) { return $this->raiseError("Invalid Dependency"); } if (method_exists($this, "validate{$type}Dependency")) { return $this->{"validate{$type}Dependency"}($newdep, $dep['optional'] == 'no', $params, true); } } /** * Convert a 1.0 dep into a 2.0 dep */ function normalizeDep($dep) { $types = array( 'pkg' => 'Package', 'ext' => 'Extension', 'os' => 'Os', 'php' => 'Php' ); if (!isset($types[$dep['type']])) { return array(false, false); } $type = $types[$dep['type']]; $newdep = array(); switch ($type) { case 'Package' : $newdep['channel'] = 'pear.php.net'; case 'Extension' : case 'Os' : $newdep['name'] = $dep['name']; break; } $dep['rel'] = PEAR_Dependency2::signOperator($dep['rel']); switch ($dep['rel']) { case 'has' : return array($newdep, $type); break; case 'not' : $newdep['conflicts'] = true; break; case '>=' : case '>' : $newdep['min'] = $dep['version']; if ($dep['rel'] == '>') { $newdep['exclude'] = $dep['version']; } break; case '<=' : case '<' : $newdep['max'] = $dep['version']; if ($dep['rel'] == '<') { $newdep['exclude'] = $dep['version']; } break; case 'ne' : case '!=' : $newdep['min'] = '0'; $newdep['max'] = '100000'; $newdep['exclude'] = $dep['version']; break; case '==' : $newdep['min'] = $dep['version']; $newdep['max'] = $dep['version']; break; } if ($type == 'Php') { if (!isset($newdep['min'])) { $newdep['min'] = '4.4.0'; } if (!isset($newdep['max'])) { $newdep['max'] = '6.0.0'; } } return array($newdep, $type); } /** * Converts text comparing operators to them sign equivalents * * Example: 'ge' to '>=' * * @access public * @param string Operator * @return string Sign equivalent */ function signOperator($operator) { switch($operator) { case 'lt': return '<'; case 'le': return '<='; case 'gt': return '>'; case 'ge': return '>='; case 'eq': return '=='; case 'ne': return '!='; default: return $operator; } } function raiseError($msg) { if (isset($this->_options['ignore-errors'])) { return $this->warning($msg); } return PEAR::raiseError(sprintf($msg, $this->_registry->parsedPackageNameToString( $this->_currentPackage, true))); } function warning($msg) { return array(sprintf($msg, $this->_registry->parsedPackageNameToString( $this->_currentPackage, true))); } } php-pear-1.10.1+submodules+notgz/PEAR/DependencyDB.php000066400000000000000000000570031262614675700223720ustar00rootroot00000000000000 * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ /** * Needed for error handling */ require_once 'PEAR.php'; require_once 'PEAR/Config.php'; $GLOBALS['_PEAR_DEPENDENCYDB_INSTANCE'] = array(); /** * Track dependency relationships between installed packages * @category pear * @package PEAR * @author Greg Beaver * @author Tomas V.V.Cox * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version Release: @package_version@ * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ class PEAR_DependencyDB { // {{{ properties /** * This is initialized by {@link setConfig()} * @var PEAR_Config * @access private */ var $_config; /** * This is initialized by {@link setConfig()} * @var PEAR_Registry * @access private */ var $_registry; /** * Filename of the dependency DB (usually .depdb) * @var string * @access private */ var $_depdb = false; /** * File name of the lockfile (usually .depdblock) * @var string * @access private */ var $_lockfile = false; /** * Open file resource for locking the lockfile * @var resource|false * @access private */ var $_lockFp = false; /** * API version of this class, used to validate a file on-disk * @var string * @access private */ var $_version = '1.0'; /** * Cached dependency database file * @var array|null * @access private */ var $_cache; // }}} // {{{ & singleton() /** * Get a raw dependency database. Calls setConfig() and assertDepsDB() * @param PEAR_Config * @param string|false full path to the dependency database, or false to use default * @return PEAR_DependencyDB|PEAR_Error */ public static function &singleton(&$config, $depdb = false) { $phpdir = $config->get('php_dir', null, 'pear.php.net'); if (!isset($GLOBALS['_PEAR_DEPENDENCYDB_INSTANCE'][$phpdir])) { $a = new PEAR_DependencyDB; $GLOBALS['_PEAR_DEPENDENCYDB_INSTANCE'][$phpdir] = &$a; $a->setConfig($config, $depdb); $e = $a->assertDepsDB(); if (PEAR::isError($e)) { return $e; } } return $GLOBALS['_PEAR_DEPENDENCYDB_INSTANCE'][$phpdir]; } /** * Set up the registry/location of dependency DB * @param PEAR_Config|false * @param string|false full path to the dependency database, or false to use default */ function setConfig(&$config, $depdb = false) { if (!$config) { $this->_config = &PEAR_Config::singleton(); } else { $this->_config = &$config; } $this->_registry = &$this->_config->getRegistry(); if (!$depdb) { $dir = $this->_config->get('metadata_dir', null, 'pear.php.net'); if (!$dir) { $dir = $this->_config->get('php_dir', null, 'pear.php.net'); } $this->_depdb = $dir . DIRECTORY_SEPARATOR . '.depdb'; } else { $this->_depdb = $depdb; } $this->_lockfile = dirname($this->_depdb) . DIRECTORY_SEPARATOR . '.depdblock'; } // }}} function hasWriteAccess() { if (!file_exists($this->_depdb)) { $dir = $this->_depdb; while ($dir && $dir != '.') { $dir = dirname($dir); // cd .. if ($dir != '.' && file_exists($dir)) { if (is_writeable($dir)) { return true; } return false; } } return false; } return is_writeable($this->_depdb); } // {{{ assertDepsDB() /** * Create the dependency database, if it doesn't exist. Error if the database is * newer than the code reading it. * @return void|PEAR_Error */ function assertDepsDB() { if (!is_file($this->_depdb)) { $this->rebuildDB(); return; } $depdb = $this->_getDepDB(); // Datatype format has been changed, rebuild the Deps DB if ($depdb['_version'] < $this->_version) { $this->rebuildDB(); } if ($depdb['_version']{0} > $this->_version{0}) { return PEAR::raiseError('Dependency database is version ' . $depdb['_version'] . ', and we are version ' . $this->_version . ', cannot continue'); } } /** * Get a list of installed packages that depend on this package * @param PEAR_PackageFile_v1|PEAR_PackageFile_v2|array * @return array|false */ function getDependentPackages(&$pkg) { $data = $this->_getDepDB(); if (is_object($pkg)) { $channel = strtolower($pkg->getChannel()); $package = strtolower($pkg->getPackage()); } else { $channel = strtolower($pkg['channel']); $package = strtolower($pkg['package']); } if (isset($data['packages'][$channel][$package])) { return $data['packages'][$channel][$package]; } return false; } /** * Get a list of the actual dependencies of installed packages that depend on * a package. * @param PEAR_PackageFile_v1|PEAR_PackageFile_v2|array * @return array|false */ function getDependentPackageDependencies(&$pkg) { $data = $this->_getDepDB(); if (is_object($pkg)) { $channel = strtolower($pkg->getChannel()); $package = strtolower($pkg->getPackage()); } else { $channel = strtolower($pkg['channel']); $package = strtolower($pkg['package']); } $depend = $this->getDependentPackages($pkg); if (!$depend) { return false; } $dependencies = array(); foreach ($depend as $info) { $temp = $this->getDependencies($info); foreach ($temp as $dep) { if ( isset($dep['dep'], $dep['dep']['channel'], $dep['dep']['name']) && strtolower($dep['dep']['channel']) == $channel && strtolower($dep['dep']['name']) == $package ) { if (!isset($dependencies[$info['channel']])) { $dependencies[$info['channel']] = array(); } if (!isset($dependencies[$info['channel']][$info['package']])) { $dependencies[$info['channel']][$info['package']] = array(); } $dependencies[$info['channel']][$info['package']][] = $dep; } } } return $dependencies; } /** * Get a list of dependencies of this installed package * @param PEAR_PackageFile_v1|PEAR_PackageFile_v2|array * @return array|false */ function getDependencies(&$pkg) { if (is_object($pkg)) { $channel = strtolower($pkg->getChannel()); $package = strtolower($pkg->getPackage()); } else { $channel = strtolower($pkg['channel']); $package = strtolower($pkg['package']); } $data = $this->_getDepDB(); if (isset($data['dependencies'][$channel][$package])) { return $data['dependencies'][$channel][$package]; } return false; } /** * Determine whether $parent depends on $child, near or deep * @param array|PEAR_PackageFile_v2|PEAR_PackageFile_v2 * @param array|PEAR_PackageFile_v2|PEAR_PackageFile_v2 */ function dependsOn($parent, $child) { $c = array(); $this->_getDepDB(); return $this->_dependsOn($parent, $child, $c); } function _dependsOn($parent, $child, &$checked) { if (is_object($parent)) { $channel = strtolower($parent->getChannel()); $package = strtolower($parent->getPackage()); } else { $channel = strtolower($parent['channel']); $package = strtolower($parent['package']); } if (is_object($child)) { $depchannel = strtolower($child->getChannel()); $deppackage = strtolower($child->getPackage()); } else { $depchannel = strtolower($child['channel']); $deppackage = strtolower($child['package']); } if (isset($checked[$channel][$package][$depchannel][$deppackage])) { return false; // avoid endless recursion } $checked[$channel][$package][$depchannel][$deppackage] = true; if (!isset($this->_cache['dependencies'][$channel][$package])) { return false; } foreach ($this->_cache['dependencies'][$channel][$package] as $info) { if (isset($info['dep']['uri'])) { if (is_object($child)) { if ($info['dep']['uri'] == $child->getURI()) { return true; } } elseif (isset($child['uri'])) { if ($info['dep']['uri'] == $child['uri']) { return true; } } return false; } if (strtolower($info['dep']['channel']) == $depchannel && strtolower($info['dep']['name']) == $deppackage) { return true; } } foreach ($this->_cache['dependencies'][$channel][$package] as $info) { if (isset($info['dep']['uri'])) { if ($this->_dependsOn(array( 'uri' => $info['dep']['uri'], 'package' => $info['dep']['name']), $child, $checked)) { return true; } } else { if ($this->_dependsOn(array( 'channel' => $info['dep']['channel'], 'package' => $info['dep']['name']), $child, $checked)) { return true; } } } return false; } /** * Register dependencies of a package that is being installed or upgraded * @param PEAR_PackageFile_v2|PEAR_PackageFile_v2 */ function installPackage(&$package) { $data = $this->_getDepDB(); unset($this->_cache); $this->_setPackageDeps($data, $package); $this->_writeDepDB($data); } /** * Remove dependencies of a package that is being uninstalled, or upgraded. * * Upgraded packages first uninstall, then install * @param PEAR_PackageFile_v1|PEAR_PackageFile_v2|array If an array, then it must have * indices 'channel' and 'package' */ function uninstallPackage(&$pkg) { $data = $this->_getDepDB(); unset($this->_cache); if (is_object($pkg)) { $channel = strtolower($pkg->getChannel()); $package = strtolower($pkg->getPackage()); } else { $channel = strtolower($pkg['channel']); $package = strtolower($pkg['package']); } if (!isset($data['dependencies'][$channel][$package])) { return true; } foreach ($data['dependencies'][$channel][$package] as $dep) { $found = false; $depchannel = isset($dep['dep']['uri']) ? '__uri' : strtolower($dep['dep']['channel']); $depname = strtolower($dep['dep']['name']); if (isset($data['packages'][$depchannel][$depname])) { foreach ($data['packages'][$depchannel][$depname] as $i => $info) { if ($info['channel'] == $channel && $info['package'] == $package) { $found = true; break; } } } if ($found) { unset($data['packages'][$depchannel][$depname][$i]); if (!count($data['packages'][$depchannel][$depname])) { unset($data['packages'][$depchannel][$depname]); if (!count($data['packages'][$depchannel])) { unset($data['packages'][$depchannel]); } } else { $data['packages'][$depchannel][$depname] = array_values($data['packages'][$depchannel][$depname]); } } } unset($data['dependencies'][$channel][$package]); if (!count($data['dependencies'][$channel])) { unset($data['dependencies'][$channel]); } if (!count($data['dependencies'])) { unset($data['dependencies']); } if (!count($data['packages'])) { unset($data['packages']); } $this->_writeDepDB($data); } /** * Rebuild the dependency DB by reading registry entries. * @return true|PEAR_Error */ function rebuildDB() { $depdb = array('_version' => $this->_version); if (!$this->hasWriteAccess()) { // allow startup for read-only with older Registry return $depdb; } $packages = $this->_registry->listAllPackages(); if (PEAR::isError($packages)) { return $packages; } foreach ($packages as $channel => $ps) { foreach ($ps as $package) { $package = $this->_registry->getPackage($package, $channel); if (PEAR::isError($package)) { return $package; } $this->_setPackageDeps($depdb, $package); } } $error = $this->_writeDepDB($depdb); if (PEAR::isError($error)) { return $error; } $this->_cache = $depdb; return true; } /** * Register usage of the dependency DB to prevent race conditions * @param int one of the LOCK_* constants * @return true|PEAR_Error * @access private */ function _lock($mode = LOCK_EX) { if (stristr(php_uname(), 'Windows 9')) { return true; } if ($mode != LOCK_UN && is_resource($this->_lockFp)) { // XXX does not check type of lock (LOCK_SH/LOCK_EX) return true; } $open_mode = 'w'; // XXX People reported problems with LOCK_SH and 'w' if ($mode === LOCK_SH) { if (!file_exists($this->_lockfile)) { touch($this->_lockfile); } elseif (!is_file($this->_lockfile)) { return PEAR::raiseError('could not create Dependency lock file, ' . 'it exists and is not a regular file'); } $open_mode = 'r'; } if (!is_resource($this->_lockFp)) { $this->_lockFp = @fopen($this->_lockfile, $open_mode); } if (!is_resource($this->_lockFp)) { return PEAR::raiseError("could not create Dependency lock file" . (isset($php_errormsg) ? ": " . $php_errormsg : "")); } if (!(int)flock($this->_lockFp, $mode)) { switch ($mode) { case LOCK_SH: $str = 'shared'; break; case LOCK_EX: $str = 'exclusive'; break; case LOCK_UN: $str = 'unlock'; break; default: $str = 'unknown'; break; } return PEAR::raiseError("could not acquire $str lock ($this->_lockfile)"); } return true; } /** * Release usage of dependency DB * @return true|PEAR_Error * @access private */ function _unlock() { $ret = $this->_lock(LOCK_UN); if (is_resource($this->_lockFp)) { fclose($this->_lockFp); } $this->_lockFp = null; return $ret; } /** * Load the dependency database from disk, or return the cache * @return array|PEAR_Error */ function _getDepDB() { if (!$this->hasWriteAccess()) { return array('_version' => $this->_version); } if (isset($this->_cache)) { return $this->_cache; } if (!$fp = fopen($this->_depdb, 'r')) { $err = PEAR::raiseError("Could not open dependencies file `".$this->_depdb."'"); return $err; } clearstatcache(); fclose($fp); $data = unserialize(file_get_contents($this->_depdb)); $this->_cache = $data; return $data; } /** * Write out the dependency database to disk * @param array the database * @return true|PEAR_Error * @access private */ function _writeDepDB(&$deps) { if (PEAR::isError($e = $this->_lock(LOCK_EX))) { return $e; } if (!$fp = fopen($this->_depdb, 'wb')) { $this->_unlock(); return PEAR::raiseError("Could not open dependencies file `".$this->_depdb."' for writing"); } fwrite($fp, serialize($deps)); fclose($fp); $this->_unlock(); $this->_cache = $deps; return true; } /** * Register all dependencies from a package in the dependencies database, in essence * "installing" the package's dependency information * @param array the database * @param PEAR_PackageFile_v1|PEAR_PackageFile_v2 * @access private */ function _setPackageDeps(&$data, &$pkg) { $pkg->setConfig($this->_config); if ($pkg->getPackagexmlVersion() == '1.0') { $gen = &$pkg->getDefaultGenerator(); $deps = $gen->dependenciesToV2(); } else { $deps = $pkg->getDeps(true); } if (!$deps) { return; } if (!is_array($data)) { $data = array(); } if (!isset($data['dependencies'])) { $data['dependencies'] = array(); } $channel = strtolower($pkg->getChannel()); $package = strtolower($pkg->getPackage()); if (!isset($data['dependencies'][$channel])) { $data['dependencies'][$channel] = array(); } $data['dependencies'][$channel][$package] = array(); if (isset($deps['required']['package'])) { if (!isset($deps['required']['package'][0])) { $deps['required']['package'] = array($deps['required']['package']); } foreach ($deps['required']['package'] as $dep) { $this->_registerDep($data, $pkg, $dep, 'required'); } } if (isset($deps['optional']['package'])) { if (!isset($deps['optional']['package'][0])) { $deps['optional']['package'] = array($deps['optional']['package']); } foreach ($deps['optional']['package'] as $dep) { $this->_registerDep($data, $pkg, $dep, 'optional'); } } if (isset($deps['required']['subpackage'])) { if (!isset($deps['required']['subpackage'][0])) { $deps['required']['subpackage'] = array($deps['required']['subpackage']); } foreach ($deps['required']['subpackage'] as $dep) { $this->_registerDep($data, $pkg, $dep, 'required'); } } if (isset($deps['optional']['subpackage'])) { if (!isset($deps['optional']['subpackage'][0])) { $deps['optional']['subpackage'] = array($deps['optional']['subpackage']); } foreach ($deps['optional']['subpackage'] as $dep) { $this->_registerDep($data, $pkg, $dep, 'optional'); } } if (isset($deps['group'])) { if (!isset($deps['group'][0])) { $deps['group'] = array($deps['group']); } foreach ($deps['group'] as $group) { if (isset($group['package'])) { if (!isset($group['package'][0])) { $group['package'] = array($group['package']); } foreach ($group['package'] as $dep) { $this->_registerDep($data, $pkg, $dep, 'optional', $group['attribs']['name']); } } if (isset($group['subpackage'])) { if (!isset($group['subpackage'][0])) { $group['subpackage'] = array($group['subpackage']); } foreach ($group['subpackage'] as $dep) { $this->_registerDep($data, $pkg, $dep, 'optional', $group['attribs']['name']); } } } } if ($data['dependencies'][$channel][$package] == array()) { unset($data['dependencies'][$channel][$package]); if (!count($data['dependencies'][$channel])) { unset($data['dependencies'][$channel]); } } } /** * @param array the database * @param PEAR_PackageFile_v1|PEAR_PackageFile_v2 * @param array the specific dependency * @param required|optional whether this is a required or an optional dep * @param string|false dependency group this dependency is from, or false for ordinary dep */ function _registerDep(&$data, &$pkg, $dep, $type, $group = false) { $info = array( 'dep' => $dep, 'type' => $type, 'group' => $group ); $dep = array_map('strtolower', $dep); $depchannel = isset($dep['channel']) ? $dep['channel'] : '__uri'; if (!isset($data['dependencies'])) { $data['dependencies'] = array(); } $channel = strtolower($pkg->getChannel()); $package = strtolower($pkg->getPackage()); if (!isset($data['dependencies'][$channel])) { $data['dependencies'][$channel] = array(); } if (!isset($data['dependencies'][$channel][$package])) { $data['dependencies'][$channel][$package] = array(); } $data['dependencies'][$channel][$package][] = $info; if (isset($data['packages'][$depchannel][$dep['name']])) { $found = false; foreach ($data['packages'][$depchannel][$dep['name']] as $i => $p) { if ($p['channel'] == $channel && $p['package'] == $package) { $found = true; break; } } } else { if (!isset($data['packages'])) { $data['packages'] = array(); } if (!isset($data['packages'][$depchannel])) { $data['packages'][$depchannel] = array(); } if (!isset($data['packages'][$depchannel][$dep['name']])) { $data['packages'][$depchannel][$dep['name']] = array(); } $found = false; } if (!$found) { $data['packages'][$depchannel][$dep['name']][] = array( 'channel' => $channel, 'package' => $package ); } } } php-pear-1.10.1+submodules+notgz/PEAR/Downloader.php000066400000000000000000002033131262614675700222010ustar00rootroot00000000000000 * @author Stig Bakken * @author Tomas V. V. Cox * @author Martin Jansen * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @link http://pear.php.net/package/PEAR * @since File available since Release 1.3.0 */ /** * Needed for constants, extending */ require_once 'PEAR/Common.php'; define('PEAR_INSTALLER_OK', 1); define('PEAR_INSTALLER_FAILED', 0); define('PEAR_INSTALLER_SKIPPED', -1); define('PEAR_INSTALLER_ERROR_NO_PREF_STATE', 2); /** * Administration class used to download anything from the internet (PEAR Packages, * static URLs, xml files) * * @category pear * @package PEAR * @author Greg Beaver * @author Stig Bakken * @author Tomas V. V. Cox * @author Martin Jansen * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version Release: @package_version@ * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.3.0 */ class PEAR_Downloader extends PEAR_Common { /** * @var PEAR_Registry * @access private */ var $_registry; /** * Preferred Installation State (snapshot, devel, alpha, beta, stable) * @var string|null * @access private */ var $_preferredState; /** * Options from command-line passed to Install. * * Recognized options:
* - onlyreqdeps : install all required dependencies as well * - alldeps : install all dependencies, including optional * - installroot : base relative path to install files in * - force : force a download even if warnings would prevent it * - nocompress : download uncompressed tarballs * @see PEAR_Command_Install * @access private * @var array */ var $_options; /** * Downloaded Packages after a call to download(). * * Format of each entry: * * * array('pkg' => 'package_name', 'file' => '/path/to/local/file', * 'info' => array() // parsed package.xml * ); * * @access private * @var array */ var $_downloadedPackages = array(); /** * 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: * *
     * array('package_name1' => parsed package.xml, 'package_name2' => parsed package.xml,
     * );
     * 
* @access private * @var array */ var $_toDownload = array(); /** * Array of every package installed, with names lower-cased. * * Format: * * array('package1' => 0, 'package2' => 1, ); * * @var array */ var $_installed = array(); /** * @var array * @access private */ var $_errorStack = array(); /** * @var boolean * @access private */ var $_internalDownload = false; /** * Temporary variable used in sorting packages by dependency in {@link sortPkgDeps()} * @var array * @access private */ var $_packageSortTree; /** * Temporary directory, or configuration value where downloads will occur * @var string */ var $_downloadDir; /** * List of methods that can be called both statically and non-statically. * @var array */ protected static $bivalentMethods = array( 'setErrorHandling' => true, 'raiseError' => true, 'throwError' => true, 'pushErrorHandling' => true, 'popErrorHandling' => true, 'downloadHttp' => true, ); /** * @param PEAR_Frontend_* * @param array * @param PEAR_Config */ function __construct($ui = null, $options = array(), $config = null) { parent::__construct(); $this->_options = $options; if ($config !== null) { $this->config = &$config; $this->_preferredState = $this->config->get('preferred_state'); } $this->ui = &$ui; if (!$this->_preferredState) { // don't inadvertantly use a non-set preferred_state $this->_preferredState = null; } if ($config !== null) { if (isset($this->_options['installroot'])) { $this->config->setInstallRoot($this->_options['installroot']); } $this->_registry = &$config->getRegistry(); } if (isset($this->_options['alldeps']) || isset($this->_options['onlyreqdeps'])) { $this->_installed = $this->_registry->listAllPackages(); foreach ($this->_installed as $key => $unused) { if (!count($unused)) { continue; } $strtolower = create_function('$a','return strtolower($a);'); array_walk($this->_installed[$key], $strtolower); } } } /** * Attempt to discover a channel's remote capabilities from * its server name * @param string * @return boolean */ function discover($channel) { $this->log(1, 'Attempting to discover channel "' . $channel . '"...'); PEAR::pushErrorHandling(PEAR_ERROR_RETURN); $callback = $this->ui ? array(&$this, '_downloadCallback') : null; if (!class_exists('System')) { require_once 'System.php'; } $tmpdir = $this->config->get('temp_dir'); $tmp = System::mktemp('-d -t "' . $tmpdir . '"'); $a = $this->downloadHttp('http://' . $channel . '/channel.xml', $this->ui, $tmp, $callback, false); PEAR::popErrorHandling(); if (PEAR::isError($a)) { // Attempt to fallback to https automatically. PEAR::pushErrorHandling(PEAR_ERROR_RETURN); $this->log(1, 'Attempting fallback to https instead of http on channel "' . $channel . '"...'); $a = $this->downloadHttp('https://' . $channel . '/channel.xml', $this->ui, $tmp, $callback, false); PEAR::popErrorHandling(); if (PEAR::isError($a)) { return false; } } list($a, $lastmodified) = $a; if (!class_exists('PEAR_ChannelFile')) { require_once 'PEAR/ChannelFile.php'; } $b = new PEAR_ChannelFile; if ($b->fromXmlFile($a)) { unlink($a); if ($this->config->get('auto_discover')) { $this->_registry->addChannel($b, $lastmodified); $alias = $b->getName(); if ($b->getName() == $this->_registry->channelName($b->getAlias())) { $alias = $b->getAlias(); } $this->log(1, 'Auto-discovered channel "' . $channel . '", alias "' . $alias . '", adding to registry'); } return true; } unlink($a); return false; } /** * For simpler unit-testing * @param PEAR_Downloader * @return PEAR_Downloader_Package */ function newDownloaderPackage(&$t) { if (!class_exists('PEAR_Downloader_Package')) { require_once 'PEAR/Downloader/Package.php'; } $a = new PEAR_Downloader_Package($t); return $a; } /** * For simpler unit-testing * @param PEAR_Config * @param array * @param array * @param int */ function &getDependency2Object(&$c, $i, $p, $s) { if (!class_exists('PEAR_Dependency2')) { require_once 'PEAR/Dependency2.php'; } $z = new PEAR_Dependency2($c, $i, $p, $s); return $z; } function &download($params) { if (!count($params)) { $a = array(); return $a; } if (!isset($this->_registry)) { $this->_registry = &$this->config->getRegistry(); } $channelschecked = array(); // convert all parameters into PEAR_Downloader_Package objects foreach ($params as $i => $param) { $params[$i] = $this->newDownloaderPackage($this); PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); $err = $params[$i]->initialize($param); PEAR::staticPopErrorHandling(); if (!$err) { // skip parameters that were missed by preferred_state continue; } if (PEAR::isError($err)) { if (!isset($this->_options['soft']) && $err->getMessage() !== '') { $this->log(0, $err->getMessage()); } $params[$i] = false; if (is_object($param)) { $param = $param->getChannel() . '/' . $param->getPackage(); } if (!isset($this->_options['soft'])) { $this->log(2, 'Package "' . $param . '" is not valid'); } // Message logged above in a specific verbose mode, passing null to not show up on CLI $this->pushError(null, PEAR_INSTALLER_SKIPPED); } else { do { if ($params[$i] && $params[$i]->getType() == 'local') { // bug #7090 skip channel.xml check for local packages break; } if ($params[$i] && !isset($channelschecked[$params[$i]->getChannel()]) && !isset($this->_options['offline']) ) { $channelschecked[$params[$i]->getChannel()] = true; PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); if (!class_exists('System')) { require_once 'System.php'; } $curchannel = $this->_registry->getChannel($params[$i]->getChannel()); if (PEAR::isError($curchannel)) { PEAR::staticPopErrorHandling(); return $this->raiseError($curchannel); } if (PEAR::isError($dir = $this->getDownloadDir())) { PEAR::staticPopErrorHandling(); break; } $mirror = $this->config->get('preferred_mirror', null, $params[$i]->getChannel()); $url = 'http://' . $mirror . '/channel.xml'; $a = $this->downloadHttp($url, $this->ui, $dir, null, $curchannel->lastModified()); PEAR::staticPopErrorHandling(); if ($a === false) { //channel.xml not modified break; } else if (PEAR::isError($a)) { // Attempt fallback to https automatically PEAR::pushErrorHandling(PEAR_ERROR_RETURN); $a = $this->downloadHttp('https://' . $mirror . '/channel.xml', $this->ui, $dir, null, $curchannel->lastModified()); PEAR::staticPopErrorHandling(); if (PEAR::isError($a) || !$a) { break; } } $this->log(0, 'WARNING: channel "' . $params[$i]->getChannel() . '" has ' . 'updated its protocols, use "' . PEAR_RUNTYPE . ' channel-update ' . $params[$i]->getChannel() . '" to update'); } } while (false); if ($params[$i] && !isset($this->_options['downloadonly'])) { if (isset($this->_options['packagingroot'])) { $checkdir = $this->_prependPath( $this->config->get('php_dir', null, $params[$i]->getChannel()), $this->_options['packagingroot']); } else { $checkdir = $this->config->get('php_dir', null, $params[$i]->getChannel()); } while ($checkdir && $checkdir != '/' && !file_exists($checkdir)) { $checkdir = dirname($checkdir); } if ($checkdir == '.') { $checkdir = '/'; } if (!is_writeable($checkdir)) { return PEAR::raiseError('Cannot install, php_dir for channel "' . $params[$i]->getChannel() . '" is not writeable by the current user'); } } } } unset($channelschecked); PEAR_Downloader_Package::removeDuplicates($params); if (!count($params)) { $a = array(); return $a; } if (!isset($this->_options['nodeps']) && !isset($this->_options['offline'])) { $reverify = true; while ($reverify) { $reverify = false; foreach ($params as $i => $param) { //PHP Bug 40768 / PEAR Bug #10944 //Nested foreaches fail in PHP 5.2.1 key($params); $ret = $params[$i]->detectDependencies($params); if (PEAR::isError($ret)) { $reverify = true; $params[$i] = false; PEAR_Downloader_Package::removeDuplicates($params); if (!isset($this->_options['soft'])) { $this->log(0, $ret->getMessage()); } continue 2; } } } } if (isset($this->_options['offline'])) { $this->log(3, 'Skipping dependency download check, --offline specified'); } if (!count($params)) { $a = array(); return $a; } while (PEAR_Downloader_Package::mergeDependencies($params)); PEAR_Downloader_Package::removeDuplicates($params, true); $errorparams = array(); if (PEAR_Downloader_Package::detectStupidDuplicates($params, $errorparams)) { if (count($errorparams)) { foreach ($errorparams as $param) { $name = $this->_registry->parsedPackageNameToString($param->getParsedPackage()); $this->pushError('Duplicate package ' . $name . ' found', PEAR_INSTALLER_FAILED); } $a = array(); return $a; } } PEAR_Downloader_Package::removeInstalled($params); if (!count($params)) { $this->pushError('No valid packages found', PEAR_INSTALLER_FAILED); $a = array(); return $a; } PEAR::pushErrorHandling(PEAR_ERROR_RETURN); $err = $this->analyzeDependencies($params); PEAR::popErrorHandling(); if (!count($params)) { $this->pushError('No valid packages found', PEAR_INSTALLER_FAILED); $a = array(); return $a; } $ret = array(); $newparams = array(); if (isset($this->_options['pretend'])) { return $params; } $somefailed = false; foreach ($params as $i => $package) { PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); $pf = &$params[$i]->download(); PEAR::staticPopErrorHandling(); if (PEAR::isError($pf)) { if (!isset($this->_options['soft'])) { $this->log(1, $pf->getMessage()); $this->log(0, 'Error: cannot download "' . $this->_registry->parsedPackageNameToString($package->getParsedPackage(), true) . '"'); } $somefailed = true; continue; } $newparams[] = &$params[$i]; $ret[] = array( 'file' => $pf->getArchiveFile(), 'info' => &$pf, 'pkg' => $pf->getPackage() ); } if ($somefailed) { // remove params that did not download successfully PEAR::pushErrorHandling(PEAR_ERROR_RETURN); $err = $this->analyzeDependencies($newparams, true); PEAR::popErrorHandling(); if (!count($newparams)) { $this->pushError('Download failed', PEAR_INSTALLER_FAILED); $a = array(); return $a; } } $this->_downloadedPackages = $ret; return $newparams; } /** * @param array all packages to be installed */ function analyzeDependencies(&$params, $force = false) { if (isset($this->_options['downloadonly'])) { return; } PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); $redo = true; $reset = $hasfailed = $failed = false; while ($redo) { $redo = false; foreach ($params as $i => $param) { $deps = $param->getDeps(); if (!$deps) { $depchecker = &$this->getDependency2Object($this->config, $this->getOptions(), $param->getParsedPackage(), PEAR_VALIDATE_DOWNLOADING); $send = $param->getPackageFile(); $installcheck = $depchecker->validatePackage($send, $this, $params); if (PEAR::isError($installcheck)) { if (!isset($this->_options['soft'])) { $this->log(0, $installcheck->getMessage()); } $hasfailed = true; $params[$i] = false; $reset = true; $redo = true; $failed = false; PEAR_Downloader_Package::removeDuplicates($params); continue 2; } continue; } if (!$reset && $param->alreadyValidated() && !$force) { continue; } if (count($deps)) { $depchecker = &$this->getDependency2Object($this->config, $this->getOptions(), $param->getParsedPackage(), PEAR_VALIDATE_DOWNLOADING); $send = $param->getPackageFile(); if ($send === null) { $send = $param->getDownloadURL(); } $installcheck = $depchecker->validatePackage($send, $this, $params); if (PEAR::isError($installcheck)) { if (!isset($this->_options['soft'])) { $this->log(0, $installcheck->getMessage()); } $hasfailed = true; $params[$i] = false; $reset = true; $redo = true; $failed = false; PEAR_Downloader_Package::removeDuplicates($params); continue 2; } $failed = false; if (isset($deps['required']) && is_array($deps['required'])) { foreach ($deps['required'] as $type => $dep) { // note: Dependency2 will never return a PEAR_Error if ignore-errors // is specified, so soft is needed to turn off logging if (!isset($dep[0])) { if (PEAR::isError($e = $depchecker->{"validate{$type}Dependency"}($dep, true, $params))) { $failed = true; if (!isset($this->_options['soft'])) { $this->log(0, $e->getMessage()); } } elseif (is_array($e) && !$param->alreadyValidated()) { if (!isset($this->_options['soft'])) { $this->log(0, $e[0]); } } } else { foreach ($dep as $d) { if (PEAR::isError($e = $depchecker->{"validate{$type}Dependency"}($d, true, $params))) { $failed = true; if (!isset($this->_options['soft'])) { $this->log(0, $e->getMessage()); } } elseif (is_array($e) && !$param->alreadyValidated()) { if (!isset($this->_options['soft'])) { $this->log(0, $e[0]); } } } } } if (isset($deps['optional']) && is_array($deps['optional'])) { foreach ($deps['optional'] as $type => $dep) { if (!isset($dep[0])) { if (PEAR::isError($e = $depchecker->{"validate{$type}Dependency"}($dep, false, $params))) { $failed = true; if (!isset($this->_options['soft'])) { $this->log(0, $e->getMessage()); } } elseif (is_array($e) && !$param->alreadyValidated()) { if (!isset($this->_options['soft'])) { $this->log(0, $e[0]); } } } else { foreach ($dep as $d) { if (PEAR::isError($e = $depchecker->{"validate{$type}Dependency"}($d, false, $params))) { $failed = true; if (!isset($this->_options['soft'])) { $this->log(0, $e->getMessage()); } } elseif (is_array($e) && !$param->alreadyValidated()) { if (!isset($this->_options['soft'])) { $this->log(0, $e[0]); } } } } } } $groupname = $param->getGroup(); if (isset($deps['group']) && $groupname) { if (!isset($deps['group'][0])) { $deps['group'] = array($deps['group']); } $found = false; foreach ($deps['group'] as $group) { if ($group['attribs']['name'] == $groupname) { $found = true; break; } } if ($found) { unset($group['attribs']); foreach ($group as $type => $dep) { if (!isset($dep[0])) { if (PEAR::isError($e = $depchecker->{"validate{$type}Dependency"}($dep, false, $params))) { $failed = true; if (!isset($this->_options['soft'])) { $this->log(0, $e->getMessage()); } } elseif (is_array($e) && !$param->alreadyValidated()) { if (!isset($this->_options['soft'])) { $this->log(0, $e[0]); } } } else { foreach ($dep as $d) { if (PEAR::isError($e = $depchecker->{"validate{$type}Dependency"}($d, false, $params))) { $failed = true; if (!isset($this->_options['soft'])) { $this->log(0, $e->getMessage()); } } elseif (is_array($e) && !$param->alreadyValidated()) { if (!isset($this->_options['soft'])) { $this->log(0, $e[0]); } } } } } } } } else { foreach ($deps as $dep) { if (PEAR::isError($e = $depchecker->validateDependency1($dep, $params))) { $failed = true; if (!isset($this->_options['soft'])) { $this->log(0, $e->getMessage()); } } elseif (is_array($e) && !$param->alreadyValidated()) { if (!isset($this->_options['soft'])) { $this->log(0, $e[0]); } } } } $params[$i]->setValidated(); } if ($failed) { $hasfailed = true; $params[$i] = false; $reset = true; $redo = true; $failed = false; PEAR_Downloader_Package::removeDuplicates($params); continue 2; } } } PEAR::staticPopErrorHandling(); if ($hasfailed && (isset($this->_options['ignore-errors']) || isset($this->_options['nodeps']))) { // this is probably not needed, but just in case if (!isset($this->_options['soft'])) { $this->log(0, 'WARNING: dependencies failed'); } } } /** * Retrieve the directory that downloads will happen in * @access private * @return string */ function getDownloadDir() { if (isset($this->_downloadDir)) { return $this->_downloadDir; } $downloaddir = $this->config->get('download_dir'); if (empty($downloaddir) || (is_dir($downloaddir) && !is_writable($downloaddir))) { if (is_dir($downloaddir) && !is_writable($downloaddir)) { $this->log(0, 'WARNING: configuration download directory "' . $downloaddir . '" is not writeable. Change download_dir config variable to ' . 'a writeable dir to avoid this warning'); } if (!class_exists('System')) { require_once 'System.php'; } if (PEAR::isError($downloaddir = System::mktemp('-d'))) { return $downloaddir; } $this->log(3, '+ tmp dir created at ' . $downloaddir); } if (!is_writable($downloaddir)) { if (PEAR::isError(System::mkdir(array('-p', $downloaddir))) || !is_writable($downloaddir)) { return PEAR::raiseError('download directory "' . $downloaddir . '" is not writeable. Change download_dir config variable to ' . 'a writeable dir'); } } return $this->_downloadDir = $downloaddir; } function setDownloadDir($dir) { if (!@is_writable($dir)) { if (PEAR::isError(System::mkdir(array('-p', $dir)))) { return PEAR::raiseError('download directory "' . $dir . '" is not writeable. Change download_dir config variable to ' . 'a writeable dir'); } } $this->_downloadDir = $dir; } function configSet($key, $value, $layer = 'user', $channel = false) { $this->config->set($key, $value, $layer, $channel); $this->_preferredState = $this->config->get('preferred_state', null, $channel); if (!$this->_preferredState) { // don't inadvertantly use a non-set preferred_state $this->_preferredState = null; } } function setOptions($options) { $this->_options = $options; } function getOptions() { return $this->_options; } /** * @param array output of {@link parsePackageName()} * @access private */ function _getPackageDownloadUrl($parr) { $curchannel = $this->config->get('default_channel'); $this->configSet('default_channel', $parr['channel']); // getDownloadURL returns an array. On error, it only contains information // on the latest release as array(version, info). On success it contains // array(version, info, download url string) $state = isset($parr['state']) ? $parr['state'] : $this->config->get('preferred_state'); if (!$this->_registry->channelExists($parr['channel'])) { do { if ($this->config->get('auto_discover') && $this->discover($parr['channel'])) { break; } $this->configSet('default_channel', $curchannel); return PEAR::raiseError('Unknown remote channel: ' . $parr['channel']); } while (false); } $chan = $this->_registry->getChannel($parr['channel']); if (PEAR::isError($chan)) { return $chan; } PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); $version = $this->_registry->packageInfo($parr['package'], 'version', $parr['channel']); $stability = $this->_registry->packageInfo($parr['package'], 'stability', $parr['channel']); // package is installed - use the installed release stability level if (!isset($parr['state']) && $stability !== null) { $state = $stability['release']; } PEAR::staticPopErrorHandling(); $base2 = false; $preferred_mirror = $this->config->get('preferred_mirror'); if (!$chan->supportsREST($preferred_mirror) || ( !($base2 = $chan->getBaseURL('REST1.3', $preferred_mirror)) && !($base = $chan->getBaseURL('REST1.0', $preferred_mirror)) ) ) { return $this->raiseError($parr['channel'] . ' is using a unsupported protocol - This should never happen.'); } if ($base2) { $rest = &$this->config->getREST('1.3', $this->_options); $base = $base2; } else { $rest = &$this->config->getREST('1.0', $this->_options); } $downloadVersion = false; if (!isset($parr['version']) && !isset($parr['state']) && $version && !PEAR::isError($version) && !isset($this->_options['downloadonly']) ) { $downloadVersion = $version; } $url = $rest->getDownloadURL($base, $parr, $state, $downloadVersion, $chan->getName()); if (PEAR::isError($url)) { $this->configSet('default_channel', $curchannel); return $url; } if ($parr['channel'] != $curchannel) { $this->configSet('default_channel', $curchannel); } if (!is_array($url)) { return $url; } $url['raw'] = false; // no checking is necessary for REST if (!is_array($url['info'])) { return PEAR::raiseError('Invalid remote dependencies retrieved from REST - ' . 'this should never happen'); } if (!isset($this->_options['force']) && !isset($this->_options['downloadonly']) && $version && !PEAR::isError($version) && !isset($parr['group']) ) { if (version_compare($version, $url['version'], '=')) { return PEAR::raiseError($this->_registry->parsedPackageNameToString( $parr, true) . ' is already installed and is the same as the ' . 'released version ' . $url['version'], -976); } if (version_compare($version, $url['version'], '>')) { return PEAR::raiseError($this->_registry->parsedPackageNameToString( $parr, true) . ' is already installed and is newer than detected ' . 'released version ' . $url['version'], -976); } } if (isset($url['info']['required']) || $url['compatible']) { require_once 'PEAR/PackageFile/v2.php'; $pf = new PEAR_PackageFile_v2; $pf->setRawChannel($parr['channel']); if ($url['compatible']) { $pf->setRawCompatible($url['compatible']); } } else { require_once 'PEAR/PackageFile/v1.php'; $pf = new PEAR_PackageFile_v1; } $pf->setRawPackage($url['package']); $pf->setDeps($url['info']); if ($url['compatible']) { $pf->setCompatible($url['compatible']); } $pf->setRawState($url['stability']); $url['info'] = &$pf; if (!extension_loaded("zlib") || isset($this->_options['nocompress'])) { $ext = '.tar'; } else { $ext = '.tgz'; } if (is_array($url) && isset($url['url'])) { $url['url'] .= $ext; } return $url; } /** * @param array dependency array * @access private */ function _getDepPackageDownloadUrl($dep, $parr) { $xsdversion = isset($dep['rel']) ? '1.0' : '2.0'; $curchannel = $this->config->get('default_channel'); if (isset($dep['uri'])) { $xsdversion = '2.0'; $chan = $this->_registry->getChannel('__uri'); if (PEAR::isError($chan)) { return $chan; } $version = $this->_registry->packageInfo($dep['name'], 'version', '__uri'); $this->configSet('default_channel', '__uri'); } else { if (isset($dep['channel'])) { $remotechannel = $dep['channel']; } else { $remotechannel = 'pear.php.net'; } if (!$this->_registry->channelExists($remotechannel)) { do { if ($this->config->get('auto_discover')) { if ($this->discover($remotechannel)) { break; } } return PEAR::raiseError('Unknown remote channel: ' . $remotechannel); } while (false); } $chan = $this->_registry->getChannel($remotechannel); if (PEAR::isError($chan)) { return $chan; } $version = $this->_registry->packageInfo($dep['name'], 'version', $remotechannel); $this->configSet('default_channel', $remotechannel); } $state = isset($parr['state']) ? $parr['state'] : $this->config->get('preferred_state'); if (isset($parr['state']) && isset($parr['version'])) { unset($parr['state']); } if (isset($dep['uri'])) { $info = $this->newDownloaderPackage($this); PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); $err = $info->initialize($dep); PEAR::staticPopErrorHandling(); if (!$err) { // skip parameters that were missed by preferred_state return PEAR::raiseError('Cannot initialize dependency'); } if (PEAR::isError($err)) { if (!isset($this->_options['soft'])) { $this->log(0, $err->getMessage()); } if (is_object($info)) { $param = $info->getChannel() . '/' . $info->getPackage(); } return PEAR::raiseError('Package "' . $param . '" is not valid'); } return $info; } elseif ($chan->supportsREST($this->config->get('preferred_mirror')) && ( ($base2 = $chan->getBaseURL('REST1.3', $this->config->get('preferred_mirror'))) || ($base = $chan->getBaseURL('REST1.0', $this->config->get('preferred_mirror'))) ) ) { if ($base2) { $base = $base2; $rest = &$this->config->getREST('1.3', $this->_options); } else { $rest = &$this->config->getREST('1.0', $this->_options); } $url = $rest->getDepDownloadURL($base, $xsdversion, $dep, $parr, $state, $version, $chan->getName()); if (PEAR::isError($url)) { return $url; } if ($parr['channel'] != $curchannel) { $this->configSet('default_channel', $curchannel); } if (!is_array($url)) { return $url; } $url['raw'] = false; // no checking is necessary for REST if (!is_array($url['info'])) { return PEAR::raiseError('Invalid remote dependencies retrieved from REST - ' . 'this should never happen'); } if (isset($url['info']['required'])) { if (!class_exists('PEAR_PackageFile_v2')) { require_once 'PEAR/PackageFile/v2.php'; } $pf = new PEAR_PackageFile_v2; $pf->setRawChannel($remotechannel); } else { if (!class_exists('PEAR_PackageFile_v1')) { require_once 'PEAR/PackageFile/v1.php'; } $pf = new PEAR_PackageFile_v1; } $pf->setRawPackage($url['package']); $pf->setDeps($url['info']); if ($url['compatible']) { $pf->setCompatible($url['compatible']); } $pf->setRawState($url['stability']); $url['info'] = &$pf; if (!extension_loaded("zlib") || isset($this->_options['nocompress'])) { $ext = '.tar'; } else { $ext = '.tgz'; } if (is_array($url) && isset($url['url'])) { $url['url'] .= $ext; } return $url; } return $this->raiseError($parr['channel'] . ' is using a unsupported protocol - This should never happen.'); } /** * @deprecated in favor of _getPackageDownloadUrl */ function getPackageDownloadUrl($package, $version = null, $channel = false) { if ($version) { $package .= "-$version"; } if ($this === null || $this->_registry === null) { $package = "http://pear.php.net/get/$package"; } else { $chan = $this->_registry->getChannel($channel); if (PEAR::isError($chan)) { return ''; } $package = "http://" . $chan->getServer() . "/get/$package"; } if (!extension_loaded("zlib")) { $package .= '?uncompress=yes'; } return $package; } /** * Retrieve a list of downloaded packages after a call to {@link download()}. * * Also resets the list of downloaded packages. * @return array */ function getDownloadedPackages() { $ret = $this->_downloadedPackages; $this->_downloadedPackages = array(); $this->_toDownload = array(); return $ret; } function _downloadCallback($msg, $params = null) { switch ($msg) { case 'saveas': $this->log(1, "downloading $params ..."); break; case 'done': $this->log(1, '...done: ' . number_format($params, 0, '', ',') . ' bytes'); break; case 'bytesread': static $bytes; if (empty($bytes)) { $bytes = 0; } if (!($bytes % 10240)) { $this->log(1, '.', false); } $bytes += $params; break; case 'start': if($params[1] == -1) { $length = "Unknown size"; } else { $length = number_format($params[1], 0, '', ',')." bytes"; } $this->log(1, "Starting to download {$params[0]} ($length)"); break; } if (method_exists($this->ui, '_downloadCallback')) $this->ui->_downloadCallback($msg, $params); } function _prependPath($path, $prepend) { if (strlen($prepend) > 0) { if (OS_WINDOWS && preg_match('/^[a-z]:/i', $path)) { if (preg_match('/^[a-z]:/i', $prepend)) { $prepend = substr($prepend, 2); } elseif ($prepend{0} != '\\') { $prepend = "\\$prepend"; } $path = substr($path, 0, 2) . $prepend . substr($path, 2); } else { $path = $prepend . $path; } } return $path; } /** * @param string * @param integer */ function pushError($errmsg, $code = -1) { array_push($this->_errorStack, array($errmsg, $code)); } function getErrorMsgs() { $msgs = array(); $errs = $this->_errorStack; foreach ($errs as $err) { $msgs[] = $err[0]; } $this->_errorStack = array(); return $msgs; } /** * for BC * * @deprecated */ function sortPkgDeps(&$packages, $uninstall = false) { $uninstall ? $this->sortPackagesForUninstall($packages) : $this->sortPackagesForInstall($packages); } /** * Sort a list of arrays of array(downloaded packagefilename) by dependency. * * This uses the topological sort method from graph theory, and the * Structures_Graph package to properly sort dependencies for installation. * @param array an array of downloaded PEAR_Downloader_Packages * @return array array of array(packagefilename, package.xml contents) */ function sortPackagesForInstall(&$packages) { require_once 'Structures/Graph.php'; require_once 'Structures/Graph/Node.php'; require_once 'Structures/Graph/Manipulator/TopologicalSorter.php'; $depgraph = new Structures_Graph(true); $nodes = array(); $reg = &$this->config->getRegistry(); foreach ($packages as $i => $package) { $pname = $reg->parsedPackageNameToString( array( 'channel' => $package->getChannel(), 'package' => strtolower($package->getPackage()), )); $nodes[$pname] = new Structures_Graph_Node; $nodes[$pname]->setData($packages[$i]); $depgraph->addNode($nodes[$pname]); } $deplinks = array(); foreach ($nodes as $package => $node) { $pf = &$node->getData(); $pdeps = $pf->getDeps(true); if (!$pdeps) { continue; } if ($pf->getPackagexmlVersion() == '1.0') { foreach ($pdeps as $dep) { if ($dep['type'] != 'pkg' || (isset($dep['optional']) && $dep['optional'] == 'yes')) { continue; } $dname = $reg->parsedPackageNameToString( array( 'channel' => 'pear.php.net', 'package' => strtolower($dep['name']), )); if (isset($nodes[$dname])) { if (!isset($deplinks[$dname])) { $deplinks[$dname] = array(); } $deplinks[$dname][$package] = 1; // dependency is in installed packages continue; } $dname = $reg->parsedPackageNameToString( array( 'channel' => 'pecl.php.net', 'package' => strtolower($dep['name']), )); if (isset($nodes[$dname])) { if (!isset($deplinks[$dname])) { $deplinks[$dname] = array(); } $deplinks[$dname][$package] = 1; // dependency is in installed packages continue; } } } else { // the only ordering we care about is: // 1) subpackages must be installed before packages that depend on them // 2) required deps must be installed before packages that depend on them if (isset($pdeps['required']['subpackage'])) { $t = $pdeps['required']['subpackage']; if (!isset($t[0])) { $t = array($t); } $this->_setupGraph($t, $reg, $deplinks, $nodes, $package); } if (isset($pdeps['group'])) { if (!isset($pdeps['group'][0])) { $pdeps['group'] = array($pdeps['group']); } foreach ($pdeps['group'] as $group) { if (isset($group['subpackage'])) { $t = $group['subpackage']; if (!isset($t[0])) { $t = array($t); } $this->_setupGraph($t, $reg, $deplinks, $nodes, $package); } } } if (isset($pdeps['optional']['subpackage'])) { $t = $pdeps['optional']['subpackage']; if (!isset($t[0])) { $t = array($t); } $this->_setupGraph($t, $reg, $deplinks, $nodes, $package); } if (isset($pdeps['required']['package'])) { $t = $pdeps['required']['package']; if (!isset($t[0])) { $t = array($t); } $this->_setupGraph($t, $reg, $deplinks, $nodes, $package); } if (isset($pdeps['group'])) { if (!isset($pdeps['group'][0])) { $pdeps['group'] = array($pdeps['group']); } foreach ($pdeps['group'] as $group) { if (isset($group['package'])) { $t = $group['package']; if (!isset($t[0])) { $t = array($t); } $this->_setupGraph($t, $reg, $deplinks, $nodes, $package); } } } } } $this->_detectDepCycle($deplinks); foreach ($deplinks as $dependent => $parents) { foreach ($parents as $parent => $unused) { $nodes[$dependent]->connectTo($nodes[$parent]); } } $installOrder = Structures_Graph_Manipulator_TopologicalSorter::sort($depgraph); $ret = array(); for ($i = 0, $count = count($installOrder); $i < $count; $i++) { foreach ($installOrder[$i] as $index => $sortedpackage) { $data = &$installOrder[$i][$index]->getData(); $ret[] = &$nodes[$reg->parsedPackageNameToString( array( 'channel' => $data->getChannel(), 'package' => strtolower($data->getPackage()), ))]->getData(); } } $packages = $ret; return; } /** * Detect recursive links between dependencies and break the cycles * * @param array * @access private */ function _detectDepCycle(&$deplinks) { do { $keepgoing = false; foreach ($deplinks as $dep => $parents) { foreach ($parents as $parent => $unused) { // reset the parent cycle detector $this->_testCycle(null, null, null); if ($this->_testCycle($dep, $deplinks, $parent)) { $keepgoing = true; unset($deplinks[$dep][$parent]); if (count($deplinks[$dep]) == 0) { unset($deplinks[$dep]); } continue 3; } } } } while ($keepgoing); } function _testCycle($test, $deplinks, $dep) { static $visited = array(); if ($test === null) { $visited = array(); return; } // this happens when a parent has a dep cycle on another dependency // but the child is not part of the cycle if (isset($visited[$dep])) { return false; } $visited[$dep] = 1; if ($test == $dep) { return true; } if (isset($deplinks[$dep])) { if (in_array($test, array_keys($deplinks[$dep]), true)) { return true; } foreach ($deplinks[$dep] as $parent => $unused) { if ($this->_testCycle($test, $deplinks, $parent)) { return true; } } } return false; } /** * Set up the dependency for installation parsing * * @param array $t dependency information * @param PEAR_Registry $reg * @param array $deplinks list of dependency links already established * @param array $nodes all existing package nodes * @param string $package parent package name * @access private */ function _setupGraph($t, $reg, &$deplinks, &$nodes, $package) { foreach ($t as $dep) { $depchannel = !isset($dep['channel']) ? '__uri': $dep['channel']; $dname = $reg->parsedPackageNameToString( array( 'channel' => $depchannel, 'package' => strtolower($dep['name']), )); if (isset($nodes[$dname])) { if (!isset($deplinks[$dname])) { $deplinks[$dname] = array(); } $deplinks[$dname][$package] = 1; } } } function _dependsOn($a, $b) { return $this->_checkDepTree(strtolower($a->getChannel()), strtolower($a->getPackage()), $b); } function _checkDepTree($channel, $package, $b, $checked = array()) { $checked[$channel][$package] = true; if (!isset($this->_depTree[$channel][$package])) { return false; } if (isset($this->_depTree[$channel][$package][strtolower($b->getChannel())] [strtolower($b->getPackage())])) { return true; } foreach ($this->_depTree[$channel][$package] as $ch => $packages) { foreach ($packages as $pa => $true) { if ($this->_checkDepTree($ch, $pa, $b, $checked)) { return true; } } } return false; } function _sortInstall($a, $b) { if (!$a->getDeps() && !$b->getDeps()) { return 0; // neither package has dependencies, order is insignificant } if ($a->getDeps() && !$b->getDeps()) { return 1; // $a must be installed after $b because $a has dependencies } if (!$a->getDeps() && $b->getDeps()) { return -1; // $b must be installed after $a because $b has dependencies } // both packages have dependencies if ($this->_dependsOn($a, $b)) { return 1; } if ($this->_dependsOn($b, $a)) { return -1; } return 0; } /** * Download a file through HTTP. Considers suggested file name in * Content-disposition: header and can run a callback function for * different events. The callback will be called with two * parameters: the callback type, and parameters. The implemented * callback types are: * * 'setup' called at the very beginning, parameter is a UI object * that should be used for all output * 'message' the parameter is a string with an informational message * 'saveas' may be used to save with a different file name, the * parameter is the filename that is about to be used. * If a 'saveas' callback returns a non-empty string, * that file name will be used as the filename instead. * Note that $save_dir will not be affected by this, only * the basename of the file. * 'start' download is starting, parameter is number of bytes * that are expected, or -1 if unknown * 'bytesread' parameter is the number of bytes read so far * 'done' download is complete, parameter is the total number * of bytes read * 'connfailed' if the TCP/SSL connection fails, this callback is called * with array(host,port,errno,errmsg) * 'writefailed' if writing to disk fails, this callback is called * with array(destfile,errmsg) * * If an HTTP proxy has been configured (http_proxy PEAR_Config * setting), the proxy will be used. * * @param string $url the URL to download * @param object $ui PEAR_Frontend_* instance * @param object $config PEAR_Config instance * @param string $save_dir directory to save file in * @param mixed $callback function/method to call for status * updates * @param false|string|array $lastmodified header values to check against for caching * use false to return the header values from this download * @param false|array $accept Accept headers to send * @param false|string $channel Channel to use for retrieving authentication * @return mixed Returns the full path of the downloaded file or a PEAR * error on failure. If the error is caused by * socket-related errors, the error object will * have the fsockopen error code available through * getCode(). If caching is requested, then return the header * values. * If $lastmodified was given and the there are no changes, * boolean false is returned. * * @access public */ public static function _downloadHttp( $object, $url, &$ui, $save_dir = '.', $callback = null, $lastmodified = null, $accept = false, $channel = false ) { static $redirect = 0; // always reset , so we are clean case of error $wasredirect = $redirect; $redirect = 0; if ($callback) { call_user_func($callback, 'setup', array(&$ui)); } $info = parse_url($url); if (!isset($info['scheme']) || !in_array($info['scheme'], array('http', 'https'))) { return PEAR::raiseError('Cannot download non-http URL "' . $url . '"'); } if (!isset($info['host'])) { return PEAR::raiseError('Cannot download from non-URL "' . $url . '"'); } $host = isset($info['host']) ? $info['host'] : null; $port = isset($info['port']) ? $info['port'] : null; $path = isset($info['path']) ? $info['path'] : null; if ($object !== null) { $config = $object->config; } else { $config = &PEAR_Config::singleton(); } $proxy_host = $proxy_port = $proxy_user = $proxy_pass = ''; if ($config->get('http_proxy') && $proxy = parse_url($config->get('http_proxy'))) { $proxy_host = isset($proxy['host']) ? $proxy['host'] : null; if (isset($proxy['scheme']) && $proxy['scheme'] == 'https') { $proxy_host = 'ssl://' . $proxy_host; } $proxy_port = isset($proxy['port']) ? $proxy['port'] : 8080; $proxy_user = isset($proxy['user']) ? urldecode($proxy['user']) : null; $proxy_pass = isset($proxy['pass']) ? urldecode($proxy['pass']) : null; if ($callback) { call_user_func($callback, 'message', "Using HTTP proxy $host:$port"); } } if (empty($port)) { $port = (isset($info['scheme']) && $info['scheme'] == 'https') ? 443 : 80; } $scheme = (isset($info['scheme']) && $info['scheme'] == 'https') ? 'https' : 'http'; if ($proxy_host != '') { $fp = @fsockopen($proxy_host, $proxy_port, $errno, $errstr); if (!$fp) { if ($callback) { call_user_func($callback, 'connfailed', array($proxy_host, $proxy_port, $errno, $errstr)); } return PEAR::raiseError("Connection to `$proxy_host:$proxy_port' failed: $errstr", $errno); } if ($lastmodified === false || $lastmodified) { $request = "GET $url HTTP/1.1\r\n"; $request .= "Host: $host\r\n"; } else { $request = "GET $url HTTP/1.0\r\n"; $request .= "Host: $host\r\n"; } } else { $network_host = $host; if (isset($info['scheme']) && $info['scheme'] == 'https') { $network_host = 'ssl://' . $host; } $fp = @fsockopen($network_host, $port, $errno, $errstr); if (!$fp) { if ($callback) { call_user_func($callback, 'connfailed', array($host, $port, $errno, $errstr)); } return PEAR::raiseError("Connection to `$host:$port' failed: $errstr", $errno); } if ($lastmodified === false || $lastmodified) { $request = "GET $path HTTP/1.1\r\n"; $request .= "Host: $host\r\n"; } else { $request = "GET $path HTTP/1.0\r\n"; $request .= "Host: $host\r\n"; } } $ifmodifiedsince = ''; if (is_array($lastmodified)) { if (isset($lastmodified['Last-Modified'])) { $ifmodifiedsince = 'If-Modified-Since: ' . $lastmodified['Last-Modified'] . "\r\n"; } if (isset($lastmodified['ETag'])) { $ifmodifiedsince .= "If-None-Match: $lastmodified[ETag]\r\n"; } } else { $ifmodifiedsince = ($lastmodified ? "If-Modified-Since: $lastmodified\r\n" : ''); } $request .= $ifmodifiedsince . "User-Agent: PEAR/@package_version@/PHP/" . PHP_VERSION . "\r\n"; if ($object !== null) { // only pass in authentication for non-static calls $username = $config->get('username', null, $channel); $password = $config->get('password', null, $channel); if ($username && $password) { $tmp = base64_encode("$username:$password"); $request .= "Authorization: Basic $tmp\r\n"; } } if ($proxy_host != '' && $proxy_user != '') { $request .= 'Proxy-Authorization: Basic ' . base64_encode($proxy_user . ':' . $proxy_pass) . "\r\n"; } if ($accept) { $request .= 'Accept: ' . implode(', ', $accept) . "\r\n"; } $request .= "Connection: close\r\n"; $request .= "\r\n"; fwrite($fp, $request); $headers = array(); $reply = 0; while (trim($line = fgets($fp, 1024))) { if (preg_match('/^([^:]+):\s+(.*)\s*\\z/', $line, $matches)) { $headers[strtolower($matches[1])] = trim($matches[2]); } elseif (preg_match('|^HTTP/1.[01] ([0-9]{3}) |', $line, $matches)) { $reply = (int)$matches[1]; if ($reply == 304 && ($lastmodified || ($lastmodified === false))) { return false; } if (!in_array($reply, array(200, 301, 302, 303, 305, 307))) { return PEAR::raiseError("File $scheme://$host:$port$path not valid (received: $line)"); } } } if ($reply != 200) { if (!isset($headers['location'])) { return PEAR::raiseError("File $scheme://$host:$port$path not valid (redirected but no location)"); } if ($wasredirect > 4) { return PEAR::raiseError("File $scheme://$host:$port$path not valid (redirection looped more than 5 times)"); } $redirect = $wasredirect + 1; return static::_downloadHttp($object, $headers['location'], $ui, $save_dir, $callback, $lastmodified, $accept); } if (isset($headers['content-disposition']) && preg_match('/\sfilename=\"([^;]*\S)\"\s*(;|\\z)/', $headers['content-disposition'], $matches)) { $save_as = basename($matches[1]); } else { $save_as = basename($url); } if ($callback) { $tmp = call_user_func($callback, 'saveas', $save_as); if ($tmp) { $save_as = $tmp; } } $dest_file = $save_dir . DIRECTORY_SEPARATOR . $save_as; if (is_link($dest_file)) { return PEAR::raiseError('SECURITY ERROR: Will not write to ' . $dest_file . ' as it is symlinked to ' . readlink($dest_file) . ' - Possible symlink attack'); } if (!$wp = @fopen($dest_file, 'wb')) { fclose($fp); if ($callback) { call_user_func($callback, 'writefailed', array($dest_file, $php_errormsg)); } return PEAR::raiseError("could not open $dest_file for writing"); } $length = isset($headers['content-length']) ? $headers['content-length'] : -1; $bytes = 0; if ($callback) { call_user_func($callback, 'start', array(basename($dest_file), $length)); } while ($data = fread($fp, 1024)) { $bytes += strlen($data); if ($callback) { call_user_func($callback, 'bytesread', $bytes); } if (!@fwrite($wp, $data)) { fclose($fp); if ($callback) { call_user_func($callback, 'writefailed', array($dest_file, $php_errormsg)); } return PEAR::raiseError("$dest_file: write failed ($php_errormsg)"); } } fclose($fp); fclose($wp); if ($callback) { call_user_func($callback, 'done', $bytes); } if ($lastmodified === false || $lastmodified) { if (isset($headers['etag'])) { $lastmodified = array('ETag' => $headers['etag']); } if (isset($headers['last-modified'])) { if (is_array($lastmodified)) { $lastmodified['Last-Modified'] = $headers['last-modified']; } else { $lastmodified = $headers['last-modified']; } } return array($dest_file, $lastmodified, $headers); } return $dest_file; } } php-pear-1.10.1+submodules+notgz/PEAR/Downloader/000077500000000000000000000000001262614675700214665ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/PEAR/Downloader/Package.php000066400000000000000000002246101262614675700235370ustar00rootroot00000000000000 * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ /** * Error code when parameter initialization fails because no releases * exist within preferred_state, but releases do exist */ define('PEAR_DOWNLOADER_PACKAGE_STATE', -1003); /** * Error code when parameter initialization fails because no releases * exist that will work with the existing PHP version */ define('PEAR_DOWNLOADER_PACKAGE_PHPVERSION', -1004); /** * Coordinates download parameters and manages their dependencies * prior to downloading them. * * Input can come from three sources: * * - local files (archives or package.xml) * - remote files (downloadable urls) * - abstract package names * * The first two elements are handled cleanly by PEAR_PackageFile, but the third requires * accessing pearweb's xml-rpc interface to determine necessary dependencies, and the * format returned of dependencies is slightly different from that used in package.xml. * * This class hides the differences between these elements, and makes automatic * dependency resolution a piece of cake. It also manages conflicts when * two classes depend on incompatible dependencies, or differing versions of the same * package dependency. In addition, download will not be attempted if the php version is * not supported, PEAR installer version is not supported, or non-PECL extensions are not * installed. * @category pear * @package PEAR * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version Release: @PEAR-VER@ * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ class PEAR_Downloader_Package { /** * @var PEAR_Downloader */ var $_downloader; /** * @var PEAR_Config */ var $_config; /** * @var PEAR_Registry */ var $_registry; /** * Used to implement packagingroot properly * @var PEAR_Registry */ var $_installRegistry; /** * @var PEAR_PackageFile_v1|PEAR_PackageFile|v2 */ var $_packagefile; /** * @var array */ var $_parsedname; /** * @var array */ var $_downloadURL; /** * @var array */ var $_downloadDeps = array(); /** * @var boolean */ var $_valid = false; /** * @var boolean */ var $_analyzed = false; /** * if this or a parent package was invoked with Package-state, this is set to the * state variable. * * This allows temporary reassignment of preferred_state for a parent package and all of * its dependencies. * @var string|false */ var $_explicitState = false; /** * If this package is invoked with Package#group, this variable will be true */ var $_explicitGroup = false; /** * Package type local|url * @var string */ var $_type; /** * Contents of package.xml, if downloaded from a remote channel * @var string|false * @access private */ var $_rawpackagefile; /** * @var boolean * @access private */ var $_validated = false; /** * @param PEAR_Downloader */ function __construct(&$downloader) { $this->_downloader = &$downloader; $this->_config = &$this->_downloader->config; $this->_registry = &$this->_config->getRegistry(); $options = $downloader->getOptions(); if (isset($options['packagingroot'])) { $this->_config->setInstallRoot($options['packagingroot']); $this->_installRegistry = &$this->_config->getRegistry(); $this->_config->setInstallRoot(false); } else { $this->_installRegistry = &$this->_registry; } $this->_valid = $this->_analyzed = false; } /** * Parse the input and determine whether this is a local file, a remote uri, or an * abstract package name. * * This is the heart of the PEAR_Downloader_Package(), and is used in * {@link PEAR_Downloader::download()} * @param string * @return bool|PEAR_Error */ function initialize($param) { $origErr = $this->_fromFile($param); if ($this->_valid) { return true; } $options = $this->_downloader->getOptions(); if (isset($options['offline'])) { if (PEAR::isError($origErr) && !isset($options['soft'])) { foreach ($origErr->getUserInfo() as $userInfo) { if (isset($userInfo['message'])) { $this->_downloader->log(0, $userInfo['message']); } } $this->_downloader->log(0, $origErr->getMessage()); } return PEAR::raiseError('Cannot download non-local package "' . $param . '"'); } $err = $this->_fromUrl($param); if (PEAR::isError($err) || !$this->_valid) { if ($this->_type == 'url') { if (PEAR::isError($err) && !isset($options['soft'])) { $this->_downloader->log(0, $err->getMessage()); } return PEAR::raiseError("Invalid or missing remote package file"); } $err = $this->_fromString($param); if (PEAR::isError($err) || !$this->_valid) { if (PEAR::isError($err) && $err->getCode() == PEAR_DOWNLOADER_PACKAGE_STATE) { return false; // instruct the downloader to silently skip } if (isset($this->_type) && $this->_type == 'local' && PEAR::isError($origErr)) { if (is_array($origErr->getUserInfo())) { foreach ($origErr->getUserInfo() as $err) { if (is_array($err)) { $err = $err['message']; } if (!isset($options['soft'])) { $this->_downloader->log(0, $err); } } } if (!isset($options['soft'])) { $this->_downloader->log(0, $origErr->getMessage()); } if (is_array($param)) { $param = $this->_registry->parsedPackageNameToString($param, true); } if (!isset($options['soft'])) { $this->_downloader->log(2, "Cannot initialize '$param', invalid or missing package file"); } // Passing no message back - already logged above return PEAR::raiseError(); } if (PEAR::isError($err) && !isset($options['soft'])) { $this->_downloader->log(0, $err->getMessage()); } if (is_array($param)) { $param = $this->_registry->parsedPackageNameToString($param, true); } if (!isset($options['soft'])) { $this->_downloader->log(2, "Cannot initialize '$param', invalid or missing package file"); } // Passing no message back - already logged above return PEAR::raiseError(); } } return true; } /** * Retrieve any non-local packages * @return PEAR_PackageFile_v1|PEAR_PackageFile_v2|PEAR_Error */ function &download() { if (isset($this->_packagefile)) { return $this->_packagefile; } if (isset($this->_downloadURL['url'])) { $this->_isvalid = false; $info = $this->getParsedPackage(); foreach ($info as $i => $p) { $info[$i] = strtolower($p); } $err = $this->_fromUrl($this->_downloadURL['url'], $this->_registry->parsedPackageNameToString($this->_parsedname, true)); $newinfo = $this->getParsedPackage(); foreach ($newinfo as $i => $p) { $newinfo[$i] = strtolower($p); } if ($info != $newinfo) { do { if ($info['channel'] == 'pecl.php.net' && $newinfo['channel'] == 'pear.php.net') { $info['channel'] = 'pear.php.net'; if ($info == $newinfo) { // skip the channel check if a pecl package says it's a PEAR package break; } } if ($info['channel'] == 'pear.php.net' && $newinfo['channel'] == 'pecl.php.net') { $info['channel'] = 'pecl.php.net'; if ($info == $newinfo) { // skip the channel check if a pecl package says it's a PEAR package break; } } return PEAR::raiseError('CRITICAL ERROR: We are ' . $this->_registry->parsedPackageNameToString($info) . ', but the file ' . 'downloaded claims to be ' . $this->_registry->parsedPackageNameToString($this->getParsedPackage())); } while (false); } if (PEAR::isError($err) || !$this->_valid) { return $err; } } $this->_type = 'local'; return $this->_packagefile; } function &getPackageFile() { return $this->_packagefile; } function &getDownloader() { return $this->_downloader; } function getType() { return $this->_type; } /** * Like {@link initialize()}, but operates on a dependency */ function fromDepURL($dep) { $this->_downloadURL = $dep; if (isset($dep['uri'])) { $options = $this->_downloader->getOptions(); if (!extension_loaded("zlib") || isset($options['nocompress'])) { $ext = '.tar'; } else { $ext = '.tgz'; } PEAR::pushErrorHandling(PEAR_ERROR_RETURN); $err = $this->_fromUrl($dep['uri'] . $ext); PEAR::popErrorHandling(); if (PEAR::isError($err)) { if (!isset($options['soft'])) { $this->_downloader->log(0, $err->getMessage()); } return PEAR::raiseError('Invalid uri dependency "' . $dep['uri'] . $ext . '", ' . 'cannot download'); } } else { $this->_parsedname = array( 'package' => $dep['info']->getPackage(), 'channel' => $dep['info']->getChannel(), 'version' => $dep['version'] ); if (!isset($dep['nodefault'])) { $this->_parsedname['group'] = 'default'; // download the default dependency group $this->_explicitGroup = false; } $this->_rawpackagefile = $dep['raw']; } } function detectDependencies($params) { $options = $this->_downloader->getOptions(); if (isset($options['downloadonly'])) { return; } if (isset($options['offline'])) { $this->_downloader->log(3, 'Skipping dependency download check, --offline specified'); return; } $pname = $this->getParsedPackage(); if (!$pname) { return; } $deps = $this->getDeps(); if (!$deps) { return; } if (isset($deps['required'])) { // package.xml 2.0 return $this->_detect2($deps, $pname, $options, $params); } return $this->_detect1($deps, $pname, $options, $params); } function setValidated() { $this->_validated = true; } function alreadyValidated() { return $this->_validated; } /** * Remove packages to be downloaded that are already installed * @param array of PEAR_Downloader_Package objects */ public static function removeInstalled(&$params) { if (!isset($params[0])) { return; } $options = $params[0]->_downloader->getOptions(); if (!isset($options['downloadonly'])) { foreach ($params as $i => $param) { $package = $param->getPackage(); $channel = $param->getChannel(); // remove self if already installed with this version // this does not need any pecl magic - we only remove exact matches if ($param->_installRegistry->packageExists($package, $channel)) { $packageVersion = $param->_installRegistry->packageInfo($package, 'version', $channel); if (version_compare($packageVersion, $param->getVersion(), '==')) { if (!isset($options['force']) && !isset($options['packagingroot'])) { $info = $param->getParsedPackage(); unset($info['version']); unset($info['state']); if (!isset($options['soft'])) { $param->_downloader->log(1, 'Skipping package "' . $param->getShortName() . '", already installed as version ' . $packageVersion); } $params[$i] = false; } } elseif (!isset($options['force']) && !isset($options['upgrade']) && !isset($options['soft']) && !isset($options['packagingroot'])) { $info = $param->getParsedPackage(); $param->_downloader->log(1, 'Skipping package "' . $param->getShortName() . '", already installed as version ' . $packageVersion); $params[$i] = false; } } } } PEAR_Downloader_Package::removeDuplicates($params); } function _detect2($deps, $pname, $options, $params) { $this->_downloadDeps = array(); $groupnotfound = false; foreach (array('package', 'subpackage') as $packagetype) { // get required dependency group if (isset($deps['required'][$packagetype])) { if (isset($deps['required'][$packagetype][0])) { foreach ($deps['required'][$packagetype] as $dep) { if (isset($dep['conflicts'])) { // skip any package that this package conflicts with continue; } $ret = $this->_detect2Dep($dep, $pname, 'required', $params); if (is_array($ret)) { $this->_downloadDeps[] = $ret; } elseif (PEAR::isError($ret) && !isset($options['soft'])) { $this->_downloader->log(0, $ret->getMessage()); } } } else { $dep = $deps['required'][$packagetype]; if (!isset($dep['conflicts'])) { // skip any package that this package conflicts with $ret = $this->_detect2Dep($dep, $pname, 'required', $params); if (is_array($ret)) { $this->_downloadDeps[] = $ret; } elseif (PEAR::isError($ret) && !isset($options['soft'])) { $this->_downloader->log(0, $ret->getMessage()); } } } } // get optional dependency group, if any if (isset($deps['optional'][$packagetype])) { $skipnames = array(); if (!isset($deps['optional'][$packagetype][0])) { $deps['optional'][$packagetype] = array($deps['optional'][$packagetype]); } foreach ($deps['optional'][$packagetype] as $dep) { $skip = false; if (!isset($options['alldeps'])) { $dep['package'] = $dep['name']; if (!isset($options['soft'])) { $this->_downloader->log(3, 'Notice: package "' . $this->_registry->parsedPackageNameToString($this->getParsedPackage(), true) . '" optional dependency "' . $this->_registry->parsedPackageNameToString(array('package' => $dep['name'], 'channel' => 'pear.php.net'), true) . '" will not be automatically downloaded'); } $skipnames[] = $this->_registry->parsedPackageNameToString($dep, true); $skip = true; unset($dep['package']); } $ret = $this->_detect2Dep($dep, $pname, 'optional', $params); if (PEAR::isError($ret) && !isset($options['soft'])) { $this->_downloader->log(0, $ret->getMessage()); } if (!$ret) { $dep['package'] = $dep['name']; $skip = count($skipnames) ? $skipnames[count($skipnames) - 1] : ''; if ($skip == $this->_registry->parsedPackageNameToString($dep, true)) { array_pop($skipnames); } } if (!$skip && is_array($ret)) { $this->_downloadDeps[] = $ret; } } if (count($skipnames)) { if (!isset($options['soft'])) { $this->_downloader->log(1, 'Did not download optional dependencies: ' . implode(', ', $skipnames) . ', use --alldeps to download automatically'); } } } // get requested dependency group, if any $groupname = $this->getGroup(); $explicit = $this->_explicitGroup; if (!$groupname) { if (!$this->canDefault()) { continue; } $groupname = 'default'; // try the default dependency group } if ($groupnotfound) { continue; } if (isset($deps['group'])) { if (isset($deps['group']['attribs'])) { if (strtolower($deps['group']['attribs']['name']) == strtolower($groupname)) { $group = $deps['group']; } elseif ($explicit) { if (!isset($options['soft'])) { $this->_downloader->log(0, 'Warning: package "' . $this->_registry->parsedPackageNameToString($pname, true) . '" has no dependency ' . 'group named "' . $groupname . '"'); } $groupnotfound = true; continue; } } else { $found = false; foreach ($deps['group'] as $group) { if (strtolower($group['attribs']['name']) == strtolower($groupname)) { $found = true; break; } } if (!$found) { if ($explicit) { if (!isset($options['soft'])) { $this->_downloader->log(0, 'Warning: package "' . $this->_registry->parsedPackageNameToString($pname, true) . '" has no dependency ' . 'group named "' . $groupname . '"'); } } $groupnotfound = true; continue; } } } if (isset($group) && isset($group[$packagetype])) { if (isset($group[$packagetype][0])) { foreach ($group[$packagetype] as $dep) { $ret = $this->_detect2Dep($dep, $pname, 'dependency group "' . $group['attribs']['name'] . '"', $params); if (is_array($ret)) { $this->_downloadDeps[] = $ret; } elseif (PEAR::isError($ret) && !isset($options['soft'])) { $this->_downloader->log(0, $ret->getMessage()); } } } else { $ret = $this->_detect2Dep($group[$packagetype], $pname, 'dependency group "' . $group['attribs']['name'] . '"', $params); if (is_array($ret)) { $this->_downloadDeps[] = $ret; } elseif (PEAR::isError($ret) && !isset($options['soft'])) { $this->_downloader->log(0, $ret->getMessage()); } } } } } function _detect2Dep($dep, $pname, $group, $params) { if (isset($dep['conflicts'])) { return true; } $options = $this->_downloader->getOptions(); if (isset($dep['uri'])) { return array('uri' => $dep['uri'], 'dep' => $dep);; } $testdep = $dep; $testdep['package'] = $dep['name']; if (PEAR_Downloader_Package::willDownload($testdep, $params)) { $dep['package'] = $dep['name']; if (!isset($options['soft'])) { $this->_downloader->log(2, $this->getShortName() . ': Skipping ' . $group . ' dependency "' . $this->_registry->parsedPackageNameToString($dep, true) . '", will be installed'); } return false; } $options = $this->_downloader->getOptions(); PEAR::pushErrorHandling(PEAR_ERROR_RETURN); if ($this->_explicitState) { $pname['state'] = $this->_explicitState; } $url = $this->_downloader->_getDepPackageDownloadUrl($dep, $pname); if (PEAR::isError($url)) { PEAR::popErrorHandling(); return $url; } $dep['package'] = $dep['name']; $ret = $this->_analyzeDownloadURL($url, 'dependency', $dep, $params, $group == 'optional' && !isset($options['alldeps']), true); PEAR::popErrorHandling(); if (PEAR::isError($ret)) { if (!isset($options['soft'])) { $this->_downloader->log(0, $ret->getMessage()); } return false; } // check to see if a dep is already installed and is the same or newer if (!isset($dep['min']) && !isset($dep['max']) && !isset($dep['recommended'])) { $oper = 'has'; } else { $oper = 'gt'; } // do not try to move this before getDepPackageDownloadURL // we can't determine whether upgrade is necessary until we know what // version would be downloaded if (!isset($options['force']) && $this->isInstalled($ret, $oper)) { $version = $this->_installRegistry->packageInfo($dep['name'], 'version', $dep['channel']); $dep['package'] = $dep['name']; if (!isset($options['soft'])) { $this->_downloader->log(3, $this->getShortName() . ': Skipping ' . $group . ' dependency "' . $this->_registry->parsedPackageNameToString($dep, true) . '" version ' . $url['version'] . ', already installed as version ' . $version); } return false; } if (isset($dep['nodefault'])) { $ret['nodefault'] = true; } return $ret; } function _detect1($deps, $pname, $options, $params) { $this->_downloadDeps = array(); $skipnames = array(); foreach ($deps as $dep) { $nodownload = false; if (isset ($dep['type']) && $dep['type'] === 'pkg') { $dep['channel'] = 'pear.php.net'; $dep['package'] = $dep['name']; switch ($dep['rel']) { case 'not' : continue 2; case 'ge' : case 'eq' : case 'gt' : case 'has' : $group = (!isset($dep['optional']) || $dep['optional'] == 'no') ? 'required' : 'optional'; if (PEAR_Downloader_Package::willDownload($dep, $params)) { $this->_downloader->log(2, $this->getShortName() . ': Skipping ' . $group . ' dependency "' . $this->_registry->parsedPackageNameToString($dep, true) . '", will be installed'); continue 2; } $fakedp = new PEAR_PackageFile_v1; $fakedp->setPackage($dep['name']); // skip internet check if we are not upgrading (bug #5810) if (!isset($options['upgrade']) && $this->isInstalled( $fakedp, $dep['rel'])) { $this->_downloader->log(2, $this->getShortName() . ': Skipping ' . $group . ' dependency "' . $this->_registry->parsedPackageNameToString($dep, true) . '", is already installed'); continue 2; } } PEAR::pushErrorHandling(PEAR_ERROR_RETURN); if ($this->_explicitState) { $pname['state'] = $this->_explicitState; } $url = $this->_downloader->_getDepPackageDownloadUrl($dep, $pname); $chan = 'pear.php.net'; if (PEAR::isError($url)) { // check to see if this is a pecl package that has jumped // from pear.php.net to pecl.php.net channel if (!class_exists('PEAR_Dependency2')) { require_once 'PEAR/Dependency2.php'; } $newdep = PEAR_Dependency2::normalizeDep($dep); $newdep = $newdep[0]; $newdep['channel'] = 'pecl.php.net'; $chan = 'pecl.php.net'; $url = $this->_downloader->_getDepPackageDownloadUrl($newdep, $pname); $obj = &$this->_installRegistry->getPackage($dep['name']); if (PEAR::isError($url)) { PEAR::popErrorHandling(); if ($obj !== null && $this->isInstalled($obj, $dep['rel'])) { $group = (!isset($dep['optional']) || $dep['optional'] == 'no') ? 'required' : 'optional'; $dep['package'] = $dep['name']; if (!isset($options['soft'])) { $this->_downloader->log(3, $this->getShortName() . ': Skipping ' . $group . ' dependency "' . $this->_registry->parsedPackageNameToString($dep, true) . '", already installed as version ' . $obj->getVersion()); } $skip = count($skipnames) ? $skipnames[count($skipnames) - 1] : ''; if ($skip == $this->_registry->parsedPackageNameToString($dep, true)) { array_pop($skipnames); } continue; } else { if (isset($dep['optional']) && $dep['optional'] == 'yes') { $this->_downloader->log(2, $this->getShortName() . ': Skipping optional dependency "' . $this->_registry->parsedPackageNameToString($dep, true) . '", no releases exist'); continue; } else { return $url; } } } } PEAR::popErrorHandling(); if (!isset($options['alldeps'])) { if (isset($dep['optional']) && $dep['optional'] == 'yes') { if (!isset($options['soft'])) { $this->_downloader->log(3, 'Notice: package "' . $this->getShortName() . '" optional dependency "' . $this->_registry->parsedPackageNameToString( array('channel' => $chan, 'package' => $dep['name']), true) . '" will not be automatically downloaded'); } $skipnames[] = $this->_registry->parsedPackageNameToString( array('channel' => $chan, 'package' => $dep['name']), true); $nodownload = true; } } if (!isset($options['alldeps']) && !isset($options['onlyreqdeps'])) { if (!isset($dep['optional']) || $dep['optional'] == 'no') { if (!isset($options['soft'])) { $this->_downloader->log(3, 'Notice: package "' . $this->getShortName() . '" required dependency "' . $this->_registry->parsedPackageNameToString( array('channel' => $chan, 'package' => $dep['name']), true) . '" will not be automatically downloaded'); } $skipnames[] = $this->_registry->parsedPackageNameToString( array('channel' => $chan, 'package' => $dep['name']), true); $nodownload = true; } } // check to see if a dep is already installed // do not try to move this before getDepPackageDownloadURL // we can't determine whether upgrade is necessary until we know what // version would be downloaded if (!isset($options['force']) && $this->isInstalled( $url, $dep['rel'])) { $group = (!isset($dep['optional']) || $dep['optional'] == 'no') ? 'required' : 'optional'; $dep['package'] = $dep['name']; if (isset($newdep)) { $version = $this->_installRegistry->packageInfo($newdep['name'], 'version', $newdep['channel']); } else { $version = $this->_installRegistry->packageInfo($dep['name'], 'version'); } $dep['version'] = $url['version']; if (!isset($options['soft'])) { $this->_downloader->log(3, $this->getShortName() . ': Skipping ' . $group . ' dependency "' . $this->_registry->parsedPackageNameToString($dep, true) . '", already installed as version ' . $version); } $skip = count($skipnames) ? $skipnames[count($skipnames) - 1] : ''; if ($skip == $this->_registry->parsedPackageNameToString($dep, true)) { array_pop($skipnames); } continue; } if ($nodownload) { continue; } PEAR::pushErrorHandling(PEAR_ERROR_RETURN); if (isset($newdep)) { $dep = $newdep; } $dep['package'] = $dep['name']; $ret = $this->_analyzeDownloadURL($url, 'dependency', $dep, $params, isset($dep['optional']) && $dep['optional'] == 'yes' && !isset($options['alldeps']), true); PEAR::popErrorHandling(); if (PEAR::isError($ret)) { if (!isset($options['soft'])) { $this->_downloader->log(0, $ret->getMessage()); } continue; } $this->_downloadDeps[] = $ret; } } if (count($skipnames)) { if (!isset($options['soft'])) { $this->_downloader->log(1, 'Did not download dependencies: ' . implode(', ', $skipnames) . ', use --alldeps or --onlyreqdeps to download automatically'); } } } function setDownloadURL($pkg) { $this->_downloadURL = $pkg; } /** * Set the package.xml object for this downloaded package * * @param PEAR_PackageFile_v1|PEAR_PackageFile_v2 $pkg */ function setPackageFile(&$pkg) { $this->_packagefile = &$pkg; } function getShortName() { return $this->_registry->parsedPackageNameToString(array('channel' => $this->getChannel(), 'package' => $this->getPackage()), true); } function getParsedPackage() { if (isset($this->_packagefile) || isset($this->_parsedname)) { return array('channel' => $this->getChannel(), 'package' => $this->getPackage(), 'version' => $this->getVersion()); } return false; } function getDownloadURL() { return $this->_downloadURL; } function canDefault() { if (isset($this->_downloadURL) && isset($this->_downloadURL['nodefault'])) { return false; } return true; } function getPackage() { if (isset($this->_packagefile)) { return $this->_packagefile->getPackage(); } elseif (isset($this->_downloadURL['info'])) { return $this->_downloadURL['info']->getPackage(); } return false; } /** * @param PEAR_PackageFile_v1|PEAR_PackageFile_v2 */ function isSubpackage(&$pf) { if (isset($this->_packagefile)) { return $this->_packagefile->isSubpackage($pf); } elseif (isset($this->_downloadURL['info'])) { return $this->_downloadURL['info']->isSubpackage($pf); } return false; } function getPackageType() { if (isset($this->_packagefile)) { return $this->_packagefile->getPackageType(); } elseif (isset($this->_downloadURL['info'])) { return $this->_downloadURL['info']->getPackageType(); } return false; } function isBundle() { if (isset($this->_packagefile)) { return $this->_packagefile->getPackageType() == 'bundle'; } return false; } function getPackageXmlVersion() { if (isset($this->_packagefile)) { return $this->_packagefile->getPackagexmlVersion(); } elseif (isset($this->_downloadURL['info'])) { return $this->_downloadURL['info']->getPackagexmlVersion(); } return '1.0'; } function getChannel() { if (isset($this->_packagefile)) { return $this->_packagefile->getChannel(); } elseif (isset($this->_downloadURL['info'])) { return $this->_downloadURL['info']->getChannel(); } return false; } function getURI() { if (isset($this->_packagefile)) { return $this->_packagefile->getURI(); } elseif (isset($this->_downloadURL['info'])) { return $this->_downloadURL['info']->getURI(); } return false; } function getVersion() { if (isset($this->_packagefile)) { return $this->_packagefile->getVersion(); } elseif (isset($this->_downloadURL['version'])) { return $this->_downloadURL['version']; } return false; } function isCompatible($pf) { if (isset($this->_packagefile)) { return $this->_packagefile->isCompatible($pf); } elseif (isset($this->_downloadURL['info'])) { return $this->_downloadURL['info']->isCompatible($pf); } return true; } function setGroup($group) { $this->_parsedname['group'] = $group; } function getGroup() { if (isset($this->_parsedname['group'])) { return $this->_parsedname['group']; } return ''; } function isExtension($name) { if (isset($this->_packagefile)) { return $this->_packagefile->isExtension($name); } elseif (isset($this->_downloadURL['info'])) { if ($this->_downloadURL['info']->getPackagexmlVersion() == '2.0') { return $this->_downloadURL['info']->getProvidesExtension() == $name; } return false; } return false; } function getDeps() { if (isset($this->_packagefile)) { $ver = $this->_packagefile->getPackagexmlVersion(); if (version_compare($ver, '2.0', '>=')) { return $this->_packagefile->getDeps(true); } return $this->_packagefile->getDeps(); } elseif (isset($this->_downloadURL['info'])) { $ver = $this->_downloadURL['info']->getPackagexmlVersion(); if (version_compare($ver, '2.0', '>=')) { return $this->_downloadURL['info']->getDeps(true); } return $this->_downloadURL['info']->getDeps(); } return array(); } /** * @param array Parsed array from {@link PEAR_Registry::parsePackageName()} or a dependency * returned from getDepDownloadURL() */ function isEqual($param) { if (is_object($param)) { $channel = $param->getChannel(); $package = $param->getPackage(); if ($param->getURI()) { $param = array( 'channel' => $param->getChannel(), 'package' => $param->getPackage(), 'version' => $param->getVersion(), 'uri' => $param->getURI(), ); } else { $param = array( 'channel' => $param->getChannel(), 'package' => $param->getPackage(), 'version' => $param->getVersion(), ); } } else { if (isset($param['uri'])) { if ($this->getChannel() != '__uri') { return false; } return $param['uri'] == $this->getURI(); } $package = isset($param['package']) ? $param['package'] : $param['info']->getPackage(); $channel = isset($param['channel']) ? $param['channel'] : $param['info']->getChannel(); if (isset($param['rel'])) { if (!class_exists('PEAR_Dependency2')) { require_once 'PEAR/Dependency2.php'; } $newdep = PEAR_Dependency2::normalizeDep($param); $newdep = $newdep[0]; } elseif (isset($param['min'])) { $newdep = $param; } } if (isset($newdep)) { if (!isset($newdep['min'])) { $newdep['min'] = '0'; } if (!isset($newdep['max'])) { $newdep['max'] = '100000000000000000000'; } // use magic to support pecl packages suddenly jumping to the pecl channel // we need to support both dependency possibilities if ($channel == 'pear.php.net' && $this->getChannel() == 'pecl.php.net') { if ($package == $this->getPackage()) { $channel = 'pecl.php.net'; } } if ($channel == 'pecl.php.net' && $this->getChannel() == 'pear.php.net') { if ($package == $this->getPackage()) { $channel = 'pear.php.net'; } } return (strtolower($package) == strtolower($this->getPackage()) && $channel == $this->getChannel() && version_compare($newdep['min'], $this->getVersion(), '<=') && version_compare($newdep['max'], $this->getVersion(), '>=')); } // use magic to support pecl packages suddenly jumping to the pecl channel if ($channel == 'pecl.php.net' && $this->getChannel() == 'pear.php.net') { if (strtolower($package) == strtolower($this->getPackage())) { $channel = 'pear.php.net'; } } if (isset($param['version'])) { return (strtolower($package) == strtolower($this->getPackage()) && $channel == $this->getChannel() && $param['version'] == $this->getVersion()); } return strtolower($package) == strtolower($this->getPackage()) && $channel == $this->getChannel(); } function isInstalled($dep, $oper = '==') { if (!$dep) { return false; } if ($oper != 'ge' && $oper != 'gt' && $oper != 'has' && $oper != '==') { return false; } if (is_object($dep)) { $package = $dep->getPackage(); $channel = $dep->getChannel(); if ($dep->getURI()) { $dep = array( 'uri' => $dep->getURI(), 'version' => $dep->getVersion(), ); } else { $dep = array( 'version' => $dep->getVersion(), ); } } else { if (isset($dep['uri'])) { $channel = '__uri'; $package = $dep['dep']['name']; } else { $channel = $dep['info']->getChannel(); $package = $dep['info']->getPackage(); } } $options = $this->_downloader->getOptions(); $test = $this->_installRegistry->packageExists($package, $channel); if (!$test && $channel == 'pecl.php.net') { // do magic to allow upgrading from old pecl packages to new ones $test = $this->_installRegistry->packageExists($package, 'pear.php.net'); $channel = 'pear.php.net'; } if ($test) { if (isset($dep['uri'])) { if ($this->_installRegistry->packageInfo($package, 'uri', '__uri') == $dep['uri']) { return true; } } if (isset($options['upgrade'])) { $packageVersion = $this->_installRegistry->packageInfo($package, 'version', $channel); if (version_compare($packageVersion, $dep['version'], '>=')) { return true; } return false; } return true; } return false; } /** * Detect duplicate package names with differing versions * * If a user requests to install Date 1.4.6 and Date 1.4.7, * for instance, this is a logic error. This method * detects this situation. * * @param array $params array of PEAR_Downloader_Package objects * @param array $errorparams empty array * @return array array of stupid duplicated packages in PEAR_Downloader_Package obejcts */ public static function detectStupidDuplicates($params, &$errorparams) { $existing = array(); foreach ($params as $i => $param) { $package = $param->getPackage(); $channel = $param->getChannel(); $group = $param->getGroup(); if (!isset($existing[$channel . '/' . $package])) { $existing[$channel . '/' . $package] = array(); } if (!isset($existing[$channel . '/' . $package][$group])) { $existing[$channel . '/' . $package][$group] = array(); } $existing[$channel . '/' . $package][$group][] = $i; } $indices = array(); foreach ($existing as $package => $groups) { foreach ($groups as $group => $dupes) { if (count($dupes) > 1) { $indices = $indices + $dupes; } } } $indices = array_unique($indices); foreach ($indices as $index) { $errorparams[] = $params[$index]; } return count($errorparams); } /** * @param array * @param bool ignore install groups - for final removal of dupe packages */ public static function removeDuplicates(&$params, $ignoreGroups = false) { $pnames = array(); foreach ($params as $i => $param) { if (!$param) { continue; } if ($param->getPackage()) { $group = $ignoreGroups ? '' : $param->getGroup(); $pnames[$i] = $param->getChannel() . '/' . $param->getPackage() . '-' . $param->getVersion() . '#' . $group; } } $pnames = array_unique($pnames); $unset = array_diff(array_keys($params), array_keys($pnames)); $testp = array_flip($pnames); foreach ($params as $i => $param) { if (!$param) { $unset[] = $i; continue; } if (!is_a($param, 'PEAR_Downloader_Package')) { $unset[] = $i; continue; } $group = $ignoreGroups ? '' : $param->getGroup(); if (!isset($testp[$param->getChannel() . '/' . $param->getPackage() . '-' . $param->getVersion() . '#' . $group])) { $unset[] = $i; } } foreach ($unset as $i) { unset($params[$i]); } $ret = array(); foreach ($params as $i => $param) { $ret[] = &$params[$i]; } $params = array(); foreach ($ret as $i => $param) { $params[] = &$ret[$i]; } } function explicitState() { return $this->_explicitState; } function setExplicitState($s) { $this->_explicitState = $s; } /** */ public static function mergeDependencies(&$params) { $bundles = $newparams = array(); foreach ($params as $i => $param) { if (!$param->isBundle()) { continue; } $bundles[] = $i; $pf = &$param->getPackageFile(); $newdeps = array(); $contents = $pf->getBundledPackages(); if (!is_array($contents)) { $contents = array($contents); } foreach ($contents as $file) { $filecontents = $pf->getFileContents($file); $dl = &$param->getDownloader(); $options = $dl->getOptions(); if (PEAR::isError($dir = $dl->getDownloadDir())) { return $dir; } $fp = @fopen($dir . DIRECTORY_SEPARATOR . $file, 'wb'); if (!$fp) { continue; } // FIXME do symlink check fwrite($fp, $filecontents, strlen($filecontents)); fclose($fp); if ($s = $params[$i]->explicitState()) { $obj->setExplicitState($s); } $obj = new PEAR_Downloader_Package($params[$i]->getDownloader()); PEAR::pushErrorHandling(PEAR_ERROR_RETURN); if (PEAR::isError($dir = $dl->getDownloadDir())) { PEAR::popErrorHandling(); return $dir; } $a = $dir . DIRECTORY_SEPARATOR . $file; $e = $obj->_fromFile($a); PEAR::popErrorHandling(); if (PEAR::isError($e)) { if (!isset($options['soft'])) { $dl->log(0, $e->getMessage()); } continue; } if (!PEAR_Downloader_Package::willDownload($obj, array_merge($params, $newparams)) && !$param->isInstalled($obj)) { $newparams[] = $obj; } } } foreach ($bundles as $i) { unset($params[$i]); // remove bundles - only their contents matter for installation } PEAR_Downloader_Package::removeDuplicates($params); // strip any unset indices if (count($newparams)) { // add in bundled packages for install foreach ($newparams as $i => $unused) { $params[] = &$newparams[$i]; } $newparams = array(); } foreach ($params as $i => $param) { $newdeps = array(); foreach ($param->_downloadDeps as $dep) { $merge = array_merge($params, $newparams); if (!PEAR_Downloader_Package::willDownload($dep, $merge) && !$param->isInstalled($dep) ) { $newdeps[] = $dep; } else { //var_dump($dep); // detect versioning conflicts here } } // convert the dependencies into PEAR_Downloader_Package objects for the next time around $params[$i]->_downloadDeps = array(); foreach ($newdeps as $dep) { $obj = new PEAR_Downloader_Package($params[$i]->getDownloader()); if ($s = $params[$i]->explicitState()) { $obj->setExplicitState($s); } PEAR::pushErrorHandling(PEAR_ERROR_RETURN); $e = $obj->fromDepURL($dep); PEAR::popErrorHandling(); if (PEAR::isError($e)) { if (!isset($options['soft'])) { $obj->_downloader->log(0, $e->getMessage()); } continue; } $e = $obj->detectDependencies($params); if (PEAR::isError($e)) { if (!isset($options['soft'])) { $obj->_downloader->log(0, $e->getMessage()); } } $newparams[] = $obj; } } if (count($newparams)) { foreach ($newparams as $i => $unused) { $params[] = &$newparams[$i]; } return true; } return false; } /** */ public static function willDownload($param, $params) { if (!is_array($params)) { return false; } foreach ($params as $obj) { if ($obj->isEqual($param)) { return true; } } return false; } /** * For simpler unit-testing * @param PEAR_Config * @param int * @param string */ function &getPackagefileObject(&$c, $d) { $a = new PEAR_PackageFile($c, $d); return $a; } /** * This will retrieve from a local file if possible, and parse out * a group name as well. The original parameter will be modified to reflect this. * @param string|array can be a parsed package name as well * @access private */ function _fromFile(&$param) { $saveparam = $param; if (is_string($param)) { if (!@file_exists($param)) { $test = explode('#', $param); $group = array_pop($test); if (@file_exists(implode('#', $test))) { $this->setGroup($group); $param = implode('#', $test); $this->_explicitGroup = true; } } if (@is_file($param)) { $this->_type = 'local'; $options = $this->_downloader->getOptions(); $pkg = &$this->getPackagefileObject($this->_config, $this->_downloader->_debug); PEAR::pushErrorHandling(PEAR_ERROR_RETURN); $pf = &$pkg->fromAnyFile($param, PEAR_VALIDATE_INSTALLING); PEAR::popErrorHandling(); if (PEAR::isError($pf)) { $this->_valid = false; $param = $saveparam; return $pf; } $this->_packagefile = &$pf; if (!$this->getGroup()) { $this->setGroup('default'); // install the default dependency group } return $this->_valid = true; } } $param = $saveparam; return $this->_valid = false; } function _fromUrl($param, $saveparam = '') { if (!is_array($param) && (preg_match('#^(http|https|ftp)://#', $param))) { $options = $this->_downloader->getOptions(); $this->_type = 'url'; $callback = $this->_downloader->ui ? array(&$this->_downloader, '_downloadCallback') : null; $this->_downloader->pushErrorHandling(PEAR_ERROR_RETURN); if (PEAR::isError($dir = $this->_downloader->getDownloadDir())) { $this->_downloader->popErrorHandling(); return $dir; } $this->_downloader->log(3, 'Downloading "' . $param . '"'); $file = $this->_downloader->downloadHttp($param, $this->_downloader->ui, $dir, $callback, null, false, $this->getChannel()); $this->_downloader->popErrorHandling(); if (PEAR::isError($file)) { if (!empty($saveparam)) { $saveparam = ", cannot download \"$saveparam\""; } $err = PEAR::raiseError('Could not download from "' . $param . '"' . $saveparam . ' (' . $file->getMessage() . ')'); return $err; } if ($this->_rawpackagefile) { require_once 'Archive/Tar.php'; $tar = new Archive_Tar($file); $packagexml = $tar->extractInString('package2.xml'); if (!$packagexml) { $packagexml = $tar->extractInString('package.xml'); } if (str_replace(array("\n", "\r"), array('',''), $packagexml) != str_replace(array("\n", "\r"), array('',''), $this->_rawpackagefile)) { if ($this->getChannel() != 'pear.php.net') { return PEAR::raiseError('CRITICAL ERROR: package.xml downloaded does ' . 'not match value returned from xml-rpc'); } // be more lax for the existing PEAR packages that have not-ok // characters in their package.xml $this->_downloader->log(0, 'CRITICAL WARNING: The "' . $this->getPackage() . '" package has invalid characters in its ' . 'package.xml. The next version of PEAR may not be able to install ' . 'this package for security reasons. Please open a bug report at ' . 'http://pear.php.net/package/' . $this->getPackage() . '/bugs'); } } // whew, download worked! $pkg = &$this->getPackagefileObject($this->_config, $this->_downloader->debug); PEAR::pushErrorHandling(PEAR_ERROR_RETURN); $pf = &$pkg->fromAnyFile($file, PEAR_VALIDATE_INSTALLING); PEAR::popErrorHandling(); if (PEAR::isError($pf)) { if (is_array($pf->getUserInfo())) { foreach ($pf->getUserInfo() as $err) { if (is_array($err)) { $err = $err['message']; } if (!isset($options['soft'])) { $this->_downloader->log(0, "Validation Error: $err"); } } } if (!isset($options['soft'])) { $this->_downloader->log(0, $pf->getMessage()); } ///FIXME need to pass back some error code that we can use to match with to cancel all further operations /// At least stop all deps of this package from being installed $out = $saveparam ? $saveparam : $param; $err = PEAR::raiseError('Download of "' . $out . '" succeeded, but it is not a valid package archive'); $this->_valid = false; return $err; } $this->_packagefile = &$pf; $this->setGroup('default'); // install the default dependency group return $this->_valid = true; } return $this->_valid = false; } /** * * @param string|array pass in an array of format * array( * 'package' => 'pname', * ['channel' => 'channame',] * ['version' => 'version',] * ['state' => 'state',]) * or a string of format [channame/]pname[-version|-state] */ function _fromString($param) { $options = $this->_downloader->getOptions(); $channel = $this->_config->get('default_channel'); PEAR::pushErrorHandling(PEAR_ERROR_RETURN); $pname = $this->_registry->parsePackageName($param, $channel); PEAR::popErrorHandling(); if (PEAR::isError($pname)) { if ($pname->getCode() == 'invalid') { $this->_valid = false; return false; } if ($pname->getCode() == 'channel') { $parsed = $pname->getUserInfo(); if ($this->_downloader->discover($parsed['channel'])) { if ($this->_config->get('auto_discover')) { PEAR::pushErrorHandling(PEAR_ERROR_RETURN); $pname = $this->_registry->parsePackageName($param, $channel); PEAR::popErrorHandling(); } else { if (!isset($options['soft'])) { $this->_downloader->log(0, 'Channel "' . $parsed['channel'] . '" is not initialized, use ' . '"pear channel-discover ' . $parsed['channel'] . '" to initialize' . 'or pear config-set auto_discover 1'); } } } if (PEAR::isError($pname)) { if (!isset($options['soft'])) { $this->_downloader->log(0, $pname->getMessage()); } if (is_array($param)) { $param = $this->_registry->parsedPackageNameToString($param); } $err = PEAR::raiseError('invalid package name/package file "' . $param . '"'); $this->_valid = false; return $err; } } else { if (!isset($options['soft'])) { $this->_downloader->log(0, $pname->getMessage()); } $err = PEAR::raiseError('invalid package name/package file "' . $param . '"'); $this->_valid = false; return $err; } } if (!isset($this->_type)) { $this->_type = 'rest'; } $this->_parsedname = $pname; $this->_explicitState = isset($pname['state']) ? $pname['state'] : false; $this->_explicitGroup = isset($pname['group']) ? true : false; $info = $this->_downloader->_getPackageDownloadUrl($pname); if (PEAR::isError($info)) { if ($info->getCode() != -976 && $pname['channel'] == 'pear.php.net') { // try pecl $pname['channel'] = 'pecl.php.net'; if ($test = $this->_downloader->_getPackageDownloadUrl($pname)) { if (!PEAR::isError($test)) { $info = PEAR::raiseError($info->getMessage() . ' - package ' . $this->_registry->parsedPackageNameToString($pname, true) . ' can be installed with "pecl install ' . $pname['package'] . '"'); } else { $pname['channel'] = 'pear.php.net'; } } else { $pname['channel'] = 'pear.php.net'; } } return $info; } $this->_rawpackagefile = $info['raw']; $ret = $this->_analyzeDownloadURL($info, $param, $pname); if (PEAR::isError($ret)) { return $ret; } if ($ret) { $this->_downloadURL = $ret; return $this->_valid = (bool) $ret; } } /** * @param array output of package.getDownloadURL * @param string|array|object information for detecting packages to be downloaded, and * for errors * @param array name information of the package * @param array|null packages to be downloaded * @param bool is this an optional dependency? * @param bool is this any kind of dependency? * @access private */ function _analyzeDownloadURL($info, $param, $pname, $params = null, $optional = false, $isdependency = false) { if (!is_string($param) && PEAR_Downloader_Package::willDownload($param, $params)) { return false; } if ($info === false) { $saveparam = !is_string($param) ? ", cannot download \"$param\"" : ''; // no releases exist return PEAR::raiseError('No releases for package "' . $this->_registry->parsedPackageNameToString($pname, true) . '" exist' . $saveparam); } if (strtolower($info['info']->getChannel()) != strtolower($pname['channel'])) { $err = false; if ($pname['channel'] == 'pecl.php.net') { if ($info['info']->getChannel() != 'pear.php.net') { $err = true; } } elseif ($info['info']->getChannel() == 'pecl.php.net') { if ($pname['channel'] != 'pear.php.net') { $err = true; } } else { $err = true; } if ($err) { return PEAR::raiseError('SECURITY ERROR: package in channel "' . $pname['channel'] . '" retrieved another channel\'s name for download! ("' . $info['info']->getChannel() . '")'); } } $preferred_state = $this->_config->get('preferred_state'); if (!isset($info['url'])) { $package_version = $this->_registry->packageInfo($info['info']->getPackage(), 'version', $info['info']->getChannel()); if ($this->isInstalled($info)) { if ($isdependency && version_compare($info['version'], $package_version, '<=')) { // ignore bogus errors of "failed to download dependency" // if it is already installed and the one that would be // downloaded is older or the same version (Bug #7219) return false; } } if ($info['version'] === $package_version) { if (!isset($options['soft'])) { $this->_downloader->log(1, 'WARNING: failed to download ' . $pname['channel'] . '/' . $pname['package'] . '-' . $package_version. ', additionally the suggested version' . ' (' . $package_version . ') is the same as the locally installed one.'); } return false; } if (version_compare($info['version'], $package_version, '<=')) { if (!isset($options['soft'])) { $this->_downloader->log(1, 'WARNING: failed to download ' . $pname['channel'] . '/' . $pname['package'] . '-' . $package_version . ', additionally the suggested version' . ' (' . $info['version'] . ') is a lower version than the locally installed one (' . $package_version . ').'); } return false; } $instead = ', will instead download version ' . $info['version'] . ', stability "' . $info['info']->getState() . '"'; // releases exist, but we failed to get any if (isset($this->_downloader->_options['force'])) { if (isset($pname['version'])) { $vs = ', version "' . $pname['version'] . '"'; } elseif (isset($pname['state'])) { $vs = ', stability "' . $pname['state'] . '"'; } elseif ($param == 'dependency') { if (!class_exists('PEAR_Common')) { require_once 'PEAR/Common.php'; } if (!in_array($info['info']->getState(), PEAR_Common::betterStates($preferred_state, true))) { if ($optional) { // don't spit out confusing error message return $this->_downloader->_getPackageDownloadUrl( array('package' => $pname['package'], 'channel' => $pname['channel'], 'version' => $info['version'])); } $vs = ' within preferred state "' . $preferred_state . '"'; } else { if (!class_exists('PEAR_Dependency2')) { require_once 'PEAR/Dependency2.php'; } if ($optional) { // don't spit out confusing error message return $this->_downloader->_getPackageDownloadUrl( array('package' => $pname['package'], 'channel' => $pname['channel'], 'version' => $info['version'])); } $vs = PEAR_Dependency2::_getExtraString($pname); $instead = ''; } } else { $vs = ' within preferred state "' . $preferred_state . '"'; } if (!isset($options['soft'])) { $this->_downloader->log(1, 'WARNING: failed to download ' . $pname['channel'] . '/' . $pname['package'] . $vs . $instead); } // download the latest release return $this->_downloader->_getPackageDownloadUrl( array('package' => $pname['package'], 'channel' => $pname['channel'], 'version' => $info['version'])); } else { if (isset($info['php']) && $info['php']) { $err = PEAR::raiseError('Failed to download ' . $this->_registry->parsedPackageNameToString( array('channel' => $pname['channel'], 'package' => $pname['package']), true) . ', latest release is version ' . $info['php']['v'] . ', but it requires PHP version "' . $info['php']['m'] . '", use "' . $this->_registry->parsedPackageNameToString( array('channel' => $pname['channel'], 'package' => $pname['package'], 'version' => $info['php']['v'])) . '" to install', PEAR_DOWNLOADER_PACKAGE_PHPVERSION); return $err; } // construct helpful error message if (isset($pname['version'])) { $vs = ', version "' . $pname['version'] . '"'; } elseif (isset($pname['state'])) { $vs = ', stability "' . $pname['state'] . '"'; } elseif ($param == 'dependency') { if (!class_exists('PEAR_Common')) { require_once 'PEAR/Common.php'; } if (!in_array($info['info']->getState(), PEAR_Common::betterStates($preferred_state, true))) { if ($optional) { // don't spit out confusing error message, and don't die on // optional dep failure! return $this->_downloader->_getPackageDownloadUrl( array('package' => $pname['package'], 'channel' => $pname['channel'], 'version' => $info['version'])); } $vs = ' within preferred state "' . $preferred_state . '"'; } else { if (!class_exists('PEAR_Dependency2')) { require_once 'PEAR/Dependency2.php'; } if ($optional) { // don't spit out confusing error message, and don't die on // optional dep failure! return $this->_downloader->_getPackageDownloadUrl( array('package' => $pname['package'], 'channel' => $pname['channel'], 'version' => $info['version'])); } $vs = PEAR_Dependency2::_getExtraString($pname); } } else { $vs = ' within preferred state "' . $this->_downloader->config->get('preferred_state') . '"'; } $options = $this->_downloader->getOptions(); // this is only set by the "download-all" command if (isset($options['ignorepreferred_state'])) { $err = PEAR::raiseError( 'Failed to download ' . $this->_registry->parsedPackageNameToString( array('channel' => $pname['channel'], 'package' => $pname['package']), true) . $vs . ', latest release is version ' . $info['version'] . ', stability "' . $info['info']->getState() . '", use "' . $this->_registry->parsedPackageNameToString( array('channel' => $pname['channel'], 'package' => $pname['package'], 'version' => $info['version'])) . '" to install', PEAR_DOWNLOADER_PACKAGE_STATE); return $err; } // Checks if the user has a package installed already and checks the release against // the state against the installed package, this allows upgrades for packages // with lower stability than the preferred_state $stability = $this->_registry->packageInfo($pname['package'], 'stability', $pname['channel']); if (!$this->isInstalled($info) || !in_array($info['info']->getState(), PEAR_Common::betterStates($stability['release'], true)) ) { $err = PEAR::raiseError( 'Failed to download ' . $this->_registry->parsedPackageNameToString( array('channel' => $pname['channel'], 'package' => $pname['package']), true) . $vs . ', latest release is version ' . $info['version'] . ', stability "' . $info['info']->getState() . '", use "' . $this->_registry->parsedPackageNameToString( array('channel' => $pname['channel'], 'package' => $pname['package'], 'version' => $info['version'])) . '" to install'); return $err; } } } if (isset($info['deprecated']) && $info['deprecated']) { $this->_downloader->log(0, 'WARNING: "' . $this->_registry->parsedPackageNameToString( array('channel' => $info['info']->getChannel(), 'package' => $info['info']->getPackage()), true) . '" is deprecated in favor of "' . $this->_registry->parsedPackageNameToString($info['deprecated'], true) . '"'); } return $info; } } php-pear-1.10.1+submodules+notgz/PEAR/ErrorStack.php000066400000000000000000001020171262614675700221610ustar00rootroot00000000000000 * @copyright 2004-2008 Greg Beaver * @license http://opensource.org/licenses/bsd-license.php New BSD License * @link http://pear.php.net/package/PEAR_ErrorStack */ /** * Singleton storage * * Format: *
 * array(
 *  'package1' => PEAR_ErrorStack object,
 *  'package2' => PEAR_ErrorStack object,
 *  ...
 * )
 * 
* @access private * @global array $GLOBALS['_PEAR_ERRORSTACK_SINGLETON'] */ $GLOBALS['_PEAR_ERRORSTACK_SINGLETON'] = array(); /** * Global error callback (default) * * This is only used if set to non-false. * is the default callback for * all packages, whereas specific packages may set a default callback * for all instances, regardless of whether they are a singleton or not. * * To exclude non-singletons, only set the local callback for the singleton * @see PEAR_ErrorStack::setDefaultCallback() * @access private * @global array $GLOBALS['_PEAR_ERRORSTACK_DEFAULT_CALLBACK'] */ $GLOBALS['_PEAR_ERRORSTACK_DEFAULT_CALLBACK'] = array( '*' => false, ); /** * Global Log object (default) * * This is only used if set to non-false. Use to set a default log object for * all stacks, regardless of instantiation order or location * @see PEAR_ErrorStack::setDefaultLogger() * @access private * @global array $GLOBALS['_PEAR_ERRORSTACK_DEFAULT_LOGGER'] */ $GLOBALS['_PEAR_ERRORSTACK_DEFAULT_LOGGER'] = false; /** * Global Overriding Callback * * This callback will override any error callbacks that specific loggers have set. * Use with EXTREME caution * @see PEAR_ErrorStack::staticPushCallback() * @access private * @global array $GLOBALS['_PEAR_ERRORSTACK_DEFAULT_LOGGER'] */ $GLOBALS['_PEAR_ERRORSTACK_OVERRIDE_CALLBACK'] = array(); /**#@+ * One of four possible return values from the error Callback * @see PEAR_ErrorStack::_errorCallback() */ /** * If this is returned, then the error will be both pushed onto the stack * and logged. */ define('PEAR_ERRORSTACK_PUSHANDLOG', 1); /** * If this is returned, then the error will only be pushed onto the stack, * and not logged. */ define('PEAR_ERRORSTACK_PUSH', 2); /** * If this is returned, then the error will only be logged, but not pushed * onto the error stack. */ define('PEAR_ERRORSTACK_LOG', 3); /** * 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); /**#@-*/ /** * Error code for an attempt to instantiate a non-class as a PEAR_ErrorStack in * the singleton method. */ define('PEAR_ERRORSTACK_ERR_NONCLASS', 1); /** * Error code for an attempt to pass an object into {@link PEAR_ErrorStack::getMessage()} * that has no __toString() method */ define('PEAR_ERRORSTACK_ERR_OBJTOSTRING', 2); /** * Error Stack Implementation * * Usage: * * // global error stack * $global_stack = &PEAR_ErrorStack::singleton('MyPackage'); * // local error stack * $local_stack = new PEAR_ErrorStack('MyPackage'); * * @author Greg Beaver * @version @package_version@ * @package PEAR_ErrorStack * @category Debugging * @copyright 2004-2008 Greg Beaver * @license http://opensource.org/licenses/bsd-license.php New BSD License * @link http://pear.php.net/package/PEAR_ErrorStack */ class PEAR_ErrorStack { /** * Errors are stored in the order that they are pushed on the stack. * @since 0.4alpha Errors are no longer organized by error level. * This renders pop() nearly unusable, and levels could be more easily * handled in a callback anyway * @var array * @access private */ var $_errors = array(); /** * Storage of errors by level. * * Allows easy retrieval and deletion of only errors from a particular level * @since PEAR 1.4.0dev * @var array * @access private */ var $_errorsByLevel = array(); /** * Package name this error stack represents * @var string * @access protected */ var $_package; /** * Determines whether a PEAR_Error is thrown upon every error addition * @var boolean * @access private */ var $_compat = false; /** * If set to a valid callback, this will be used to generate the error * message from the error code, otherwise the message passed in will be * used * @var false|string|array * @access private */ var $_msgCallback = false; /** * If set to a valid callback, this will be used to generate the error * context for an error. For PHP-related errors, this will be a file * and line number as retrieved from debug_backtrace(), but can be * customized for other purposes. The error might actually be in a separate * configuration file, or in a database query. * @var false|string|array * @access protected */ var $_contextCallback = false; /** * If set to a valid callback, this will be called every time an error * is pushed onto the stack. The return value will be used to determine * whether to allow an error to be pushed or logged. * * The return value must be one an PEAR_ERRORSTACK_* constant * @see PEAR_ERRORSTACK_PUSHANDLOG, PEAR_ERRORSTACK_PUSH, PEAR_ERRORSTACK_LOG * @var false|string|array * @access protected */ var $_errorCallback = array(); /** * PEAR::Log object for logging errors * @var false|Log * @access protected */ var $_logger = false; /** * Error messages - designed to be overridden * @var array * @abstract */ var $_errorMsgs = array(); /** * Set up a new error stack * * @param string $package name of the package this error stack represents * @param callback $msgCallback callback used for error message generation * @param callback $contextCallback callback used for context generation, * defaults to {@link getFileLine()} * @param boolean $throwPEAR_Error */ function __construct($package, $msgCallback = false, $contextCallback = false, $throwPEAR_Error = false) { $this->_package = $package; $this->setMessageCallback($msgCallback); $this->setContextCallback($contextCallback); $this->_compat = $throwPEAR_Error; } /** * Return a single error stack for this package. * * Note that all parameters are ignored if the stack for package $package * has already been instantiated * @param string $package name of the package this error stack represents * @param callback $msgCallback callback used for error message generation * @param callback $contextCallback callback used for context generation, * defaults to {@link getFileLine()} * @param boolean $throwPEAR_Error * @param string $stackClass class to instantiate * * @return PEAR_ErrorStack */ public static function &singleton( $package, $msgCallback = false, $contextCallback = false, $throwPEAR_Error = false, $stackClass = 'PEAR_ErrorStack' ) { if (isset($GLOBALS['_PEAR_ERRORSTACK_SINGLETON'][$package])) { return $GLOBALS['_PEAR_ERRORSTACK_SINGLETON'][$package]; } if (!class_exists($stackClass)) { 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); } $GLOBALS['_PEAR_ERRORSTACK_SINGLETON'][$package] = new $stackClass($package, $msgCallback, $contextCallback, $throwPEAR_Error); return $GLOBALS['_PEAR_ERRORSTACK_SINGLETON'][$package]; } /** * Internal error handler for PEAR_ErrorStack class * * Dies if the error is an exception (and would have died anyway) * @access private */ function _handleError($err) { if ($err['level'] == 'exception') { $message = $err['message']; if (isset($_SERVER['REQUEST_URI'])) { echo '
'; } else { echo "\n"; } var_dump($err['context']); die($message); } } /** * Set up a PEAR::Log object for all error stacks that don't have one * @param Log $log */ public static function setDefaultLogger(&$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; } } /** * Set up a PEAR::Log object for this error stack * @param Log $log */ function setLogger(&$log) { if (is_object($log) && method_exists($log, 'log') ) { $this->_logger = &$log; } elseif (is_callable($log)) { $this->_logger = &$log; } } /** * Set an error code => error message mapping callback * * This method sets the callback that can be used to generate error * messages for any instance * @param array|string Callback function/method */ function setMessageCallback($msgCallback) { if (!$msgCallback) { $this->_msgCallback = array(&$this, 'getErrorMessage'); } else { if (is_callable($msgCallback)) { $this->_msgCallback = $msgCallback; } } } /** * Get an error code => error message mapping callback * * This method returns the current callback that can be used to generate error * messages * @return array|string|false Callback function/method or false if none */ function getMessageCallback() { return $this->_msgCallback; } /** * Sets a default callback to be used by all error stacks * * This method sets the callback that can be used to generate error * messages for a singleton * @param array|string Callback function/method * @param string Package name, or false for all packages */ public static function setDefaultCallback($callback = false, $package = false) { if (!is_callable($callback)) { $callback = false; } $package = $package ? $package : '*'; $GLOBALS['_PEAR_ERRORSTACK_DEFAULT_CALLBACK'][$package] = $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 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 { if (is_callable($contextCallback)) { $this->_contextCallback = $contextCallback; } } } /** * Set an error Callback * If set to a valid callback, this will be called every time an error * is pushed onto the stack. The return value will be used to determine * whether to allow an error to be pushed or logged. * * The return value must be one of the ERRORSTACK_* constants. * * This functionality can be used to emulate PEAR's pushErrorHandling, and * the PEAR_ERROR_CALLBACK mode, without affecting the integrity of * the error stack or logging * @see PEAR_ERRORSTACK_PUSHANDLOG, PEAR_ERRORSTACK_PUSH, PEAR_ERRORSTACK_LOG * @see popCallback() * @param string|array $cb */ function pushCallback($cb) { array_push($this->_errorCallback, $cb); } /** * Remove a callback from the error callback stack * @see pushCallback() * @return array|string|false */ function popCallback() { if (!count($this->_errorCallback)) { return false; } return array_pop($this->_errorCallback); } /** * Set a temporary overriding error callback for every package error stack * * Use this to temporarily disable all existing callbacks (can be used * to emulate the @ operator, for instance) * @see PEAR_ERRORSTACK_PUSHANDLOG, PEAR_ERRORSTACK_PUSH, PEAR_ERRORSTACK_LOG * @see staticPopCallback(), pushCallback() * @param string|array $cb */ public static function staticPushCallback($cb) { array_push($GLOBALS['_PEAR_ERRORSTACK_OVERRIDE_CALLBACK'], $cb); } /** * Remove a temporary overriding error callback * @see staticPushCallback() * @return array|string|false */ public static function staticPopCallback() { $ret = array_pop($GLOBALS['_PEAR_ERRORSTACK_OVERRIDE_CALLBACK']); if (!is_array($GLOBALS['_PEAR_ERRORSTACK_OVERRIDE_CALLBACK'])) { $GLOBALS['_PEAR_ERRORSTACK_OVERRIDE_CALLBACK'] = array(); } return $ret; } /** * Add an error to the stack * * If the message generator exists, it is called with 2 parameters. * - the current Error Stack object * - an array that is in the same format as an error. Available indices * are 'code', 'package', 'time', 'params', 'level', and 'context' * * Next, if the error should contain context information, this is * handled by the context grabbing method. * Finally, the error is pushed onto the proper error stack * @param int $code Package-specific error code * @param string $level Error level. This is NOT spell-checked * @param array $params associative array of error parameters * @param string $msg Error message, or a portion of it if the message * is to be generated * @param array $repackage If this error re-packages an error pushed by * another package, place the array returned from * {@link pop()} in this parameter * @param array $backtrace Protected parameter: use this to pass in the * {@link debug_backtrace()} that should be used * to find error context * @return PEAR_Error|array if compatibility mode is on, a PEAR_Error is also * thrown. If a PEAR_Error is returned, the userinfo * property is set to the following array: * * * array( * 'code' => $code, * 'params' => $params, * 'package' => $this->_package, * 'level' => $level, * 'time' => time(), * 'context' => $context, * 'message' => $msg, * //['repackage' => $err] repackaged error array/Exception class * ); * * * Normally, the previous array is returned. */ function push($code, $level = 'error', $params = array(), $msg = false, $repackage = false, $backtrace = false) { $context = false; // grab error context if ($this->_contextCallback) { if (!$backtrace) { $backtrace = debug_backtrace(); } $context = call_user_func($this->_contextCallback, $code, $params, $backtrace); } // save error $time = explode(' ', microtime()); $time = $time[1] + $time[0]; $err = array( 'code' => $code, 'params' => $params, 'package' => $this->_package, 'level' => $level, 'time' => $time, 'context' => $context, 'message' => $msg, ); if ($repackage) { $err['repackage'] = $repackage; } // set up the error message, if necessary if ($this->_msgCallback) { $msg = call_user_func_array($this->_msgCallback, array(&$this, $err)); $err['message'] = $msg; } $push = $log = true; $die = false; // try the overriding callback first $callback = $this->staticPopCallback(); if ($callback) { $this->staticPushCallback($callback); } if (!is_callable($callback)) { // try the local callback next $callback = $this->popCallback(); if (is_callable($callback)) { $this->pushCallback($callback); } else { // try the default callback $callback = isset($GLOBALS['_PEAR_ERRORSTACK_DEFAULT_CALLBACK'][$this->_package]) ? $GLOBALS['_PEAR_ERRORSTACK_DEFAULT_CALLBACK'][$this->_package] : $GLOBALS['_PEAR_ERRORSTACK_DEFAULT_CALLBACK']['*']; } } if (is_callable($callback)) { switch(call_user_func($callback, $err)){ case PEAR_ERRORSTACK_IGNORE: return $err; break; case PEAR_ERRORSTACK_PUSH: $log = false; break; case PEAR_ERRORSTACK_LOG: $push = false; break; case PEAR_ERRORSTACK_DIE: $die = true; break; // anything else returned has the same effect as pushandlog } } if ($push) { array_unshift($this->_errors, $err); if (!isset($this->_errorsByLevel[$err['level']])) { $this->_errorsByLevel[$err['level']] = array(); } $this->_errorsByLevel[$err['level']][] = &$this->_errors[0]; } if ($log) { if ($this->_logger || $GLOBALS['_PEAR_ERRORSTACK_DEFAULT_LOGGER']) { $this->_log($err); } } if ($die) { die(); } if ($this->_compat && $push) { return $this->raiseError($msg, $code, null, null, $err); } return $err; } /** * Static version of {@link push()} * * @param string $package Package name this error belongs to * @param int $code Package-specific error code * @param string $level Error level. This is NOT spell-checked * @param array $params associative array of error parameters * @param string $msg Error message, or a portion of it if the message * is to be generated * @param array $repackage If this error re-packages an error pushed by * another package, place the array returned from * {@link pop()} in this parameter * @param array $backtrace Protected parameter: use this to pass in the * {@link debug_backtrace()} that should be used * to find error context * @return PEAR_Error|array if compatibility mode is on, a PEAR_Error is also * thrown. see docs for {@link push()} */ public static function staticPush( $package, $code, $level = 'error', $params = array(), $msg = false, $repackage = false, $backtrace = false ) { $s = &PEAR_ErrorStack::singleton($package); if ($s->_contextCallback) { if (!$backtrace) { if (function_exists('debug_backtrace')) { $backtrace = debug_backtrace(); } } } return $s->push($code, $level, $params, $msg, $repackage, $backtrace); } /** * Log an error using PEAR::Log * @param array $err Error array * @param array $levels Error level => Log constant map * @access protected */ 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, 'error' => PEAR_LOG_ERR, '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; } $logger->log($err['message'], $level, $err); } else { // support non-standard logs call_user_func($logger, $err); } } /** * Pop an error off of the error stack * * @return false|array * @since 0.4alpha it is no longer possible to specify a specific error * level to return - the last error pushed will be returned, instead */ function pop() { $err = @array_shift($this->_errors); if (!is_null($err)) { @array_pop($this->_errorsByLevel[$err['level']]); if (!count($this->_errorsByLevel[$err['level']])) { unset($this->_errorsByLevel[$err['level']]); } } return $err; } /** * Pop an error off of the error stack, static method * * @param string package name * @return boolean * @since PEAR1.5.0a1 */ function staticPop($package) { if ($package) { if (!isset($GLOBALS['_PEAR_ERRORSTACK_SINGLETON'][$package])) { return false; } return $GLOBALS['_PEAR_ERRORSTACK_SINGLETON'][$package]->pop(); } } /** * Determine whether there are any errors on the stack * @param string|array Level name. Use to determine if any errors * of level (string), or levels (array) have been pushed * @return boolean */ function hasErrors($level = false) { if ($level) { return isset($this->_errorsByLevel[$level]); } return count($this->_errors); } /** * Retrieve all errors since last purge * * @param boolean set in order to empty the error stack * @param string level name, to return only errors of a particular severity * @return array */ function getErrors($purge = false, $level = false) { if (!$purge) { if ($level) { if (!isset($this->_errorsByLevel[$level])) { return array(); } else { return $this->_errorsByLevel[$level]; } } else { return $this->_errors; } } if ($level) { $ret = $this->_errorsByLevel[$level]; foreach ($this->_errorsByLevel[$level] as $i => $unused) { // entries are references to the $_errors array $this->_errorsByLevel[$level][$i] = false; } // array_filter removes all entries === false $this->_errors = array_filter($this->_errors); unset($this->_errorsByLevel[$level]); return $ret; } $ret = $this->_errors; $this->_errors = array(); $this->_errorsByLevel = array(); return $ret; } /** * Determine whether there are any errors on a single error stack, or on any error stack * * The optional parameter can be used to test the existence of any errors without the need of * singleton instantiation * @param string|false Package name to check for errors * @param string Level name to check for a particular severity * @return boolean */ public static function staticHasErrors($package = false, $level = false) { if ($package) { if (!isset($GLOBALS['_PEAR_ERRORSTACK_SINGLETON'][$package])) { return false; } return $GLOBALS['_PEAR_ERRORSTACK_SINGLETON'][$package]->hasErrors($level); } foreach ($GLOBALS['_PEAR_ERRORSTACK_SINGLETON'] as $package => $obj) { if ($obj->hasErrors($level)) { return true; } } return false; } /** * 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 $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 * sorts by time, and should be good for most cases * * @return array */ public static function staticGetErrors( $purge = false, $level = false, $merge = false, $sortfunc = array('PEAR_ErrorStack', '_sortErrors') ) { $ret = array(); if (!is_callable($sortfunc)) { $sortfunc = array('PEAR_ErrorStack', '_sortErrors'); } foreach ($GLOBALS['_PEAR_ERRORSTACK_SINGLETON'] as $package => $obj) { $test = $GLOBALS['_PEAR_ERRORSTACK_SINGLETON'][$package]->getErrors($purge, $level); if ($test) { if ($merge) { $ret = array_merge($ret, $test); } else { $ret[$package] = $test; } } } if ($merge) { usort($ret, $sortfunc); } return $ret; } /** * Error sorting function, sorts by time * @access private */ public static function _sortErrors($a, $b) { if ($a['time'] == $b['time']) { return 0; } if ($a['time'] < $b['time']) { return 1; } return -1; } /** * Standard file/line number/function/class context callback * * This function uses a backtrace generated from {@link debug_backtrace()} * and so will not work at all in PHP < 4.3.0. The frame should * reference the frame that contains the source of the error. * @return array|false either array('file' => file, 'line' => line, * 'function' => function name, 'class' => class name) or * if this doesn't work, then false * @param unused * @param integer backtrace frame. * @param array Results of debug_backtrace() */ public static function getFileLine($code, $params, $backtrace = null) { if ($backtrace === null) { return false; } $frame = 0; $functionframe = 1; if (!isset($backtrace[1])) { $functionframe = 0; } else { while (isset($backtrace[$functionframe]['function']) && $backtrace[$functionframe]['function'] == 'eval' && isset($backtrace[$functionframe + 1])) { $functionframe++; } } if (isset($backtrace[$frame])) { if (!isset($backtrace[$frame]['file'])) { $frame++; } $funcbacktrace = $backtrace[$functionframe]; $filebacktrace = $backtrace[$frame]; $ret = array('file' => $filebacktrace['file'], 'line' => $filebacktrace['line']); // rearrange for eval'd code or create function errors if (strpos($filebacktrace['file'], '(') && preg_match(';^(.*?)\((\d+)\) : (.*?)\\z;', $filebacktrace['file'], $matches)) { $ret['file'] = $matches[1]; $ret['line'] = $matches[2] + 0; } if (isset($funcbacktrace['function']) && isset($backtrace[1])) { if ($funcbacktrace['function'] != 'eval') { if ($funcbacktrace['function'] == '__lambda_func') { $ret['function'] = 'create_function() code'; } else { $ret['function'] = $funcbacktrace['function']; } } } if (isset($funcbacktrace['class']) && isset($backtrace[1])) { $ret['class'] = $funcbacktrace['class']; } return $ret; } return false; } /** * Standard error message generation callback * * This method may also be called by a custom error message generator * to fill in template values from the params array, simply * set the third parameter to the error message template string to use * * The special variable %__msg% is reserved: use it only to specify * where a message passed in by the user should be placed in the template, * like so: * * Error message: %msg% - internal error * * If the message passed like so: * * * $stack->push(ERROR_CODE, 'error', array(), 'server error 500'); * * * The returned error message will be "Error message: server error 500 - * internal error" * @param PEAR_ErrorStack * @param array * @param string|false Pre-generated error message template * * @return string */ public static function getErrorMessage(&$stack, $err, $template = false) { if ($template) { $mainmsg = $template; } else { $mainmsg = $stack->getErrorMessageTemplate($err['code']); } $mainmsg = str_replace('%__msg%', $err['message'], $mainmsg); if (is_array($err['params']) && count($err['params'])) { foreach ($err['params'] as $name => $val) { if (is_array($val)) { // @ is needed in case $val is a multi-dimensional array $val = @implode(', ', $val); } if (is_object($val)) { if (method_exists($val, '__toString')) { $val = $val->__toString(); } else { PEAR_ErrorStack::staticPush('PEAR_ErrorStack', PEAR_ERRORSTACK_ERR_OBJTOSTRING, 'warning', array('obj' => get_class($val)), 'object %obj% passed into getErrorMessage, but has no __toString() method'); $val = 'Object'; } } $mainmsg = str_replace('%' . $name . '%', $val, $mainmsg); } } return $mainmsg; } /** * Standard Error Message Template generator from code * @return string */ function getErrorMessageTemplate($code) { if (!isset($this->_errorMsgs[$code])) { return '%__msg%'; } return $this->_errorMsgs[$code]; } /** * Set the Error Message Template array * * The array format must be: *
     * array(error code => 'message template',...)
     * 
* * Error message parameters passed into {@link push()} will be used as input * for the error message. If the template is 'message %foo% was %bar%', and the * parameters are array('foo' => 'one', 'bar' => 'six'), the error message returned will * be 'message one was six' * @return string */ function setErrorMessageTemplate($template) { $this->_errorMsgs = $template; } /** * emulate PEAR::raiseError() * * @return PEAR_Error */ function raiseError() { require_once 'PEAR.php'; $args = func_get_args(); return call_user_func_array(array('PEAR', 'raiseError'), $args); } } $stack = &PEAR_ErrorStack::singleton('PEAR_ErrorStack'); $stack->pushCallback(array('PEAR_ErrorStack', '_handleError')); ?> php-pear-1.10.1+submodules+notgz/PEAR/Exception.php000066400000000000000000000331671262614675700220510ustar00rootroot00000000000000 * @author Hans Lellelid * @author Bertrand Mansion * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @link http://pear.php.net/package/PEAR * @since File available since Release 1.3.3 */ /** * Base PEAR_Exception Class * * 1) 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 available (like class, method or cause) * - cause can be a PEAR_Exception or an array of mixed * PEAR_Exceptions/PEAR_ErrorStack warnings * - callbacks for specific exception classes and their children * * 2) Ideas: * * - Maybe a way to define a 'template' for the output * * 3) Inherited properties from PHP Exception Class: * * protected $message * protected $code * protected $line * protected $file * private $trace * * 4) Inherited methods from PHP Exception Class: * * __clone * __construct * getMessage * getCode * getFile * getLine * getTraceSafe * getTraceSafeAsString * __toString * * 5) Usage example * * * 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'); * $test = new Test; * try { * $test->foo(); * } catch (PEAR_Exception $e) { * print $e; * } * * * @category pear * @package PEAR * @author Tomas V.V.Cox * @author Hans Lellelid * @author Bertrand Mansion * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version Release: @package_version@ * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.3.3 * */ class PEAR_Exception extends Exception { const OBSERVER_PRINT = -2; const OBSERVER_TRIGGER = -4; const OBSERVER_DIE = -8; protected $cause; private static $_observers = array(); private static $_uniqueid = 0; private $_trace; /** * 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); * - PEAR_Exception(string $message, PEAR_Error $cause); * - PEAR_Exception(string $message, PEAR_Error $cause, int $code); * - PEAR_Exception(string $message, array $causes); * - PEAR_Exception(string $message, array $causes, int $code); * @param string exception message * @param int|Exception|PEAR_Error|array|null exception cause * @param int|null exception code or null */ public function __construct($message, $p2 = null, $p3 = null) { if (is_int($p2)) { $code = $p2; $this->cause = null; } elseif (is_object($p2) || is_array($p2)) { // using is_object allows both Exception and PEAR_Error if (is_object($p2) && !($p2 instanceof Exception)) { if (!class_exists('PEAR_Error') || !($p2 instanceof PEAR_Error)) { throw new PEAR_Exception('exception cause must be Exception, ' . 'array, or PEAR_Error'); } } $code = $p3; if (is_array($p2) && isset($p2['message'])) { // fix potential problem of passing in a single warning $p2 = array($p2); } $this->cause = $p2; } else { $code = null; $this->cause = null; } parent::__construct($message, $code); $this->signal(); } /** * @param mixed $callback - A valid php callback, see php func is_callable() * - A PEAR_Exception::OBSERVER_* constant * - An array(const PEAR_Exception::OBSERVER_*, * mixed $options) * @param string $label The name of the observer. Use this if you want * to remove it later with removeObserver() */ public static function addObserver($callback, $label = 'default') { self::$_observers[$label] = $callback; } public static function removeObserver($label = 'default') { unset(self::$_observers[$label]); } /** * @return int unique identifier for an observer */ public static function getUniqueId() { return self::$_uniqueid++; } 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 self::OBSERVER_PRINT : $f = (isset($func[1])) ? $func[1] : '%s'; printf($f, $this->getMessage()); break; case self::OBSERVER_TRIGGER : $f = (isset($func[1])) ? $func[1] : E_USER_NOTICE; trigger_error($this->getMessage(), $f); break; case self::OBSERVER_DIE : $f = (isset($func[1])) ? $func[1] : '%s'; die(printf($f, $this->getMessage())); break; default: trigger_error('invalid observer type', E_USER_WARNING); } } } /** * Return specific error information that can be used for more detailed * error messages or translation. * * This method may be overridden in child exception classes in order * to add functionality not present in PEAR_Exception and is a placeholder * to define API * * The returned array must be an associative array of parameter => value like so: *
     * array('name' => $name, 'context' => array(...))
     * 
* @return array */ public function getErrorData() { return array(); } /** * Returns the exception that caused this exception to be thrown * @access public * @return Exception|array The context of the exception */ public function getCause() { return $this->cause; } /** * Function must be public to call on caused exceptions * @param array */ public function getCauseMessage(&$causes) { $trace = $this->getTraceSafe(); $cause = array('class' => get_class($this), 'message' => $this->message, 'file' => 'unknown', 'line' => 'unknown'); if (isset($trace[0])) { if (isset($trace[0]['file'])) { $cause['file'] = $trace[0]['file']; $cause['line'] = $trace[0]['line']; } } $causes[] = $cause; if ($this->cause instanceof PEAR_Exception) { $this->cause->getCauseMessage($causes); } elseif ($this->cause instanceof Exception) { $causes[] = array('class' => get_class($this->cause), 'message' => $this->cause->getMessage(), 'file' => $this->cause->getFile(), 'line' => $this->cause->getLine()); } elseif (class_exists('PEAR_Error') && $this->cause instanceof PEAR_Error) { $causes[] = array('class' => get_class($this->cause), 'message' => $this->cause->getMessage(), 'file' => 'unknown', 'line' => 'unknown'); } elseif (is_array($this->cause)) { foreach ($this->cause as $cause) { if ($cause instanceof PEAR_Exception) { $cause->getCauseMessage($causes); } elseif ($cause instanceof Exception) { $causes[] = array('class' => get_class($cause), 'message' => $cause->getMessage(), 'file' => $cause->getFile(), 'line' => $cause->getLine()); } elseif (class_exists('PEAR_Error') && $cause instanceof PEAR_Error) { $causes[] = array('class' => get_class($cause), 'message' => $cause->getMessage(), 'file' => 'unknown', 'line' => 'unknown'); } elseif (is_array($cause) && isset($cause['message'])) { // PEAR_ErrorStack warning $causes[] = array( 'class' => $cause['package'], 'message' => $cause['message'], 'file' => isset($cause['context']['file']) ? $cause['context']['file'] : 'unknown', 'line' => isset($cause['context']['line']) ? $cause['context']['line'] : 'unknown', ); } } } } public function getTraceSafe() { if (!isset($this->_trace)) { $this->_trace = $this->getTrace(); if (empty($this->_trace)) { $backtrace = debug_backtrace(); $this->_trace = array($backtrace[count($backtrace)-1]); } } return $this->_trace; } public function getErrorClass() { $trace = $this->getTraceSafe(); return $trace[0]['class']; } public function getErrorMethod() { $trace = $this->getTraceSafe(); return $trace[0]['function']; } public function __toString() { if (isset($_SERVER['REQUEST_URI'])) { return $this->toHtml(); } return $this->toText(); } public function toHtml() { $trace = $this->getTraceSafe(); $causes = array(); $this->getCauseMessage($causes); $html = '' . "\n"; foreach ($causes as $i => $cause) { $html .= '\n"; } $html .= '' . "\n" . '' . '' . '' . "\n"; foreach ($trace as $k => $v) { $html .= '' . '' . '' . "\n"; } $html .= '' . '' . '' . "\n" . '
' . str_repeat('-', $i) . ' ' . $cause['class'] . ': ' . htmlspecialchars($cause['message']) . ' in ' . $cause['file'] . ' ' . 'on line ' . $cause['line'] . '' . "
Exception trace
#FunctionLocation
' . $k . ''; if (!empty($v['class'])) { $html .= $v['class'] . $v['type']; } $html .= $v['function']; $args = array(); if (!empty($v['args'])) { foreach ($v['args'] as $arg) { if (is_null($arg)) $args[] = 'null'; elseif (is_array($arg)) $args[] = 'Array'; elseif (is_object($arg)) $args[] = 'Object('.get_class($arg).')'; elseif (is_bool($arg)) $args[] = $arg ? 'true' : 'false'; elseif (is_int($arg) || is_double($arg)) $args[] = $arg; else { $arg = (string)$arg; $str = htmlspecialchars(substr($arg, 0, 16)); if (strlen($arg) > 16) $str .= '…'; $args[] = "'" . $str . "'"; } } } $html .= '(' . implode(', ',$args) . ')' . '' . (isset($v['file']) ? $v['file'] : 'unknown') . ':' . (isset($v['line']) ? $v['line'] : 'unknown') . '
' . ($k+1) . '{main} 
'; return $html; } public function toText() { $causes = array(); $this->getCauseMessage($causes); $causeMsg = ''; foreach ($causes as $i => $cause) { $causeMsg .= str_repeat(' ', $i) . $cause['class'] . ': ' . $cause['message'] . ' in ' . $cause['file'] . ' on line ' . $cause['line'] . "\n"; } return $causeMsg . $this->getTraceAsString(); } }php-pear-1.10.1+submodules+notgz/PEAR/Frontend.php000066400000000000000000000147741262614675700216750ustar00rootroot00000000000000 * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ /** * Include error handling */ //require_once 'PEAR.php'; /** * Which user interface class is being used. * @var string class name */ $GLOBALS['_PEAR_FRONTEND_CLASS'] = 'PEAR_Frontend_CLI'; /** * Instance of $_PEAR_Command_uiclass. * @var object */ $GLOBALS['_PEAR_FRONTEND_SINGLETON'] = null; /** * Singleton-based frontend for PEAR user input/output * * @category pear * @package PEAR * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version Release: @package_version@ * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ class PEAR_Frontend extends PEAR { /** * Retrieve the frontend object * @return PEAR_Frontend_CLI|PEAR_Frontend_Web|PEAR_Frontend_Gtk */ public static function &singleton($type = null) { if ($type === null) { if (!isset($GLOBALS['_PEAR_FRONTEND_SINGLETON'])) { $a = false; return $a; } return $GLOBALS['_PEAR_FRONTEND_SINGLETON']; } $a = PEAR_Frontend::setFrontendClass($type); return $a; } /** * Set the frontend class that will be used by calls to {@link singleton()} * * Frontends are expected to conform to the PEAR naming standard of * _ => DIRECTORY_SEPARATOR (PEAR_Frontend_CLI is in PEAR/Frontend/CLI.php) * @param string $uiclass full class name * @return PEAR_Frontend */ public static function &setFrontendClass($uiclass) { if (is_object($GLOBALS['_PEAR_FRONTEND_SINGLETON']) && is_a($GLOBALS['_PEAR_FRONTEND_SINGLETON'], $uiclass)) { return $GLOBALS['_PEAR_FRONTEND_SINGLETON']; } if (!class_exists($uiclass)) { $file = str_replace('_', '/', $uiclass) . '.php'; if (PEAR_Frontend::isIncludeable($file)) { include_once $file; } } if (class_exists($uiclass)) { $obj = new $uiclass; // quick test to see if this class implements a few of the most // important frontend methods if (is_a($obj, 'PEAR_Frontend')) { $GLOBALS['_PEAR_FRONTEND_SINGLETON'] = &$obj; $GLOBALS['_PEAR_FRONTEND_CLASS'] = $uiclass; return $obj; } $err = PEAR::raiseError("not a frontend class: $uiclass"); return $err; } $err = PEAR::raiseError("no such class: $uiclass"); return $err; } /** * Set the frontend class that will be used by calls to {@link singleton()} * * Frontends are expected to be a descendant of PEAR_Frontend * @param PEAR_Frontend * @return PEAR_Frontend */ public static function &setFrontendObject($uiobject) { if (is_object($GLOBALS['_PEAR_FRONTEND_SINGLETON']) && is_a($GLOBALS['_PEAR_FRONTEND_SINGLETON'], get_class($uiobject))) { return $GLOBALS['_PEAR_FRONTEND_SINGLETON']; } if (!is_a($uiobject, 'PEAR_Frontend')) { $err = PEAR::raiseError('not a valid frontend class: (' . get_class($uiobject) . ')'); return $err; } $GLOBALS['_PEAR_FRONTEND_SINGLETON'] = &$uiobject; $GLOBALS['_PEAR_FRONTEND_CLASS'] = get_class($uiobject); return $uiobject; } /** * @param string $path relative or absolute include path * @return boolean */ public static function isIncludeable($path) { if (file_exists($path) && is_readable($path)) { return true; } $fp = @fopen($path, 'r', true); if ($fp) { fclose($fp); return true; } return false; } /** * @param PEAR_Config */ function setConfig(&$config) { } /** * This can be overridden to allow session-based temporary file management * * By default, all files are deleted at the end of a session. The web installer * needs to be able to sustain a list over many sessions in order to support * user interaction with install scripts */ function addTempFile($file) { $GLOBALS['_PEAR_Common_tempfiles'][] = $file; } /** * Log an action * * @param string $msg the message to log * @param boolean $append_crlf * @return boolean true * @abstract */ function log($msg, $append_crlf = true) { } /** * Run a post-installation script * * @param array $scripts array of post-install scripts * @abstract */ function runPostinstallScripts(&$scripts) { } /** * Display human-friendly output formatted depending on the * $command parameter. * * This should be able to handle basic output data with no command * @param mixed $data data structure containing the information to display * @param string $command command from which this method was called * @abstract */ function outputData($data, $command = '_default') { } /** * Display a modal form dialog and return the given input * * A frontend that requires multiple requests to retrieve and process * data must take these needs into account, and implement the request * handling code. * @param string $command command from which this method was called * @param array $prompts associative array. keys are the input field names * and values are the description * @param array $types array of input field types (text, password, * etc.) keys have to be the same like in $prompts * @param array $defaults array of default values. again keys have * to be the same like in $prompts. Do not depend * on a default value being set. * @return array input sent by the user * @abstract */ function userDialog($command, $prompts, $types = array(), $defaults = array()) { } }php-pear-1.10.1+submodules+notgz/PEAR/Frontend/000077500000000000000000000000001262614675700211475ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/PEAR/Frontend/CLI.php000066400000000000000000000621271262614675700222770ustar00rootroot00000000000000 * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @link http://pear.php.net/package/PEAR * @since File available since Release 0.1 */ /** * base class */ require_once 'PEAR/Frontend.php'; /** * Command-line Frontend for the PEAR Installer * @category pear * @package PEAR * @author Stig Bakken * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version Release: @package_version@ * @link http://pear.php.net/package/PEAR * @since Class available since Release 0.1 */ class PEAR_Frontend_CLI extends PEAR_Frontend { /** * What type of user interface this frontend is for. * @var string * @access public */ var $type = 'CLI'; var $lp = ''; // line prefix var $params = array(); var $term = array( 'bold' => '', 'normal' => '', ); function __construct() { parent::__construct(); $term = getenv('TERM'); //(cox) $_ENV is empty for me in 4.1.1 if (function_exists('posix_isatty') && !posix_isatty(1)) { // output is being redirected to a file or through a pipe } elseif ($term) { if (preg_match('/^(xterm|vt220|linux)/', $term)) { $this->term['bold'] = sprintf("%c%c%c%c", 27, 91, 49, 109); $this->term['normal'] = sprintf("%c%c%c", 27, 91, 109); } elseif (preg_match('/^vt100/', $term)) { $this->term['bold'] = sprintf("%c%c%c%c%c%c", 27, 91, 49, 109, 0, 0); $this->term['normal'] = sprintf("%c%c%c%c%c", 27, 91, 109, 0, 0); } } elseif (OS_WINDOWS) { // XXX add ANSI codes here } } /** * @param object PEAR_Error object */ function displayError($e) { return $this->_displayLine($e->getMessage()); } /** * @param object PEAR_Error object */ function displayFatalError($eobj) { $this->displayError($eobj); if (class_exists('PEAR_Config')) { $config = &PEAR_Config::singleton(); if ($config->get('verbose') > 5) { if (function_exists('debug_print_backtrace')) { debug_print_backtrace(); exit(1); } $raised = false; foreach (debug_backtrace() as $i => $frame) { if (!$raised) { if (isset($frame['class']) && strtolower($frame['class']) == 'pear' && strtolower($frame['function']) == 'raiseerror' ) { $raised = true; } else { continue; } } $frame['class'] = !isset($frame['class']) ? '' : $frame['class']; $frame['type'] = !isset($frame['type']) ? '' : $frame['type']; $frame['function'] = !isset($frame['function']) ? '' : $frame['function']; $frame['line'] = !isset($frame['line']) ? '' : $frame['line']; $this->_displayLine("#$i: $frame[class]$frame[type]$frame[function] $frame[line]"); } } } exit(1); } /** * Instruct the runInstallScript method to skip a paramgroup that matches the * id value passed in. * * This method is useful for dynamically configuring which sections of a post-install script * will be run based on the user's setup, which is very useful for making flexible * post-install scripts without losing the cross-Frontend ability to retrieve user input * @param string */ function skipParamgroup($id) { $this->_skipSections[$id] = true; } function runPostinstallScripts(&$scripts) { foreach ($scripts as $i => $script) { $this->runInstallScript($scripts[$i]->_params, $scripts[$i]->_obj); } } /** * @param array $xml contents of postinstallscript tag * @param object $script post-installation script * @param string install|upgrade */ function runInstallScript($xml, &$script) { $this->_skipSections = array(); if (!is_array($xml) || !isset($xml['paramgroup'])) { $script->run(array(), '_default'); return; } $completedPhases = array(); if (!isset($xml['paramgroup'][0])) { $xml['paramgroup'] = array($xml['paramgroup']); } foreach ($xml['paramgroup'] as $group) { if (isset($this->_skipSections[$group['id']])) { // the post-install script chose to skip this section dynamically continue; } if (isset($group['name'])) { $paramname = explode('::', $group['name']); if ($lastgroup['id'] != $paramname[0]) { continue; } $group['name'] = $paramname[1]; if (!isset($answers)) { return; } if (isset($answers[$group['name']])) { switch ($group['conditiontype']) { case '=' : if ($answers[$group['name']] != $group['value']) { continue 2; } break; case '!=' : if ($answers[$group['name']] == $group['value']) { continue 2; } break; case 'preg_match' : if (!@preg_match('/' . $group['value'] . '/', $answers[$group['name']])) { continue 2; } break; default : return; } } } $lastgroup = $group; if (isset($group['instructions'])) { $this->_display($group['instructions']); } if (!isset($group['param'][0])) { $group['param'] = array($group['param']); } if (isset($group['param'])) { if (method_exists($script, 'postProcessPrompts')) { $prompts = $script->postProcessPrompts($group['param'], $group['id']); if (!is_array($prompts) || count($prompts) != count($group['param'])) { $this->outputData('postinstall', 'Error: post-install script did not ' . 'return proper post-processed prompts'); $prompts = $group['param']; } else { foreach ($prompts as $i => $var) { if (!is_array($var) || !isset($var['prompt']) || !isset($var['name']) || ($var['name'] != $group['param'][$i]['name']) || ($var['type'] != $group['param'][$i]['type']) ) { $this->outputData('postinstall', 'Error: post-install script ' . 'modified the variables or prompts, severe security risk. ' . 'Will instead use the defaults from the package.xml'); $prompts = $group['param']; } } } $answers = $this->confirmDialog($prompts); } else { $answers = $this->confirmDialog($group['param']); } } if ((isset($answers) && $answers) || !isset($group['param'])) { if (!isset($answers)) { $answers = array(); } array_unshift($completedPhases, $group['id']); if (!$script->run($answers, $group['id'])) { $script->run($completedPhases, '_undoOnError'); return; } } else { $script->run($completedPhases, '_undoOnError'); return; } } } /** * Ask for user input, confirm the answers and continue until the user is satisfied * @param array an array of arrays, format array('name' => 'paramname', 'prompt' => * 'text to display', 'type' => 'string'[, default => 'default value']) * @return array */ function confirmDialog($params) { $answers = $prompts = $types = array(); foreach ($params as $param) { $prompts[$param['name']] = $param['prompt']; $types[$param['name']] = $param['type']; $answers[$param['name']] = isset($param['default']) ? $param['default'] : ''; } $tried = false; do { if ($tried) { $i = 1; foreach ($answers as $var => $value) { if (!strlen($value)) { echo $this->bold("* Enter an answer for #" . $i . ": ({$prompts[$var]})\n"); } $i++; } } $answers = $this->userDialog('', $prompts, $types, $answers); $tried = true; } while (is_array($answers) && count(array_filter($answers)) != count($prompts)); return $answers; } function userDialog($command, $prompts, $types = array(), $defaults = array(), $screensize = 20) { if (!is_array($prompts)) { return array(); } $testprompts = array_keys($prompts); $result = $defaults; reset($prompts); if (count($prompts) === 1) { foreach ($prompts as $key => $prompt) { $type = $types[$key]; $default = @$defaults[$key]; print "$prompt "; if ($default) { print "[$default] "; } print ": "; $line = fgets(STDIN, 2048); $result[$key] = ($default && trim($line) == '') ? $default : trim($line); } return $result; } $first_run = true; while (true) { $descLength = max(array_map('strlen', $prompts)); $descFormat = "%-{$descLength}s"; $last = count($prompts); $i = 0; foreach ($prompts as $n => $var) { $res = isset($result[$n]) ? $result[$n] : null; printf("%2d. $descFormat : %s\n", ++$i, $prompts[$n], $res); } print "\n1-$last, 'all', 'abort', or Enter to continue: "; $tmp = trim(fgets(STDIN, 1024)); if (empty($tmp)) { break; } if ($tmp == 'abort') { return false; } if (isset($testprompts[(int)$tmp - 1])) { $var = $testprompts[(int)$tmp - 1]; $desc = $prompts[$var]; $current = @$result[$var]; print "$desc [$current] : "; $tmp = trim(fgets(STDIN, 1024)); if ($tmp !== '') { $result[$var] = $tmp; } } elseif ($tmp == 'all') { foreach ($prompts as $var => $desc) { $current = $result[$var]; print "$desc [$current] : "; $tmp = trim(fgets(STDIN, 1024)); if (trim($tmp) !== '') { $result[$var] = trim($tmp); } } } $first_run = false; } return $result; } function userConfirm($prompt, $default = 'yes') { 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] : "; $fp = fopen("php://stdin", "r"); $line = fgets($fp, 2048); fclose($fp); $answer = strtolower(trim($line)); if (empty($answer)) { $answer = $default; } if (in_array($answer, $positives)) { return true; } if (in_array($answer, $negatives)) { return false; } if (in_array($default, $positives)) { return true; } return false; } function outputData($data, $command = '_default') { switch ($command) { case 'channel-info': foreach ($data as $type => $section) { if ($type == 'main') { $section['data'] = array_values($section['data']); } $this->outputData($section); } break; case 'install': case 'upgrade': case 'upgrade-all': if (is_array($data) && isset($data['release_warnings'])) { $this->_displayLine(''); $this->_startTable(array( 'border' => false, 'caption' => 'Release Warnings' )); $this->_tableRow(array($data['release_warnings']), null, array(1 => array('wrap' => 55))); $this->_endTable(); $this->_displayLine(''); } $this->_displayLine(is_array($data) ? $data['data'] : $data); break; case 'search': $this->_startTable($data); if (isset($data['headline']) && is_array($data['headline'])) { $this->_tableRow($data['headline'], array('bold' => true), array(1 => array('wrap' => 55))); } $packages = array(); foreach($data['data'] as $category) { foreach($category as $name => $pkg) { $packages[$pkg[0]] = $pkg; } } $p = array_keys($packages); natcasesort($p); foreach ($p as $name) { $this->_tableRow($packages[$name], null, array(1 => array('wrap' => 55))); } $this->_endTable(); break; case 'list-all': if (!isset($data['data'])) { $this->_displayLine('No packages in channel'); break; } $this->_startTable($data); if (isset($data['headline']) && is_array($data['headline'])) { $this->_tableRow($data['headline'], array('bold' => true), array(1 => array('wrap' => 55))); } $packages = array(); foreach($data['data'] as $category) { foreach($category as $name => $pkg) { $packages[$pkg[0]] = $pkg; } } $p = array_keys($packages); natcasesort($p); foreach ($p as $name) { $pkg = $packages[$name]; unset($pkg[4], $pkg[5]); $this->_tableRow($pkg, null, array(1 => array('wrap' => 55))); } $this->_endTable(); break; case 'config-show': $data['border'] = false; $opts = array( 0 => array('wrap' => 30), 1 => array('wrap' => 20), 2 => array('wrap' => 35) ); $this->_startTable($data); if (isset($data['headline']) && is_array($data['headline'])) { $this->_tableRow($data['headline'], array('bold' => true), $opts); } foreach ($data['data'] as $group) { foreach ($group as $value) { if ($value[2] == '') { $value[2] = ""; } $this->_tableRow($value, null, $opts); } } $this->_endTable(); break; case 'remote-info': $d = $data; $data = array( 'caption' => 'Package details:', 'border' => false, 'data' => array( array("Latest", $data['stable']), array("Installed", $data['installed']), array("Package", $data['name']), array("License", $data['license']), array("Category", $data['category']), array("Summary", $data['summary']), array("Description", $data['description']), ), ); if (isset($d['deprecated']) && $d['deprecated']) { $conf = &PEAR_Config::singleton(); $reg = $conf->getRegistry(); $name = $reg->parsedPackageNameToString($d['deprecated'], true); $data['data'][] = array('Deprecated! use', $name); } default: { if (is_array($data)) { $this->_startTable($data); $count = count($data['data'][0]); if ($count == 2) { $opts = array(0 => array('wrap' => 25), 1 => array('wrap' => 48) ); } elseif ($count == 3) { $opts = array(0 => array('wrap' => 30), 1 => array('wrap' => 20), 2 => array('wrap' => 35) ); } else { $opts = null; } if (isset($data['headline']) && is_array($data['headline'])) { $this->_tableRow($data['headline'], array('bold' => true), $opts); } if (is_array($data['data'])) { foreach($data['data'] as $row) { $this->_tableRow($row, null, $opts); } } else { $this->_tableRow(array($data['data']), null, $opts); } $this->_endTable(); } else { $this->_displayLine($data); } } } } function log($text, $append_crlf = true) { if ($append_crlf) { return $this->_displayLine($text); } return $this->_display($text); } function bold($text) { if (empty($this->term['bold'])) { return strtoupper($text); } return $this->term['bold'] . $text . $this->term['normal']; } function _displayHeading($title) { print $this->lp.$this->bold($title)."\n"; print $this->lp.str_repeat("=", strlen($title))."\n"; } function _startTable($params = array()) { $params['table_data'] = array(); $params['widest'] = array(); // indexed by column $params['highest'] = array(); // indexed by row $params['ncols'] = 0; $this->params = $params; } function _tableRow($columns, $rowparams = array(), $colparams = array()) { $highest = 1; for ($i = 0; $i < count($columns); $i++) { $col = &$columns[$i]; if (isset($colparams[$i]) && !empty($colparams[$i]['wrap'])) { $col = wordwrap($col, $colparams[$i]['wrap']); } if (strpos($col, "\n") !== false) { $multiline = explode("\n", $col); $w = 0; foreach ($multiline as $n => $line) { $len = strlen($line); if ($len > $w) { $w = $len; } } $lines = count($multiline); } else { $w = strlen($col); } if (isset($this->params['widest'][$i])) { if ($w > $this->params['widest'][$i]) { $this->params['widest'][$i] = $w; } } else { $this->params['widest'][$i] = $w; } $tmp = count_chars($columns[$i], 1); // handle unix, mac and windows formats $lines = (isset($tmp[10]) ? $tmp[10] : (isset($tmp[13]) ? $tmp[13] : 0)) + 1; if ($lines > $highest) { $highest = $lines; } } if (count($columns) > $this->params['ncols']) { $this->params['ncols'] = count($columns); } $new_row = array( 'data' => $columns, 'height' => $highest, 'rowparams' => $rowparams, 'colparams' => $colparams, ); $this->params['table_data'][] = $new_row; } function _endTable() { extract($this->params); if (!empty($caption)) { $this->_displayHeading($caption); } if (count($table_data) === 0) { return; } if (!isset($width)) { $width = $widest; } else { for ($i = 0; $i < $ncols; $i++) { if (!isset($width[$i])) { $width[$i] = $widest[$i]; } } } $border = false; if (empty($border)) { $cellstart = ''; $cellend = ' '; $rowend = ''; $padrowend = false; $borderline = ''; } else { $cellstart = '| '; $cellend = ' '; $rowend = '|'; $padrowend = true; $borderline = '+'; foreach ($width as $w) { $borderline .= str_repeat('-', $w + strlen($cellstart) + strlen($cellend) - 1); $borderline .= '+'; } } if ($borderline) { $this->_displayLine($borderline); } for ($i = 0; $i < count($table_data); $i++) { extract($table_data[$i]); if (!is_array($rowparams)) { $rowparams = array(); } if (!is_array($colparams)) { $colparams = array(); } $rowlines = array(); if ($height > 1) { for ($c = 0; $c < count($data); $c++) { $rowlines[$c] = preg_split('/(\r?\n|\r)/', $data[$c]); if (count($rowlines[$c]) < $height) { $rowlines[$c] = array_pad($rowlines[$c], $height, ''); } } } else { for ($c = 0; $c < count($data); $c++) { $rowlines[$c] = array($data[$c]); } } for ($r = 0; $r < $height; $r++) { $rowtext = ''; for ($c = 0; $c < count($data); $c++) { if (isset($colparams[$c])) { $attribs = array_merge($rowparams, $colparams); } else { $attribs = $rowparams; } $w = isset($width[$c]) ? $width[$c] : 0; //$cell = $data[$c]; $cell = $rowlines[$c][$r]; $l = strlen($cell); if ($l > $w) { $cell = substr($cell, 0, $w); } if (isset($attribs['bold'])) { $cell = $this->bold($cell); } if ($l < $w) { // not using str_pad here because we may // add bold escape characters to $cell $cell .= str_repeat(' ', $w - $l); } $rowtext .= $cellstart . $cell . $cellend; } if (!$border) { $rowtext = rtrim($rowtext); } $rowtext .= $rowend; $this->_displayLine($rowtext); } } if ($borderline) { $this->_displayLine($borderline); } } function _displayLine($text) { print "$this->lp$text\n"; } function _display($text) { print $text; } } php-pear-1.10.1+submodules+notgz/PEAR/Installer.php000066400000000000000000002074611262614675700220500ustar00rootroot00000000000000 * @author Tomas V.V. Cox * @author Martin Jansen * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @link http://pear.php.net/package/PEAR * @since File available since Release 0.1 */ /** * Used for installation groups in package.xml 2.0 and platform exceptions */ require_once 'OS/Guess.php'; require_once 'PEAR/Downloader.php'; define('PEAR_INSTALLER_NOBINARY', -240); /** * Administration class used to install PEAR packages and maintain the * installed package database. * * @category pear * @package PEAR * @author Stig Bakken * @author Tomas V.V. Cox * @author Martin Jansen * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version Release: @package_version@ * @link http://pear.php.net/package/PEAR * @since Class available since Release 0.1 */ class PEAR_Installer extends PEAR_Downloader { // {{{ properties /** name of the package directory, for example Foo-1.0 * @var string */ var $pkgdir; /** directory where PHP code files go * @var string */ var $phpdir; /** directory where PHP extension files go * @var string */ var $extdir; /** directory where documentation goes * @var string */ var $docdir; /** installation root directory (ala PHP's INSTALL_ROOT or * automake's DESTDIR * @var string */ var $installroot = ''; /** debug level * @var int */ var $debug = 1; /** temporary directory * @var string */ var $tmpdir; /** * PEAR_Registry object used by the installer * @var PEAR_Registry */ var $registry; /** * array of PEAR_Downloader_Packages * @var array */ var $_downloadedPackages; /** List of file transactions queued for an install/upgrade/uninstall. * * Format: * array( * 0 => array("rename => array("from-file", "to-file")), * 1 => array("delete" => array("file-to-delete")), * ... * ) * * @var array */ var $file_operations = array(); // }}} // {{{ constructor /** * PEAR_Installer constructor. * * @param object $ui user interface object (instance of PEAR_Frontend_*) * * @access public */ function __construct(&$ui) { parent::__construct($ui, array(), null); $this->setFrontendObject($ui); $this->debug = $this->config->get('verbose'); } function setOptions($options) { $this->_options = $options; } function setConfig(&$config) { $this->config = &$config; $this->_registry = &$config->getRegistry(); } // }}} function _removeBackups($files) { foreach ($files as $path) { $this->addFileOperation('removebackup', array($path)); } } // {{{ _deletePackageFiles() /** * Delete a package's installed files, does not remove empty directories. * * @param string package name * @param string channel name * @param bool if true, then files are backed up first * @return bool TRUE on success, or a PEAR error on failure * @access protected */ function _deletePackageFiles($package, $channel = false, $backup = false) { if (!$channel) { $channel = 'pear.php.net'; } if (!strlen($package)) { return $this->raiseError("No package to uninstall given"); } if (strtolower($package) == 'pear' && $channel == 'pear.php.net') { // to avoid race conditions, include all possible needed files require_once 'PEAR/Task/Common.php'; require_once 'PEAR/Task/Replace.php'; require_once 'PEAR/Task/Unixeol.php'; require_once 'PEAR/Task/Windowseol.php'; require_once 'PEAR/PackageFile/v1.php'; require_once 'PEAR/PackageFile/v2.php'; require_once 'PEAR/PackageFile/Generator/v1.php'; require_once 'PEAR/PackageFile/Generator/v2.php'; } $filelist = $this->_registry->packageInfo($package, 'filelist', $channel); if ($filelist == null) { return $this->raiseError("$channel/$package not installed"); } $ret = array(); foreach ($filelist as $file => $props) { if (empty($props['installed_as'])) { continue; } $path = $props['installed_as']; if ($backup) { $this->addFileOperation('backup', array($path)); $ret[] = $path; } $this->addFileOperation('delete', array($path)); } if ($backup) { return $ret; } return true; } // }}} // {{{ _installFile() /** * @param string filename * @param array attributes from tag in package.xml * @param string path to install the file in * @param array options from command-line * @access private */ function _installFile($file, $atts, $tmp_path, $options) { // {{{ return if this file is meant for another platform static $os; if (!isset($this->_registry)) { $this->_registry = &$this->config->getRegistry(); } if (isset($atts['platform'])) { if (empty($os)) { $os = new OS_Guess(); } 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; } } // }}} $channel = $this->pkginfo->getChannel(); // {{{ assemble the destination paths switch ($atts['role']) { case 'src': case 'extsrc': $this->source_files++; return; case 'doc': case 'data': case 'test': $dest_dir = $this->config->get($atts['role'] . '_dir', null, $channel) . DIRECTORY_SEPARATOR . $this->pkginfo->getPackage(); unset($atts['baseinstalldir']); break; case 'ext': case 'php': $dest_dir = $this->config->get($atts['role'] . '_dir', null, $channel); break; case 'script': $dest_dir = $this->config->get('bin_dir', null, $channel); break; default: return $this->raiseError("Invalid role `$atts[role]' for file $file"); } $save_destdir = $dest_dir; if (!empty($atts['baseinstalldir'])) { $dest_dir .= DIRECTORY_SEPARATOR . $atts['baseinstalldir']; } if (dirname($file) != '.' && empty($atts['install-as'])) { $dest_dir .= DIRECTORY_SEPARATOR . dirname($file); } if (empty($atts['install-as'])) { $dest_file = $dest_dir . DIRECTORY_SEPARATOR . basename($file); } else { $dest_file = $dest_dir . DIRECTORY_SEPARATOR . $atts['install-as']; } $orig_file = $tmp_path . DIRECTORY_SEPARATOR . $file; // Clean up the DIRECTORY_SEPARATOR mess $ds2 = DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR; list($dest_file, $orig_file) = preg_replace(array('!\\\\+!', '!/!', "!$ds2+!"), array(DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR), array($dest_file, $orig_file)); $final_dest_file = $installed_as = $dest_file; if (isset($this->_options['packagingroot'])) { $installedas_dest_dir = dirname($final_dest_file); $installedas_dest_file = $dest_dir . DIRECTORY_SEPARATOR . '.tmp' . basename($final_dest_file); $final_dest_file = $this->_prependPath($final_dest_file, $this->_options['packagingroot']); } else { $installedas_dest_dir = dirname($final_dest_file); $installedas_dest_file = $installedas_dest_dir . DIRECTORY_SEPARATOR . '.tmp' . basename($final_dest_file); } $dest_dir = dirname($final_dest_file); $dest_file = $dest_dir . DIRECTORY_SEPARATOR . '.tmp' . basename($final_dest_file); if (preg_match('~/\.\.(/|\\z)|^\.\./~', str_replace('\\', '/', $dest_file))) { return $this->raiseError("SECURITY ERROR: file $file (installed to $dest_file) contains parent directory reference ..", PEAR_INSTALLER_FAILED); } // }}} if (empty($this->_options['register-only']) && (!file_exists($dest_dir) || !is_dir($dest_dir))) { if (!$this->mkDirHier($dest_dir)) { return $this->raiseError("failed to mkdir $dest_dir", PEAR_INSTALLER_FAILED); } $this->log(3, "+ mkdir $dest_dir"); } // pretty much nothing happens if we are only registering the install if (empty($this->_options['register-only'])) { if (empty($atts['replacements'])) { if (!file_exists($orig_file)) { return $this->raiseError("file $orig_file does not exist", PEAR_INSTALLER_FAILED); } if (!@copy($orig_file, $dest_file)) { return $this->raiseError("failed to write $dest_file: $php_errormsg", PEAR_INSTALLER_FAILED); } $this->log(3, "+ cp $orig_file $dest_file"); if (isset($atts['md5sum'])) { $md5sum = md5_file($dest_file); } } else { // {{{ file with replacements if (!file_exists($orig_file)) { return $this->raiseError("file does not exist", PEAR_INSTALLER_FAILED); } $contents = file_get_contents($orig_file); if ($contents === false) { $contents = ''; } if (isset($atts['md5sum'])) { $md5sum = md5($contents); } $subst_from = $subst_to = array(); foreach ($atts['replacements'] as $a) { $to = ''; if ($a['type'] == 'php-const') { if (preg_match('/^[a-z0-9_]+\\z/i', $a['to'])) { eval("\$to = $a[to];"); } else { if (!isset($options['soft'])) { $this->log(0, "invalid php-const replacement: $a[to]"); } continue; } } elseif ($a['type'] == 'pear-config') { if ($a['to'] == 'master_server') { $chan = $this->_registry->getChannel($channel); if (!PEAR::isError($chan)) { $to = $chan->getServer(); } else { $to = $this->config->get($a['to'], null, $channel); } } else { $to = $this->config->get($a['to'], null, $channel); } if (is_null($to)) { if (!isset($options['soft'])) { $this->log(0, "invalid pear-config replacement: $a[to]"); } continue; } } elseif ($a['type'] == 'package-info') { if ($t = $this->pkginfo->packageInfo($a['to'])) { $to = $t; } else { if (!isset($options['soft'])) { $this->log(0, "invalid package-info replacement: $a[to]"); } continue; } } if (!is_null($to)) { $subst_from[] = $a['from']; $subst_to[] = $to; } } $this->log(3, "doing ".sizeof($subst_from)." substitution(s) for $final_dest_file"); if (sizeof($subst_from)) { $contents = str_replace($subst_from, $subst_to, $contents); } $wp = @fopen($dest_file, "wb"); if (!is_resource($wp)) { return $this->raiseError("failed to create $dest_file: $php_errormsg", PEAR_INSTALLER_FAILED); } if (@fwrite($wp, $contents) === false) { return $this->raiseError("failed writing to $dest_file: $php_errormsg", PEAR_INSTALLER_FAILED); } fclose($wp); // }}} } // {{{ check the md5 if (isset($md5sum)) { if (strtolower($md5sum) === strtolower($atts['md5sum'])) { $this->log(2, "md5sum ok: $final_dest_file"); } else { if (empty($options['force'])) { // delete the file if (file_exists($dest_file)) { unlink($dest_file); } if (!isset($options['ignore-errors'])) { return $this->raiseError("bad md5sum for file $final_dest_file", PEAR_INSTALLER_FAILED); } if (!isset($options['soft'])) { $this->log(0, "warning : bad md5sum for file $final_dest_file"); } } else { if (!isset($options['soft'])) { $this->log(0, "warning : bad md5sum for file $final_dest_file"); } } } } // }}} // {{{ set file permissions if (!OS_WINDOWS) { if ($atts['role'] == 'script') { $mode = 0777 & ~(int)octdec($this->config->get('umask')); $this->log(3, "+ chmod +x $dest_file"); } else { $mode = 0666 & ~(int)octdec($this->config->get('umask')); } if ($atts['role'] != 'src') { $this->addFileOperation("chmod", array($mode, $dest_file)); if (!@chmod($dest_file, $mode)) { if (!isset($options['soft'])) { $this->log(0, "failed to change mode of $dest_file: $php_errormsg"); } } } } // }}} if ($atts['role'] == 'src') { rename($dest_file, $final_dest_file); $this->log(2, "renamed source file $dest_file to $final_dest_file"); } else { $this->addFileOperation("rename", array($dest_file, $final_dest_file, $atts['role'] == 'ext')); } } // Store the full path where the file was installed for easy unistall if ($atts['role'] != 'script') { $loc = $this->config->get($atts['role'] . '_dir'); } else { $loc = $this->config->get('bin_dir'); } if ($atts['role'] != 'src') { $this->addFileOperation("installed_as", array($file, $installed_as, $loc, dirname(substr($installedas_dest_file, strlen($loc))))); } //$this->log(2, "installed: $dest_file"); return PEAR_INSTALLER_OK; } // }}} // {{{ _installFile2() /** * @param PEAR_PackageFile_v1|PEAR_PackageFile_v2 * @param string filename * @param array attributes from tag in package.xml * @param string path to install the file in * @param array options from command-line * @access private */ function _installFile2(&$pkg, $file, &$real_atts, $tmp_path, $options) { $atts = $real_atts; if (!isset($this->_registry)) { $this->_registry = &$this->config->getRegistry(); } $channel = $pkg->getChannel(); // {{{ assemble the destination paths if (!in_array($atts['attribs']['role'], PEAR_Installer_Role::getValidRoles($pkg->getPackageType()))) { return $this->raiseError('Invalid role `' . $atts['attribs']['role'] . "' for file $file"); } $role = &PEAR_Installer_Role::factory($pkg, $atts['attribs']['role'], $this->config); $err = $role->setup($this, $pkg, $atts['attribs'], $file); if (PEAR::isError($err)) { return $err; } if (!$role->isInstallable()) { return; } $info = $role->processInstallation($pkg, $atts['attribs'], $file, $tmp_path); if (PEAR::isError($info)) { return $info; } list($save_destdir, $dest_dir, $dest_file, $orig_file) = $info; if (preg_match('~/\.\.(/|\\z)|^\.\./~', str_replace('\\', '/', $dest_file))) { return $this->raiseError("SECURITY ERROR: file $file (installed to $dest_file) contains parent directory reference ..", PEAR_INSTALLER_FAILED); } $final_dest_file = $installed_as = $dest_file; if (isset($this->_options['packagingroot'])) { $final_dest_file = $this->_prependPath($final_dest_file, $this->_options['packagingroot']); } $dest_dir = dirname($final_dest_file); $dest_file = $dest_dir . DIRECTORY_SEPARATOR . '.tmp' . basename($final_dest_file); // }}} if (empty($this->_options['register-only'])) { if (!file_exists($dest_dir) || !is_dir($dest_dir)) { if (!$this->mkDirHier($dest_dir)) { return $this->raiseError("failed to mkdir $dest_dir", PEAR_INSTALLER_FAILED); } $this->log(3, "+ mkdir $dest_dir"); } } $attribs = $atts['attribs']; unset($atts['attribs']); // pretty much nothing happens if we are only registering the install if (empty($this->_options['register-only'])) { if (!count($atts)) { // no tasks if (!file_exists($orig_file)) { return $this->raiseError("file $orig_file does not exist", PEAR_INSTALLER_FAILED); } if (!@copy($orig_file, $dest_file)) { return $this->raiseError("failed to write $dest_file: $php_errormsg", PEAR_INSTALLER_FAILED); } $this->log(3, "+ cp $orig_file $dest_file"); if (isset($attribs['md5sum'])) { $md5sum = md5_file($dest_file); } } else { // file with tasks if (!file_exists($orig_file)) { return $this->raiseError("file $orig_file does not exist", PEAR_INSTALLER_FAILED); } $contents = file_get_contents($orig_file); if ($contents === false) { $contents = ''; } if (isset($attribs['md5sum'])) { $md5sum = md5($contents); } foreach ($atts as $tag => $raw) { $tag = str_replace(array($pkg->getTasksNs() . ':', '-'), array('', '_'), $tag); $task = "PEAR_Task_$tag"; $task = new $task($this->config, $this, PEAR_TASK_INSTALL); if (!$task->isScript()) { // scripts are only handled after installation $task->init($raw, $attribs, $pkg->getLastInstalledVersion()); $res = $task->startSession($pkg, $contents, $final_dest_file); if ($res === false) { continue; // skip this file } if (PEAR::isError($res)) { return $res; } $contents = $res; // save changes } $wp = @fopen($dest_file, "wb"); if (!is_resource($wp)) { return $this->raiseError("failed to create $dest_file: $php_errormsg", PEAR_INSTALLER_FAILED); } if (fwrite($wp, $contents) === false) { return $this->raiseError("failed writing to $dest_file: $php_errormsg", PEAR_INSTALLER_FAILED); } fclose($wp); } } // {{{ check the md5 if (isset($md5sum)) { // Make sure the original md5 sum matches with expected if (strtolower($md5sum) === strtolower($attribs['md5sum'])) { $this->log(2, "md5sum ok: $final_dest_file"); if (isset($contents)) { // set md5 sum based on $content in case any tasks were run. $real_atts['attribs']['md5sum'] = md5($contents); } } else { if (empty($options['force'])) { // delete the file if (file_exists($dest_file)) { unlink($dest_file); } if (!isset($options['ignore-errors'])) { return $this->raiseError("bad md5sum for file $final_dest_file", PEAR_INSTALLER_FAILED); } if (!isset($options['soft'])) { $this->log(0, "warning : bad md5sum for file $final_dest_file"); } } else { if (!isset($options['soft'])) { $this->log(0, "warning : bad md5sum for file $final_dest_file"); } } } } else { $real_atts['attribs']['md5sum'] = md5_file($dest_file); } // }}} // {{{ set file permissions if (!OS_WINDOWS) { if ($role->isExecutable()) { $mode = 0777 & ~(int)octdec($this->config->get('umask')); $this->log(3, "+ chmod +x $dest_file"); } else { $mode = 0666 & ~(int)octdec($this->config->get('umask')); } if ($attribs['role'] != 'src') { $this->addFileOperation("chmod", array($mode, $dest_file)); if (!@chmod($dest_file, $mode)) { if (!isset($options['soft'])) { $this->log(0, "failed to change mode of $dest_file: $php_errormsg"); } } } } // }}} if ($attribs['role'] == 'src') { rename($dest_file, $final_dest_file); $this->log(2, "renamed source file $dest_file to $final_dest_file"); } else { $this->addFileOperation("rename", array($dest_file, $final_dest_file, $role->isExtension())); } } // Store the full path where the file was installed for easy uninstall if ($attribs['role'] != 'src') { $loc = $this->config->get($role->getLocationConfig(), null, $channel); $this->addFileOperation('installed_as', array($file, $installed_as, $loc, dirname(substr($installed_as, strlen($loc))))); } //$this->log(2, "installed: $dest_file"); return PEAR_INSTALLER_OK; } // }}} // {{{ addFileOperation() /** * Add a file operation to the current file transaction. * * @see startFileTransaction() * @param string $type This can be one of: * - rename: rename a file ($data has 3 values) * - backup: backup an existing file ($data has 1 value) * - removebackup: clean up backups created during install ($data has 1 value) * - chmod: change permissions on a file ($data has 2 values) * - delete: delete a file ($data has 1 value) * - rmdir: delete a directory if empty ($data has 1 value) * - installed_as: mark a file as installed ($data has 4 values). * @param array $data For all file operations, this array must contain the * full path to the file or directory that is being operated on. For * the rename command, the first parameter must be the file to rename, * the second its new name, the third whether this is a PHP extension. * * The installed_as operation contains 4 elements in this order: * 1. Filename as listed in the filelist element from package.xml * 2. Full path to the installed file * 3. Full path from the php_dir configuration variable used in this * installation * 4. Relative path from the php_dir that this file is installed in */ function addFileOperation($type, $data) { if (!is_array($data)) { return $this->raiseError('Internal Error: $data in addFileOperation' . ' must be an array, was ' . gettype($data)); } if ($type == 'chmod') { $octmode = decoct($data[0]); $this->log(3, "adding to transaction: $type $octmode $data[1]"); } else { $this->log(3, "adding to transaction: $type " . implode(" ", $data)); } $this->file_operations[] = array($type, $data); } // }}} // {{{ startFileTransaction() function startFileTransaction($rollback_in_case = false) { if (count($this->file_operations) && $rollback_in_case) { $this->rollbackFileTransaction(); } $this->file_operations = array(); } // }}} // {{{ commitFileTransaction() function commitFileTransaction() { // {{{ first, check permissions and such manually $errors = array(); foreach ($this->file_operations as $key => $tr) { list($type, $data) = $tr; switch ($type) { case 'rename': if (!file_exists($data[0])) { $errors[] = "cannot rename file $data[0], doesn't exist"; } // check that dest dir. is writable if (!is_writable(dirname($data[1]))) { $errors[] = "permission denied ($type): $data[1]"; } break; case 'chmod': // check that file is writable if (!is_writable($data[1])) { $errors[] = "permission denied ($type): $data[1] " . decoct($data[0]); } break; case 'delete': if (!file_exists($data[0])) { $this->log(2, "warning: file $data[0] doesn't exist, can't be deleted"); } // check that directory is writable if (file_exists($data[0])) { if (!is_writable(dirname($data[0]))) { $errors[] = "permission denied ($type): $data[0]"; } else { // make sure the file to be deleted can be opened for writing $fp = false; if (!is_dir($data[0]) && (!is_writable($data[0]) || !($fp = @fopen($data[0], 'a')))) { $errors[] = "permission denied ($type): $data[0]"; } elseif ($fp) { fclose($fp); } } /* Verify we are not deleting a file owned by another package * This can happen when a file moves from package A to B in * an upgrade ala http://pear.php.net/17986 */ $info = array( 'package' => strtolower($this->pkginfo->getName()), 'channel' => strtolower($this->pkginfo->getChannel()), ); $result = $this->_registry->checkFileMap($data[0], $info, '1.1'); if (is_array($result)) { $res = array_diff($result, $info); if (!empty($res)) { $new = $this->_registry->getPackage($result[1], $result[0]); $this->file_operations[$key] = false; $pkginfoName = $this->pkginfo->getName(); $newChannel = $new->getChannel(); $newPackage = $new->getName(); $this->log(3, "file $data[0] was scheduled for removal from $pkginfoName but is owned by $newChannel/$newPackage, removal has been cancelled."); } } } break; } } // }}} $n = count($this->file_operations); $this->log(2, "about to commit $n file operations for " . $this->pkginfo->getName()); $m = count($errors); if ($m > 0) { foreach ($errors as $error) { if (!isset($this->_options['soft'])) { $this->log(1, $error); } } if (!isset($this->_options['ignore-errors'])) { return false; } } $this->_dirtree = array(); // {{{ really commit the transaction foreach ($this->file_operations as $i => $tr) { if (!$tr) { // support removal of non-existing backups continue; } list($type, $data) = $tr; switch ($type) { case 'backup': if (!file_exists($data[0])) { $this->file_operations[$i] = false; break; } if (!@copy($data[0], $data[0] . '.bak')) { $this->log(1, 'Could not copy ' . $data[0] . ' to ' . $data[0] . '.bak ' . $php_errormsg); return false; } $this->log(3, "+ backup $data[0] to $data[0].bak"); break; case 'removebackup': if (file_exists($data[0] . '.bak') && is_writable($data[0] . '.bak')) { unlink($data[0] . '.bak'); $this->log(3, "+ rm backup of $data[0] ($data[0].bak)"); } break; case 'rename': $test = file_exists($data[1]) ? @unlink($data[1]) : null; if (!$test && file_exists($data[1])) { if ($data[2]) { $extra = ', this extension must be installed manually. Rename to "' . basename($data[1]) . '"'; } else { $extra = ''; } if (!isset($this->_options['soft'])) { $this->log(1, 'Could not delete ' . $data[1] . ', cannot rename ' . $data[0] . $extra); } if (!isset($this->_options['ignore-errors'])) { return false; } } // permissions issues with rename - copy() is far superior $perms = @fileperms($data[0]); if (!@copy($data[0], $data[1])) { $this->log(1, 'Could not rename ' . $data[0] . ' to ' . $data[1] . ' ' . $php_errormsg); return false; } // copy over permissions, otherwise they are lost @chmod($data[1], $perms); @unlink($data[0]); $this->log(3, "+ mv $data[0] $data[1]"); break; case 'chmod': if (!@chmod($data[1], $data[0])) { $this->log(1, 'Could not chmod ' . $data[1] . ' to ' . decoct($data[0]) . ' ' . $php_errormsg); return false; } $octmode = decoct($data[0]); $this->log(3, "+ chmod $octmode $data[1]"); break; case 'delete': if (file_exists($data[0])) { if (!@unlink($data[0])) { $this->log(1, 'Could not delete ' . $data[0] . ' ' . $php_errormsg); return false; } $this->log(3, "+ rm $data[0]"); } break; case 'rmdir': if (file_exists($data[0])) { do { $testme = opendir($data[0]); while (false !== ($entry = readdir($testme))) { if ($entry == '.' || $entry == '..') { continue; } closedir($testme); break 2; // this directory is not empty and can't be // deleted } closedir($testme); if (!@rmdir($data[0])) { $this->log(1, 'Could not rmdir ' . $data[0] . ' ' . $php_errormsg); return false; } $this->log(3, "+ rmdir $data[0]"); } while (false); } break; case 'installed_as': $this->pkginfo->setInstalledAs($data[0], $data[1]); if (!isset($this->_dirtree[dirname($data[1])])) { $this->_dirtree[dirname($data[1])] = true; $this->pkginfo->setDirtree(dirname($data[1])); while(!empty($data[3]) && dirname($data[3]) != $data[3] && $data[3] != '/' && $data[3] != '\\') { $this->pkginfo->setDirtree($pp = $this->_prependPath($data[3], $data[2])); $this->_dirtree[$pp] = true; $data[3] = dirname($data[3]); } } break; } } // }}} $this->log(2, "successfully committed $n file operations"); $this->file_operations = array(); return true; } // }}} // {{{ rollbackFileTransaction() function rollbackFileTransaction() { $n = count($this->file_operations); $this->log(2, "rolling back $n file operations"); foreach ($this->file_operations as $tr) { list($type, $data) = $tr; switch ($type) { case 'backup': if (file_exists($data[0] . '.bak')) { if (file_exists($data[0] && is_writable($data[0]))) { unlink($data[0]); } @copy($data[0] . '.bak', $data[0]); $this->log(3, "+ restore $data[0] from $data[0].bak"); } break; case 'removebackup': if (file_exists($data[0] . '.bak') && is_writable($data[0] . '.bak')) { unlink($data[0] . '.bak'); $this->log(3, "+ rm backup of $data[0] ($data[0].bak)"); } break; case 'rename': @unlink($data[0]); $this->log(3, "+ rm $data[0]"); break; case 'mkdir': @rmdir($data[0]); $this->log(3, "+ rmdir $data[0]"); break; case 'chmod': break; case 'delete': break; case 'installed_as': $this->pkginfo->setInstalledAs($data[0], false); break; } } $this->pkginfo->resetDirtree(); $this->file_operations = array(); } // }}} // {{{ mkDirHier($dir) function mkDirHier($dir) { $this->addFileOperation('mkdir', array($dir)); return parent::mkDirHier($dir); } // }}} // {{{ _parsePackageXml() function _parsePackageXml(&$descfile) { // Parse xml file ----------------------------------------------- $pkg = new PEAR_PackageFile($this->config, $this->debug); PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); $p = &$pkg->fromAnyFile($descfile, PEAR_VALIDATE_INSTALLING); PEAR::staticPopErrorHandling(); if (PEAR::isError($p)) { if (is_array($p->getUserInfo())) { foreach ($p->getUserInfo() as $err) { $loglevel = $err['level'] == 'error' ? 0 : 1; if (!isset($this->_options['soft'])) { $this->log($loglevel, ucfirst($err['level']) . ': ' . $err['message']); } } } return $this->raiseError('Installation failed: invalid package file'); } $descfile = $p->getPackageFile(); return $p; } // }}} /** * Set the list of PEAR_Downloader_Package objects to allow more sane * dependency validation * @param array */ function setDownloadedPackages(&$pkgs) { PEAR::pushErrorHandling(PEAR_ERROR_RETURN); $err = $this->analyzeDependencies($pkgs); PEAR::popErrorHandling(); if (PEAR::isError($err)) { return $err; } $this->_downloadedPackages = &$pkgs; } /** * Set the list of PEAR_Downloader_Package objects to allow more sane * dependency validation * @param array */ function setUninstallPackages(&$pkgs) { $this->_downloadedPackages = &$pkgs; } function getInstallPackages() { return $this->_downloadedPackages; } // {{{ install() /** * Installs the files within the package file specified. * * @param string|PEAR_Downloader_Package $pkgfile path to the package file, * or a pre-initialized packagefile object * @param array $options * recognized options: * - installroot : optional prefix directory for installation * - force : force installation * - register-only : update registry but don't install files * - upgrade : upgrade existing install * - soft : fail silently * - nodeps : ignore dependency conflicts/missing dependencies * - alldeps : install all dependencies * - onlyreqdeps : install only required dependencies * * @return array|PEAR_Error package info if successful */ function install($pkgfile, $options = array()) { $this->_options = $options; $this->_registry = &$this->config->getRegistry(); if (is_object($pkgfile)) { $dlpkg = &$pkgfile; $pkg = $pkgfile->getPackageFile(); $pkgfile = $pkg->getArchiveFile(); $descfile = $pkg->getPackageFile(); } else { $descfile = $pkgfile; $pkg = $this->_parsePackageXml($descfile); if (PEAR::isError($pkg)) { return $pkg; } } $tmpdir = dirname($descfile); if (realpath($descfile) != realpath($pkgfile)) { // Use the temp_dir since $descfile can contain the download dir path $tmpdir = $this->config->get('temp_dir', null, 'pear.php.net'); $tmpdir = System::mktemp('-d -t "' . $tmpdir . '"'); $tar = new Archive_Tar($pkgfile); if (!$tar->extract($tmpdir)) { return $this->raiseError("unable to unpack $pkgfile"); } } $pkgname = $pkg->getName(); $channel = $pkg->getChannel(); if (isset($options['installroot'])) { $this->config->setInstallRoot($options['installroot']); $this->_registry = &$this->config->getRegistry(); $installregistry = &$this->_registry; $this->installroot = ''; // all done automagically now $php_dir = $this->config->get('php_dir', null, $channel); } else { $this->config->setInstallRoot(false); $this->_registry = &$this->config->getRegistry(); if (isset($this->_options['packagingroot'])) { $regdir = $this->_prependPath( $this->config->get('php_dir', null, 'pear.php.net'), $this->_options['packagingroot']); $metadata_dir = $this->config->get('metadata_dir', null, 'pear.php.net'); if ($metadata_dir) { $metadata_dir = $this->_prependPath( $metadata_dir, $this->_options['packagingroot']); } $packrootphp_dir = $this->_prependPath( $this->config->get('php_dir', null, $channel), $this->_options['packagingroot']); $installregistry = new PEAR_Registry($regdir, false, false, $metadata_dir); if (!$installregistry->channelExists($channel, true)) { // we need to fake a channel-discover of this channel $chanobj = $this->_registry->getChannel($channel, true); $installregistry->addChannel($chanobj); } $php_dir = $packrootphp_dir; } else { $installregistry = &$this->_registry; $php_dir = $this->config->get('php_dir', null, $channel); } $this->installroot = ''; } // {{{ checks to do when not in "force" mode if (empty($options['force']) && (file_exists($this->config->get('php_dir')) && is_dir($this->config->get('php_dir')))) { $testp = $channel == 'pear.php.net' ? $pkgname : array($channel, $pkgname); $instfilelist = $pkg->getInstallationFileList(true); if (PEAR::isError($instfilelist)) { return $instfilelist; } // ensure we have the most accurate registry $installregistry->flushFileMap(); $test = $installregistry->checkFileMap($instfilelist, $testp, '1.1'); if (PEAR::isError($test)) { return $test; } if (sizeof($test)) { $pkgs = $this->getInstallPackages(); $found = false; foreach ($pkgs as $param) { if ($pkg->isSubpackageOf($param)) { $found = true; break; } } if ($found) { // subpackages can conflict with earlier versions of parent packages $parentreg = $installregistry->packageInfo($param->getPackage(), null, $param->getChannel()); $tmp = $test; foreach ($tmp as $file => $info) { if (is_array($info)) { if (strtolower($info[1]) == strtolower($param->getPackage()) && strtolower($info[0]) == strtolower($param->getChannel()) ) { if (isset($parentreg['filelist'][$file])) { unset($parentreg['filelist'][$file]); } else{ $pos = strpos($file, '/'); $basedir = substr($file, 0, $pos); $file2 = substr($file, $pos + 1); if (isset($parentreg['filelist'][$file2]['baseinstalldir']) && $parentreg['filelist'][$file2]['baseinstalldir'] === $basedir ) { unset($parentreg['filelist'][$file2]); } } unset($test[$file]); } } else { if (strtolower($param->getChannel()) != 'pear.php.net') { continue; } if (strtolower($info) == strtolower($param->getPackage())) { if (isset($parentreg['filelist'][$file])) { unset($parentreg['filelist'][$file]); } else{ $pos = strpos($file, '/'); $basedir = substr($file, 0, $pos); $file2 = substr($file, $pos + 1); if (isset($parentreg['filelist'][$file2]['baseinstalldir']) && $parentreg['filelist'][$file2]['baseinstalldir'] === $basedir ) { unset($parentreg['filelist'][$file2]); } } unset($test[$file]); } } } $pfk = new PEAR_PackageFile($this->config); $parentpkg = &$pfk->fromArray($parentreg); $installregistry->updatePackage2($parentpkg); } if ($param->getChannel() == 'pecl.php.net' && isset($options['upgrade'])) { $tmp = $test; foreach ($tmp as $file => $info) { if (is_string($info)) { // pear.php.net packages are always stored as strings if (strtolower($info) == strtolower($param->getPackage())) { // upgrading existing package unset($test[$file]); } } } } if (count($test)) { $msg = "$channel/$pkgname: conflicting files found:\n"; $longest = max(array_map("strlen", array_keys($test))); $fmt = "%${longest}s (%s)\n"; foreach ($test as $file => $info) { if (!is_array($info)) { $info = array('pear.php.net', $info); } $info = $info[0] . '/' . $info[1]; $msg .= sprintf($fmt, $file, $info); } if (!isset($options['ignore-errors'])) { return $this->raiseError($msg); } if (!isset($options['soft'])) { $this->log(0, "WARNING: $msg"); } } } } // }}} $this->startFileTransaction(); $usechannel = $channel; if ($channel == 'pecl.php.net') { $test = $installregistry->packageExists($pkgname, $channel); if (!$test) { $test = $installregistry->packageExists($pkgname, 'pear.php.net'); $usechannel = 'pear.php.net'; } } else { $test = $installregistry->packageExists($pkgname, $channel); } if (empty($options['upgrade']) && empty($options['soft'])) { // checks to do only when installing new packages if (empty($options['force']) && $test) { return $this->raiseError("$channel/$pkgname is already installed"); } } else { // Upgrade if ($test) { $v1 = $installregistry->packageInfo($pkgname, 'version', $usechannel); $v2 = $pkg->getVersion(); $cmp = version_compare("$v1", "$v2", 'gt'); if (empty($options['force']) && !version_compare("$v2", "$v1", 'gt')) { return $this->raiseError("upgrade to a newer version ($v2 is not newer than $v1)"); } } } // Do cleanups for upgrade and install, remove old release's files first if ($test && empty($options['register-only'])) { // when upgrading, remove old release's files first: if (PEAR::isError($err = $this->_deletePackageFiles($pkgname, $usechannel, true))) { if (!isset($options['ignore-errors'])) { return $this->raiseError($err); } if (!isset($options['soft'])) { $this->log(0, 'WARNING: ' . $err->getMessage()); } } else { $backedup = $err; } } // {{{ Copy files to dest dir --------------------------------------- // info from the package it self we want to access from _installFile $this->pkginfo = &$pkg; // used to determine whether we should build any C code $this->source_files = 0; $savechannel = $this->config->get('default_channel'); if (empty($options['register-only']) && !is_dir($php_dir)) { if (PEAR::isError(System::mkdir(array('-p'), $php_dir))) { return $this->raiseError("no installation destination directory '$php_dir'\n"); } } if (substr($pkgfile, -4) != '.xml') { $tmpdir .= DIRECTORY_SEPARATOR . $pkgname . '-' . $pkg->getVersion(); } $this->configSet('default_channel', $channel); // {{{ install files $ver = $pkg->getPackagexmlVersion(); if (version_compare($ver, '2.0', '>=')) { $filelist = $pkg->getInstallationFilelist(); } else { $filelist = $pkg->getFileList(); } if (PEAR::isError($filelist)) { return $filelist; } $p = &$installregistry->getPackage($pkgname, $channel); $dirtree = (empty($options['register-only']) && $p) ? $p->getDirTree() : false; $pkg->resetFilelist(); $pkg->setLastInstalledVersion($installregistry->packageInfo($pkg->getPackage(), 'version', $pkg->getChannel())); foreach ($filelist as $file => $atts) { $this->expectError(PEAR_INSTALLER_FAILED); if ($pkg->getPackagexmlVersion() == '1.0') { $res = $this->_installFile($file, $atts, $tmpdir, $options); } else { $res = $this->_installFile2($pkg, $file, $atts, $tmpdir, $options); } $this->popExpect(); if (PEAR::isError($res)) { if (empty($options['ignore-errors'])) { $this->rollbackFileTransaction(); if ($res->getMessage() == "file does not exist") { $this->raiseError("file $file in package.xml does not exist"); } return $this->raiseError($res); } if (!isset($options['soft'])) { $this->log(0, "Warning: " . $res->getMessage()); } } $real = isset($atts['attribs']) ? $atts['attribs'] : $atts; if ($res == PEAR_INSTALLER_OK && $real['role'] != 'src') { // Register files that were installed $pkg->installedFile($file, $atts); } } // }}} // {{{ compile and install source files if ($this->source_files > 0 && empty($options['nobuild'])) { if (PEAR::isError($err = $this->_compileSourceFiles($savechannel, $pkg))) { return $err; } } // }}} if (isset($backedup)) { $this->_removeBackups($backedup); } if (!$this->commitFileTransaction()) { $this->rollbackFileTransaction(); $this->configSet('default_channel', $savechannel); return $this->raiseError("commit failed", PEAR_INSTALLER_FAILED); } // }}} $ret = false; $installphase = 'install'; $oldversion = false; // {{{ Register that the package is installed ----------------------- if (empty($options['upgrade'])) { // if 'force' is used, replace the info in registry $usechannel = $channel; if ($channel == 'pecl.php.net') { $test = $installregistry->packageExists($pkgname, $channel); if (!$test) { $test = $installregistry->packageExists($pkgname, 'pear.php.net'); $usechannel = 'pear.php.net'; } } else { $test = $installregistry->packageExists($pkgname, $channel); } if (!empty($options['force']) && $test) { $oldversion = $installregistry->packageInfo($pkgname, 'version', $usechannel); $installregistry->deletePackage($pkgname, $usechannel); } $ret = $installregistry->addPackage2($pkg); } else { if ($dirtree) { $this->startFileTransaction(); // attempt to delete empty directories uksort($dirtree, array($this, '_sortDirs')); foreach($dirtree as $dir => $notused) { $this->addFileOperation('rmdir', array($dir)); } $this->commitFileTransaction(); } $usechannel = $channel; if ($channel == 'pecl.php.net') { $test = $installregistry->packageExists($pkgname, $channel); if (!$test) { $test = $installregistry->packageExists($pkgname, 'pear.php.net'); $usechannel = 'pear.php.net'; } } else { $test = $installregistry->packageExists($pkgname, $channel); } // new: upgrade installs a package if it isn't installed if (!$test) { $ret = $installregistry->addPackage2($pkg); } else { if ($usechannel != $channel) { $installregistry->deletePackage($pkgname, $usechannel); $ret = $installregistry->addPackage2($pkg); } else { $ret = $installregistry->updatePackage2($pkg); } $installphase = 'upgrade'; } } if (!$ret) { $this->configSet('default_channel', $savechannel); return $this->raiseError("Adding package $channel/$pkgname to registry failed"); } // }}} $this->configSet('default_channel', $savechannel); if (class_exists('PEAR_Task_Common')) { // this is auto-included if any tasks exist if (PEAR_Task_Common::hasPostinstallTasks()) { PEAR_Task_Common::runPostinstallTasks($installphase); } } return $pkg->toArray(true); } // }}} // {{{ _compileSourceFiles() /** * @param string * @param PEAR_PackageFile_v1|PEAR_PackageFile_v2 */ function _compileSourceFiles($savechannel, &$filelist) { require_once 'PEAR/Builder.php'; $this->log(1, "$this->source_files source files, building"); $bob = new PEAR_Builder($this->ui); $bob->debug = $this->debug; $built = $bob->build($filelist, array(&$this, '_buildCallback')); if (PEAR::isError($built)) { $this->rollbackFileTransaction(); $this->configSet('default_channel', $savechannel); return $built; } $this->log(1, "\nBuild process completed successfully"); foreach ($built as $ext) { $bn = basename($ext['file']); 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']; $packagingroot = ''; if (isset($this->_options['packagingroot'])) { $packagingroot = $this->_options['packagingroot']; } $copyto = $this->_prependPath($dest, $packagingroot); $extra = $copyto != $dest ? " as '$copyto'" : ''; $this->log(1, "Installing '$dest'$extra"); $copydir = dirname($copyto); // pretty much nothing happens if we are only registering the install if (empty($this->_options['register-only'])) { if (!file_exists($copydir) || !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)) { return $this->raiseError("failed to write $copyto ($php_errormsg)", PEAR_INSTALLER_FAILED); } $this->log(3, "+ cp $ext[file] $copyto"); $this->addFileOperation('rename', array($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 ($php_errormsg)"); } } } $data = array( 'role' => $role, 'name' => $bn, 'installed_as' => $dest, 'php_api' => $ext['php_api'], 'zend_mod_api' => $ext['zend_mod_api'], 'zend_ext_api' => $ext['zend_ext_api'], ); if ($filelist->getPackageXmlVersion() == '1.0') { $filelist->installedFile($bn, $data); } else { $filelist->installedFile($bn, array('attribs' => $data)); } } } // }}} function &getUninstallPackages() { return $this->_downloadedPackages; } // {{{ uninstall() /** * Uninstall a package * * This method removes all files installed by the application, and then * removes any empty directories. * @param string package name * @param array Command-line options. Possibilities include: * * - installroot: base installation dir, if not the default * - register-only : update registry but don't remove files * - nodeps: do not process dependencies of other packages to ensure * uninstallation does not break things */ function uninstall($package, $options = array()) { $installRoot = isset($options['installroot']) ? $options['installroot'] : ''; $this->config->setInstallRoot($installRoot); $this->installroot = ''; $this->_registry = &$this->config->getRegistry(); if (is_object($package)) { $channel = $package->getChannel(); $pkg = $package; $package = $pkg->getPackage(); } else { $pkg = false; $info = $this->_registry->parsePackageName($package, $this->config->get('default_channel')); $channel = $info['channel']; $package = $info['package']; } $savechannel = $this->config->get('default_channel'); $this->configSet('default_channel', $channel); if (!is_object($pkg)) { $pkg = $this->_registry->getPackage($package, $channel); } if (!$pkg) { $this->configSet('default_channel', $savechannel); return $this->raiseError($this->_registry->parsedPackageNameToString( array( 'channel' => $channel, 'package' => $package ), true) . ' not installed'); } if ($pkg->getInstalledBinary()) { // this is just an alias for a binary package return $this->_registry->deletePackage($package, $channel); } $filelist = $pkg->getFilelist(); PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); if (!class_exists('PEAR_Dependency2')) { require_once 'PEAR/Dependency2.php'; } $depchecker = new PEAR_Dependency2($this->config, $options, array('channel' => $channel, 'package' => $package), PEAR_VALIDATE_UNINSTALLING); $e = $depchecker->validatePackageUninstall($this); PEAR::staticPopErrorHandling(); if (PEAR::isError($e)) { if (!isset($options['ignore-errors'])) { return $this->raiseError($e); } if (!isset($options['soft'])) { $this->log(0, 'WARNING: ' . $e->getMessage()); } } elseif (is_array($e)) { if (!isset($options['soft'])) { $this->log(0, $e[0]); } } $this->pkginfo = &$pkg; // pretty much nothing happens if we are only registering the uninstall if (empty($options['register-only'])) { // {{{ Delete the files $this->startFileTransaction(); PEAR::pushErrorHandling(PEAR_ERROR_RETURN); if (PEAR::isError($err = $this->_deletePackageFiles($package, $channel))) { PEAR::popErrorHandling(); $this->rollbackFileTransaction(); $this->configSet('default_channel', $savechannel); if (!isset($options['ignore-errors'])) { return $this->raiseError($err); } if (!isset($options['soft'])) { $this->log(0, 'WARNING: ' . $err->getMessage()); } } else { PEAR::popErrorHandling(); } if (!$this->commitFileTransaction()) { $this->rollbackFileTransaction(); if (!isset($options['ignore-errors'])) { return $this->raiseError("uninstall failed"); } if (!isset($options['soft'])) { $this->log(0, 'WARNING: uninstall failed'); } } else { $this->startFileTransaction(); $dirtree = $pkg->getDirTree(); if ($dirtree === false) { $this->configSet('default_channel', $savechannel); return $this->_registry->deletePackage($package, $channel); } // attempt to delete empty directories uksort($dirtree, array($this, '_sortDirs')); foreach($dirtree as $dir => $notused) { $this->addFileOperation('rmdir', array($dir)); } if (!$this->commitFileTransaction()) { $this->rollbackFileTransaction(); if (!isset($options['ignore-errors'])) { return $this->raiseError("uninstall failed"); } if (!isset($options['soft'])) { $this->log(0, 'WARNING: uninstall failed'); } } } // }}} } $this->configSet('default_channel', $savechannel); // Register that the package is no longer installed return $this->_registry->deletePackage($package, $channel); } /** * Sort a list of arrays of array(downloaded packagefilename) by dependency. * * It also removes duplicate dependencies * @param array an array of PEAR_PackageFile_v[1/2] objects * @return array|PEAR_Error array of array(packagefilename, package.xml contents) */ function sortPackagesForUninstall(&$packages) { $this->_dependencyDB = &PEAR_DependencyDB::singleton($this->config); if (PEAR::isError($this->_dependencyDB)) { return $this->_dependencyDB; } usort($packages, array(&$this, '_sortUninstall')); } function _sortUninstall($a, $b) { if (!$a->getDeps() && !$b->getDeps()) { return 0; // neither package has dependencies, order is insignificant } if ($a->getDeps() && !$b->getDeps()) { return -1; // $a must be installed after $b because $a has dependencies } if (!$a->getDeps() && $b->getDeps()) { return 1; // $b must be installed after $a because $b has dependencies } // both packages have dependencies if ($this->_dependencyDB->dependsOn($a, $b)) { return -1; } if ($this->_dependencyDB->dependsOn($b, $a)) { return 1; } return 0; } // }}} // {{{ _sortDirs() function _sortDirs($a, $b) { if (strnatcmp($a, $b) == -1) return 1; if (strnatcmp($a, $b) == 1) return -1; return 0; } // }}} // {{{ _buildCallback() function _buildCallback($what, $data) { if (($what == 'cmdoutput' && $this->debug > 1) || ($what == 'output' && $this->debug > 0)) { $this->ui->outputData(rtrim($data), 'build'); } } // }}} } php-pear-1.10.1+submodules+notgz/PEAR/Installer/000077500000000000000000000000001262614675700213255ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/PEAR/Installer/Role.php000066400000000000000000000173061262614675700227460ustar00rootroot00000000000000 * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ /** * base class for installer roles */ require_once 'PEAR/Installer/Role/Common.php'; require_once 'PEAR/XMLParser.php'; /** * @category pear * @package PEAR * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version Release: @package_version@ * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ class PEAR_Installer_Role { /** * Set up any additional configuration variables that file roles require * * Never call this directly, it is called by the PEAR_Config constructor * @param PEAR_Config */ public static function initializeConfig(&$config) { if (!isset($GLOBALS['_PEAR_INSTALLER_ROLES'])) { PEAR_Installer_Role::registerRoles(); } foreach ($GLOBALS['_PEAR_INSTALLER_ROLES'] as $class => $info) { if (!$info['config_vars']) { continue; } $config->_addConfigVars($class, $info['config_vars']); } } /** * @param PEAR_PackageFile_v2 * @param string role name * @param PEAR_Config * @return PEAR_Installer_Role_Common */ public static function &factory($pkg, $role, &$config) { if (!isset($GLOBALS['_PEAR_INSTALLER_ROLES'])) { PEAR_Installer_Role::registerRoles(); } if (!in_array($role, PEAR_Installer_Role::getValidRoles($pkg->getPackageType()))) { $a = false; return $a; } $a = 'PEAR_Installer_Role_' . ucfirst($role); if (!class_exists($a)) { require_once str_replace('_', '/', $a) . '.php'; } $b = new $a($config); return $b; } /** * Get a list of file roles that are valid for the particular release type. * * For instance, src files serve no purpose in regular php releases. * @param string * @param bool clear cache * @return array */ public static function getValidRoles($release, $clear = false) { if (!isset($GLOBALS['_PEAR_INSTALLER_ROLES'])) { PEAR_Installer_Role::registerRoles(); } static $ret = array(); if ($clear) { $ret = array(); } if (isset($ret[$release])) { return $ret[$release]; } $ret[$release] = array(); foreach ($GLOBALS['_PEAR_INSTALLER_ROLES'] as $role => $okreleases) { if (in_array($release, $okreleases['releasetypes'])) { $ret[$release][] = strtolower(str_replace('PEAR_Installer_Role_', '', $role)); } } return $ret[$release]; } /** * Get a list of roles that require their files to be installed * * Most roles must be installed, but src and package roles, for instance * are pseudo-roles. src files are compiled into a new extension. Package * roles are actually fully bundled releases of a package * @param bool clear cache * @return array */ public static function getInstallableRoles($clear = false) { if (!isset($GLOBALS['_PEAR_INSTALLER_ROLES'])) { PEAR_Installer_Role::registerRoles(); } static $ret; if ($clear) { unset($ret); } if (isset($ret)) { return $ret; } $ret = array(); foreach ($GLOBALS['_PEAR_INSTALLER_ROLES'] as $role => $okreleases) { if ($okreleases['installable']) { $ret[] = strtolower(str_replace('PEAR_Installer_Role_', '', $role)); } } return $ret; } /** * Return an array of roles that are affected by the baseinstalldir attribute * * Most roles ignore this attribute, and instead install directly into: * PackageName/filepath * so a tests file tests/file.phpt is installed into PackageName/tests/filepath.php * @param bool clear cache * @return array */ public static function getBaseinstallRoles($clear = false) { if (!isset($GLOBALS['_PEAR_INSTALLER_ROLES'])) { PEAR_Installer_Role::registerRoles(); } static $ret; if ($clear) { unset($ret); } if (isset($ret)) { return $ret; } $ret = array(); foreach ($GLOBALS['_PEAR_INSTALLER_ROLES'] as $role => $okreleases) { if ($okreleases['honorsbaseinstall']) { $ret[] = strtolower(str_replace('PEAR_Installer_Role_', '', $role)); } } return $ret; } /** * Return an array of file roles that should be analyzed for PHP content at package time, * like the "php" role. * @param bool clear cache * @return array */ public static function getPhpRoles($clear = false) { if (!isset($GLOBALS['_PEAR_INSTALLER_ROLES'])) { PEAR_Installer_Role::registerRoles(); } static $ret; if ($clear) { unset($ret); } if (isset($ret)) { return $ret; } $ret = array(); foreach ($GLOBALS['_PEAR_INSTALLER_ROLES'] as $role => $okreleases) { if ($okreleases['phpfile']) { $ret[] = strtolower(str_replace('PEAR_Installer_Role_', '', $role)); } } return $ret; } /** * Scan through the Command directory looking for classes * and see what commands they implement. * @param string which directory to look for classes, defaults to * the Installer/Roles subdirectory of * the directory from where this file (__FILE__) is * included. * * @return bool TRUE on success, a PEAR error on failure */ public static function registerRoles($dir = null) { $GLOBALS['_PEAR_INSTALLER_ROLES'] = array(); $parser = new PEAR_XMLParser; if ($dir === null) { $dir = dirname(__FILE__) . '/Role'; } if (!file_exists($dir) || !is_dir($dir)) { return PEAR::raiseError("registerRoles: opendir($dir) failed: does not exist/is not directory"); } $dp = @opendir($dir); if (empty($dp)) { return PEAR::raiseError("registerRoles: opendir($dir) failed: $php_errmsg"); } while ($entry = readdir($dp)) { if ($entry{0} == '.' || substr($entry, -4) != '.xml') { continue; } $class = "PEAR_Installer_Role_".substr($entry, 0, -4); // List of roles if (!isset($GLOBALS['_PEAR_INSTALLER_ROLES'][$class])) { $file = "$dir/$entry"; $parser->parse(file_get_contents($file)); $data = $parser->getData(); if (!is_array($data['releasetypes'])) { $data['releasetypes'] = array($data['releasetypes']); } $GLOBALS['_PEAR_INSTALLER_ROLES'][$class] = $data; } } closedir($dp); ksort($GLOBALS['_PEAR_INSTALLER_ROLES']); PEAR_Installer_Role::getBaseinstallRoles(true); PEAR_Installer_Role::getInstallableRoles(true); PEAR_Installer_Role::getPhpRoles(true); PEAR_Installer_Role::getValidRoles('****', true); return true; } }php-pear-1.10.1+submodules+notgz/PEAR/Installer/Role/000077500000000000000000000000001262614675700222265ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/PEAR/Installer/Role/Cfg.php000066400000000000000000000076111262614675700234430ustar00rootroot00000000000000 * @copyright 2007-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @link http://pear.php.net/package/PEAR * @since File available since Release 1.7.0 */ /** * @category pear * @package PEAR * @author Greg Beaver * @copyright 2007-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version Release: @package_version@ * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.7.0 */ class PEAR_Installer_Role_Cfg extends PEAR_Installer_Role_Common { /** * @var PEAR_Installer */ var $installer; /** * the md5 of the original file * * @var unknown_type */ var $md5 = null; /** * Do any unusual setup here * @param PEAR_Installer * @param PEAR_PackageFile_v2 * @param array file attributes * @param string file name */ function setup(&$installer, $pkg, $atts, $file) { $this->installer = &$installer; $reg = &$this->installer->config->getRegistry(); $package = $reg->getPackage($pkg->getPackage(), $pkg->getChannel()); if ($package) { $filelist = $package->getFilelist(); if (isset($filelist[$file]) && isset($filelist[$file]['md5sum'])) { $this->md5 = $filelist[$file]['md5sum']; } } } function processInstallation($pkg, $atts, $file, $tmp_path, $layer = null) { $test = parent::processInstallation($pkg, $atts, $file, $tmp_path, $layer); if (@file_exists($test[2]) && @file_exists($test[3])) { $md5 = md5_file($test[2]); // configuration has already been installed, check for mods if ($md5 !== $this->md5 && $md5 !== md5_file($test[3])) { // configuration has been modified, so save our version as // configfile-version $old = $test[2]; $test[2] .= '.new-' . $pkg->getVersion(); // backup original and re-install it PEAR::pushErrorHandling(PEAR_ERROR_RETURN); $tmpcfg = $this->config->get('temp_dir'); $newloc = System::mkdir(array('-p', $tmpcfg)); if (!$newloc) { // try temp_dir $newloc = System::mktemp(array('-d')); if (!$newloc || PEAR::isError($newloc)) { PEAR::popErrorHandling(); return PEAR::raiseError('Could not save existing configuration file '. $old . ', unable to install. Please set temp_dir ' . 'configuration variable to a writeable location and try again'); } } else { $newloc = $tmpcfg; } $temp_file = $newloc . DIRECTORY_SEPARATOR . uniqid('savefile'); if (!@copy($old, $temp_file)) { PEAR::popErrorHandling(); return PEAR::raiseError('Could not save existing configuration file '. $old . ', unable to install. Please set temp_dir ' . 'configuration variable to a writeable location and try again'); } PEAR::popErrorHandling(); $this->installer->log(0, "WARNING: configuration file $old is being installed as $test[2], you should manually merge in changes to the existing configuration file"); $this->installer->addFileOperation('rename', array($temp_file, $old, false)); $this->installer->addFileOperation('delete', array($temp_file)); } } return $test; } }php-pear-1.10.1+submodules+notgz/PEAR/Installer/Role/Cfg.xml000066400000000000000000000006451262614675700234540ustar00rootroot00000000000000 php extsrc extbin zendextsrc zendextbin 1 cfg_dir 1 php-pear-1.10.1+submodules+notgz/PEAR/Installer/Role/Common.php000066400000000000000000000141211262614675700241660ustar00rootroot00000000000000 * @copyright 1997-2006 The PHP Group * @license http://opensource.org/licenses/bsd-license.php New BSD License * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ /** * Base class for all installation roles. * * This class allows extensibility of file roles. Packages with complex * customization can now provide custom file roles along with the possibility of * adding configuration values to match. * @category pear * @package PEAR * @author Greg Beaver * @copyright 1997-2006 The PHP Group * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version Release: @package_version@ * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ class PEAR_Installer_Role_Common { /** * @var PEAR_Config * @access protected */ var $config; /** * @param PEAR_Config */ function __construct(&$config) { $this->config = $config; } /** * Retrieve configuration information about a file role from its XML info * * @param string $role Role Classname, as in "PEAR_Installer_Role_Data" * @return array */ function getInfo($role) { if (empty($GLOBALS['_PEAR_INSTALLER_ROLES'][$role])) { return PEAR::raiseError('Unknown Role class: "' . $role . '"'); } return $GLOBALS['_PEAR_INSTALLER_ROLES'][$role]; } /** * This is called for each file to set up the directories and files * @param PEAR_PackageFile_v1|PEAR_PackageFile_v2 * @param array attributes from the tag * @param string file name * @return array an array consisting of: * * 1 the original, pre-baseinstalldir installation directory * 2 the final installation directory * 3 the full path to the final location of the file * 4 the location of the pre-installation file */ function processInstallation($pkg, $atts, $file, $tmp_path, $layer = null) { $roleInfo = PEAR_Installer_Role_Common::getInfo('PEAR_Installer_Role_' . ucfirst(str_replace('pear_installer_role_', '', strtolower(get_class($this))))); if (PEAR::isError($roleInfo)) { return $roleInfo; } if (!$roleInfo['locationconfig']) { return false; } if ($roleInfo['honorsbaseinstall']) { $dest_dir = $save_destdir = $this->config->get($roleInfo['locationconfig'], $layer, $pkg->getChannel()); if (!empty($atts['baseinstalldir'])) { $dest_dir .= DIRECTORY_SEPARATOR . $atts['baseinstalldir']; } } elseif ($roleInfo['unusualbaseinstall']) { $dest_dir = $save_destdir = $this->config->get($roleInfo['locationconfig'], $layer, $pkg->getChannel()) . DIRECTORY_SEPARATOR . $pkg->getPackage(); if (!empty($atts['baseinstalldir'])) { $dest_dir .= DIRECTORY_SEPARATOR . $atts['baseinstalldir']; } } else { $dest_dir = $save_destdir = $this->config->get($roleInfo['locationconfig'], $layer, $pkg->getChannel()) . DIRECTORY_SEPARATOR . $pkg->getPackage(); } if (dirname($file) != '.' && empty($atts['install-as'])) { $dest_dir .= DIRECTORY_SEPARATOR . dirname($file); } if (empty($atts['install-as'])) { $dest_file = $dest_dir . DIRECTORY_SEPARATOR . basename($file); } else { $dest_file = $dest_dir . DIRECTORY_SEPARATOR . $atts['install-as']; } $orig_file = $tmp_path . DIRECTORY_SEPARATOR . $file; // Clean up the DIRECTORY_SEPARATOR mess $ds2 = DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR; list($dest_dir, $dest_file, $orig_file) = preg_replace(array('!\\\\+!', '!/!', "!$ds2+!"), array(DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR), array($dest_dir, $dest_file, $orig_file)); return array($save_destdir, $dest_dir, $dest_file, $orig_file); } /** * Get the name of the configuration variable that specifies the location of this file * @return string|false */ function getLocationConfig() { $roleInfo = PEAR_Installer_Role_Common::getInfo('PEAR_Installer_Role_' . ucfirst(str_replace('pear_installer_role_', '', strtolower(get_class($this))))); if (PEAR::isError($roleInfo)) { return $roleInfo; } return $roleInfo['locationconfig']; } /** * Do any unusual setup here * @param PEAR_Installer * @param PEAR_PackageFile_v2 * @param array file attributes * @param string file name */ function setup(&$installer, $pkg, $atts, $file) { } function isExecutable() { $roleInfo = PEAR_Installer_Role_Common::getInfo('PEAR_Installer_Role_' . ucfirst(str_replace('pear_installer_role_', '', strtolower(get_class($this))))); if (PEAR::isError($roleInfo)) { return $roleInfo; } return $roleInfo['executable']; } function isInstallable() { $roleInfo = PEAR_Installer_Role_Common::getInfo('PEAR_Installer_Role_' . ucfirst(str_replace('pear_installer_role_', '', strtolower(get_class($this))))); if (PEAR::isError($roleInfo)) { return $roleInfo; } return $roleInfo['installable']; } function isExtension() { $roleInfo = PEAR_Installer_Role_Common::getInfo('PEAR_Installer_Role_' . ucfirst(str_replace('pear_installer_role_', '', strtolower(get_class($this))))); if (PEAR::isError($roleInfo)) { return $roleInfo; } return $roleInfo['phpextension']; } } ?> php-pear-1.10.1+submodules+notgz/PEAR/Installer/Role/Data.php000066400000000000000000000014311262614675700236070ustar00rootroot00000000000000 * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ /** * @category pear * @package PEAR * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version Release: @package_version@ * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ class PEAR_Installer_Role_Data extends PEAR_Installer_Role_Common {} ?>php-pear-1.10.1+submodules+notgz/PEAR/Installer/Role/Data.xml000066400000000000000000000006221262614675700236210ustar00rootroot00000000000000 php extsrc extbin zendextsrc zendextbin 1 data_dir php-pear-1.10.1+submodules+notgz/PEAR/Installer/Role/Doc.php000066400000000000000000000014271262614675700234500ustar00rootroot00000000000000 * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ /** * @category pear * @package PEAR * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version Release: @package_version@ * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ class PEAR_Installer_Role_Doc extends PEAR_Installer_Role_Common {} ?>php-pear-1.10.1+submodules+notgz/PEAR/Installer/Role/Doc.xml000066400000000000000000000006211262614675700234540ustar00rootroot00000000000000 php extsrc extbin zendextsrc zendextbin 1 doc_dir php-pear-1.10.1+submodules+notgz/PEAR/Installer/Role/Ext.php000066400000000000000000000014271262614675700235030ustar00rootroot00000000000000 * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ /** * @category pear * @package PEAR * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version Release: @package_version@ * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ class PEAR_Installer_Role_Ext extends PEAR_Installer_Role_Common {} ?>php-pear-1.10.1+submodules+notgz/PEAR/Installer/Role/Ext.xml000066400000000000000000000005021262614675700235050ustar00rootroot00000000000000 extbin zendextbin 1 ext_dir 1 1 php-pear-1.10.1+submodules+notgz/PEAR/Installer/Role/Man.php000066400000000000000000000014571262614675700234610ustar00rootroot00000000000000 * @copyright 2011 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version SVN: $Id: $ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.10.0 */ /** * @category pear * @package PEAR * @author Hannes Magnusson * @copyright 2011 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version Release: @package_version@ * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.10.0 */ class PEAR_Installer_Role_Man extends PEAR_Installer_Role_Common {} ?> php-pear-1.10.1+submodules+notgz/PEAR/Installer/Role/Man.xml000066400000000000000000000006451262614675700234700ustar00rootroot00000000000000 php extsrc extbin zendextsrc zendextbin 1 man_dir 1 php-pear-1.10.1+submodules+notgz/PEAR/Installer/Role/Php.php000066400000000000000000000014271262614675700234720ustar00rootroot00000000000000 * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ /** * @category pear * @package PEAR * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version Release: @package_version@ * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ class PEAR_Installer_Role_Php extends PEAR_Installer_Role_Common {} ?>php-pear-1.10.1+submodules+notgz/PEAR/Installer/Role/Php.xml000066400000000000000000000006551262614675700235050ustar00rootroot00000000000000 php extsrc extbin zendextsrc zendextbin 1 php_dir 1 1 php-pear-1.10.1+submodules+notgz/PEAR/Installer/Role/Script.php000066400000000000000000000014351262614675700242060ustar00rootroot00000000000000 * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ /** * @category pear * @package PEAR * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version Release: @package_version@ * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ class PEAR_Installer_Role_Script extends PEAR_Installer_Role_Common {} ?>php-pear-1.10.1+submodules+notgz/PEAR/Installer/Role/Script.xml000066400000000000000000000006601262614675700242160ustar00rootroot00000000000000 php extsrc extbin zendextsrc zendextbin 1 bin_dir 1 1 php-pear-1.10.1+submodules+notgz/PEAR/Installer/Role/Src.php000066400000000000000000000015741262614675700234750ustar00rootroot00000000000000 * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ /** * @category pear * @package PEAR * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version Release: @package_version@ * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ class PEAR_Installer_Role_Src extends PEAR_Installer_Role_Common { function setup(&$installer, $pkg, $atts, $file) { $installer->source_files++; } } ?>php-pear-1.10.1+submodules+notgz/PEAR/Installer/Role/Src.xml000066400000000000000000000004421262614675700234770ustar00rootroot00000000000000 extsrc zendextsrc 1 temp_dir php-pear-1.10.1+submodules+notgz/PEAR/Installer/Role/Test.php000066400000000000000000000014311262614675700236550ustar00rootroot00000000000000 * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ /** * @category pear * @package PEAR * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version Release: @package_version@ * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ class PEAR_Installer_Role_Test extends PEAR_Installer_Role_Common {} ?>php-pear-1.10.1+submodules+notgz/PEAR/Installer/Role/Test.xml000066400000000000000000000006221262614675700236670ustar00rootroot00000000000000 php extsrc extbin zendextsrc zendextbin 1 test_dir php-pear-1.10.1+submodules+notgz/PEAR/Installer/Role/Www.php000066400000000000000000000014231262614675700235230ustar00rootroot00000000000000 * @copyright 2007-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @link http://pear.php.net/package/PEAR * @since File available since Release 1.7.0 */ /** * @category pear * @package PEAR * @author Greg Beaver * @copyright 2007-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version Release: @package_version@ * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.7.0 */ class PEAR_Installer_Role_Www extends PEAR_Installer_Role_Common {} ?>php-pear-1.10.1+submodules+notgz/PEAR/Installer/Role/Www.xml000066400000000000000000000006441262614675700235400ustar00rootroot00000000000000 php extsrc extbin zendextsrc zendextbin 1 www_dir 1 php-pear-1.10.1+submodules+notgz/PEAR/PackageFile.php000066400000000000000000000367411262614675700222470ustar00rootroot00000000000000 * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ /** * needed for PEAR_VALIDATE_* constants */ require_once 'PEAR/Validate.php'; /** * Error code if the package.xml tag does not contain a valid version */ define('PEAR_PACKAGEFILE_ERROR_NO_PACKAGEVERSION', 1); /** * Error code if the package.xml tag version is not supported (version 1.0 and 1.1 are the only supported versions, * currently */ define('PEAR_PACKAGEFILE_ERROR_INVALID_PACKAGEVERSION', 2); /** * Abstraction for the package.xml package description file * * @category pear * @package PEAR * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version Release: @PEAR-VER@ * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ class PEAR_PackageFile { /** * @var PEAR_Config */ var $_config; var $_debug; var $_logger = false; /** * @var boolean */ var $_rawReturn = false; /** * helper for extracting Archive_Tar errors * @var array * @access private */ var $_extractErrors = array(); /** * * @param PEAR_Config $config * @param ? $debug * @param string @tmpdir Optional temporary directory for uncompressing * files */ function __construct(&$config, $debug = false) { $this->_config = $config; $this->_debug = $debug; } /** * Turn off validation - return a parsed package.xml without checking it * * This is used by the package-validate command */ function rawReturn() { $this->_rawReturn = true; } function setLogger(&$l) { $this->_logger = &$l; } /** * Create a PEAR_PackageFile_Parser_v* of a given version. * @param int $version * @return PEAR_PackageFile_Parser_v1|PEAR_PackageFile_Parser_v1 */ function &parserFactory($version) { if (!in_array($version{0}, array('1', '2'))) { $a = false; return $a; } include_once 'PEAR/PackageFile/Parser/v' . $version{0} . '.php'; $version = $version{0}; $class = "PEAR_PackageFile_Parser_v$version"; $a = new $class; return $a; } /** * For simpler unit-testing * @return string */ function getClassPrefix() { return 'PEAR_PackageFile_v'; } /** * Create a PEAR_PackageFile_v* of a given version. * @param int $version * @return PEAR_PackageFile_v1|PEAR_PackageFile_v1 */ function &factory($version) { if (!in_array($version{0}, array('1', '2'))) { $a = false; return $a; } include_once 'PEAR/PackageFile/v' . $version{0} . '.php'; $version = $version{0}; $class = $this->getClassPrefix() . $version; $a = new $class; return $a; } /** * Create a PEAR_PackageFile_v* from its toArray() method * * WARNING: no validation is performed, the array is assumed to be valid, * always parse from xml if you want validation. * @param array $arr * @return PEAR_PackageFileManager_v1|PEAR_PackageFileManager_v2 * @uses factory() to construct the returned object. */ function &fromArray($arr) { if (isset($arr['xsdversion'])) { $obj = &$this->factory($arr['xsdversion']); if ($this->_logger) { $obj->setLogger($this->_logger); } $obj->setConfig($this->_config); $obj->fromArray($arr); return $obj; } if (isset($arr['package']['attribs']['version'])) { $obj = &$this->factory($arr['package']['attribs']['version']); } else { $obj = &$this->factory('1.0'); } if ($this->_logger) { $obj->setLogger($this->_logger); } $obj->setConfig($this->_config); $obj->fromArray($arr); return $obj; } /** * Create a PEAR_PackageFile_v* from an XML string. * @access public * @param string $data contents of package.xml file * @param int $state package state (one of PEAR_VALIDATE_* constants) * @param string $file full path to the package.xml file (and the files * it references) * @param string $archive optional name of the archive that the XML was * extracted from, if any * @return PEAR_PackageFile_v1|PEAR_PackageFile_v2 * @uses parserFactory() to construct a parser to load the package. */ function &fromXmlString($data, $state, $file, $archive = false) { if (preg_match('/]+version=[\'"]([0-9]+\.[0-9]+)[\'"]/', $data, $packageversion)) { if (!in_array($packageversion[1], array('1.0', '2.0', '2.1'))) { return PEAR::raiseError('package.xml version "' . $packageversion[1] . '" is not supported, only 1.0, 2.0, and 2.1 are supported.'); } $object = &$this->parserFactory($packageversion[1]); if ($this->_logger) { $object->setLogger($this->_logger); } $object->setConfig($this->_config); $pf = $object->parse($data, $file, $archive); if (PEAR::isError($pf)) { return $pf; } if ($this->_rawReturn) { return $pf; } if (!$pf->validate($state)) {; if ($this->_config->get('verbose') > 0 && $this->_logger && $pf->getValidationWarnings(false) ) { foreach ($pf->getValidationWarnings(false) as $warning) { $this->_logger->log(0, 'ERROR: ' . $warning['message']); } } $a = PEAR::raiseError('Parsing of package.xml from file "' . $file . '" failed', 2, null, null, $pf->getValidationWarnings()); return $a; } if ($this->_logger && $pf->getValidationWarnings(false)) { foreach ($pf->getValidationWarnings() as $warning) { $this->_logger->log(0, 'WARNING: ' . $warning['message']); } } if (method_exists($pf, 'flattenFilelist')) { $pf->flattenFilelist(); // for v2 } return $pf; } elseif (preg_match('/]+version=[\'"]([^"\']+)[\'"]/', $data, $packageversion)) { $a = PEAR::raiseError('package.xml file "' . $file . '" has unsupported package.xml version "' . $packageversion[1] . '"'); return $a; } else { if (!class_exists('PEAR_ErrorStack')) { require_once 'PEAR/ErrorStack.php'; } PEAR_ErrorStack::staticPush('PEAR_PackageFile', PEAR_PACKAGEFILE_ERROR_NO_PACKAGEVERSION, 'warning', array('xml' => $data), 'package.xml "' . $file . '" has no package.xml version'); $object = &$this->parserFactory('1.0'); $object->setConfig($this->_config); $pf = $object->parse($data, $file, $archive); if (PEAR::isError($pf)) { return $pf; } if ($this->_rawReturn) { return $pf; } if (!$pf->validate($state)) { $a = PEAR::raiseError('Parsing of package.xml from file "' . $file . '" failed', 2, null, null, $pf->getValidationWarnings()); return $a; } if ($this->_logger && $pf->getValidationWarnings(false)) { foreach ($pf->getValidationWarnings() as $warning) { $this->_logger->log(0, 'WARNING: ' . $warning['message']); } } if (method_exists($pf, 'flattenFilelist')) { $pf->flattenFilelist(); // for v2 } return $pf; } } /** * Register a temporary file or directory. When the destructor is * executed, all registered temporary files and directories are * removed. * * @param string $file name of file or directory * @return void */ function addTempFile($file) { $GLOBALS['_PEAR_Common_tempfiles'][] = $file; } /** * Create a PEAR_PackageFile_v* from a compresed Tar or Tgz file. * @access public * @param string contents of package.xml file * @param int package state (one of PEAR_VALIDATE_* constants) * @return PEAR_PackageFile_v1|PEAR_PackageFile_v2 * @using Archive_Tar to extract the files * @using fromPackageFile() to load the package after the package.xml * file is extracted. */ function &fromTgzFile($file, $state) { if (!class_exists('Archive_Tar')) { require_once 'Archive/Tar.php'; } $tar = new Archive_Tar($file); if ($this->_debug <= 1) { $tar->pushErrorHandling(PEAR_ERROR_RETURN); } $content = $tar->listContent(); if ($this->_debug <= 1) { $tar->popErrorHandling(); } if (!is_array($content)) { if (is_string($file) && strlen($file < 255) && (!file_exists($file) || !@is_file($file))) { $ret = PEAR::raiseError("could not open file \"$file\""); return $ret; } $file = realpath($file); $ret = PEAR::raiseError("Could not get contents of package \"$file\"". '. Invalid tgz file.'); return $ret; } if (!count($content) && !@is_file($file)) { $ret = PEAR::raiseError("could not open file \"$file\""); return $ret; } $xml = null; $origfile = $file; foreach ($content as $file) { $name = $file['filename']; if ($name == 'package2.xml') { // allow a .tgz to distribute both versions $xml = $name; break; } if ($name == 'package.xml') { $xml = $name; break; } elseif (preg_match('/package.xml$/', $name, $match)) { $xml = $name; break; } } $tmpdir = System::mktemp('-t "' . $this->_config->get('temp_dir') . '" -d pear'); if ($tmpdir === false) { $ret = PEAR::raiseError("there was a problem with getting the configured temp directory"); return $ret; } PEAR_PackageFile::addTempFile($tmpdir); $this->_extractErrors(); PEAR::staticPushErrorHandling(PEAR_ERROR_CALLBACK, array($this, '_extractErrors')); if (!$xml || !$tar->extractList(array($xml), $tmpdir)) { $extra = implode("\n", $this->_extractErrors()); if ($extra) { $extra = ' ' . $extra; } PEAR::staticPopErrorHandling(); $ret = PEAR::raiseError('could not extract the package.xml file from "' . $origfile . '"' . $extra); return $ret; } PEAR::staticPopErrorHandling(); $ret = &PEAR_PackageFile::fromPackageFile("$tmpdir/$xml", $state, $origfile); return $ret; } /** * helper callback for extracting Archive_Tar errors * * @param PEAR_Error|null $err * @return array * @access private */ function _extractErrors($err = null) { static $errors = array(); if ($err === null) { $e = $errors; $errors = array(); return $e; } $errors[] = $err->getMessage(); } /** * Create a PEAR_PackageFile_v* from a package.xml file. * * @access public * @param string $descfile name of package xml file * @param int $state package state (one of PEAR_VALIDATE_* constants) * @param string|false $archive name of the archive this package.xml came * from, if any * @return PEAR_PackageFile_v1|PEAR_PackageFile_v2 * @uses PEAR_PackageFile::fromXmlString to create the oject after the * XML is loaded from the package.xml file. */ function &fromPackageFile($descfile, $state, $archive = false) { $fp = false; if (is_string($descfile) && strlen($descfile) < 255 && ( !file_exists($descfile) || !is_file($descfile) || !is_readable($descfile) || (!$fp = @fopen($descfile, 'r')) ) ) { $a = PEAR::raiseError("Unable to open $descfile"); return $a; } // read the whole thing so we only get one cdata callback // for each block of cdata fclose($fp); $data = file_get_contents($descfile); $ret = &PEAR_PackageFile::fromXmlString($data, $state, $descfile, $archive); return $ret; } /** * Create a PEAR_PackageFile_v* from a .tgz archive or package.xml file. * * This method is able to extract information about a package from a .tgz * archive or from a XML package definition file. * * @access public * @param string $info file name * @param int $state package state (one of PEAR_VALIDATE_* constants) * @return PEAR_PackageFile_v1|PEAR_PackageFile_v2 * @uses fromPackageFile() if the file appears to be XML * @uses fromTgzFile() to load all non-XML files */ function &fromAnyFile($info, $state) { if (is_dir($info)) { $dir_name = realpath($info); if (file_exists($dir_name . '/package.xml')) { $info = PEAR_PackageFile::fromPackageFile($dir_name . '/package.xml', $state); } elseif (file_exists($dir_name . '/package2.xml')) { $info = PEAR_PackageFile::fromPackageFile($dir_name . '/package2.xml', $state); } else { $info = PEAR::raiseError("No package definition found in '$info' directory"); } return $info; } $fp = false; if (is_string($info) && strlen($info) < 255 && (file_exists($info) || ($fp = @fopen($info, 'r'))) ) { if ($fp) { fclose($fp); } $tmp = substr($info, -4); if ($tmp == '.xml') { $info = &PEAR_PackageFile::fromPackageFile($info, $state); } elseif ($tmp == '.tar' || $tmp == '.tgz') { $info = &PEAR_PackageFile::fromTgzFile($info, $state); } else { $fp = fopen($info, 'r'); $test = fread($fp, 5); fclose($fp); if ($test == ' * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ /** * needed for PEAR_VALIDATE_* constants */ require_once 'PEAR/Validate.php'; require_once 'System.php'; require_once 'PEAR/PackageFile/v2.php'; /** * This class converts a PEAR_PackageFile_v1 object into any output format. * * Supported output formats include array, XML string, and a PEAR_PackageFile_v2 * object, for converting package.xml 1.0 into package.xml 2.0 with no sweat. * @category pear * @package PEAR * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version Release: @PEAR-VER@ * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ class PEAR_PackageFile_Generator_v1 { /** * @var PEAR_PackageFile_v1 */ var $_packagefile; function __construct(&$packagefile) { $this->_packagefile = &$packagefile; } function getPackagerVersion() { return '@PEAR-VER@'; } /** * @param PEAR_Packager * @param bool if true, a .tgz is written, otherwise a .tar is written * @param string|null directory in which to save the .tgz * @return string|PEAR_Error location of package or error object */ function toTgz(&$packager, $compress = true, $where = null) { require_once 'Archive/Tar.php'; if ($where === null) { if (!($where = System::mktemp(array('-d')))) { return PEAR::raiseError('PEAR_Packagefile_v1::toTgz: mktemp failed'); } } elseif (!@System::mkDir(array('-p', $where))) { return PEAR::raiseError('PEAR_Packagefile_v1::toTgz: "' . $where . '" could' . ' not be created'); } if (file_exists($where . DIRECTORY_SEPARATOR . 'package.xml') && !is_file($where . DIRECTORY_SEPARATOR . 'package.xml')) { return PEAR::raiseError('PEAR_Packagefile_v1::toTgz: unable to save package.xml as' . ' "' . $where . DIRECTORY_SEPARATOR . 'package.xml"'); } if (!$this->_packagefile->validate(PEAR_VALIDATE_PACKAGING)) { return PEAR::raiseError('PEAR_Packagefile_v1::toTgz: invalid package file'); } $pkginfo = $this->_packagefile->getArray(); $ext = $compress ? '.tgz' : '.tar'; $pkgver = $pkginfo['package'] . '-' . $pkginfo['version']; $dest_package = getcwd() . DIRECTORY_SEPARATOR . $pkgver . $ext; if (file_exists(getcwd() . DIRECTORY_SEPARATOR . $pkgver . $ext) && !is_file(getcwd() . DIRECTORY_SEPARATOR . $pkgver . $ext)) { return PEAR::raiseError('PEAR_Packagefile_v1::toTgz: cannot create tgz file "' . getcwd() . DIRECTORY_SEPARATOR . $pkgver . $ext . '"'); } if ($pkgfile = $this->_packagefile->getPackageFile()) { $pkgdir = dirname(realpath($pkgfile)); $pkgfile = basename($pkgfile); } else { return PEAR::raiseError('PEAR_Packagefile_v1::toTgz: package file object must ' . 'be created from a real file'); } // {{{ Create the package file list $filelist = array(); $i = 0; foreach ($this->_packagefile->getFilelist() as $fname => $atts) { $file = $pkgdir . DIRECTORY_SEPARATOR . $fname; if (!file_exists($file)) { return PEAR::raiseError("File does not exist: $fname"); } else { $filelist[$i++] = $file; if (!isset($atts['md5sum'])) { $this->_packagefile->setFileAttribute($fname, 'md5sum', md5_file($file)); } $packager->log(2, "Adding file $fname"); } } // }}} $packagexml = $this->toPackageFile($where, PEAR_VALIDATE_PACKAGING, 'package.xml', true); if ($packagexml) { $tar = new Archive_Tar($dest_package, $compress); $tar->setErrorHandling(PEAR_ERROR_RETURN); // XXX Don't print errors // ----- Creates with the package.xml file $ok = $tar->createModify(array($packagexml), '', $where); if (PEAR::isError($ok)) { return $ok; } elseif (!$ok) { return PEAR::raiseError('PEAR_Packagefile_v1::toTgz: tarball creation failed'); } // ----- Add the content of the package if (!$tar->addModify($filelist, $pkgver, $pkgdir)) { return PEAR::raiseError('PEAR_Packagefile_v1::toTgz: tarball creation failed'); } return $dest_package; } } /** * @param string|null directory to place the package.xml in, or null for a temporary dir * @param int one of the PEAR_VALIDATE_* constants * @param string name of the generated file * @param bool if true, then no analysis will be performed on role="php" files * @return string|PEAR_Error path to the created file on success */ function toPackageFile($where = null, $state = PEAR_VALIDATE_NORMAL, $name = 'package.xml', $nofilechecking = false) { if (!$this->_packagefile->validate($state, $nofilechecking)) { return PEAR::raiseError('PEAR_Packagefile_v1::toPackageFile: invalid package.xml', null, null, null, $this->_packagefile->getValidationWarnings()); } if ($where === null) { if (!($where = System::mktemp(array('-d')))) { return PEAR::raiseError('PEAR_Packagefile_v1::toPackageFile: mktemp failed'); } } elseif (!@System::mkDir(array('-p', $where))) { return PEAR::raiseError('PEAR_Packagefile_v1::toPackageFile: "' . $where . '" could' . ' not be created'); } $newpkgfile = $where . DIRECTORY_SEPARATOR . $name; $np = @fopen($newpkgfile, 'wb'); if (!$np) { return PEAR::raiseError('PEAR_Packagefile_v1::toPackageFile: unable to save ' . "$name as $newpkgfile"); } fwrite($np, $this->toXml($state, true)); fclose($np); return $newpkgfile; } /** * fix both XML encoding to be UTF8, and replace standard XML entities < > " & ' * * @param string $string * @return string * @access private */ function _fixXmlEncoding($string) { return strtr($string, array( '&' => '&', '>' => '>', '<' => '<', '"' => '"', '\'' => ''' )); } /** * Return an XML document based on the package info (as returned * by the PEAR_Common::infoFrom* methods). * * @return string XML data */ function toXml($state = PEAR_VALIDATE_NORMAL, $nofilevalidation = false) { $this->_packagefile->setDate(date('Y-m-d')); if (!$this->_packagefile->validate($state, $nofilevalidation)) { return false; } $pkginfo = $this->_packagefile->getArray(); static $maint_map = array( "handle" => "user", "name" => "name", "email" => "email", "role" => "role", ); $ret = "\n"; $ret .= "\n"; $ret .= "\n" . " $pkginfo[package]"; if (isset($pkginfo['extends'])) { $ret .= "\n$pkginfo[extends]"; } $ret .= "\n ".$this->_fixXmlEncoding($pkginfo['summary'])."\n" . " ".trim($this->_fixXmlEncoding($pkginfo['description']))."\n \n" . " \n"; foreach ($pkginfo['maintainers'] as $maint) { $ret .= " \n"; foreach ($maint_map as $idx => $elm) { $ret .= " <$elm>"; $ret .= $this->_fixXmlEncoding($maint[$idx]); $ret .= "\n"; } $ret .= " \n"; } $ret .= " \n"; $ret .= $this->_makeReleaseXml($pkginfo, false, $state); if (isset($pkginfo['changelog']) && count($pkginfo['changelog']) > 0) { $ret .= " \n"; foreach ($pkginfo['changelog'] as $oldrelease) { $ret .= $this->_makeReleaseXml($oldrelease, true); } $ret .= " \n"; } $ret .= "\n"; return $ret; } // }}} // {{{ _makeReleaseXml() /** * Generate part of an XML description with release information. * * @param array $pkginfo array with release information * @param bool $changelog whether the result will be in a changelog element * * @return string XML data * * @access private */ function _makeReleaseXml($pkginfo, $changelog = false, $state = PEAR_VALIDATE_NORMAL) { // XXX QUOTE ENTITIES IN PCDATA, OR EMBED IN CDATA BLOCKS!! $indent = $changelog ? " " : ""; $ret = "$indent \n"; if (!empty($pkginfo['version'])) { $ret .= "$indent $pkginfo[version]\n"; } if (!empty($pkginfo['release_date'])) { $ret .= "$indent $pkginfo[release_date]\n"; } if (!empty($pkginfo['release_license'])) { $ret .= "$indent $pkginfo[release_license]\n"; } if (!empty($pkginfo['release_state'])) { $ret .= "$indent $pkginfo[release_state]\n"; } if (!empty($pkginfo['release_notes'])) { $ret .= "$indent ".trim($this->_fixXmlEncoding($pkginfo['release_notes'])) ."\n$indent \n"; } if (!empty($pkginfo['release_warnings'])) { $ret .= "$indent ".$this->_fixXmlEncoding($pkginfo['release_warnings'])."\n"; } if (isset($pkginfo['release_deps']) && sizeof($pkginfo['release_deps']) > 0) { $ret .= "$indent \n"; foreach ($pkginfo['release_deps'] as $dep) { $ret .= "$indent _fixXmlEncoding($c['name']) . "\""; if (isset($c['default'])) { $ret .= " default=\"" . $this->_fixXmlEncoding($c['default']) . "\""; } $ret .= " prompt=\"" . $this->_fixXmlEncoding($c['prompt']) . "\""; $ret .= "/>\n"; } $ret .= "$indent \n"; } if (isset($pkginfo['provides'])) { foreach ($pkginfo['provides'] as $key => $what) { $ret .= "$indent recursiveXmlFilelist($pkginfo['filelist']); } else { foreach ($pkginfo['filelist'] as $file => $fa) { if (!isset($fa['role'])) { $fa['role'] = ''; } $ret .= "$indent _fixXmlEncoding($fa['baseinstalldir']) . '"'; } if (isset($fa['md5sum'])) { $ret .= " md5sum=\"$fa[md5sum]\""; } if (isset($fa['platform'])) { $ret .= " platform=\"$fa[platform]\""; } if (!empty($fa['install-as'])) { $ret .= ' install-as="' . $this->_fixXmlEncoding($fa['install-as']) . '"'; } $ret .= ' name="' . $this->_fixXmlEncoding($file) . '"'; if (empty($fa['replacements'])) { $ret .= "/>\n"; } else { $ret .= ">\n"; foreach ($fa['replacements'] as $r) { $ret .= "$indent $v) { $ret .= " $k=\"" . $this->_fixXmlEncoding($v) .'"'; } $ret .= "/>\n"; } $ret .= "$indent \n"; } } } $ret .= "$indent \n"; } $ret .= "$indent \n"; return $ret; } /** * @param array * @access protected */ function recursiveXmlFilelist($list) { $this->_dirs = array(); foreach ($list as $file => $attributes) { $this->_addDir($this->_dirs, explode('/', dirname($file)), $file, $attributes); } return $this->_formatDir($this->_dirs); } /** * @param array * @param array * @param string|null * @param array|null * @access private */ function _addDir(&$dirs, $dir, $file = null, $attributes = null) { if ($dir == array() || $dir == array('.')) { $dirs['files'][basename($file)] = $attributes; return; } $curdir = array_shift($dir); if (!isset($dirs['dirs'][$curdir])) { $dirs['dirs'][$curdir] = array(); } $this->_addDir($dirs['dirs'][$curdir], $dir, $file, $attributes); } /** * @param array * @param string * @param string * @access private */ function _formatDir($dirs, $indent = '', $curdir = '') { $ret = ''; if (!count($dirs)) { return ''; } if (isset($dirs['dirs'])) { uksort($dirs['dirs'], 'strnatcasecmp'); foreach ($dirs['dirs'] as $dir => $contents) { $usedir = "$curdir/$dir"; $ret .= "$indent \n"; $ret .= $this->_formatDir($contents, "$indent ", $usedir); $ret .= "$indent \n"; } } if (isset($dirs['files'])) { uksort($dirs['files'], 'strnatcasecmp'); foreach ($dirs['files'] as $file => $attribs) { $ret .= $this->_formatFile($file, $attribs, $indent); } } return $ret; } /** * @param string * @param array * @param string * @access private */ function _formatFile($file, $attributes, $indent) { $ret = "$indent _fixXmlEncoding($attributes['baseinstalldir']) . '"'; } if (isset($attributes['md5sum'])) { $ret .= " md5sum=\"$attributes[md5sum]\""; } if (isset($attributes['platform'])) { $ret .= " platform=\"$attributes[platform]\""; } if (!empty($attributes['install-as'])) { $ret .= ' install-as="' . $this->_fixXmlEncoding($attributes['install-as']) . '"'; } $ret .= ' name="' . $this->_fixXmlEncoding($file) . '"'; if (empty($attributes['replacements'])) { $ret .= "/>\n"; } else { $ret .= ">\n"; foreach ($attributes['replacements'] as $r) { $ret .= "$indent $v) { $ret .= " $k=\"" . $this->_fixXmlEncoding($v) .'"'; } $ret .= "/>\n"; } $ret .= "$indent \n"; } return $ret; } // {{{ _unIndent() /** * Unindent given string (?) * * @param string $str The string that has to be unindented. * @return string * @access private */ function _unIndent($str) { // remove leading newlines $str = preg_replace('/^[\r\n]+/', '', $str); // find whitespace at the beginning of the first line $indent_len = strspn($str, " \t"); $indent = substr($str, 0, $indent_len); $data = ''; // remove the same amount of whitespace from following lines foreach (explode("\n", $str) as $line) { if (substr($line, 0, $indent_len) == $indent) { $data .= substr($line, $indent_len) . "\n"; } } return $data; } /** * @return array */ function dependenciesToV2() { $arr = array(); $this->_convertDependencies2_0($arr); return $arr['dependencies']; } /** * Convert a package.xml version 1.0 into version 2.0 * * Note that this does a basic conversion, to allow more advanced * features like bundles and multiple releases * @param string the classname to instantiate and return. This must be * PEAR_PackageFile_v2 or a descendant * @param boolean if true, only valid, deterministic package.xml 1.0 as defined by the * strictest parameters will be converted * @return PEAR_PackageFile_v2|PEAR_Error */ function &toV2($class = 'PEAR_PackageFile_v2', $strict = false) { if ($strict) { if (!$this->_packagefile->validate()) { $a = PEAR::raiseError('invalid package.xml version 1.0 cannot be converted' . ' to version 2.0', null, null, null, $this->_packagefile->getValidationWarnings(true)); return $a; } } $arr = array( 'attribs' => array( 'version' => '2.0', 'xmlns' => 'http://pear.php.net/dtd/package-2.0', 'xmlns:tasks' => 'http://pear.php.net/dtd/tasks-1.0', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation' => "http://pear.php.net/dtd/tasks-1.0\n" . "http://pear.php.net/dtd/tasks-1.0.xsd\n" . "http://pear.php.net/dtd/package-2.0\n" . 'http://pear.php.net/dtd/package-2.0.xsd', ), 'name' => $this->_packagefile->getPackage(), 'channel' => 'pear.php.net', ); $arr['summary'] = $this->_packagefile->getSummary(); $arr['description'] = $this->_packagefile->getDescription(); $maintainers = $this->_packagefile->getMaintainers(); foreach ($maintainers as $maintainer) { if ($maintainer['role'] != 'lead') { continue; } $new = array( 'name' => $maintainer['name'], 'user' => $maintainer['handle'], 'email' => $maintainer['email'], 'active' => 'yes', ); $arr['lead'][] = $new; } if (!isset($arr['lead'])) { // some people... you know? $arr['lead'] = array( 'name' => 'unknown', 'user' => 'unknown', 'email' => 'noleadmaintainer@example.com', 'active' => 'no', ); } if (count($arr['lead']) == 1) { $arr['lead'] = $arr['lead'][0]; } foreach ($maintainers as $maintainer) { if ($maintainer['role'] == 'lead') { continue; } $new = array( 'name' => $maintainer['name'], 'user' => $maintainer['handle'], 'email' => $maintainer['email'], 'active' => 'yes', ); $arr[$maintainer['role']][] = $new; } if (isset($arr['developer']) && count($arr['developer']) == 1) { $arr['developer'] = $arr['developer'][0]; } if (isset($arr['contributor']) && count($arr['contributor']) == 1) { $arr['contributor'] = $arr['contributor'][0]; } if (isset($arr['helper']) && count($arr['helper']) == 1) { $arr['helper'] = $arr['helper'][0]; } $arr['date'] = $this->_packagefile->getDate(); $arr['version'] = array( 'release' => $this->_packagefile->getVersion(), 'api' => $this->_packagefile->getVersion(), ); $arr['stability'] = array( 'release' => $this->_packagefile->getState(), 'api' => $this->_packagefile->getState(), ); $licensemap = array( 'php' => 'http://www.php.net/license', 'php license' => 'http://www.php.net/license', 'lgpl' => 'http://www.gnu.org/copyleft/lesser.html', 'bsd' => 'http://www.opensource.org/licenses/bsd-license.php', 'bsd style' => 'http://www.opensource.org/licenses/bsd-license.php', 'bsd-style' => 'http://www.opensource.org/licenses/bsd-license.php', 'mit' => 'http://www.opensource.org/licenses/mit-license.php', 'gpl' => 'http://www.gnu.org/copyleft/gpl.html', 'apache' => 'http://www.opensource.org/licenses/apache2.0.php' ); if (isset($licensemap[strtolower($this->_packagefile->getLicense())])) { $arr['license'] = array( 'attribs' => array('uri' => $licensemap[strtolower($this->_packagefile->getLicense())]), '_content' => $this->_packagefile->getLicense() ); } else { // don't use bogus uri $arr['license'] = $this->_packagefile->getLicense(); } $arr['notes'] = $this->_packagefile->getNotes(); $temp = array(); $arr['contents'] = $this->_convertFilelist2_0($temp); $this->_convertDependencies2_0($arr); $release = ($this->_packagefile->getConfigureOptions() || $this->_isExtension) ? 'extsrcrelease' : 'phprelease'; if ($release == 'extsrcrelease') { $arr['channel'] = 'pecl.php.net'; $arr['providesextension'] = $arr['name']; // assumption } $arr[$release] = array(); if ($this->_packagefile->getConfigureOptions()) { $arr[$release]['configureoption'] = $this->_packagefile->getConfigureOptions(); foreach ($arr[$release]['configureoption'] as $i => $opt) { $arr[$release]['configureoption'][$i] = array('attribs' => $opt); } if (count($arr[$release]['configureoption']) == 1) { $arr[$release]['configureoption'] = $arr[$release]['configureoption'][0]; } } $this->_convertRelease2_0($arr[$release], $temp); if ($release == 'extsrcrelease' && count($arr[$release]) > 1) { // multiple extsrcrelease tags added in PEAR 1.4.1 $arr['dependencies']['required']['pearinstaller']['min'] = '1.4.1'; } if ($cl = $this->_packagefile->getChangelog()) { foreach ($cl as $release) { $rel = array(); $rel['version'] = array( 'release' => $release['version'], 'api' => $release['version'], ); if (!isset($release['release_state'])) { $release['release_state'] = 'stable'; } $rel['stability'] = array( 'release' => $release['release_state'], 'api' => $release['release_state'], ); if (isset($release['release_date'])) { $rel['date'] = $release['release_date']; } else { $rel['date'] = date('Y-m-d'); } if (isset($release['release_license'])) { if (isset($licensemap[strtolower($release['release_license'])])) { $uri = $licensemap[strtolower($release['release_license'])]; } else { $uri = 'http://www.example.com'; } $rel['license'] = array( 'attribs' => array('uri' => $uri), '_content' => $release['release_license'] ); } else { $rel['license'] = $arr['license']; } if (!isset($release['release_notes'])) { $release['release_notes'] = 'no release notes'; } $rel['notes'] = $release['release_notes']; $arr['changelog']['release'][] = $rel; } } $ret = new $class; $ret->setConfig($this->_packagefile->_config); if (isset($this->_packagefile->_logger) && is_object($this->_packagefile->_logger)) { $ret->setLogger($this->_packagefile->_logger); } $ret->fromArray($arr); return $ret; } /** * @param array * @param bool * @access private */ function _convertDependencies2_0(&$release, $internal = false) { $peardep = array('pearinstaller' => array('min' => '1.4.0b1')); // this is a lot safer $required = $optional = array(); $release['dependencies'] = array('required' => array()); if ($this->_packagefile->hasDeps()) { foreach ($this->_packagefile->getDeps() as $dep) { if (!isset($dep['optional']) || $dep['optional'] == 'no') { $required[] = $dep; } else { $optional[] = $dep; } } foreach (array('required', 'optional') as $arr) { $deps = array(); foreach ($$arr as $dep) { // organize deps by dependency type and name if (!isset($deps[$dep['type']])) { $deps[$dep['type']] = array(); } if (isset($dep['name'])) { $deps[$dep['type']][$dep['name']][] = $dep; } else { $deps[$dep['type']][] = $dep; } } do { if (isset($deps['php'])) { $php = array(); if (count($deps['php']) > 1) { $php = $this->_processPhpDeps($deps['php']); } else { if (!isset($deps['php'][0])) { list($key, $blah) = each ($deps['php']); // stupid buggy versions $deps['php'] = array($blah[0]); } $php = $this->_processDep($deps['php'][0]); if (!$php) { break; // poor mans throw } } $release['dependencies'][$arr]['php'] = $php; } } while (false); do { if (isset($deps['pkg'])) { $pkg = array(); $pkg = $this->_processMultipleDepsName($deps['pkg']); if (!$pkg) { break; // poor mans throw } $release['dependencies'][$arr]['package'] = $pkg; } } while (false); do { if (isset($deps['ext'])) { $pkg = array(); $pkg = $this->_processMultipleDepsName($deps['ext']); $release['dependencies'][$arr]['extension'] = $pkg; } } while (false); // skip sapi - it's not supported so nobody will have used it // skip os - it's not supported in 1.0 } } if (isset($release['dependencies']['required'])) { $release['dependencies']['required'] = array_merge($peardep, $release['dependencies']['required']); } else { $release['dependencies']['required'] = $peardep; } if (!isset($release['dependencies']['required']['php'])) { $release['dependencies']['required']['php'] = array('min' => '4.0.0'); } $order = array(); $bewm = $release['dependencies']['required']; $order['php'] = $bewm['php']; $order['pearinstaller'] = $bewm['pearinstaller']; isset($bewm['package']) ? $order['package'] = $bewm['package'] :0; isset($bewm['extension']) ? $order['extension'] = $bewm['extension'] :0; $release['dependencies']['required'] = $order; } /** * @param array * @access private */ function _convertFilelist2_0(&$package) { $ret = array('dir' => array( 'attribs' => array('name' => '/'), 'file' => array() ) ); $package['platform'] = $package['install-as'] = array(); $this->_isExtension = false; foreach ($this->_packagefile->getFilelist() as $name => $file) { $file['name'] = $name; if (isset($file['role']) && $file['role'] == 'src') { $this->_isExtension = true; } if (isset($file['replacements'])) { $repl = $file['replacements']; unset($file['replacements']); } else { unset($repl); } if (isset($file['install-as'])) { $package['install-as'][$name] = $file['install-as']; unset($file['install-as']); } if (isset($file['platform'])) { $package['platform'][$name] = $file['platform']; unset($file['platform']); } $file = array('attribs' => $file); if (isset($repl)) { foreach ($repl as $replace ) { $file['tasks:replace'][] = array('attribs' => $replace); } if (count($repl) == 1) { $file['tasks:replace'] = $file['tasks:replace'][0]; } } $ret['dir']['file'][] = $file; } return $ret; } /** * Post-process special files with install-as/platform attributes and * make the release tag. * * This complex method follows this work-flow to create the release tags: * *
     * - if any install-as/platform exist, create a generic release and fill it with
     *   o  tags for 
     *   o  tags for 
     *   o  tags for 
     *   o  tags for 
     * - create a release for each platform encountered and fill with
     *   o  tags for 
     *   o  tags for 
     *   o  tags for 
     *   o  tags for 
     *   o  tags for 
     *   o  tags for 
     *   o  tags for 
     * 
* * It does this by accessing the $package parameter, which contains an array with * indices: * * - platform: mapping of file => OS the file should be installed on * - install-as: mapping of file => installed name * - osmap: mapping of OS => list of files that should be installed * on that OS * - notosmap: mapping of OS => list of files that should not be * installed on that OS * * @param array * @param array * @access private */ function _convertRelease2_0(&$release, $package) { //- if any install-as/platform exist, create a generic release and fill it with if (count($package['platform']) || count($package['install-as'])) { $generic = array(); $genericIgnore = array(); foreach ($package['install-as'] as $file => $as) { //o tags for if (!isset($package['platform'][$file])) { $generic[] = $file; continue; } //o tags for if (isset($package['platform'][$file]) && $package['platform'][$file]{0} == '!') { $generic[] = $file; continue; } //o tags for if (isset($package['platform'][$file]) && $package['platform'][$file]{0} != '!') { $genericIgnore[] = $file; continue; } } foreach ($package['platform'] as $file => $platform) { if (isset($package['install-as'][$file])) { continue; } if ($platform{0} != '!') { //o tags for $genericIgnore[] = $file; } } if (count($package['platform'])) { $oses = $notplatform = $platform = array(); foreach ($package['platform'] as $file => $os) { // get a list of oses if ($os{0} == '!') { if (isset($oses[substr($os, 1)])) { continue; } $oses[substr($os, 1)] = count($oses); } else { if (isset($oses[$os])) { continue; } $oses[$os] = count($oses); } } //- create a release for each platform encountered and fill with foreach ($oses as $os => $releaseNum) { $release[$releaseNum]['installconditions']['os']['name'] = $os; $release[$releaseNum]['filelist'] = array('install' => array(), 'ignore' => array()); foreach ($package['install-as'] as $file => $as) { //o tags for if (!isset($package['platform'][$file])) { $release[$releaseNum]['filelist']['install'][] = array( 'attribs' => array( 'name' => $file, 'as' => $as, ), ); continue; } //o tags for // if (isset($package['platform'][$file]) && $package['platform'][$file] == $os) { $release[$releaseNum]['filelist']['install'][] = array( 'attribs' => array( 'name' => $file, 'as' => $as, ), ); continue; } //o tags for // if (isset($package['platform'][$file]) && $package['platform'][$file] != "!$os" && $package['platform'][$file]{0} == '!') { $release[$releaseNum]['filelist']['install'][] = array( 'attribs' => array( 'name' => $file, 'as' => $as, ), ); continue; } //o tags for // if (isset($package['platform'][$file]) && $package['platform'][$file] == "!$os") { $release[$releaseNum]['filelist']['ignore'][] = array( 'attribs' => array( 'name' => $file, ), ); continue; } //o tags for // if (isset($package['platform'][$file]) && $package['platform'][$file]{0} != '!' && $package['platform'][$file] != $os) { $release[$releaseNum]['filelist']['ignore'][] = array( 'attribs' => array( 'name' => $file, ), ); continue; } } foreach ($package['platform'] as $file => $platform) { if (isset($package['install-as'][$file])) { continue; } //o tags for if ($platform == "!$os") { $release[$releaseNum]['filelist']['ignore'][] = array( 'attribs' => array( 'name' => $file, ), ); continue; } //o tags for if ($platform{0} != '!' && $platform != $os) { $release[$releaseNum]['filelist']['ignore'][] = array( 'attribs' => array( 'name' => $file, ), ); } } if (!count($release[$releaseNum]['filelist']['install'])) { unset($release[$releaseNum]['filelist']['install']); } if (!count($release[$releaseNum]['filelist']['ignore'])) { unset($release[$releaseNum]['filelist']['ignore']); } } if (count($generic) || count($genericIgnore)) { $release[count($oses)] = array(); if (count($generic)) { foreach ($generic as $file) { if (isset($package['install-as'][$file])) { $installas = $package['install-as'][$file]; } else { $installas = $file; } $release[count($oses)]['filelist']['install'][] = array( 'attribs' => array( 'name' => $file, 'as' => $installas, ) ); } } if (count($genericIgnore)) { foreach ($genericIgnore as $file) { $release[count($oses)]['filelist']['ignore'][] = array( 'attribs' => array( 'name' => $file, ) ); } } } // cleanup foreach ($release as $i => $rel) { if (isset($rel['filelist']['install']) && count($rel['filelist']['install']) == 1) { $release[$i]['filelist']['install'] = $release[$i]['filelist']['install'][0]; } if (isset($rel['filelist']['ignore']) && count($rel['filelist']['ignore']) == 1) { $release[$i]['filelist']['ignore'] = $release[$i]['filelist']['ignore'][0]; } } if (count($release) == 1) { $release = $release[0]; } } else { // no platform atts, but some install-as atts foreach ($package['install-as'] as $file => $value) { $release['filelist']['install'][] = array( 'attribs' => array( 'name' => $file, 'as' => $value ) ); } if (count($release['filelist']['install']) == 1) { $release['filelist']['install'] = $release['filelist']['install'][0]; } } } } /** * @param array * @return array * @access private */ function _processDep($dep) { if ($dep['type'] == 'php') { if ($dep['rel'] == 'has') { // come on - everyone has php! return false; } } $php = array(); if ($dep['type'] != 'php') { $php['name'] = $dep['name']; if ($dep['type'] == 'pkg') { $php['channel'] = 'pear.php.net'; } } switch ($dep['rel']) { case 'gt' : $php['min'] = $dep['version']; $php['exclude'] = $dep['version']; break; case 'ge' : if (!isset($dep['version'])) { if ($dep['type'] == 'php') { if (isset($dep['name'])) { $dep['version'] = $dep['name']; } } } $php['min'] = $dep['version']; break; case 'lt' : $php['max'] = $dep['version']; $php['exclude'] = $dep['version']; break; case 'le' : $php['max'] = $dep['version']; break; case 'eq' : $php['min'] = $dep['version']; $php['max'] = $dep['version']; break; case 'ne' : $php['exclude'] = $dep['version']; break; case 'not' : $php['conflicts'] = 'yes'; break; } return $php; } /** * @param array * @return array */ function _processPhpDeps($deps) { $test = array(); foreach ($deps as $dep) { $test[] = $this->_processDep($dep); } $min = array(); $max = array(); foreach ($test as $dep) { if (!$dep) { continue; } if (isset($dep['min'])) { $min[$dep['min']] = count($min); } if (isset($dep['max'])) { $max[$dep['max']] = count($max); } } if (count($min) > 0) { uksort($min, 'version_compare'); } if (count($max) > 0) { uksort($max, 'version_compare'); } if (count($min)) { // get the highest minimum $a = array_flip($min); $min = array_pop($a); } else { $min = false; } if (count($max)) { // get the lowest maximum $a = array_flip($max); $max = array_shift($a); } else { $max = false; } if ($min) { $php['min'] = $min; } if ($max) { $php['max'] = $max; } $exclude = array(); foreach ($test as $dep) { if (!isset($dep['exclude'])) { continue; } $exclude[] = $dep['exclude']; } if (count($exclude)) { $php['exclude'] = $exclude; } return $php; } /** * process multiple dependencies that have a name, like package deps * @param array * @return array * @access private */ function _processMultipleDepsName($deps) { $ret = $tests = array(); foreach ($deps as $name => $dep) { foreach ($dep as $d) { $tests[$name][] = $this->_processDep($d); } } foreach ($tests as $name => $test) { $max = $min = $php = array(); $php['name'] = $name; foreach ($test as $dep) { if (!$dep) { continue; } if (isset($dep['channel'])) { $php['channel'] = 'pear.php.net'; } if (isset($dep['conflicts']) && $dep['conflicts'] == 'yes') { $php['conflicts'] = 'yes'; } if (isset($dep['min'])) { $min[$dep['min']] = count($min); } if (isset($dep['max'])) { $max[$dep['max']] = count($max); } } if (count($min) > 0) { uksort($min, 'version_compare'); } if (count($max) > 0) { uksort($max, 'version_compare'); } if (count($min)) { // get the highest minimum $a = array_flip($min); $min = array_pop($a); } else { $min = false; } if (count($max)) { // get the lowest maximum $a = array_flip($max); $max = array_shift($a); } else { $max = false; } if ($min) { $php['min'] = $min; } if ($max) { $php['max'] = $max; } $exclude = array(); foreach ($test as $dep) { if (!isset($dep['exclude'])) { continue; } $exclude[] = $dep['exclude']; } if (count($exclude)) { $php['exclude'] = $exclude; } $ret[] = $php; } return $ret; } } ?> php-pear-1.10.1+submodules+notgz/PEAR/PackageFile/Generator/v2.php000066400000000000000000001007221262614675700245130ustar00rootroot00000000000000 * @author Stephan Schmidt (original XML_Serializer code) * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ /** * file/dir manipulation routines */ require_once 'System.php'; require_once 'XML/Util.php'; /** * This class converts a PEAR_PackageFile_v2 object into any output format. * * Supported output formats include array, XML string (using S. Schmidt's * XML_Serializer, slightly customized) * @category pear * @package PEAR * @author Greg Beaver * @author Stephan Schmidt (original XML_Serializer code) * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version Release: @PEAR-VER@ * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ class PEAR_PackageFile_Generator_v2 { /** * default options for the serialization * @access private * @var array $_defaultOptions */ var $_defaultOptions = array( 'indent' => ' ', // string used for indentation 'linebreak' => "\n", // string used for newlines 'typeHints' => false, // automatically add type hin attributes 'addDecl' => true, // add an XML declaration 'defaultTagName' => 'XML_Serializer_Tag', // tag used for indexed arrays or invalid names 'classAsTagName' => false, // use classname for objects in indexed arrays 'keyAttribute' => '_originalKey', // attribute where original key is stored 'typeAttribute' => '_type', // attribute for type (only if typeHints => true) 'classAttribute' => '_class', // attribute for class of objects (only if typeHints => true) 'scalarAsAttributes' => false, // scalar values (strings, ints,..) will be serialized as attribute 'prependAttributes' => '', // prepend string for attributes 'indentAttributes' => false, // indent the attributes, if set to '_auto', it will indent attributes so they all start at the same column 'mode' => 'simplexml', // use 'simplexml' to use parent name as tagname if transforming an indexed array 'addDoctype' => false, // add a doctype declaration 'doctype' => null, // supply a string or an array with id and uri ({@see XML_Util::getDoctypeDeclaration()} 'rootName' => 'package', // name of the root tag 'rootAttributes' => array( 'version' => '2.0', 'xmlns' => 'http://pear.php.net/dtd/package-2.0', 'xmlns:tasks' => 'http://pear.php.net/dtd/tasks-1.0', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation' => 'http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd', ), // attributes of the root tag 'attributesArray' => 'attribs', // all values in this key will be treated as attributes 'contentName' => '_content', // this value will be used directly as content, instead of creating a new tag, may only be used in conjunction with attributesArray 'beautifyFilelist' => false, 'encoding' => 'UTF-8', ); /** * options for the serialization * @access private * @var array $options */ var $options = array(); /** * current tag depth * @var integer $_tagDepth */ var $_tagDepth = 0; /** * serilialized representation of the data * @var string $_serializedData */ var $_serializedData = null; /** * @var PEAR_PackageFile_v2 */ var $_packagefile; /** * @param PEAR_PackageFile_v2 */ function __construct(&$packagefile) { $this->_packagefile = &$packagefile; if (isset($this->_packagefile->encoding)) { $this->_defaultOptions['encoding'] = $this->_packagefile->encoding; } } /** * @return string */ function getPackagerVersion() { return '@PEAR-VER@'; } /** * @param PEAR_Packager * @param bool generate a .tgz or a .tar * @param string|null temporary directory to package in */ function toTgz(&$packager, $compress = true, $where = null) { $a = null; return $this->toTgz2($packager, $a, $compress, $where); } /** * Package up both a package.xml and package2.xml for the same release * @param PEAR_Packager * @param PEAR_PackageFile_v1 * @param bool generate a .tgz or a .tar * @param string|null temporary directory to package in */ function toTgz2(&$packager, &$pf1, $compress = true, $where = null) { require_once 'Archive/Tar.php'; if (!$this->_packagefile->isEquivalent($pf1)) { return PEAR::raiseError('PEAR_Packagefile_v2::toTgz: "' . basename($pf1->getPackageFile()) . '" is not equivalent to "' . basename($this->_packagefile->getPackageFile()) . '"'); } if ($where === null) { if (!($where = System::mktemp(array('-d')))) { return PEAR::raiseError('PEAR_Packagefile_v2::toTgz: mktemp failed'); } } elseif (!@System::mkDir(array('-p', $where))) { return PEAR::raiseError('PEAR_Packagefile_v2::toTgz: "' . $where . '" could' . ' not be created'); } $file = $where . DIRECTORY_SEPARATOR . 'package.xml'; if (file_exists($file) && !is_file($file)) { return PEAR::raiseError('PEAR_Packagefile_v2::toTgz: unable to save package.xml as' . ' "' . $file .'"'); } if (!$this->_packagefile->validate(PEAR_VALIDATE_PACKAGING)) { return PEAR::raiseError('PEAR_Packagefile_v2::toTgz: invalid package.xml'); } $ext = $compress ? '.tgz' : '.tar'; $pkgver = $this->_packagefile->getPackage() . '-' . $this->_packagefile->getVersion(); $dest_package = getcwd() . DIRECTORY_SEPARATOR . $pkgver . $ext; if (file_exists($dest_package) && !is_file($dest_package)) { return PEAR::raiseError('PEAR_Packagefile_v2::toTgz: cannot create tgz file "' . $dest_package . '"'); } $pkgfile = $this->_packagefile->getPackageFile(); if (!$pkgfile) { return PEAR::raiseError('PEAR_Packagefile_v2::toTgz: package file object must ' . 'be created from a real file'); } $pkgdir = dirname(realpath($pkgfile)); $pkgfile = basename($pkgfile); // {{{ Create the package file list $filelist = array(); $i = 0; $this->_packagefile->flattenFilelist(); $contents = $this->_packagefile->getContents(); if (isset($contents['bundledpackage'])) { // bundles of packages $contents = $contents['bundledpackage']; if (!isset($contents[0])) { $contents = array($contents); } $packageDir = $where; foreach ($contents as $i => $package) { $fname = $package; $file = $pkgdir . DIRECTORY_SEPARATOR . $fname; if (!file_exists($file)) { return $packager->raiseError("File does not exist: $fname"); } $tfile = $packageDir . DIRECTORY_SEPARATOR . $fname; System::mkdir(array('-p', dirname($tfile))); copy($file, $tfile); $filelist[$i++] = $tfile; $packager->log(2, "Adding package $fname"); } } else { // normal packages $contents = $contents['dir']['file']; if (!isset($contents[0])) { $contents = array($contents); } $packageDir = $where; foreach ($contents as $i => $file) { $fname = $file['attribs']['name']; $atts = $file['attribs']; $orig = $file; $file = $pkgdir . DIRECTORY_SEPARATOR . $fname; if (!file_exists($file)) { return $packager->raiseError("File does not exist: $fname"); } $origperms = fileperms($file); $tfile = $packageDir . DIRECTORY_SEPARATOR . $fname; unset($orig['attribs']); if (count($orig)) { // file with tasks // run any package-time tasks $contents = file_get_contents($file); foreach ($orig as $tag => $raw) { $tag = str_replace( array($this->_packagefile->getTasksNs() . ':', '-'), array('', '_'), $tag); $task = "PEAR_Task_$tag"; $task = new $task($this->_packagefile->_config, $this->_packagefile->_logger, PEAR_TASK_PACKAGE); $task->init($raw, $atts, null); $res = $task->startSession($this->_packagefile, $contents, $tfile); if (!$res) { continue; // skip this task } if (PEAR::isError($res)) { return $res; } $contents = $res; // save changes System::mkdir(array('-p', dirname($tfile))); $wp = fopen($tfile, "wb"); fwrite($wp, $contents); fclose($wp); } } if (!file_exists($tfile)) { System::mkdir(array('-p', dirname($tfile))); copy($file, $tfile); } chmod($tfile, $origperms); $filelist[$i++] = $tfile; $this->_packagefile->setFileAttribute($fname, 'md5sum', md5_file($tfile), $i - 1); $packager->log(2, "Adding file $fname"); } } // }}} $name = $pf1 !== null ? 'package2.xml' : 'package.xml'; $packagexml = $this->toPackageFile($where, PEAR_VALIDATE_PACKAGING, $name); if ($packagexml) { $tar = new Archive_Tar($dest_package, $compress); $tar->setErrorHandling(PEAR_ERROR_RETURN); // XXX Don't print errors // ----- Creates with the package.xml file $ok = $tar->createModify(array($packagexml), '', $where); if (PEAR::isError($ok)) { return $packager->raiseError($ok); } elseif (!$ok) { return $packager->raiseError('PEAR_Packagefile_v2::toTgz(): adding ' . $name . ' failed'); } // ----- Add the content of the package if (!$tar->addModify($filelist, $pkgver, $where)) { return $packager->raiseError( 'PEAR_Packagefile_v2::toTgz(): tarball creation failed'); } // add the package.xml version 1.0 if ($pf1 !== null) { $pfgen = &$pf1->getDefaultGenerator(); $packagexml1 = $pfgen->toPackageFile($where, PEAR_VALIDATE_PACKAGING, 'package.xml', true); if (!$tar->addModify(array($packagexml1), '', $where)) { return $packager->raiseError( 'PEAR_Packagefile_v2::toTgz(): adding package.xml failed'); } } return $dest_package; } } function toPackageFile($where = null, $state = PEAR_VALIDATE_NORMAL, $name = 'package.xml') { if (!$this->_packagefile->validate($state)) { return PEAR::raiseError('PEAR_Packagefile_v2::toPackageFile: invalid package.xml', null, null, null, $this->_packagefile->getValidationWarnings()); } if ($where === null) { if (!($where = System::mktemp(array('-d')))) { return PEAR::raiseError('PEAR_Packagefile_v2::toPackageFile: mktemp failed'); } } elseif (!@System::mkDir(array('-p', $where))) { return PEAR::raiseError('PEAR_Packagefile_v2::toPackageFile: "' . $where . '" could' . ' not be created'); } $newpkgfile = $where . DIRECTORY_SEPARATOR . $name; $np = @fopen($newpkgfile, 'wb'); if (!$np) { return PEAR::raiseError('PEAR_Packagefile_v2::toPackageFile: unable to save ' . "$name as $newpkgfile"); } fwrite($np, $this->toXml($state)); fclose($np); return $newpkgfile; } function &toV2() { return $this->_packagefile; } /** * Return an XML document based on the package info (as returned * by the PEAR_Common::infoFrom* methods). * * @return string XML data */ function toXml($state = PEAR_VALIDATE_NORMAL, $options = array()) { $this->_packagefile->setDate(date('Y-m-d')); $this->_packagefile->setTime(date('H:i:s')); if (!$this->_packagefile->validate($state)) { return false; } if (is_array($options)) { $this->options = array_merge($this->_defaultOptions, $options); } else { $this->options = $this->_defaultOptions; } $arr = $this->_packagefile->getArray(); if (isset($arr['filelist'])) { unset($arr['filelist']); } if (isset($arr['_lastversion'])) { unset($arr['_lastversion']); } // Fix the notes a little bit if (isset($arr['notes'])) { // This trims out the indenting, needs fixing $arr['notes'] = "\n" . trim($arr['notes']) . "\n"; } if (isset($arr['changelog']) && !empty($arr['changelog'])) { // Fix for inconsistency how the array is filled depending on the changelog release amount if (!isset($arr['changelog']['release'][0])) { $release = $arr['changelog']['release']; unset($arr['changelog']['release']); $arr['changelog']['release'] = array(); $arr['changelog']['release'][0] = $release; } foreach (array_keys($arr['changelog']['release']) as $key) { $c =& $arr['changelog']['release'][$key]; if (isset($c['notes'])) { // This trims out the indenting, needs fixing $c['notes'] = "\n" . trim($c['notes']) . "\n"; } } } if ($state ^ PEAR_VALIDATE_PACKAGING && !isset($arr['bundle'])) { $use = $this->_recursiveXmlFilelist($arr['contents']['dir']['file']); unset($arr['contents']['dir']['file']); if (isset($use['dir'])) { $arr['contents']['dir']['dir'] = $use['dir']; } if (isset($use['file'])) { $arr['contents']['dir']['file'] = $use['file']; } $this->options['beautifyFilelist'] = true; } $arr['attribs']['packagerversion'] = '@PEAR-VER@'; if ($this->serialize($arr, $options)) { return $this->_serializedData . "\n"; } return false; } function _recursiveXmlFilelist($list) { $dirs = array(); if (isset($list['attribs'])) { $file = $list['attribs']['name']; unset($list['attribs']['name']); $attributes = $list['attribs']; $this->_addDir($dirs, explode('/', dirname($file)), $file, $attributes); } else { foreach ($list as $a) { $file = $a['attribs']['name']; $attributes = $a['attribs']; unset($a['attribs']); $this->_addDir($dirs, explode('/', dirname($file)), $file, $attributes, $a); } } $this->_formatDir($dirs); $this->_deFormat($dirs); return $dirs; } function _addDir(&$dirs, $dir, $file = null, $attributes = null, $tasks = null) { if (!$tasks) { $tasks = array(); } if ($dir == array() || $dir == array('.')) { $dirs['file'][basename($file)] = $tasks; $attributes['name'] = basename($file); $dirs['file'][basename($file)]['attribs'] = $attributes; return; } $curdir = array_shift($dir); if (!isset($dirs['dir'][$curdir])) { $dirs['dir'][$curdir] = array(); } $this->_addDir($dirs['dir'][$curdir], $dir, $file, $attributes, $tasks); } function _formatDir(&$dirs) { if (!count($dirs)) { return array(); } $newdirs = array(); if (isset($dirs['dir'])) { $newdirs['dir'] = $dirs['dir']; } if (isset($dirs['file'])) { $newdirs['file'] = $dirs['file']; } $dirs = $newdirs; if (isset($dirs['dir'])) { uksort($dirs['dir'], 'strnatcasecmp'); foreach ($dirs['dir'] as $dir => $contents) { $this->_formatDir($dirs['dir'][$dir]); } } if (isset($dirs['file'])) { uksort($dirs['file'], 'strnatcasecmp'); }; } function _deFormat(&$dirs) { if (!count($dirs)) { return array(); } $newdirs = array(); if (isset($dirs['dir'])) { foreach ($dirs['dir'] as $dir => $contents) { $newdir = array(); $newdir['attribs']['name'] = $dir; $this->_deFormat($contents); foreach ($contents as $tag => $val) { $newdir[$tag] = $val; } $newdirs['dir'][] = $newdir; } if (count($newdirs['dir']) == 1) { $newdirs['dir'] = $newdirs['dir'][0]; } } if (isset($dirs['file'])) { foreach ($dirs['file'] as $name => $file) { $newdirs['file'][] = $file; } if (count($newdirs['file']) == 1) { $newdirs['file'] = $newdirs['file'][0]; } } $dirs = $newdirs; } /** * reset all options to default options * * @access public * @see setOption(), XML_Unserializer() */ function resetOptions() { $this->options = $this->_defaultOptions; } /** * set an option * * You can use this method if you do not want to set all options in the constructor * * @access public * @see resetOption(), XML_Serializer() */ function setOption($name, $value) { $this->options[$name] = $value; } /** * sets several options at once * * You can use this method if you do not want to set all options in the constructor * * @access public * @see resetOption(), XML_Unserializer(), setOption() */ function setOptions($options) { $this->options = array_merge($this->options, $options); } /** * serialize data * * @access public * @param mixed $data data to serialize * @return boolean true on success, pear error on failure */ function serialize($data, $options = null) { // if options have been specified, use them instead // of the previously defined ones if (is_array($options)) { $optionsBak = $this->options; if (isset($options['overrideOptions']) && $options['overrideOptions'] == true) { $this->options = array_merge($this->_defaultOptions, $options); } else { $this->options = array_merge($this->options, $options); } } else { $optionsBak = null; } // start depth is zero $this->_tagDepth = 0; $this->_serializedData = ''; // serialize an array if (is_array($data)) { $tagName = isset($this->options['rootName']) ? $this->options['rootName'] : 'array'; $this->_serializedData .= $this->_serializeArray($data, $tagName, $this->options['rootAttributes']); } // add doctype declaration if ($this->options['addDoctype'] === true) { $this->_serializedData = XML_Util::getDoctypeDeclaration($tagName, $this->options['doctype']) . $this->options['linebreak'] . $this->_serializedData; } // build xml declaration if ($this->options['addDecl']) { $atts = array(); $encoding = isset($this->options['encoding']) ? $this->options['encoding'] : null; $this->_serializedData = XML_Util::getXMLDeclaration('1.0', $encoding) . $this->options['linebreak'] . $this->_serializedData; } if ($optionsBak !== null) { $this->options = $optionsBak; } return true; } /** * get the result of the serialization * * @access public * @return string serialized XML */ function getSerializedData() { if ($this->_serializedData === null) { return $this->raiseError('No serialized data available. Use XML_Serializer::serialize() first.', XML_SERIALIZER_ERROR_NO_SERIALIZATION); } return $this->_serializedData; } /** * serialize any value * * This method checks for the type of the value and calls the appropriate method * * @access private * @param mixed $value * @param string $tagName * @param array $attributes * @return string */ function _serializeValue($value, $tagName = null, $attributes = array()) { if (is_array($value)) { $xml = $this->_serializeArray($value, $tagName, $attributes); } elseif (is_object($value)) { $xml = $this->_serializeObject($value, $tagName); } else { $tag = array( 'qname' => $tagName, 'attributes' => $attributes, 'content' => $value ); $xml = $this->_createXMLTag($tag); } return $xml; } /** * serialize an array * * @access private * @param array $array array to serialize * @param string $tagName name of the root tag * @param array $attributes attributes for the root tag * @return string $string serialized data * @uses XML_Util::isValidName() to check, whether key has to be substituted */ function _serializeArray(&$array, $tagName = null, $attributes = array()) { $_content = null; /** * check for special attributes */ if ($this->options['attributesArray'] !== null) { if (isset($array[$this->options['attributesArray']])) { $attributes = $array[$this->options['attributesArray']]; unset($array[$this->options['attributesArray']]); } /** * check for special content */ if ($this->options['contentName'] !== null) { if (isset($array[$this->options['contentName']])) { $_content = $array[$this->options['contentName']]; unset($array[$this->options['contentName']]); } } } /* * if mode is set to simpleXML, check whether * the array is associative or indexed */ if (is_array($array) && $this->options['mode'] == 'simplexml') { $indexed = true; if (!count($array)) { $indexed = false; } foreach ($array as $key => $val) { if (!is_int($key)) { $indexed = false; break; } } if ($indexed && $this->options['mode'] == 'simplexml') { $string = ''; foreach ($array as $key => $val) { if ($this->options['beautifyFilelist'] && $tagName == 'dir') { if (!isset($this->_curdir)) { $this->_curdir = ''; } $savedir = $this->_curdir; if (isset($val['attribs'])) { if ($val['attribs']['name'] == '/') { $this->_curdir = '/'; } else { if ($this->_curdir == '/') { $this->_curdir = ''; } $this->_curdir .= '/' . $val['attribs']['name']; } } } $string .= $this->_serializeValue( $val, $tagName, $attributes); if ($this->options['beautifyFilelist'] && $tagName == 'dir') { $string .= ' '; if (empty($savedir)) { unset($this->_curdir); } else { $this->_curdir = $savedir; } } $string .= $this->options['linebreak']; // do indentation if ($this->options['indent'] !== null && $this->_tagDepth > 0) { $string .= str_repeat($this->options['indent'], $this->_tagDepth); } } return rtrim($string); } } if ($this->options['scalarAsAttributes'] === true) { foreach ($array as $key => $value) { if (is_scalar($value) && (XML_Util::isValidName($key) === true)) { unset($array[$key]); $attributes[$this->options['prependAttributes'].$key] = $value; } } } // check for empty array => create empty tag if (empty($array)) { $tag = array( 'qname' => $tagName, 'content' => $_content, 'attributes' => $attributes ); } else { $this->_tagDepth++; $tmp = $this->options['linebreak']; foreach ($array as $key => $value) { // do indentation if ($this->options['indent'] !== null && $this->_tagDepth > 0) { $tmp .= str_repeat($this->options['indent'], $this->_tagDepth); } // copy key $origKey = $key; // key cannot be used as tagname => use default tag $valid = XML_Util::isValidName($key); if (PEAR::isError($valid)) { if ($this->options['classAsTagName'] && is_object($value)) { $key = get_class($value); } else { $key = $this->options['defaultTagName']; } } $atts = array(); if ($this->options['typeHints'] === true) { $atts[$this->options['typeAttribute']] = gettype($value); if ($key !== $origKey) { $atts[$this->options['keyAttribute']] = (string)$origKey; } } if ($this->options['beautifyFilelist'] && $key == 'dir') { if (!isset($this->_curdir)) { $this->_curdir = ''; } $savedir = $this->_curdir; if (isset($value['attribs'])) { if ($value['attribs']['name'] == '/') { $this->_curdir = '/'; } else { $this->_curdir .= '/' . $value['attribs']['name']; } } } if (is_string($value) && $value && ($value{strlen($value) - 1} == "\n")) { $value .= str_repeat($this->options['indent'], $this->_tagDepth); } $tmp .= $this->_createXMLTag(array( 'qname' => $key, 'attributes' => $atts, 'content' => $value ) ); if ($this->options['beautifyFilelist'] && $key == 'dir') { if (isset($value['attribs'])) { $tmp .= ' '; if (empty($savedir)) { unset($this->_curdir); } else { $this->_curdir = $savedir; } } } $tmp .= $this->options['linebreak']; } $this->_tagDepth--; if ($this->options['indent']!==null && $this->_tagDepth>0) { $tmp .= str_repeat($this->options['indent'], $this->_tagDepth); } if (trim($tmp) === '') { $tmp = null; } $tag = array( 'qname' => $tagName, 'content' => $tmp, 'attributes' => $attributes ); } if ($this->options['typeHints'] === true) { if (!isset($tag['attributes'][$this->options['typeAttribute']])) { $tag['attributes'][$this->options['typeAttribute']] = 'array'; } } $string = $this->_createXMLTag($tag, false); return $string; } /** * create a tag from an array * this method awaits an array in the following format * array( * 'qname' => $tagName, * 'attributes' => array(), * 'content' => $content, // optional * 'namespace' => $namespace // optional * 'namespaceUri' => $namespaceUri // optional * ) * * @access private * @param array $tag tag definition * @param boolean $replaceEntities whether to replace XML entities in content or not * @return string $string XML tag */ function _createXMLTag($tag, $replaceEntities = true) { if ($this->options['indentAttributes'] !== false) { $multiline = true; $indent = str_repeat($this->options['indent'], $this->_tagDepth); if ($this->options['indentAttributes'] == '_auto') { $indent .= str_repeat(' ', (strlen($tag['qname'])+2)); } else { $indent .= $this->options['indentAttributes']; } } else { $indent = $multiline = false; } if (is_array($tag['content'])) { if (empty($tag['content'])) { $tag['content'] = ''; } } elseif(is_scalar($tag['content']) && (string)$tag['content'] == '') { $tag['content'] = ''; } if (is_scalar($tag['content']) || is_null($tag['content'])) { if ($replaceEntities === true) { $replaceEntities = XML_UTIL_ENTITIES_XML; } $tag = XML_Util::createTagFromArray($tag, $replaceEntities, $multiline, $indent, $this->options['linebreak']); } elseif (is_array($tag['content'])) { $tag = $this->_serializeArray($tag['content'], $tag['qname'], $tag['attributes']); } elseif (is_object($tag['content'])) { $tag = $this->_serializeObject($tag['content'], $tag['qname'], $tag['attributes']); } elseif (is_resource($tag['content'])) { settype($tag['content'], 'string'); $tag = XML_Util::createTagFromArray($tag, $replaceEntities); } return $tag; } } php-pear-1.10.1+submodules+notgz/PEAR/PackageFile/Parser/000077500000000000000000000000001262614675700227575ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/PEAR/PackageFile/Parser/v1.php000066400000000000000000000402071262614675700240210ustar00rootroot00000000000000 * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ /** * package.xml abstraction class */ require_once 'PEAR/PackageFile/v1.php'; /** * Parser for package.xml version 1.0 * @category pear * @package PEAR * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version Release: @PEAR-VER@ * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ class PEAR_PackageFile_Parser_v1 { var $_registry; var $_config; var $_logger; /** * BC hack to allow PEAR_Common::infoFromString() to sort of * work with the version 2.0 format - there's no filelist though * @param PEAR_PackageFile_v2 */ function fromV2($packagefile) { $info = $packagefile->getArray(true); $ret = new PEAR_PackageFile_v1; $ret->fromArray($info['old']); } function setConfig(&$c) { $this->_config = &$c; $this->_registry = &$c->getRegistry(); } function setLogger(&$l) { $this->_logger = &$l; } /** * @param string contents of package.xml file, version 1.0 * @return bool success of parsing */ function &parse($data, $file, $archive = false) { if (!extension_loaded('xml')) { return PEAR::raiseError('Cannot create xml parser for parsing package.xml, no xml extension'); } $xp = xml_parser_create(); if (!$xp) { $a = &PEAR::raiseError('Cannot create xml parser for parsing package.xml'); return $a; } xml_set_object($xp, $this); xml_set_element_handler($xp, '_element_start_1_0', '_element_end_1_0'); xml_set_character_data_handler($xp, '_pkginfo_cdata_1_0'); xml_parser_set_option($xp, XML_OPTION_CASE_FOLDING, false); $this->element_stack = array(); $this->_packageInfo = array('provides' => array()); $this->current_element = false; unset($this->dir_install); $this->_packageInfo['filelist'] = array(); $this->filelist =& $this->_packageInfo['filelist']; $this->dir_names = array(); $this->in_changelog = false; $this->d_i = 0; $this->cdata = ''; $this->_isValid = true; if (!xml_parse($xp, $data, 1)) { $code = xml_get_error_code($xp); $line = xml_get_current_line_number($xp); xml_parser_free($xp); $a = PEAR::raiseError(sprintf("XML error: %s at line %d", $str = xml_error_string($code), $line), 2); return $a; } xml_parser_free($xp); $pf = new PEAR_PackageFile_v1; $pf->setConfig($this->_config); if (isset($this->_logger)) { $pf->setLogger($this->_logger); } $pf->setPackagefile($file, $archive); $pf->fromArray($this->_packageInfo); return $pf; } // {{{ _unIndent() /** * Unindent given string * * @param string $str The string that has to be unindented. * @return string * @access private */ function _unIndent($str) { // remove leading newlines $str = preg_replace('/^[\r\n]+/', '', $str); // find whitespace at the beginning of the first line $indent_len = strspn($str, " \t"); $indent = substr($str, 0, $indent_len); $data = ''; // remove the same amount of whitespace from following lines foreach (explode("\n", $str) as $line) { if (substr($line, 0, $indent_len) == $indent) { $data .= substr($line, $indent_len) . "\n"; } elseif (trim(substr($line, 0, $indent_len))) { $data .= ltrim($line); } } return $data; } // Support for package DTD v1.0: // {{{ _element_start_1_0() /** * XML parser callback for ending elements. Used for version 1.0 * packages. * * @param resource $xp XML parser resource * @param string $name name of ending element * * @return void * * @access private */ function _element_start_1_0($xp, $name, $attribs) { array_push($this->element_stack, $name); $this->current_element = $name; $spos = sizeof($this->element_stack) - 2; $this->prev_element = ($spos >= 0) ? $this->element_stack[$spos] : ''; $this->current_attributes = $attribs; $this->cdata = ''; switch ($name) { case 'dir': if ($this->in_changelog) { break; } if (array_key_exists('name', $attribs) && $attribs['name'] != '/') { $attribs['name'] = preg_replace(array('!\\\\+!', '!/+!'), array('/', '/'), $attribs['name']); if (strrpos($attribs['name'], '/') === strlen($attribs['name']) - 1) { $attribs['name'] = substr($attribs['name'], 0, strlen($attribs['name']) - 1); } if (strpos($attribs['name'], '/') === 0) { $attribs['name'] = substr($attribs['name'], 1); } $this->dir_names[] = $attribs['name']; } if (isset($attribs['baseinstalldir'])) { $this->dir_install = $attribs['baseinstalldir']; } if (isset($attribs['role'])) { $this->dir_role = $attribs['role']; } break; case 'file': if ($this->in_changelog) { break; } if (isset($attribs['name'])) { $path = ''; if (count($this->dir_names)) { foreach ($this->dir_names as $dir) { $path .= $dir . '/'; } } $path .= preg_replace(array('!\\\\+!', '!/+!'), array('/', '/'), $attribs['name']); unset($attribs['name']); $this->current_path = $path; $this->filelist[$path] = $attribs; // Set the baseinstalldir only if the file don't have this attrib if (!isset($this->filelist[$path]['baseinstalldir']) && isset($this->dir_install)) { $this->filelist[$path]['baseinstalldir'] = $this->dir_install; } // Set the Role if (!isset($this->filelist[$path]['role']) && isset($this->dir_role)) { $this->filelist[$path]['role'] = $this->dir_role; } } break; case 'replace': if (!$this->in_changelog) { $this->filelist[$this->current_path]['replacements'][] = $attribs; } break; case 'maintainers': $this->_packageInfo['maintainers'] = array(); $this->m_i = 0; // maintainers array index break; case 'maintainer': // compatibility check if (!isset($this->_packageInfo['maintainers'])) { $this->_packageInfo['maintainers'] = array(); $this->m_i = 0; } $this->_packageInfo['maintainers'][$this->m_i] = array(); $this->current_maintainer =& $this->_packageInfo['maintainers'][$this->m_i]; break; case 'changelog': $this->_packageInfo['changelog'] = array(); $this->c_i = 0; // changelog array index $this->in_changelog = true; break; case 'release': if ($this->in_changelog) { $this->_packageInfo['changelog'][$this->c_i] = array(); $this->current_release = &$this->_packageInfo['changelog'][$this->c_i]; } else { $this->current_release = &$this->_packageInfo; } break; case 'deps': if (!$this->in_changelog) { $this->_packageInfo['release_deps'] = array(); } break; case 'dep': // dependencies array index if (!$this->in_changelog) { $this->d_i++; isset($attribs['type']) ? ($attribs['type'] = strtolower($attribs['type'])) : false; $this->_packageInfo['release_deps'][$this->d_i] = $attribs; } break; case 'configureoptions': if (!$this->in_changelog) { $this->_packageInfo['configure_options'] = array(); } break; case 'configureoption': if (!$this->in_changelog) { $this->_packageInfo['configure_options'][] = $attribs; } break; case 'provides': if (empty($attribs['type']) || empty($attribs['name'])) { break; } $attribs['explicit'] = true; $this->_packageInfo['provides']["$attribs[type];$attribs[name]"] = $attribs; break; case 'package' : if (isset($attribs['version'])) { $this->_packageInfo['xsdversion'] = trim($attribs['version']); } else { $this->_packageInfo['xsdversion'] = '1.0'; } if (isset($attribs['packagerversion'])) { $this->_packageInfo['packagerversion'] = $attribs['packagerversion']; } break; } } // }}} // {{{ _element_end_1_0() /** * XML parser callback for ending elements. Used for version 1.0 * packages. * * @param resource $xp XML parser resource * @param string $name name of ending element * * @return void * * @access private */ function _element_end_1_0($xp, $name) { $data = trim($this->cdata); switch ($name) { case 'name': switch ($this->prev_element) { case 'package': $this->_packageInfo['package'] = $data; break; case 'maintainer': $this->current_maintainer['name'] = $data; break; } break; case 'extends' : $this->_packageInfo['extends'] = $data; break; case 'summary': $this->_packageInfo['summary'] = $data; break; case 'description': $data = $this->_unIndent($this->cdata); $this->_packageInfo['description'] = $data; break; case 'user': $this->current_maintainer['handle'] = $data; break; case 'email': $this->current_maintainer['email'] = $data; break; case 'role': $this->current_maintainer['role'] = $data; break; case 'version': if ($this->in_changelog) { $this->current_release['version'] = $data; } else { $this->_packageInfo['version'] = $data; } break; case 'date': if ($this->in_changelog) { $this->current_release['release_date'] = $data; } else { $this->_packageInfo['release_date'] = $data; } break; case 'notes': // try to "de-indent" release notes in case someone // has been over-indenting their xml ;-) // Trim only on the right side $data = rtrim($this->_unIndent($this->cdata)); if ($this->in_changelog) { $this->current_release['release_notes'] = $data; } else { $this->_packageInfo['release_notes'] = $data; } break; case 'warnings': if ($this->in_changelog) { $this->current_release['release_warnings'] = $data; } else { $this->_packageInfo['release_warnings'] = $data; } break; case 'state': if ($this->in_changelog) { $this->current_release['release_state'] = $data; } else { $this->_packageInfo['release_state'] = $data; } break; case 'license': if ($this->in_changelog) { $this->current_release['release_license'] = $data; } else { $this->_packageInfo['release_license'] = $data; } break; case 'dep': if ($data && !$this->in_changelog) { $this->_packageInfo['release_deps'][$this->d_i]['name'] = $data; } break; case 'dir': if ($this->in_changelog) { break; } array_pop($this->dir_names); break; case 'file': if ($this->in_changelog) { break; } if ($data) { $path = ''; if (count($this->dir_names)) { foreach ($this->dir_names as $dir) { $path .= $dir . '/'; } } $path .= $data; $this->filelist[$path] = $this->current_attributes; // Set the baseinstalldir only if the file don't have this attrib if (!isset($this->filelist[$path]['baseinstalldir']) && isset($this->dir_install)) { $this->filelist[$path]['baseinstalldir'] = $this->dir_install; } // Set the Role if (!isset($this->filelist[$path]['role']) && isset($this->dir_role)) { $this->filelist[$path]['role'] = $this->dir_role; } } break; case 'maintainer': if (empty($this->_packageInfo['maintainers'][$this->m_i]['role'])) { $this->_packageInfo['maintainers'][$this->m_i]['role'] = 'lead'; } $this->m_i++; break; case 'release': if ($this->in_changelog) { $this->c_i++; } break; case 'changelog': $this->in_changelog = false; break; } array_pop($this->element_stack); $spos = sizeof($this->element_stack) - 1; $this->current_element = ($spos > 0) ? $this->element_stack[$spos] : ''; $this->cdata = ''; } // }}} // {{{ _pkginfo_cdata_1_0() /** * XML parser callback for character data. Used for version 1.0 * packages. * * @param resource $xp XML parser resource * @param string $name character data * * @return void * * @access private */ function _pkginfo_cdata_1_0($xp, $data) { if (isset($this->cdata)) { $this->cdata .= $data; } } // }}} } ?>php-pear-1.10.1+submodules+notgz/PEAR/PackageFile/Parser/v2.php000066400000000000000000000061101262614675700240150ustar00rootroot00000000000000 * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ /** * base xml parser class */ require_once 'PEAR/XMLParser.php'; require_once 'PEAR/PackageFile/v2.php'; /** * Parser for package.xml version 2.0 * @category pear * @package PEAR * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version Release: @PEAR-VER@ * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ class PEAR_PackageFile_Parser_v2 extends PEAR_XMLParser { var $_config; var $_logger; var $_registry; function setConfig(&$c) { $this->_config = &$c; $this->_registry = &$c->getRegistry(); } function setLogger(&$l) { $this->_logger = &$l; } /** * Unindent given string * * @param string $str The string that has to be unindented. * @return string * @access private */ function _unIndent($str) { // remove leading newlines $str = preg_replace('/^[\r\n]+/', '', $str); // find whitespace at the beginning of the first line $indent_len = strspn($str, " \t"); $indent = substr($str, 0, $indent_len); $data = ''; // remove the same amount of whitespace from following lines foreach (explode("\n", $str) as $line) { if (substr($line, 0, $indent_len) == $indent) { $data .= substr($line, $indent_len) . "\n"; } else { $data .= $line . "\n"; } } return $data; } /** * post-process data * * @param string $data * @param string $element element name */ function postProcess($data, $element) { if ($element == 'notes') { return trim($this->_unIndent($data)); } return trim($data); } /** * @param string * @param string file name of the package.xml * @param string|false name of the archive this package.xml came from, if any * @param string class name to instantiate and return. This must be PEAR_PackageFile_v2 or * a subclass * @return PEAR_PackageFile_v2 */ function parse($data, $file = null, $archive = false, $class = 'PEAR_PackageFile_v2') { if (PEAR::isError($err = parent::parse($data))) { return $err; } $ret = new $class; $ret->encoding = $this->encoding; $ret->setConfig($this->_config); if (isset($this->_logger)) { $ret->setLogger($this->_logger); } $ret->fromArray($this->_unserializedData); $ret->setPackagefile($file, $archive); return $ret; } }php-pear-1.10.1+submodules+notgz/PEAR/PackageFile/v1.php000066400000000000000000001427011262614675700225670ustar00rootroot00000000000000 * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ /** * For error handling */ require_once 'PEAR/ErrorStack.php'; /** * Error code if parsing is attempted with no xml extension */ define('PEAR_PACKAGEFILE_ERROR_NO_XML_EXT', 3); /** * Error code if creating the xml parser resource fails */ define('PEAR_PACKAGEFILE_ERROR_CANT_MAKE_PARSER', 4); /** * Error code used for all sax xml parsing errors */ define('PEAR_PACKAGEFILE_ERROR_PARSER_ERROR', 5); /** * Error code used when there is no name */ define('PEAR_PACKAGEFILE_ERROR_NO_NAME', 6); /** * Error code when a package name is not valid */ define('PEAR_PACKAGEFILE_ERROR_INVALID_NAME', 7); /** * Error code used when no summary is parsed */ define('PEAR_PACKAGEFILE_ERROR_NO_SUMMARY', 8); /** * Error code for summaries that are more than 1 line */ define('PEAR_PACKAGEFILE_ERROR_MULTILINE_SUMMARY', 9); /** * Error code used when no description is present */ define('PEAR_PACKAGEFILE_ERROR_NO_DESCRIPTION', 10); /** * Error code used when no license is present */ define('PEAR_PACKAGEFILE_ERROR_NO_LICENSE', 11); /** * Error code used when a version number is not present */ define('PEAR_PACKAGEFILE_ERROR_NO_VERSION', 12); /** * Error code used when a version number is invalid */ define('PEAR_PACKAGEFILE_ERROR_INVALID_VERSION', 13); /** * Error code when release state is missing */ define('PEAR_PACKAGEFILE_ERROR_NO_STATE', 14); /** * Error code when release state is invalid */ define('PEAR_PACKAGEFILE_ERROR_INVALID_STATE', 15); /** * Error code when release state is missing */ define('PEAR_PACKAGEFILE_ERROR_NO_DATE', 16); /** * Error code when release state is invalid */ define('PEAR_PACKAGEFILE_ERROR_INVALID_DATE', 17); /** * Error code when no release notes are found */ define('PEAR_PACKAGEFILE_ERROR_NO_NOTES', 18); /** * Error code when no maintainers are found */ define('PEAR_PACKAGEFILE_ERROR_NO_MAINTAINERS', 19); /** * Error code when a maintainer has no handle */ define('PEAR_PACKAGEFILE_ERROR_NO_MAINTHANDLE', 20); /** * Error code when a maintainer has no handle */ define('PEAR_PACKAGEFILE_ERROR_NO_MAINTROLE', 21); /** * Error code when a maintainer has no name */ define('PEAR_PACKAGEFILE_ERROR_NO_MAINTNAME', 22); /** * Error code when a maintainer has no email */ define('PEAR_PACKAGEFILE_ERROR_NO_MAINTEMAIL', 23); /** * Error code when a maintainer has no handle */ define('PEAR_PACKAGEFILE_ERROR_INVALID_MAINTROLE', 24); /** * Error code when a dependency is not a PHP dependency, but has no name */ define('PEAR_PACKAGEFILE_ERROR_NO_DEPNAME', 25); /** * Error code when a dependency has no type (pkg, php, etc.) */ define('PEAR_PACKAGEFILE_ERROR_NO_DEPTYPE', 26); /** * Error code when a dependency has no relation (lt, ge, has, etc.) */ define('PEAR_PACKAGEFILE_ERROR_NO_DEPREL', 27); /** * Error code when a dependency is not a 'has' relation, but has no version */ define('PEAR_PACKAGEFILE_ERROR_NO_DEPVERSION', 28); /** * Error code when a dependency has an invalid relation */ define('PEAR_PACKAGEFILE_ERROR_INVALID_DEPREL', 29); /** * Error code when a dependency has an invalid type */ define('PEAR_PACKAGEFILE_ERROR_INVALID_DEPTYPE', 30); /** * Error code when a dependency has an invalid optional option */ define('PEAR_PACKAGEFILE_ERROR_INVALID_DEPOPTIONAL', 31); /** * Error code when a dependency is a pkg dependency, and has an invalid package name */ define('PEAR_PACKAGEFILE_ERROR_INVALID_DEPNAME', 32); /** * Error code when a dependency has a channel="foo" attribute, and foo is not a registered channel */ define('PEAR_PACKAGEFILE_ERROR_UNKNOWN_DEPCHANNEL', 33); /** * Error code when rel="has" and version attribute is present. */ define('PEAR_PACKAGEFILE_ERROR_DEPVERSION_IGNORED', 34); /** * Error code when type="php" and dependency name is present */ define('PEAR_PACKAGEFILE_ERROR_DEPNAME_IGNORED', 35); /** * Error code when a configure option has no name */ define('PEAR_PACKAGEFILE_ERROR_NO_CONFNAME', 36); /** * Error code when a configure option has no name */ define('PEAR_PACKAGEFILE_ERROR_NO_CONFPROMPT', 37); /** * Error code when a file in the filelist has an invalid role */ define('PEAR_PACKAGEFILE_ERROR_INVALID_FILEROLE', 38); /** * Error code when a file in the filelist has no role */ define('PEAR_PACKAGEFILE_ERROR_NO_FILEROLE', 39); /** * Error code when analyzing a php source file that has parse errors */ define('PEAR_PACKAGEFILE_ERROR_INVALID_PHPFILE', 40); /** * Error code when analyzing a php source file reveals a source element * without a package name prefix */ define('PEAR_PACKAGEFILE_ERROR_NO_PNAME_PREFIX', 41); /** * Error code when an unknown channel is specified */ define('PEAR_PACKAGEFILE_ERROR_UNKNOWN_CHANNEL', 42); /** * Error code when no files are found in the filelist */ define('PEAR_PACKAGEFILE_ERROR_NO_FILES', 43); /** * Error code when a file is not valid php according to _analyzeSourceCode() */ define('PEAR_PACKAGEFILE_ERROR_INVALID_FILE', 44); /** * Error code when the channel validator returns an error or warning */ define('PEAR_PACKAGEFILE_ERROR_CHANNELVAL', 45); /** * Error code when a php5 package is packaged in php4 (analysis doesn't work) */ define('PEAR_PACKAGEFILE_ERROR_PHP5', 46); /** * Error code when a file is listed in package.xml but does not exist */ define('PEAR_PACKAGEFILE_ERROR_FILE_NOTFOUND', 47); /** * Error code when a * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version Release: @package_version@ * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ class PEAR_PackageFile_v1 { /** * @access private * @var PEAR_ErrorStack * @access private */ var $_stack; /** * A registry object, used to access the package name validation regex for non-standard channels * @var PEAR_Registry * @access private */ var $_registry; /** * An object that contains a log method that matches PEAR_Common::log's signature * @var object * @access private */ var $_logger; /** * Parsed package information * @var array * @access private */ var $_packageInfo; /** * path to package.xml * @var string * @access private */ var $_packageFile; /** * path to package .tgz or false if this is a local/extracted package.xml * @var string * @access private */ var $_archiveFile; /** * @var int * @access private */ var $_isValid = 0; /** * Determines whether this packagefile was initialized only with partial package info * * If this package file was constructed via parsing REST, it will only contain * * - package name * - channel name * - dependencies * @var boolean * @access private */ var $_incomplete = true; /** * @param bool determines whether to return a PEAR_Error object, or use the PEAR_ErrorStack * @param string Name of Error Stack class to use. */ function __construct() { $this->_stack = new PEAR_ErrorStack('PEAR_PackageFile_v1'); $this->_stack->setErrorMessageTemplate($this->_getErrorMessage()); $this->_isValid = 0; } function installBinary($installer) { return false; } function isExtension($name) { return false; } function setConfig(&$config) { $this->_config = &$config; $this->_registry = &$config->getRegistry(); } function setRequestedGroup() { // placeholder } /** * For saving in the registry. * * Set the last version that was installed * @param string */ function setLastInstalledVersion($version) { $this->_packageInfo['_lastversion'] = $version; } /** * @return string|false */ function getLastInstalledVersion() { if (isset($this->_packageInfo['_lastversion'])) { return $this->_packageInfo['_lastversion']; } return false; } function getInstalledBinary() { return false; } function listPostinstallScripts() { return false; } function initPostinstallScripts() { return false; } function setLogger(&$logger) { if ($logger && (!is_object($logger) || !method_exists($logger, 'log'))) { return PEAR::raiseError('Logger must be compatible with PEAR_Common::log'); } $this->_logger = &$logger; } function setPackagefile($file, $archive = false) { $this->_packageFile = $file; $this->_archiveFile = $archive ? $archive : $file; } function getPackageFile() { return isset($this->_packageFile) ? $this->_packageFile : false; } function getPackageType() { return 'php'; } function getArchiveFile() { return $this->_archiveFile; } function packageInfo($field) { if (!is_string($field) || empty($field) || !isset($this->_packageInfo[$field])) { return false; } return $this->_packageInfo[$field]; } function setDirtree($path) { if (!isset($this->_packageInfo['dirtree'])) { $this->_packageInfo['dirtree'] = array(); } $this->_packageInfo['dirtree'][$path] = true; } function getDirtree() { if (isset($this->_packageInfo['dirtree']) && count($this->_packageInfo['dirtree'])) { return $this->_packageInfo['dirtree']; } return false; } function resetDirtree() { unset($this->_packageInfo['dirtree']); } function fromArray($pinfo) { $this->_incomplete = false; $this->_packageInfo = $pinfo; } function isIncomplete() { return $this->_incomplete; } function getChannel() { return 'pear.php.net'; } function getUri() { return false; } function getTime() { return false; } function getExtends() { if (isset($this->_packageInfo['extends'])) { return $this->_packageInfo['extends']; } return false; } /** * @return array */ function toArray() { if (!$this->validate(PEAR_VALIDATE_NORMAL)) { return false; } return $this->getArray(); } function getArray() { return $this->_packageInfo; } function getName() { return $this->getPackage(); } function getPackage() { if (isset($this->_packageInfo['package'])) { return $this->_packageInfo['package']; } return false; } /** * WARNING - don't use this unless you know what you are doing */ function setRawPackage($package) { $this->_packageInfo['package'] = $package; } function setPackage($package) { $this->_packageInfo['package'] = $package; $this->_isValid = false; } function getVersion() { if (isset($this->_packageInfo['version'])) { return $this->_packageInfo['version']; } return false; } function setVersion($version) { $this->_packageInfo['version'] = $version; $this->_isValid = false; } function clearMaintainers() { unset($this->_packageInfo['maintainers']); } function getMaintainers() { if (isset($this->_packageInfo['maintainers'])) { return $this->_packageInfo['maintainers']; } return false; } /** * Adds a new maintainer - no checking of duplicates is performed, use * updatemaintainer for that purpose. */ function addMaintainer($role, $handle, $name, $email) { $this->_packageInfo['maintainers'][] = array('handle' => $handle, 'role' => $role, 'email' => $email, 'name' => $name); $this->_isValid = false; } function updateMaintainer($role, $handle, $name, $email) { $found = false; if (!isset($this->_packageInfo['maintainers']) || !is_array($this->_packageInfo['maintainers'])) { return $this->addMaintainer($role, $handle, $name, $email); } foreach ($this->_packageInfo['maintainers'] as $i => $maintainer) { if ($maintainer['handle'] == $handle) { $found = $i; break; } } if ($found !== false) { unset($this->_packageInfo['maintainers'][$found]); $this->_packageInfo['maintainers'] = array_values($this->_packageInfo['maintainers']); } $this->addMaintainer($role, $handle, $name, $email); } function deleteMaintainer($handle) { $found = false; foreach ($this->_packageInfo['maintainers'] as $i => $maintainer) { if ($maintainer['handle'] == $handle) { $found = $i; break; } } if ($found !== false) { unset($this->_packageInfo['maintainers'][$found]); $this->_packageInfo['maintainers'] = array_values($this->_packageInfo['maintainers']); return true; } return false; } function getState() { if (isset($this->_packageInfo['release_state'])) { return $this->_packageInfo['release_state']; } return false; } function setRawState($state) { $this->_packageInfo['release_state'] = $state; } function setState($state) { $this->_packageInfo['release_state'] = $state; $this->_isValid = false; } function getDate() { if (isset($this->_packageInfo['release_date'])) { return $this->_packageInfo['release_date']; } return false; } function setDate($date) { $this->_packageInfo['release_date'] = $date; $this->_isValid = false; } function getLicense() { if (isset($this->_packageInfo['release_license'])) { return $this->_packageInfo['release_license']; } return false; } function setLicense($date) { $this->_packageInfo['release_license'] = $date; $this->_isValid = false; } function getSummary() { if (isset($this->_packageInfo['summary'])) { return $this->_packageInfo['summary']; } return false; } function setSummary($summary) { $this->_packageInfo['summary'] = $summary; $this->_isValid = false; } function getDescription() { if (isset($this->_packageInfo['description'])) { return $this->_packageInfo['description']; } return false; } function setDescription($desc) { $this->_packageInfo['description'] = $desc; $this->_isValid = false; } function getNotes() { if (isset($this->_packageInfo['release_notes'])) { return $this->_packageInfo['release_notes']; } return false; } function setNotes($notes) { $this->_packageInfo['release_notes'] = $notes; $this->_isValid = false; } function getDeps() { if (isset($this->_packageInfo['release_deps'])) { return $this->_packageInfo['release_deps']; } return false; } /** * Reset dependencies prior to adding new ones */ function clearDeps() { unset($this->_packageInfo['release_deps']); } function addPhpDep($version, $rel) { $this->_isValid = false; $this->_packageInfo['release_deps'][] = array('type' => 'php', 'rel' => $rel, 'version' => $version); } function addPackageDep($name, $version, $rel, $optional = 'no') { $this->_isValid = false; $dep = array('type' => 'pkg', 'name' => $name, 'rel' => $rel, 'optional' => $optional); if ($rel != 'has' && $rel != 'not') { $dep['version'] = $version; } $this->_packageInfo['release_deps'][] = $dep; } function addExtensionDep($name, $version, $rel, $optional = 'no') { $this->_isValid = false; $this->_packageInfo['release_deps'][] = array('type' => 'ext', 'name' => $name, 'rel' => $rel, 'version' => $version, 'optional' => $optional); } /** * WARNING - do not use this function directly unless you know what you're doing */ function setDeps($deps) { $this->_packageInfo['release_deps'] = $deps; } function hasDeps() { return isset($this->_packageInfo['release_deps']) && count($this->_packageInfo['release_deps']); } function getDependencyGroup($group) { return false; } function isCompatible($pf) { return false; } function isSubpackageOf($p) { return $p->isSubpackage($this); } function isSubpackage($p) { return false; } function dependsOn($package, $channel) { if (strtolower($channel) != 'pear.php.net') { return false; } if (!($deps = $this->getDeps())) { return false; } foreach ($deps as $dep) { if ($dep['type'] != 'pkg') { continue; } if (strtolower($dep['name']) == strtolower($package)) { return true; } } return false; } function getConfigureOptions() { if (isset($this->_packageInfo['configure_options'])) { return $this->_packageInfo['configure_options']; } return false; } function hasConfigureOptions() { return isset($this->_packageInfo['configure_options']) && count($this->_packageInfo['configure_options']); } function addConfigureOption($name, $prompt, $default = false) { $o = array('name' => $name, 'prompt' => $prompt); if ($default !== false) { $o['default'] = $default; } if (!isset($this->_packageInfo['configure_options'])) { $this->_packageInfo['configure_options'] = array(); } $this->_packageInfo['configure_options'][] = $o; } function clearConfigureOptions() { unset($this->_packageInfo['configure_options']); } function getProvides() { if (isset($this->_packageInfo['provides'])) { return $this->_packageInfo['provides']; } return false; } function getProvidesExtension() { return false; } function addFile($dir, $file, $attrs) { $dir = preg_replace(array('!\\\\+!', '!/+!'), array('/', '/'), $dir); if ($dir == '/' || $dir == '') { $dir = ''; } else { $dir .= '/'; } $file = $dir . $file; $file = preg_replace('![\\/]+!', '/', $file); $this->_packageInfo['filelist'][$file] = $attrs; } function getInstallationFilelist() { return $this->getFilelist(); } function getFilelist() { if (isset($this->_packageInfo['filelist'])) { return $this->_packageInfo['filelist']; } return false; } function setFileAttribute($file, $attr, $value) { $this->_packageInfo['filelist'][$file][$attr] = $value; } function resetFilelist() { $this->_packageInfo['filelist'] = array(); } function setInstalledAs($file, $path) { if ($path) { return $this->_packageInfo['filelist'][$file]['installed_as'] = $path; } unset($this->_packageInfo['filelist'][$file]['installed_as']); } function installedFile($file, $atts) { if (isset($this->_packageInfo['filelist'][$file])) { $this->_packageInfo['filelist'][$file] = array_merge($this->_packageInfo['filelist'][$file], $atts); } else { $this->_packageInfo['filelist'][$file] = $atts; } } function getChangelog() { if (isset($this->_packageInfo['changelog'])) { return $this->_packageInfo['changelog']; } return false; } function getPackagexmlVersion() { return '1.0'; } /** * Wrapper to {@link PEAR_ErrorStack::getErrors()} * @param boolean determines whether to purge the error stack after retrieving * @return array */ function getValidationWarnings($purge = true) { return $this->_stack->getErrors($purge); } // }}} /** * Validation error. Also marks the object contents as invalid * @param error code * @param array error information * @access private */ function _validateError($code, $params = array()) { $this->_stack->push($code, 'error', $params, false, false, debug_backtrace()); $this->_isValid = false; } /** * Validation warning. Does not mark the object contents invalid. * @param error code * @param array error information * @access private */ function _validateWarning($code, $params = array()) { $this->_stack->push($code, 'warning', $params, false, false, debug_backtrace()); } /** * @param integer error code * @access protected */ function _getErrorMessage() { return array( PEAR_PACKAGEFILE_ERROR_NO_NAME => 'Missing Package Name', PEAR_PACKAGEFILE_ERROR_NO_SUMMARY => 'No summary found', PEAR_PACKAGEFILE_ERROR_MULTILINE_SUMMARY => 'Summary should be on one line', PEAR_PACKAGEFILE_ERROR_NO_DESCRIPTION => 'Missing description', PEAR_PACKAGEFILE_ERROR_NO_LICENSE => 'Missing license', PEAR_PACKAGEFILE_ERROR_NO_VERSION => 'No release version found', PEAR_PACKAGEFILE_ERROR_NO_STATE => 'No release state found', PEAR_PACKAGEFILE_ERROR_NO_DATE => 'No release date found', PEAR_PACKAGEFILE_ERROR_NO_NOTES => 'No release notes found', PEAR_PACKAGEFILE_ERROR_NO_LEAD => 'Package must have at least one lead maintainer', PEAR_PACKAGEFILE_ERROR_NO_MAINTAINERS => 'No maintainers found, at least one must be defined', PEAR_PACKAGEFILE_ERROR_NO_MAINTHANDLE => 'Maintainer %index% has no handle (user ID at channel server)', PEAR_PACKAGEFILE_ERROR_NO_MAINTROLE => 'Maintainer %index% has no role', PEAR_PACKAGEFILE_ERROR_NO_MAINTNAME => 'Maintainer %index% has no name', PEAR_PACKAGEFILE_ERROR_NO_MAINTEMAIL => 'Maintainer %index% has no email', PEAR_PACKAGEFILE_ERROR_NO_DEPNAME => 'Dependency %index% is not a php dependency, and has no name', PEAR_PACKAGEFILE_ERROR_NO_DEPREL => 'Dependency %index% has no relation (rel)', PEAR_PACKAGEFILE_ERROR_NO_DEPTYPE => 'Dependency %index% has no type', PEAR_PACKAGEFILE_ERROR_DEPNAME_IGNORED => 'PHP Dependency %index% has a name attribute of "%name%" which will be' . ' ignored!', PEAR_PACKAGEFILE_ERROR_NO_DEPVERSION => 'Dependency %index% is not a rel="has" or rel="not" dependency, ' . 'and has no version', PEAR_PACKAGEFILE_ERROR_NO_DEPPHPVERSION => 'Dependency %index% is a type="php" dependency, ' . 'and has no version', PEAR_PACKAGEFILE_ERROR_DEPVERSION_IGNORED => 'Dependency %index% is a rel="%rel%" dependency, versioning is ignored', PEAR_PACKAGEFILE_ERROR_INVALID_DEPOPTIONAL => 'Dependency %index% has invalid optional value "%opt%", should be yes or no', PEAR_PACKAGEFILE_PHP_NO_NOT => 'Dependency %index%: php dependencies cannot use "not" rel, use "ne"' . ' to exclude specific versions', PEAR_PACKAGEFILE_ERROR_NO_CONFNAME => 'Configure Option %index% has no name', PEAR_PACKAGEFILE_ERROR_NO_CONFPROMPT => 'Configure Option %index% has no prompt', PEAR_PACKAGEFILE_ERROR_NO_FILES => 'No files in section of package.xml', PEAR_PACKAGEFILE_ERROR_NO_FILEROLE => 'File "%file%" has no role, expecting one of "%roles%"', PEAR_PACKAGEFILE_ERROR_INVALID_FILEROLE => 'File "%file%" has invalid role "%role%", expecting one of "%roles%"', PEAR_PACKAGEFILE_ERROR_INVALID_FILENAME => 'File "%file%" cannot start with ".", cannot package or install', PEAR_PACKAGEFILE_ERROR_INVALID_PHPFILE => 'Parser error: invalid PHP found in file "%file%"', PEAR_PACKAGEFILE_ERROR_NO_PNAME_PREFIX => 'in %file%: %type% "%name%" not prefixed with package name "%package%"', PEAR_PACKAGEFILE_ERROR_INVALID_FILE => 'Parser error: invalid PHP file "%file%"', PEAR_PACKAGEFILE_ERROR_CHANNELVAL => 'Channel validator error: field "%field%" - %reason%', PEAR_PACKAGEFILE_ERROR_PHP5 => 'Error, PHP5 token encountered in %file%, analysis should be in PHP5', PEAR_PACKAGEFILE_ERROR_FILE_NOTFOUND => 'File "%file%" in package.xml does not exist', PEAR_PACKAGEFILE_ERROR_NON_ISO_CHARS => 'Package.xml contains non-ISO-8859-1 characters, and may not validate', ); } /** * Validate XML package definition file. * * @access public * @return boolean */ function validate($state = PEAR_VALIDATE_NORMAL, $nofilechecking = false) { if (($this->_isValid & $state) == $state) { return true; } $this->_isValid = true; $info = $this->_packageInfo; if (empty($info['package'])) { $this->_validateError(PEAR_PACKAGEFILE_ERROR_NO_NAME); $this->_packageName = $pn = 'unknown'; } else { $this->_packageName = $pn = $info['package']; } if (empty($info['summary'])) { $this->_validateError(PEAR_PACKAGEFILE_ERROR_NO_SUMMARY); } elseif (strpos(trim($info['summary']), "\n") !== false) { $this->_validateWarning(PEAR_PACKAGEFILE_ERROR_MULTILINE_SUMMARY, array('summary' => $info['summary'])); } if (empty($info['description'])) { $this->_validateError(PEAR_PACKAGEFILE_ERROR_NO_DESCRIPTION); } if (empty($info['release_license'])) { $this->_validateError(PEAR_PACKAGEFILE_ERROR_NO_LICENSE); } if (empty($info['version'])) { $this->_validateError(PEAR_PACKAGEFILE_ERROR_NO_VERSION); } if (empty($info['release_state'])) { $this->_validateError(PEAR_PACKAGEFILE_ERROR_NO_STATE); } if (empty($info['release_date'])) { $this->_validateError(PEAR_PACKAGEFILE_ERROR_NO_DATE); } if (empty($info['release_notes'])) { $this->_validateError(PEAR_PACKAGEFILE_ERROR_NO_NOTES); } if (empty($info['maintainers'])) { $this->_validateError(PEAR_PACKAGEFILE_ERROR_NO_MAINTAINERS); } else { $haslead = false; $i = 1; foreach ($info['maintainers'] as $m) { if (empty($m['handle'])) { $this->_validateError(PEAR_PACKAGEFILE_ERROR_NO_MAINTHANDLE, array('index' => $i)); } if (empty($m['role'])) { $this->_validateError(PEAR_PACKAGEFILE_ERROR_NO_MAINTROLE, array('index' => $i, 'roles' => PEAR_Common::getUserRoles())); } elseif ($m['role'] == 'lead') { $haslead = true; } if (empty($m['name'])) { $this->_validateError(PEAR_PACKAGEFILE_ERROR_NO_MAINTNAME, array('index' => $i)); } if (empty($m['email'])) { $this->_validateError(PEAR_PACKAGEFILE_ERROR_NO_MAINTEMAIL, array('index' => $i)); } $i++; } if (!$haslead) { $this->_validateError(PEAR_PACKAGEFILE_ERROR_NO_LEAD); } } if (!empty($info['release_deps'])) { $i = 1; foreach ($info['release_deps'] as $d) { if (!isset($d['type']) || empty($d['type'])) { $this->_validateError(PEAR_PACKAGEFILE_ERROR_NO_DEPTYPE, array('index' => $i, 'types' => PEAR_Common::getDependencyTypes())); continue; } if (!isset($d['rel']) || empty($d['rel'])) { $this->_validateError(PEAR_PACKAGEFILE_ERROR_NO_DEPREL, array('index' => $i, 'rels' => PEAR_Common::getDependencyRelations())); continue; } if (!empty($d['optional'])) { if (!in_array($d['optional'], array('yes', 'no'))) { $this->_validateError(PEAR_PACKAGEFILE_ERROR_INVALID_DEPOPTIONAL, array('index' => $i, 'opt' => $d['optional'])); } } if ($d['rel'] != 'has' && $d['rel'] != 'not' && empty($d['version'])) { $this->_validateError(PEAR_PACKAGEFILE_ERROR_NO_DEPVERSION, array('index' => $i)); } elseif (($d['rel'] == 'has' || $d['rel'] == 'not') && !empty($d['version'])) { $this->_validateWarning(PEAR_PACKAGEFILE_ERROR_DEPVERSION_IGNORED, array('index' => $i, 'rel' => $d['rel'])); } if ($d['type'] == 'php' && !empty($d['name'])) { $this->_validateWarning(PEAR_PACKAGEFILE_ERROR_DEPNAME_IGNORED, array('index' => $i, 'name' => $d['name'])); } elseif ($d['type'] != 'php' && empty($d['name'])) { $this->_validateError(PEAR_PACKAGEFILE_ERROR_NO_DEPNAME, array('index' => $i)); } if ($d['type'] == 'php' && empty($d['version'])) { $this->_validateError(PEAR_PACKAGEFILE_ERROR_NO_DEPPHPVERSION, array('index' => $i)); } if (($d['rel'] == 'not') && ($d['type'] == 'php')) { $this->_validateError(PEAR_PACKAGEFILE_PHP_NO_NOT, array('index' => $i)); } $i++; } } if (!empty($info['configure_options'])) { $i = 1; foreach ($info['configure_options'] as $c) { if (empty($c['name'])) { $this->_validateError(PEAR_PACKAGEFILE_ERROR_NO_CONFNAME, array('index' => $i)); } if (empty($c['prompt'])) { $this->_validateError(PEAR_PACKAGEFILE_ERROR_NO_CONFPROMPT, array('index' => $i)); } $i++; } } if (empty($info['filelist'])) { $this->_validateError(PEAR_PACKAGEFILE_ERROR_NO_FILES); $errors[] = 'no files'; } else { foreach ($info['filelist'] as $file => $fa) { if (empty($fa['role'])) { $this->_validateError(PEAR_PACKAGEFILE_ERROR_NO_FILEROLE, array('file' => $file, 'roles' => PEAR_Common::getFileRoles())); continue; } elseif (!in_array($fa['role'], PEAR_Common::getFileRoles())) { $this->_validateError(PEAR_PACKAGEFILE_ERROR_INVALID_FILEROLE, array('file' => $file, 'role' => $fa['role'], 'roles' => PEAR_Common::getFileRoles())); } if (preg_match('~/\.\.?(/|\\z)|^\.\.?/~', str_replace('\\', '/', $file))) { // file contains .. parent directory or . cur directory references $this->_validateError(PEAR_PACKAGEFILE_ERROR_INVALID_FILENAME, array('file' => $file)); } if (isset($fa['install-as']) && preg_match('~/\.\.?(/|\\z)|^\.\.?/~', str_replace('\\', '/', $fa['install-as']))) { // install-as contains .. parent directory or . cur directory references $this->_validateError(PEAR_PACKAGEFILE_ERROR_INVALID_FILENAME, array('file' => $file . ' [installed as ' . $fa['install-as'] . ']')); } if (isset($fa['baseinstalldir']) && preg_match('~/\.\.?(/|\\z)|^\.\.?/~', str_replace('\\', '/', $fa['baseinstalldir']))) { // install-as contains .. parent directory or . cur directory references $this->_validateError(PEAR_PACKAGEFILE_ERROR_INVALID_FILENAME, array('file' => $file . ' [baseinstalldir ' . $fa['baseinstalldir'] . ']')); } } } if (isset($this->_registry) && $this->_isValid) { $chan = $this->_registry->getChannel('pear.php.net'); if (PEAR::isError($chan)) { $this->_validateError(PEAR_PACKAGEFILE_ERROR_CHANNELVAL, $chan->getMessage()); return $this->_isValid = 0; } $validator = $chan->getValidationObject(); $validator->setPackageFile($this); $validator->validate($state); $failures = $validator->getFailures(); foreach ($failures['errors'] as $error) { $this->_validateError(PEAR_PACKAGEFILE_ERROR_CHANNELVAL, $error); } foreach ($failures['warnings'] as $warning) { $this->_validateWarning(PEAR_PACKAGEFILE_ERROR_CHANNELVAL, $warning); } } if ($this->_isValid && $state == PEAR_VALIDATE_PACKAGING && !$nofilechecking) { if ($this->_analyzePhpFiles()) { $this->_isValid = true; } } if ($this->_isValid) { return $this->_isValid = $state; } return $this->_isValid = 0; } function _analyzePhpFiles() { if (!$this->_isValid) { return false; } if (!isset($this->_packageFile)) { return false; } $dir_prefix = dirname($this->_packageFile); $common = new PEAR_Common; $log = isset($this->_logger) ? array(&$this->_logger, 'log') : array($common, 'log'); $info = $this->getFilelist(); foreach ($info as $file => $fa) { if (!file_exists($dir_prefix . DIRECTORY_SEPARATOR . $file)) { $this->_validateError(PEAR_PACKAGEFILE_ERROR_FILE_NOTFOUND, array('file' => realpath($dir_prefix) . DIRECTORY_SEPARATOR . $file)); continue; } if ($fa['role'] == 'php' && $dir_prefix) { call_user_func_array($log, array(1, "Analyzing $file")); $srcinfo = $this->_analyzeSourceCode($dir_prefix . DIRECTORY_SEPARATOR . $file); if ($srcinfo) { $this->_buildProvidesArray($srcinfo); } } } $this->_packageName = $pn = $this->getPackage(); $pnl = strlen($pn); if (isset($this->_packageInfo['provides'])) { foreach ((array) $this->_packageInfo['provides'] as $key => $what) { if (isset($what['explicit'])) { // skip conformance checks if the provides entry is // specified in the package.xml file continue; } extract($what); if ($type == 'class') { if (!strncasecmp($name, $pn, $pnl)) { continue; } $this->_validateWarning(PEAR_PACKAGEFILE_ERROR_NO_PNAME_PREFIX, array('file' => $file, 'type' => $type, 'name' => $name, 'package' => $pn)); } elseif ($type == 'function') { if (strstr($name, '::') || !strncasecmp($name, $pn, $pnl)) { continue; } $this->_validateWarning(PEAR_PACKAGEFILE_ERROR_NO_PNAME_PREFIX, array('file' => $file, 'type' => $type, 'name' => $name, 'package' => $pn)); } } } return $this->_isValid; } /** * Get the default xml generator object * * @return PEAR_PackageFile_Generator_v1 */ function &getDefaultGenerator() { if (!class_exists('PEAR_PackageFile_Generator_v1')) { require_once 'PEAR/PackageFile/Generator/v1.php'; } $a = new PEAR_PackageFile_Generator_v1($this); return $a; } /** * Get the contents of a file listed within the package.xml * @param string * @return string */ function getFileContents($file) { if ($this->_archiveFile == $this->_packageFile) { // unpacked $dir = dirname($this->_packageFile); $file = $dir . DIRECTORY_SEPARATOR . $file; $file = str_replace(array('/', '\\'), array(DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR), $file); if (file_exists($file) && is_readable($file)) { return implode('', file($file)); } } else { // tgz if (!class_exists('Archive_Tar')) { require_once 'Archive/Tar.php'; } $tar = new Archive_Tar($this->_archiveFile); $tar->pushErrorHandling(PEAR_ERROR_RETURN); if ($file != 'package.xml' && $file != 'package2.xml') { $file = $this->getPackage() . '-' . $this->getVersion() . '/' . $file; } $file = $tar->extractInString($file); $tar->popErrorHandling(); if (PEAR::isError($file)) { return PEAR::raiseError("Cannot locate file '$file' in archive"); } return $file; } } // {{{ analyzeSourceCode() /** * Analyze the source code of the given PHP file * * @param string Filename of the PHP file * @return mixed * @access private */ function _analyzeSourceCode($file) { 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; } fclose($fp); $contents = file_get_contents($file); $tokens = token_get_all($contents); /* for ($i = 0; $i < sizeof($tokens); $i++) { @list($token, $data) = $tokens[$i]; if (is_string($token)) { var_dump($token); } else { print token_name($token) . ' '; var_dump(rtrim($data)); } } */ $look_for = 0; $paren_level = 0; $bracket_level = 0; $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]; } else { $token = $tokens[$i]; $data = ''; } if ($inquote) { if ($token != '"' && $token != T_END_HEREDOC) { continue; } else { $inquote = false; continue; } } switch ($token) { case T_WHITESPACE : continue; case ';': if ($interface) { $current_function = ''; $current_function_level = -1; } break; case '"': case T_START_HEREDOC: $inquote = true; break; case T_CURLY_OPEN: case T_DOLLAR_OPEN_CURLY_BRACES: case '{': $brace_level++; continue 2; case '}': $brace_level--; if ($current_class_level == $brace_level) { $current_class = ''; $current_class_level = -1; } if ($current_function_level == $brace_level) { $current_function = ''; $current_function_level = -1; } continue 2; case '[': $bracket_level++; continue 2; 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)) { $this->_validateError(PEAR_PACKAGEFILE_ERROR_INVALID_PHPFILE, array('file' => $file)); return false; } case T_FUNCTION: case T_NEW: case T_EXTENDS: case T_IMPLEMENTS: $look_for = $token; continue 2; case T_STRING: 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; } $current_function_level = $brace_level; $m = array(); } elseif ($look_for == T_NEW) { $used_classes[$data] = true; } $look_for = 0; continue 2; case T_VARIABLE: $look_for = 0; continue 2; case T_DOC_COMMENT: case T_COMMENT: if (preg_match('!^/\*\*\s!', $data)) { $lastphpdoc = $data; if (preg_match_all('/@nodep\s+(\S+)/', $lastphpdoc, $m)) { $nodeps = array_merge($nodeps, $m[1]); } } continue 2; case T_DOUBLE_COLON: if (!($tokens[$i - 1][0] == T_WHITESPACE || $tokens[$i - 1][0] == T_STRING)) { $this->_validateError(PEAR_PACKAGEFILE_ERROR_INVALID_PHPFILE, array('file' => $file)); return false; } $class = $tokens[$i - 1][1]; if (strtolower($class) != 'parent') { $used_classes[$class] = true; } continue 2; } } 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, ); } /** * Build a "provides" array from data returned by * analyzeSourceCode(). The format of the built array is like * this: * * array( * 'class;MyClass' => 'array('type' => 'class', 'name' => 'MyClass'), * ... * ) * * * @param array $srcinfo array with information about a source file * as returned by the analyzeSourceCode() method. * * @return void * * @access private * */ function _buildProvidesArray($srcinfo) { if (!$this->_isValid) { return false; } $file = basename($srcinfo['source_file']); $pn = $this->getPackage(); $pnl = strlen($pn); foreach ($srcinfo['declared_classes'] as $class) { $key = "class;$class"; if (isset($this->_packageInfo['provides'][$key])) { continue; } $this->_packageInfo['provides'][$key] = array('file'=> $file, 'type' => 'class', 'name' => $class); if (isset($srcinfo['inheritance'][$class])) { $this->_packageInfo['provides'][$key]['extends'] = $srcinfo['inheritance'][$class]; } } foreach ($srcinfo['declared_methods'] as $class => $methods) { foreach ($methods as $method) { $function = "$class::$method"; $key = "function;$function"; if ($method{0} == '_' || !strcasecmp($method, $class) || isset($this->_packageInfo['provides'][$key])) { continue; } $this->_packageInfo['provides'][$key] = array('file'=> $file, 'type' => 'function', 'name' => $function); } } foreach ($srcinfo['declared_functions'] as $function) { $key = "function;$function"; if ($function{0} == '_' || isset($this->_packageInfo['provides'][$key])) { continue; } if (!strstr($function, '::') && strncasecmp($function, $pn, $pnl)) { $warnings[] = "in1 " . $file . ": function \"$function\" not prefixed with package name \"$pn\""; } $this->_packageInfo['provides'][$key] = array('file'=> $file, 'type' => 'function', 'name' => $function); } } // }}} } ?> php-pear-1.10.1+submodules+notgz/PEAR/PackageFile/v2.php000066400000000000000000002104661262614675700225740ustar00rootroot00000000000000 * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ /** * For error handling */ require_once 'PEAR/ErrorStack.php'; /** * @category pear * @package PEAR * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version Release: @package_version@ * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ class PEAR_PackageFile_v2 { /** * Parsed package information * @var array * @access private */ var $_packageInfo = array(); /** * path to package .tgz or false if this is a local/extracted package.xml * @var string|false * @access private */ var $_archiveFile; /** * path to package .xml or false if this is an abstract parsed-from-string xml * @var string|false * @access private */ var $_packageFile; /** * This is used by file analysis routines to log progress information * @var PEAR_Common * @access protected */ var $_logger; /** * This is set to the highest validation level that has been validated * * If the package.xml is invalid or unknown, this is set to 0. If * normal validation has occurred, this is set to PEAR_VALIDATE_NORMAL. If * downloading/installation validation has occurred it is set to PEAR_VALIDATE_DOWNLOADING * or INSTALLING, and so on up to PEAR_VALIDATE_PACKAGING. This allows validation * "caching" to occur, which is particularly important for package validation, so * that PHP files are not validated twice * @var int * @access private */ var $_isValid = 0; /** * True if the filelist has been validated * @param bool */ var $_filesValid = false; /** * @var PEAR_Registry * @access protected */ var $_registry; /** * @var PEAR_Config * @access protected */ var $_config; /** * Optional Dependency group requested for installation * @var string * @access private */ var $_requestedGroup = false; /** * @var PEAR_ErrorStack * @access protected */ var $_stack; /** * Namespace prefix used for tasks in this package.xml - use tasks: whenever possible */ var $_tasksNs; /** * Determines whether this packagefile was initialized only with partial package info * * If this package file was constructed via parsing REST, it will only contain * * - package name * - channel name * - dependencies * @var boolean * @access private */ var $_incomplete = true; /** * @var PEAR_PackageFile_v2_Validator */ var $_v2Validator; /** * The constructor merely sets up the private error stack */ function __construct() { $this->_stack = new PEAR_ErrorStack('PEAR_PackageFile_v2', false, null); $this->_isValid = false; } /** * PHP 4 style constructor for backwards compatibility. * Used by PEAR_PackageFileManager2 */ public function PEAR_PackageFile_v2() { $this->__construct(); } /** * To make unit-testing easier * @param PEAR_Frontend_* * @param array options * @param PEAR_Config * @return PEAR_Downloader * @access protected */ function &getPEARDownloader(&$i, $o, &$c) { $z = new PEAR_Downloader($i, $o, $c); return $z; } /** * To make unit-testing easier * @param PEAR_Config * @param array options * @param array package name as returned from {@link PEAR_Registry::parsePackageName()} * @param int PEAR_VALIDATE_* constant * @return PEAR_Dependency2 * @access protected */ function &getPEARDependency2(&$c, $o, $p, $s = PEAR_VALIDATE_INSTALLING) { if (!class_exists('PEAR_Dependency2')) { require_once 'PEAR/Dependency2.php'; } $z = new PEAR_Dependency2($c, $o, $p, $s); return $z; } function getInstalledBinary() { return isset($this->_packageInfo['#binarypackage']) ? $this->_packageInfo['#binarypackage'] : false; } /** * Installation of source package has failed, attempt to download and install the * binary version of this package. * @param PEAR_Installer * @return array|false */ function installBinary(&$installer) { if (!OS_WINDOWS) { $a = false; return $a; } if ($this->getPackageType() == 'extsrc' || $this->getPackageType() == 'zendextsrc') { $releasetype = $this->getPackageType() . 'release'; if (!is_array($installer->getInstallPackages())) { $a = false; return $a; } foreach ($installer->getInstallPackages() as $p) { if ($p->isExtension($this->_packageInfo['providesextension'])) { if ($p->getPackageType() != 'extsrc' && $p->getPackageType() != 'zendextsrc') { $a = false; return $a; // the user probably downloaded it separately } } } if (isset($this->_packageInfo[$releasetype]['binarypackage'])) { $installer->log(0, 'Attempting to download binary version of extension "' . $this->_packageInfo['providesextension'] . '"'); $params = $this->_packageInfo[$releasetype]['binarypackage']; if (!is_array($params) || !isset($params[0])) { $params = array($params); } if (isset($this->_packageInfo['channel'])) { foreach ($params as $i => $param) { $params[$i] = array('channel' => $this->_packageInfo['channel'], 'package' => $param, 'version' => $this->getVersion()); } } $dl = &$this->getPEARDownloader($installer->ui, $installer->getOptions(), $installer->config); $verbose = $dl->config->get('verbose'); $dl->config->set('verbose', -1); foreach ($params as $param) { PEAR::pushErrorHandling(PEAR_ERROR_RETURN); $ret = $dl->download(array($param)); PEAR::popErrorHandling(); if (is_array($ret) && count($ret)) { break; } } $dl->config->set('verbose', $verbose); if (is_array($ret)) { if (count($ret) == 1) { $pf = $ret[0]->getPackageFile(); PEAR::pushErrorHandling(PEAR_ERROR_RETURN); $err = $installer->install($ret[0]); PEAR::popErrorHandling(); if (is_array($err)) { $this->_packageInfo['#binarypackage'] = $ret[0]->getPackage(); // "install" self, so all dependencies will work transparently $this->_registry->addPackage2($this); $installer->log(0, 'Download and install of binary extension "' . $this->_registry->parsedPackageNameToString( array('channel' => $pf->getChannel(), 'package' => $pf->getPackage()), true) . '" successful'); $a = array($ret[0], $err); return $a; } $installer->log(0, 'Download and install of binary extension "' . $this->_registry->parsedPackageNameToString( array('channel' => $pf->getChannel(), 'package' => $pf->getPackage()), true) . '" failed'); } } } } $a = false; return $a; } /** * @return string|false Extension name */ function getProvidesExtension() { if (in_array($this->getPackageType(), array('extsrc', 'extbin', 'zendextsrc', 'zendextbin'))) { if (isset($this->_packageInfo['providesextension'])) { return $this->_packageInfo['providesextension']; } } return false; } /** * @param string Extension name * @return bool */ function isExtension($extension) { if (in_array($this->getPackageType(), array('extsrc', 'extbin', 'zendextsrc', 'zendextbin'))) { return $this->_packageInfo['providesextension'] == $extension; } return false; } /** * Tests whether every part of the package.xml 1.0 is represented in * this package.xml 2.0 * @param PEAR_PackageFile_v1 * @return bool */ function isEquivalent($pf1) { if (!$pf1) { return true; } if ($this->getPackageType() == 'bundle') { return false; } $this->_stack->getErrors(true); if (!$pf1->validate(PEAR_VALIDATE_NORMAL)) { return false; } $pass = true; if ($pf1->getPackage() != $this->getPackage()) { $this->_differentPackage($pf1->getPackage()); $pass = false; } if ($pf1->getVersion() != $this->getVersion()) { $this->_differentVersion($pf1->getVersion()); $pass = false; } if (trim($pf1->getSummary()) != $this->getSummary()) { $this->_differentSummary($pf1->getSummary()); $pass = false; } if (preg_replace('/\s+/', '', $pf1->getDescription()) != preg_replace('/\s+/', '', $this->getDescription())) { $this->_differentDescription($pf1->getDescription()); $pass = false; } if ($pf1->getState() != $this->getState()) { $this->_differentState($pf1->getState()); $pass = false; } if (!strstr(preg_replace('/\s+/', '', $this->getNotes()), preg_replace('/\s+/', '', $pf1->getNotes()))) { $this->_differentNotes($pf1->getNotes()); $pass = false; } $mymaintainers = $this->getMaintainers(); $yourmaintainers = $pf1->getMaintainers(); for ($i1 = 0; $i1 < count($yourmaintainers); $i1++) { $reset = false; for ($i2 = 0; $i2 < count($mymaintainers); $i2++) { if ($mymaintainers[$i2]['handle'] == $yourmaintainers[$i1]['handle']) { if ($mymaintainers[$i2]['role'] != $yourmaintainers[$i1]['role']) { $this->_differentRole($mymaintainers[$i2]['handle'], $yourmaintainers[$i1]['role'], $mymaintainers[$i2]['role']); $pass = false; } if ($mymaintainers[$i2]['email'] != $yourmaintainers[$i1]['email']) { $this->_differentEmail($mymaintainers[$i2]['handle'], $yourmaintainers[$i1]['email'], $mymaintainers[$i2]['email']); $pass = false; } if ($mymaintainers[$i2]['name'] != $yourmaintainers[$i1]['name']) { $this->_differentName($mymaintainers[$i2]['handle'], $yourmaintainers[$i1]['name'], $mymaintainers[$i2]['name']); $pass = false; } unset($mymaintainers[$i2]); $mymaintainers = array_values($mymaintainers); unset($yourmaintainers[$i1]); $yourmaintainers = array_values($yourmaintainers); $reset = true; break; } } if ($reset) { $i1 = -1; } } $this->_unmatchedMaintainers($mymaintainers, $yourmaintainers); $filelist = $this->getFilelist(); foreach ($pf1->getFilelist() as $file => $atts) { if (!isset($filelist[$file])) { $this->_missingFile($file); $pass = false; } } return $pass; } function _differentPackage($package) { $this->_stack->push(__FUNCTION__, 'error', array('package' => $package, 'self' => $this->getPackage()), 'package.xml 1.0 package "%package%" does not match "%self%"'); } function _differentVersion($version) { $this->_stack->push(__FUNCTION__, 'error', array('version' => $version, 'self' => $this->getVersion()), 'package.xml 1.0 version "%version%" does not match "%self%"'); } function _differentState($state) { $this->_stack->push(__FUNCTION__, 'error', array('state' => $state, 'self' => $this->getState()), 'package.xml 1.0 state "%state%" does not match "%self%"'); } function _differentRole($handle, $role, $selfrole) { $this->_stack->push(__FUNCTION__, 'error', array('handle' => $handle, 'role' => $role, 'self' => $selfrole), 'package.xml 1.0 maintainer "%handle%" role "%role%" does not match "%self%"'); } function _differentEmail($handle, $email, $selfemail) { $this->_stack->push(__FUNCTION__, 'error', array('handle' => $handle, 'email' => $email, 'self' => $selfemail), 'package.xml 1.0 maintainer "%handle%" email "%email%" does not match "%self%"'); } function _differentName($handle, $name, $selfname) { $this->_stack->push(__FUNCTION__, 'error', array('handle' => $handle, 'name' => $name, 'self' => $selfname), 'package.xml 1.0 maintainer "%handle%" name "%name%" does not match "%self%"'); } function _unmatchedMaintainers($my, $yours) { if ($my) { array_walk($my, create_function('&$i, $k', '$i = $i["handle"];')); $this->_stack->push(__FUNCTION__, 'error', array('handles' => $my), 'package.xml 2.0 has unmatched extra maintainers "%handles%"'); } if ($yours) { array_walk($yours, create_function('&$i, $k', '$i = $i["handle"];')); $this->_stack->push(__FUNCTION__, 'error', array('handles' => $yours), 'package.xml 1.0 has unmatched extra maintainers "%handles%"'); } } function _differentNotes($notes) { $truncnotes = strlen($notes) < 25 ? $notes : substr($notes, 0, 24) . '...'; $truncmynotes = strlen($this->getNotes()) < 25 ? $this->getNotes() : substr($this->getNotes(), 0, 24) . '...'; $this->_stack->push(__FUNCTION__, 'error', array('notes' => $truncnotes, 'self' => $truncmynotes), 'package.xml 1.0 release notes "%notes%" do not match "%self%"'); } function _differentSummary($summary) { $truncsummary = strlen($summary) < 25 ? $summary : substr($summary, 0, 24) . '...'; $truncmysummary = strlen($this->getsummary()) < 25 ? $this->getSummary() : substr($this->getsummary(), 0, 24) . '...'; $this->_stack->push(__FUNCTION__, 'error', array('summary' => $truncsummary, 'self' => $truncmysummary), 'package.xml 1.0 summary "%summary%" does not match "%self%"'); } function _differentDescription($description) { $truncdescription = trim(strlen($description) < 25 ? $description : substr($description, 0, 24) . '...'); $truncmydescription = trim(strlen($this->getDescription()) < 25 ? $this->getDescription() : substr($this->getdescription(), 0, 24) . '...'); $this->_stack->push(__FUNCTION__, 'error', array('description' => $truncdescription, 'self' => $truncmydescription), 'package.xml 1.0 description "%description%" does not match "%self%"'); } function _missingFile($file) { $this->_stack->push(__FUNCTION__, 'error', array('file' => $file), 'package.xml 1.0 file "%file%" is not present in '); } /** * WARNING - do not use this function unless you know what you're doing */ function setRawState($state) { if (!isset($this->_packageInfo['stability'])) { $this->_packageInfo['stability'] = array(); } $this->_packageInfo['stability']['release'] = $state; } /** * WARNING - do not use this function unless you know what you're doing */ function setRawCompatible($compatible) { $this->_packageInfo['compatible'] = $compatible; } /** * WARNING - do not use this function unless you know what you're doing */ function setRawPackage($package) { $this->_packageInfo['name'] = $package; } /** * WARNING - do not use this function unless you know what you're doing */ function setRawChannel($channel) { $this->_packageInfo['channel'] = $channel; } function setRequestedGroup($group) { $this->_requestedGroup = $group; } function getRequestedGroup() { if (isset($this->_requestedGroup)) { return $this->_requestedGroup; } return false; } /** * For saving in the registry. * * Set the last version that was installed * @param string */ function setLastInstalledVersion($version) { $this->_packageInfo['_lastversion'] = $version; } /** * @return string|false */ function getLastInstalledVersion() { if (isset($this->_packageInfo['_lastversion'])) { return $this->_packageInfo['_lastversion']; } return false; } /** * Determines whether this package.xml has post-install scripts or not * @return array|false */ function listPostinstallScripts() { $filelist = $this->getFilelist(); $contents = $this->getContents(); $contents = $contents['dir']['file']; if (!is_array($contents) || !isset($contents[0])) { $contents = array($contents); } $taskfiles = array(); foreach ($contents as $file) { $atts = $file['attribs']; unset($file['attribs']); if (count($file)) { $taskfiles[$atts['name']] = $file; } } $common = new PEAR_Common; $common->debug = $this->_config->get('verbose'); $this->_scripts = array(); $ret = array(); foreach ($taskfiles as $name => $tasks) { if (!isset($filelist[$name])) { // ignored files will not be in the filelist continue; } $atts = $filelist[$name]; foreach ($tasks as $tag => $raw) { $task = $this->getTask($tag); $task = new $task($this->_config, $common, PEAR_TASK_INSTALL); if ($task->isScript()) { $ret[] = $filelist[$name]['installed_as']; } } } if (count($ret)) { return $ret; } return false; } /** * Initialize post-install scripts for running * * This method can be used to detect post-install scripts, as the return value * indicates whether any exist * @return bool */ function initPostinstallScripts() { $filelist = $this->getFilelist(); $contents = $this->getContents(); $contents = $contents['dir']['file']; if (!is_array($contents) || !isset($contents[0])) { $contents = array($contents); } $taskfiles = array(); foreach ($contents as $file) { $atts = $file['attribs']; unset($file['attribs']); if (count($file)) { $taskfiles[$atts['name']] = $file; } } $common = new PEAR_Common; $common->debug = $this->_config->get('verbose'); $this->_scripts = array(); foreach ($taskfiles as $name => $tasks) { if (!isset($filelist[$name])) { // file was not installed due to installconditions continue; } $atts = $filelist[$name]; foreach ($tasks as $tag => $raw) { $taskname = $this->getTask($tag); $task = new $taskname($this->_config, $common, PEAR_TASK_INSTALL); if (!$task->isScript()) { continue; // scripts are only handled after installation } $lastversion = isset($this->_packageInfo['_lastversion']) ? $this->_packageInfo['_lastversion'] : null; $task->init($raw, $atts, $lastversion); $res = $task->startSession($this, $atts['installed_as']); if (!$res) { continue; // skip this file } if (PEAR::isError($res)) { return $res; } $assign = &$task; $this->_scripts[] = &$assign; } } if (count($this->_scripts)) { return true; } return false; } function runPostinstallScripts() { if ($this->initPostinstallScripts()) { $ui = &PEAR_Frontend::singleton(); if ($ui) { $ui->runPostinstallScripts($this->_scripts, $this); } } } /** * Convert a recursive set of and tags into a single tag with * tags. */ function flattenFilelist() { if (isset($this->_packageInfo['bundle'])) { return; } $filelist = array(); if (isset($this->_packageInfo['contents']['dir']['dir'])) { $this->_getFlattenedFilelist($filelist, $this->_packageInfo['contents']['dir']); if (!isset($filelist[1])) { $filelist = $filelist[0]; } $this->_packageInfo['contents']['dir']['file'] = $filelist; unset($this->_packageInfo['contents']['dir']['dir']); } else { // else already flattened but check for baseinstalldir propagation if (isset($this->_packageInfo['contents']['dir']['attribs']['baseinstalldir'])) { if (isset($this->_packageInfo['contents']['dir']['file'][0])) { foreach ($this->_packageInfo['contents']['dir']['file'] as $i => $file) { if (isset($file['attribs']['baseinstalldir'])) { continue; } $this->_packageInfo['contents']['dir']['file'][$i]['attribs']['baseinstalldir'] = $this->_packageInfo['contents']['dir']['attribs']['baseinstalldir']; } } else { if (!isset($this->_packageInfo['contents']['dir']['file']['attribs']['baseinstalldir'])) { $this->_packageInfo['contents']['dir']['file']['attribs']['baseinstalldir'] = $this->_packageInfo['contents']['dir']['attribs']['baseinstalldir']; } } } } } /** * @param array the final flattened file list * @param array the current directory being processed * @param string|false any recursively inherited baeinstalldir attribute * @param string private recursion variable * @return array * @access protected */ function _getFlattenedFilelist(&$files, $dir, $baseinstall = false, $path = '') { if (isset($dir['attribs']) && isset($dir['attribs']['baseinstalldir'])) { $baseinstall = $dir['attribs']['baseinstalldir']; } if (isset($dir['dir'])) { if (!isset($dir['dir'][0])) { $dir['dir'] = array($dir['dir']); } foreach ($dir['dir'] as $subdir) { if (!isset($subdir['attribs']) || !isset($subdir['attribs']['name'])) { $name = '*unknown*'; } else { $name = $subdir['attribs']['name']; } $newpath = empty($path) ? $name : $path . '/' . $name; $this->_getFlattenedFilelist($files, $subdir, $baseinstall, $newpath); } } if (isset($dir['file'])) { if (!isset($dir['file'][0])) { $dir['file'] = array($dir['file']); } foreach ($dir['file'] as $file) { $attrs = $file['attribs']; $name = $attrs['name']; if ($baseinstall && !isset($attrs['baseinstalldir'])) { $attrs['baseinstalldir'] = $baseinstall; } $attrs['name'] = empty($path) ? $name : $path . '/' . $name; $attrs['name'] = preg_replace(array('!\\\\+!', '!/+!'), array('/', '/'), $attrs['name']); $file['attribs'] = $attrs; $files[] = $file; } } } function setConfig(&$config) { $this->_config = &$config; $this->_registry = &$config->getRegistry(); } function setLogger(&$logger) { if (!is_object($logger) || !method_exists($logger, 'log')) { return PEAR::raiseError('Logger must be compatible with PEAR_Common::log'); } $this->_logger = &$logger; } /** * WARNING - do not use this function directly unless you know what you're doing */ function setDeps($deps) { $this->_packageInfo['dependencies'] = $deps; } /** * WARNING - do not use this function directly unless you know what you're doing */ function setCompatible($compat) { $this->_packageInfo['compatible'] = $compat; } function setPackagefile($file, $archive = false) { $this->_packageFile = $file; $this->_archiveFile = $archive ? $archive : $file; } /** * Wrapper to {@link PEAR_ErrorStack::getErrors()} * @param boolean determines whether to purge the error stack after retrieving * @return array */ function getValidationWarnings($purge = true) { return $this->_stack->getErrors($purge); } function getPackageFile() { return $this->_packageFile; } function getArchiveFile() { return $this->_archiveFile; } /** * Directly set the array that defines this packagefile * * WARNING: no validation. This should only be performed by internal methods * inside PEAR or by inputting an array saved from an existing PEAR_PackageFile_v2 * @param array */ function fromArray($pinfo) { unset($pinfo['old']); unset($pinfo['xsdversion']); // If the changelog isn't an array then it was passed in as an empty tag if (isset($pinfo['changelog']) && !is_array($pinfo['changelog'])) { unset($pinfo['changelog']); } $this->_incomplete = false; $this->_packageInfo = $pinfo; } function isIncomplete() { return $this->_incomplete; } /** * @return array */ function toArray($forreg = false) { if (!$this->validate(PEAR_VALIDATE_NORMAL)) { return false; } return $this->getArray($forreg); } function getArray($forReg = false) { if ($forReg) { $arr = $this->_packageInfo; $arr['old'] = array(); $arr['old']['version'] = $this->getVersion(); $arr['old']['release_date'] = $this->getDate(); $arr['old']['release_state'] = $this->getState(); $arr['old']['release_license'] = $this->getLicense(); $arr['old']['release_notes'] = $this->getNotes(); $arr['old']['release_deps'] = $this->getDeps(); $arr['old']['maintainers'] = $this->getMaintainers(); $arr['xsdversion'] = '2.0'; return $arr; } else { $info = $this->_packageInfo; unset($info['dirtree']); if (isset($info['_lastversion'])) { unset($info['_lastversion']); } if (isset($info['#binarypackage'])) { unset($info['#binarypackage']); } return $info; } } function packageInfo($field) { $arr = $this->getArray(true); if ($field == 'state') { return $arr['stability']['release']; } if ($field == 'api-version') { return $arr['version']['api']; } if ($field == 'api-state') { return $arr['stability']['api']; } if (isset($arr['old'][$field])) { if (!is_string($arr['old'][$field])) { return null; } return $arr['old'][$field]; } if (isset($arr[$field])) { if (!is_string($arr[$field])) { return null; } return $arr[$field]; } return null; } function getName() { return $this->getPackage(); } function getPackage() { if (isset($this->_packageInfo['name'])) { return $this->_packageInfo['name']; } return false; } function getChannel() { if (isset($this->_packageInfo['uri'])) { return '__uri'; } if (isset($this->_packageInfo['channel'])) { return strtolower($this->_packageInfo['channel']); } return false; } function getUri() { if (isset($this->_packageInfo['uri'])) { return $this->_packageInfo['uri']; } return false; } function getExtends() { if (isset($this->_packageInfo['extends'])) { return $this->_packageInfo['extends']; } return false; } function getSummary() { if (isset($this->_packageInfo['summary'])) { return $this->_packageInfo['summary']; } return false; } function getDescription() { if (isset($this->_packageInfo['description'])) { return $this->_packageInfo['description']; } return false; } function getMaintainers($raw = false) { if (!isset($this->_packageInfo['lead'])) { return false; } if ($raw) { $ret = array('lead' => $this->_packageInfo['lead']); (isset($this->_packageInfo['developer'])) ? $ret['developer'] = $this->_packageInfo['developer'] :null; (isset($this->_packageInfo['contributor'])) ? $ret['contributor'] = $this->_packageInfo['contributor'] :null; (isset($this->_packageInfo['helper'])) ? $ret['helper'] = $this->_packageInfo['helper'] :null; return $ret; } else { $ret = array(); $leads = isset($this->_packageInfo['lead'][0]) ? $this->_packageInfo['lead'] : array($this->_packageInfo['lead']); foreach ($leads as $lead) { $s = $lead; $s['handle'] = $s['user']; unset($s['user']); $s['role'] = 'lead'; $ret[] = $s; } if (isset($this->_packageInfo['developer'])) { $leads = isset($this->_packageInfo['developer'][0]) ? $this->_packageInfo['developer'] : array($this->_packageInfo['developer']); foreach ($leads as $maintainer) { $s = $maintainer; $s['handle'] = $s['user']; unset($s['user']); $s['role'] = 'developer'; $ret[] = $s; } } if (isset($this->_packageInfo['contributor'])) { $leads = isset($this->_packageInfo['contributor'][0]) ? $this->_packageInfo['contributor'] : array($this->_packageInfo['contributor']); foreach ($leads as $maintainer) { $s = $maintainer; $s['handle'] = $s['user']; unset($s['user']); $s['role'] = 'contributor'; $ret[] = $s; } } if (isset($this->_packageInfo['helper'])) { $leads = isset($this->_packageInfo['helper'][0]) ? $this->_packageInfo['helper'] : array($this->_packageInfo['helper']); foreach ($leads as $maintainer) { $s = $maintainer; $s['handle'] = $s['user']; unset($s['user']); $s['role'] = 'helper'; $ret[] = $s; } } return $ret; } return false; } function getLeads() { if (isset($this->_packageInfo['lead'])) { return $this->_packageInfo['lead']; } return false; } function getDevelopers() { if (isset($this->_packageInfo['developer'])) { return $this->_packageInfo['developer']; } return false; } function getContributors() { if (isset($this->_packageInfo['contributor'])) { return $this->_packageInfo['contributor']; } return false; } function getHelpers() { if (isset($this->_packageInfo['helper'])) { return $this->_packageInfo['helper']; } return false; } function setDate($date) { if (!isset($this->_packageInfo['date'])) { // ensure that the extends tag is set up in the right location $this->_packageInfo = $this->_insertBefore($this->_packageInfo, array('time', 'version', 'stability', 'license', 'notes', 'contents', 'compatible', 'dependencies', 'providesextension', 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease', 'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog'), array(), 'date'); } $this->_packageInfo['date'] = $date; $this->_isValid = 0; } function setTime($time) { $this->_isValid = 0; if (!isset($this->_packageInfo['time'])) { // ensure that the time tag is set up in the right location $this->_packageInfo = $this->_insertBefore($this->_packageInfo, array('version', 'stability', 'license', 'notes', 'contents', 'compatible', 'dependencies', 'providesextension', 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease', 'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog'), $time, 'time'); } $this->_packageInfo['time'] = $time; } function getDate() { if (isset($this->_packageInfo['date'])) { return $this->_packageInfo['date']; } return false; } function getTime() { if (isset($this->_packageInfo['time'])) { return $this->_packageInfo['time']; } return false; } /** * @param package|api version category to return */ function getVersion($key = 'release') { if (isset($this->_packageInfo['version'][$key])) { return $this->_packageInfo['version'][$key]; } return false; } function getStability() { if (isset($this->_packageInfo['stability'])) { return $this->_packageInfo['stability']; } return false; } function getState($key = 'release') { if (isset($this->_packageInfo['stability'][$key])) { return $this->_packageInfo['stability'][$key]; } return false; } function getLicense($raw = false) { if (isset($this->_packageInfo['license'])) { if ($raw) { return $this->_packageInfo['license']; } if (is_array($this->_packageInfo['license'])) { return $this->_packageInfo['license']['_content']; } else { return $this->_packageInfo['license']; } } return false; } function getLicenseLocation() { if (!isset($this->_packageInfo['license']) || !is_array($this->_packageInfo['license'])) { return false; } return $this->_packageInfo['license']['attribs']; } function getNotes() { if (isset($this->_packageInfo['notes'])) { return $this->_packageInfo['notes']; } return false; } /** * Return the tag contents, if any * @return array|false */ function getUsesrole() { if (isset($this->_packageInfo['usesrole'])) { return $this->_packageInfo['usesrole']; } return false; } /** * Return the tag contents, if any * @return array|false */ function getUsestask() { if (isset($this->_packageInfo['usestask'])) { return $this->_packageInfo['usestask']; } return false; } /** * This should only be used to retrieve filenames and install attributes */ function getFilelist($preserve = false) { if (isset($this->_packageInfo['filelist']) && !$preserve) { return $this->_packageInfo['filelist']; } $this->flattenFilelist(); if ($contents = $this->getContents()) { $ret = array(); if (!isset($contents['dir'])) { return false; } if (!isset($contents['dir']['file'][0])) { $contents['dir']['file'] = array($contents['dir']['file']); } foreach ($contents['dir']['file'] as $file) { if (!isset($file['attribs']['name'])) { continue; } $name = $file['attribs']['name']; if (!$preserve) { $file = $file['attribs']; } $ret[$name] = $file; } if (!$preserve) { $this->_packageInfo['filelist'] = $ret; } return $ret; } return false; } /** * Return configure options array, if any * * @return array|false */ function getConfigureOptions() { if ($this->getPackageType() != 'extsrc' && $this->getPackageType() != 'zendextsrc') { return false; } $releases = $this->getReleases(); if (isset($releases[0])) { $releases = $releases[0]; } if (isset($releases['configureoption'])) { if (!isset($releases['configureoption'][0])) { $releases['configureoption'] = array($releases['configureoption']); } for ($i = 0; $i < count($releases['configureoption']); $i++) { $releases['configureoption'][$i] = $releases['configureoption'][$i]['attribs']; } return $releases['configureoption']; } return false; } /** * This is only used at install-time, after all serialization * is over. */ function resetFilelist() { $this->_packageInfo['filelist'] = array(); } /** * Retrieve a list of files that should be installed on this computer * @return array */ function getInstallationFilelist($forfilecheck = false) { $contents = $this->getFilelist(true); if (isset($contents['dir']['attribs']['baseinstalldir'])) { $base = $contents['dir']['attribs']['baseinstalldir']; } if (isset($this->_packageInfo['bundle'])) { return PEAR::raiseError( 'Exception: bundles should be handled in download code only'); } $release = $this->getReleases(); if ($release) { if (!isset($release[0])) { if (!isset($release['installconditions']) && !isset($release['filelist'])) { if ($forfilecheck) { return $this->getFilelist(); } return $contents; } $release = array($release); } $depchecker = &$this->getPEARDependency2($this->_config, array(), array('channel' => $this->getChannel(), 'package' => $this->getPackage()), PEAR_VALIDATE_INSTALLING); foreach ($release as $instance) { if (isset($instance['installconditions'])) { $installconditions = $instance['installconditions']; if (is_array($installconditions)) { PEAR::pushErrorHandling(PEAR_ERROR_RETURN); foreach ($installconditions as $type => $conditions) { if (!isset($conditions[0])) { $conditions = array($conditions); } foreach ($conditions as $condition) { $ret = $depchecker->{"validate{$type}Dependency"}($condition); if (PEAR::isError($ret)) { PEAR::popErrorHandling(); continue 3; // skip this release } } } PEAR::popErrorHandling(); } } // this is the release to use if (isset($instance['filelist'])) { // ignore files if (isset($instance['filelist']['ignore'])) { $ignore = isset($instance['filelist']['ignore'][0]) ? $instance['filelist']['ignore'] : array($instance['filelist']['ignore']); foreach ($ignore as $ig) { unset ($contents[$ig['attribs']['name']]); } } // install files as this name if (isset($instance['filelist']['install'])) { $installas = isset($instance['filelist']['install'][0]) ? $instance['filelist']['install'] : array($instance['filelist']['install']); foreach ($installas as $as) { $contents[$as['attribs']['name']]['attribs']['install-as'] = $as['attribs']['as']; } } } if ($forfilecheck) { foreach ($contents as $file => $attrs) { $contents[$file] = $attrs['attribs']; } } return $contents; } } else { // simple release - no installconditions or install-as if ($forfilecheck) { return $this->getFilelist(); } return $contents; } // no releases matched return PEAR::raiseError('No releases in package.xml matched the existing operating ' . 'system, extensions installed, or architecture, cannot install'); } /** * This is only used at install-time, after all serialization * is over. * @param string file name * @param string installed path */ function setInstalledAs($file, $path) { if ($path) { return $this->_packageInfo['filelist'][$file]['installed_as'] = $path; } unset($this->_packageInfo['filelist'][$file]['installed_as']); } function getInstalledLocation($file) { if (isset($this->_packageInfo['filelist'][$file]['installed_as'])) { return $this->_packageInfo['filelist'][$file]['installed_as']; } return false; } /** * This is only used at install-time, after all serialization * is over. */ function installedFile($file, $atts) { if (isset($this->_packageInfo['filelist'][$file])) { $this->_packageInfo['filelist'][$file] = array_merge($this->_packageInfo['filelist'][$file], $atts['attribs']); } else { $this->_packageInfo['filelist'][$file] = $atts['attribs']; } } /** * Retrieve the contents tag */ function getContents() { if (isset($this->_packageInfo['contents'])) { return $this->_packageInfo['contents']; } return false; } /** * @param string full path to file * @param string attribute name * @param string attribute value * @param int risky but fast - use this to choose a file based on its position in the list * of files. Index is zero-based like PHP arrays. * @return bool success of operation */ function setFileAttribute($filename, $attr, $value, $index = false) { $this->_isValid = 0; if (in_array($attr, array('role', 'name', 'baseinstalldir'))) { $this->_filesValid = false; } if ($index !== false && isset($this->_packageInfo['contents']['dir']['file'][$index]['attribs'])) { $this->_packageInfo['contents']['dir']['file'][$index]['attribs'][$attr] = $value; return true; } if (!isset($this->_packageInfo['contents']['dir']['file'])) { return false; } $files = $this->_packageInfo['contents']['dir']['file']; if (!isset($files[0])) { $files = array($files); $ind = false; } else { $ind = true; } foreach ($files as $i => $file) { if (isset($file['attribs'])) { if ($file['attribs']['name'] == $filename) { if ($ind) { $this->_packageInfo['contents']['dir']['file'][$i]['attribs'][$attr] = $value; } else { $this->_packageInfo['contents']['dir']['file']['attribs'][$attr] = $value; } return true; } } } return false; } function setDirtree($path) { if (!isset($this->_packageInfo['dirtree'])) { $this->_packageInfo['dirtree'] = array(); } $this->_packageInfo['dirtree'][$path] = true; } function getDirtree() { if (isset($this->_packageInfo['dirtree']) && count($this->_packageInfo['dirtree'])) { return $this->_packageInfo['dirtree']; } return false; } function resetDirtree() { unset($this->_packageInfo['dirtree']); } /** * Determines whether this package claims it is compatible with the version of * the package that has a recommended version dependency * @param PEAR_PackageFile_v2|PEAR_PackageFile_v1|PEAR_Downloader_Package * @return boolean */ function isCompatible($pf) { if (!isset($this->_packageInfo['compatible'])) { return false; } if (!isset($this->_packageInfo['channel'])) { return false; } $me = $pf->getVersion(); $compatible = $this->_packageInfo['compatible']; if (!isset($compatible[0])) { $compatible = array($compatible); } $found = false; foreach ($compatible as $info) { if (strtolower($info['name']) == strtolower($pf->getPackage())) { if (strtolower($info['channel']) == strtolower($pf->getChannel())) { $found = true; break; } } } if (!$found) { return false; } if (isset($info['exclude'])) { if (!isset($info['exclude'][0])) { $info['exclude'] = array($info['exclude']); } foreach ($info['exclude'] as $exclude) { if (version_compare($me, $exclude, '==')) { return false; } } } if (version_compare($me, $info['min'], '>=') && version_compare($me, $info['max'], '<=')) { return true; } return false; } /** * @return array|false */ function getCompatible() { if (isset($this->_packageInfo['compatible'])) { return $this->_packageInfo['compatible']; } return false; } function getDependencies() { if (isset($this->_packageInfo['dependencies'])) { return $this->_packageInfo['dependencies']; } return false; } function isSubpackageOf($p) { return $p->isSubpackage($this); } /** * Determines whether the passed in package is a subpackage of this package. * * No version checking is done, only name verification. * @param PEAR_PackageFile_v1|PEAR_PackageFile_v2 * @return bool */ function isSubpackage($p) { $sub = array(); if (isset($this->_packageInfo['dependencies']['required']['subpackage'])) { $sub = $this->_packageInfo['dependencies']['required']['subpackage']; if (!isset($sub[0])) { $sub = array($sub); } } if (isset($this->_packageInfo['dependencies']['optional']['subpackage'])) { $sub1 = $this->_packageInfo['dependencies']['optional']['subpackage']; if (!isset($sub1[0])) { $sub1 = array($sub1); } $sub = array_merge($sub, $sub1); } if (isset($this->_packageInfo['dependencies']['group'])) { $group = $this->_packageInfo['dependencies']['group']; if (!isset($group[0])) { $group = array($group); } foreach ($group as $deps) { if (isset($deps['subpackage'])) { $sub2 = $deps['subpackage']; if (!isset($sub2[0])) { $sub2 = array($sub2); } $sub = array_merge($sub, $sub2); } } } foreach ($sub as $dep) { if (strtolower($dep['name']) == strtolower($p->getPackage())) { if (isset($dep['channel'])) { if (strtolower($dep['channel']) == strtolower($p->getChannel())) { return true; } } else { if ($dep['uri'] == $p->getURI()) { return true; } } } } return false; } function dependsOn($package, $channel) { if (!($deps = $this->getDependencies())) { return false; } foreach (array('package', 'subpackage') as $type) { foreach (array('required', 'optional') as $needed) { if (isset($deps[$needed][$type])) { if (!isset($deps[$needed][$type][0])) { $deps[$needed][$type] = array($deps[$needed][$type]); } foreach ($deps[$needed][$type] as $dep) { $depchannel = isset($dep['channel']) ? $dep['channel'] : '__uri'; if (strtolower($dep['name']) == strtolower($package) && $depchannel == $channel) { return true; } } } } if (isset($deps['group'])) { if (!isset($deps['group'][0])) { $dep['group'] = array($deps['group']); } foreach ($deps['group'] as $group) { if (isset($group[$type])) { if (!is_array($group[$type])) { $group[$type] = array($group[$type]); } foreach ($group[$type] as $dep) { $depchannel = isset($dep['channel']) ? $dep['channel'] : '__uri'; if (strtolower($dep['name']) == strtolower($package) && $depchannel == $channel) { return true; } } } } } } return false; } /** * Get the contents of a dependency group * @param string * @return array|false */ function getDependencyGroup($name) { $name = strtolower($name); if (!isset($this->_packageInfo['dependencies']['group'])) { return false; } $groups = $this->_packageInfo['dependencies']['group']; if (!isset($groups[0])) { $groups = array($groups); } foreach ($groups as $group) { if (strtolower($group['attribs']['name']) == $name) { return $group; } } return false; } /** * Retrieve a partial package.xml 1.0 representation of dependencies * * a very limited representation of dependencies is returned by this method. * The tag for excluding certain versions of a dependency is * completely ignored. In addition, dependency groups are ignored, with the * assumption that all dependencies in dependency groups are also listed in * the optional group that work with all dependency groups * @param boolean return package.xml 2.0 tag * @return array|false */ function getDeps($raw = false, $nopearinstaller = false) { if (isset($this->_packageInfo['dependencies'])) { if ($raw) { return $this->_packageInfo['dependencies']; } $ret = array(); $map = array( 'php' => 'php', 'package' => 'pkg', 'subpackage' => 'pkg', 'extension' => 'ext', 'os' => 'os', 'pearinstaller' => 'pkg', ); foreach (array('required', 'optional') as $type) { $optional = ($type == 'optional') ? 'yes' : 'no'; if (!isset($this->_packageInfo['dependencies'][$type]) || empty($this->_packageInfo['dependencies'][$type])) { continue; } foreach ($this->_packageInfo['dependencies'][$type] as $dtype => $deps) { if ($dtype == 'pearinstaller' && $nopearinstaller) { continue; } if (!isset($deps[0])) { $deps = array($deps); } foreach ($deps as $dep) { if (!isset($map[$dtype])) { // no support for arch type continue; } if ($dtype == 'pearinstaller') { $dep['name'] = 'PEAR'; $dep['channel'] = 'pear.php.net'; } $s = array('type' => $map[$dtype]); if (isset($dep['channel'])) { $s['channel'] = $dep['channel']; } if (isset($dep['uri'])) { $s['uri'] = $dep['uri']; } if (isset($dep['name'])) { $s['name'] = $dep['name']; } if (isset($dep['conflicts'])) { $s['rel'] = 'not'; } else { if (!isset($dep['min']) && !isset($dep['max'])) { $s['rel'] = 'has'; $s['optional'] = $optional; } elseif (isset($dep['min']) && isset($dep['max'])) { $s['rel'] = 'ge'; $s1 = $s; $s1['rel'] = 'le'; $s['version'] = $dep['min']; $s1['version'] = $dep['max']; if (isset($dep['channel'])) { $s1['channel'] = $dep['channel']; } if ($dtype != 'php') { $s['name'] = $dep['name']; $s1['name'] = $dep['name']; } $s['optional'] = $optional; $s1['optional'] = $optional; $ret[] = $s1; } elseif (isset($dep['min'])) { if (isset($dep['exclude']) && $dep['exclude'] == $dep['min']) { $s['rel'] = 'gt'; } else { $s['rel'] = 'ge'; } $s['version'] = $dep['min']; $s['optional'] = $optional; if ($dtype != 'php') { $s['name'] = $dep['name']; } } elseif (isset($dep['max'])) { if (isset($dep['exclude']) && $dep['exclude'] == $dep['max']) { $s['rel'] = 'lt'; } else { $s['rel'] = 'le'; } $s['version'] = $dep['max']; $s['optional'] = $optional; if ($dtype != 'php') { $s['name'] = $dep['name']; } } } $ret[] = $s; } } } if (count($ret)) { return $ret; } } return false; } /** * @return php|extsrc|extbin|zendextsrc|zendextbin|bundle|false */ function getPackageType() { if (isset($this->_packageInfo['phprelease'])) { return 'php'; } if (isset($this->_packageInfo['extsrcrelease'])) { return 'extsrc'; } if (isset($this->_packageInfo['extbinrelease'])) { return 'extbin'; } if (isset($this->_packageInfo['zendextsrcrelease'])) { return 'zendextsrc'; } if (isset($this->_packageInfo['zendextbinrelease'])) { return 'zendextbin'; } if (isset($this->_packageInfo['bundle'])) { return 'bundle'; } return false; } /** * @return array|false */ function getReleases() { $type = $this->getPackageType(); if ($type != 'bundle') { $type .= 'release'; } if ($this->getPackageType() && isset($this->_packageInfo[$type])) { return $this->_packageInfo[$type]; } return false; } /** * @return array */ function getChangelog() { if (isset($this->_packageInfo['changelog'])) { return $this->_packageInfo['changelog']; } return false; } function hasDeps() { return isset($this->_packageInfo['dependencies']); } function getPackagexmlVersion() { if (isset($this->_packageInfo['zendextsrcrelease'])) { return '2.1'; } if (isset($this->_packageInfo['zendextbinrelease'])) { return '2.1'; } return '2.0'; } /** * @return array|false */ function getSourcePackage() { if (isset($this->_packageInfo['extbinrelease']) || isset($this->_packageInfo['zendextbinrelease'])) { return array('channel' => $this->_packageInfo['srcchannel'], 'package' => $this->_packageInfo['srcpackage']); } return false; } function getBundledPackages() { if (isset($this->_packageInfo['bundle'])) { return $this->_packageInfo['contents']['bundledpackage']; } return false; } function getLastModified() { if (isset($this->_packageInfo['_lastmodified'])) { return $this->_packageInfo['_lastmodified']; } return false; } /** * Get the contents of a file listed within the package.xml * @param string * @return string */ function getFileContents($file) { if ($this->_archiveFile == $this->_packageFile) { // unpacked $dir = dirname($this->_packageFile); $file = $dir . DIRECTORY_SEPARATOR . $file; $file = str_replace(array('/', '\\'), array(DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR), $file); if (file_exists($file) && is_readable($file)) { return implode('', file($file)); } } else { // tgz $tar = new Archive_Tar($this->_archiveFile); $tar->pushErrorHandling(PEAR_ERROR_RETURN); if ($file != 'package.xml' && $file != 'package2.xml') { $file = $this->getPackage() . '-' . $this->getVersion() . '/' . $file; } $file = $tar->extractInString($file); $tar->popErrorHandling(); if (PEAR::isError($file)) { return PEAR::raiseError("Cannot locate file '$file' in archive"); } return $file; } } function &getRW() { if (!class_exists('PEAR_PackageFile_v2_rw')) { require_once 'PEAR/PackageFile/v2/rw.php'; } $a = new PEAR_PackageFile_v2_rw; foreach (get_object_vars($this) as $name => $unused) { if (!isset($this->$name)) { continue; } if ($name == '_config' || $name == '_logger'|| $name == '_registry' || $name == '_stack') { $a->$name = &$this->$name; } else { $a->$name = $this->$name; } } return $a; } function &getDefaultGenerator() { if (!class_exists('PEAR_PackageFile_Generator_v2')) { require_once 'PEAR/PackageFile/Generator/v2.php'; } $a = new PEAR_PackageFile_Generator_v2($this); return $a; } function analyzeSourceCode($file, $string = false) { if (!isset($this->_v2Validator) || !is_a($this->_v2Validator, 'PEAR_PackageFile_v2_Validator')) { if (!class_exists('PEAR_PackageFile_v2_Validator')) { require_once 'PEAR/PackageFile/v2/Validator.php'; } $this->_v2Validator = new PEAR_PackageFile_v2_Validator; } return $this->_v2Validator->analyzeSourceCode($file, $string); } function validate($state = PEAR_VALIDATE_NORMAL) { if (!isset($this->_packageInfo) || !is_array($this->_packageInfo)) { return false; } if (!isset($this->_v2Validator) || !is_a($this->_v2Validator, 'PEAR_PackageFile_v2_Validator')) { if (!class_exists('PEAR_PackageFile_v2_Validator')) { require_once 'PEAR/PackageFile/v2/Validator.php'; } $this->_v2Validator = new PEAR_PackageFile_v2_Validator; } if (isset($this->_packageInfo['xsdversion'])) { unset($this->_packageInfo['xsdversion']); } return $this->_v2Validator->validate($this, $state); } function getTasksNs() { if (!isset($this->_tasksNs)) { if (isset($this->_packageInfo['attribs'])) { foreach ($this->_packageInfo['attribs'] as $name => $value) { if ($value == 'http://pear.php.net/dtd/tasks-1.0') { $this->_tasksNs = str_replace('xmlns:', '', $name); break; } } } } return $this->_tasksNs; } /** * Determine whether a task name is a valid task. Custom tasks may be defined * using subdirectories by putting a "-" in the name, as in * * Note that this method will auto-load the task class file and test for the existence * of the name with "-" replaced by "_" as in PEAR/Task/mycustom/task.php makes class * PEAR_Task_mycustom_task * @param string * @return boolean */ function getTask($task) { $this->getTasksNs(); // transform all '-' to '/' and 'tasks:' to '' so tasks:replace becomes replace $task = str_replace(array($this->_tasksNs . ':', '-'), array('', ' '), $task); $taskfile = str_replace(' ', '/', ucwords($task)); $task = str_replace(array(' ', '/'), '_', ucwords($task)); if (class_exists("PEAR_Task_$task")) { return "PEAR_Task_$task"; } $fp = @fopen("PEAR/Task/$taskfile.php", 'r', true); if ($fp) { fclose($fp); require_once "PEAR/Task/$taskfile.php"; return "PEAR_Task_$task"; } return false; } /** * Key-friendly array_splice * @param tagname to splice a value in before * @param mixed the value to splice in * @param string the new tag name */ function _ksplice($array, $key, $value, $newkey) { $offset = array_search($key, array_keys($array)); $after = array_slice($array, $offset); $before = array_slice($array, 0, $offset); $before[$newkey] = $value; return array_merge($before, $after); } /** * @param array a list of possible keys, in the order they may occur * @param mixed contents of the new package.xml tag * @param string tag name * @access private */ function _insertBefore($array, $keys, $contents, $newkey) { foreach ($keys as $key) { if (isset($array[$key])) { return $array = $this->_ksplice($array, $key, $contents, $newkey); } } $array[$newkey] = $contents; return $array; } /** * @param subsection of {@link $_packageInfo} * @param array|string tag contents * @param array format: *
     * array(
     *   tagname => array(list of tag names that follow this one),
     *   childtagname => array(list of child tag names that follow this one),
     * )
     * 
* * This allows construction of nested tags * @access private */ function _mergeTag($manip, $contents, $order) { if (count($order)) { foreach ($order as $tag => $curorder) { if (!isset($manip[$tag])) { // ensure that the tag is set up $manip = $this->_insertBefore($manip, $curorder, array(), $tag); } if (count($order) > 1) { $manip[$tag] = $this->_mergeTag($manip[$tag], $contents, array_slice($order, 1)); return $manip; } } } else { return $manip; } if (is_array($manip[$tag]) && !empty($manip[$tag]) && isset($manip[$tag][0])) { $manip[$tag][] = $contents; } else { if (!count($manip[$tag])) { $manip[$tag] = $contents; } else { $manip[$tag] = array($manip[$tag]); $manip[$tag][] = $contents; } } return $manip; } } ?> php-pear-1.10.1+submodules+notgz/PEAR/PackageFile/v2/000077500000000000000000000000001262614675700220525ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/PEAR/PackageFile/v2/Validator.php000066400000000000000000002462461262614675700245260ustar00rootroot00000000000000 * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a8 */ /** * Private validation class used by PEAR_PackageFile_v2 - do not use directly, its * sole purpose is to split up the PEAR/PackageFile/v2.php file to make it smaller * @category pear * @package PEAR * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version Release: @package_version@ * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a8 * @access private */ class PEAR_PackageFile_v2_Validator { /** * @var array */ var $_packageInfo; /** * @var PEAR_PackageFile_v2 */ var $_pf; /** * @var PEAR_ErrorStack */ var $_stack; /** * @var int */ var $_isValid = 0; /** * @var int */ var $_filesValid = 0; /** * @var int */ var $_curState = 0; /** * @param PEAR_PackageFile_v2 * @param int */ function validate(&$pf, $state = PEAR_VALIDATE_NORMAL) { $this->_pf = &$pf; $this->_curState = $state; $this->_packageInfo = $this->_pf->getArray(); $this->_isValid = $this->_pf->_isValid; $this->_filesValid = $this->_pf->_filesValid; $this->_stack = &$pf->_stack; $this->_stack->getErrors(true); if (($this->_isValid & $state) == $state) { return true; } if (!isset($this->_packageInfo) || !is_array($this->_packageInfo)) { return false; } if (!isset($this->_packageInfo['attribs']['version']) || ($this->_packageInfo['attribs']['version'] != '2.0' && $this->_packageInfo['attribs']['version'] != '2.1') ) { $this->_noPackageVersion(); } $structure = array( 'name', 'channel|uri', '*extends', // can't be multiple, but this works fine 'summary', 'description', '+lead', // these all need content checks '*developer', '*contributor', '*helper', 'date', '*time', 'version', 'stability', 'license->?uri->?filesource', 'notes', 'contents', //special validation needed '*compatible', 'dependencies', //special validation needed '*usesrole', '*usestask', // reserve these for 1.4.0a1 to implement // this will allow a package.xml to gracefully say it // needs a certain package installed in order to implement a role or task '*providesextension', '*srcpackage|*srcuri', '+phprelease|+extsrcrelease|+extbinrelease|' . '+zendextsrcrelease|+zendextbinrelease|bundle', //special validation needed '*changelog', ); $test = $this->_packageInfo; if (isset($test['dependencies']) && isset($test['dependencies']['required']) && isset($test['dependencies']['required']['pearinstaller']) && isset($test['dependencies']['required']['pearinstaller']['min']) && '@package_version@' != '@package' . '_version@' && version_compare('@package_version@', $test['dependencies']['required']['pearinstaller']['min'], '<') ) { $this->_pearVersionTooLow($test['dependencies']['required']['pearinstaller']['min']); return false; } // ignore post-installation array fields if (array_key_exists('filelist', $test)) { unset($test['filelist']); } if (array_key_exists('_lastmodified', $test)) { unset($test['_lastmodified']); } if (array_key_exists('#binarypackage', $test)) { unset($test['#binarypackage']); } if (array_key_exists('old', $test)) { unset($test['old']); } if (array_key_exists('_lastversion', $test)) { unset($test['_lastversion']); } if (!$this->_stupidSchemaValidate($structure, $test, '')) { return false; } if (empty($this->_packageInfo['name'])) { $this->_tagCannotBeEmpty('name'); } $test = isset($this->_packageInfo['uri']) ? 'uri' :'channel'; if (empty($this->_packageInfo[$test])) { $this->_tagCannotBeEmpty($test); } if (is_array($this->_packageInfo['license']) && (!isset($this->_packageInfo['license']['_content']) || empty($this->_packageInfo['license']['_content']))) { $this->_tagCannotBeEmpty('license'); } elseif (empty($this->_packageInfo['license'])) { $this->_tagCannotBeEmpty('license'); } if (empty($this->_packageInfo['summary'])) { $this->_tagCannotBeEmpty('summary'); } if (empty($this->_packageInfo['description'])) { $this->_tagCannotBeEmpty('description'); } if (empty($this->_packageInfo['date'])) { $this->_tagCannotBeEmpty('date'); } if (empty($this->_packageInfo['notes'])) { $this->_tagCannotBeEmpty('notes'); } if (isset($this->_packageInfo['time']) && empty($this->_packageInfo['time'])) { $this->_tagCannotBeEmpty('time'); } if (isset($this->_packageInfo['dependencies'])) { $this->_validateDependencies(); } if (isset($this->_packageInfo['compatible'])) { $this->_validateCompatible(); } if (!isset($this->_packageInfo['bundle'])) { if (empty($this->_packageInfo['contents'])) { $this->_tagCannotBeEmpty('contents'); } if (!isset($this->_packageInfo['contents']['dir'])) { $this->_filelistMustContainDir('contents'); return false; } if (isset($this->_packageInfo['contents']['file'])) { $this->_filelistCannotContainFile('contents'); return false; } } $this->_validateMaintainers(); $this->_validateStabilityVersion(); $fail = false; if (array_key_exists('usesrole', $this->_packageInfo)) { $roles = $this->_packageInfo['usesrole']; if (!is_array($roles) || !isset($roles[0])) { $roles = array($roles); } foreach ($roles as $role) { if (!isset($role['role'])) { $this->_usesroletaskMustHaveRoleTask('usesrole', 'role'); $fail = true; } else { if (!isset($role['channel'])) { if (!isset($role['uri'])) { $this->_usesroletaskMustHaveChannelOrUri($role['role'], 'usesrole'); $fail = true; } } elseif (!isset($role['package'])) { $this->_usesroletaskMustHavePackage($role['role'], 'usesrole'); $fail = true; } } } } if (array_key_exists('usestask', $this->_packageInfo)) { $roles = $this->_packageInfo['usestask']; if (!is_array($roles) || !isset($roles[0])) { $roles = array($roles); } foreach ($roles as $role) { if (!isset($role['task'])) { $this->_usesroletaskMustHaveRoleTask('usestask', 'task'); $fail = true; } else { if (!isset($role['channel'])) { if (!isset($role['uri'])) { $this->_usesroletaskMustHaveChannelOrUri($role['task'], 'usestask'); $fail = true; } } elseif (!isset($role['package'])) { $this->_usesroletaskMustHavePackage($role['task'], 'usestask'); $fail = true; } } } } if ($fail) { return false; } $list = $this->_packageInfo['contents']; if (isset($list['dir']) && is_array($list['dir']) && isset($list['dir'][0])) { $this->_multipleToplevelDirNotAllowed(); return $this->_isValid = 0; } $this->_validateFilelist(); $this->_validateRelease(); if (!$this->_stack->hasErrors()) { $chan = $this->_pf->_registry->getChannel($this->_pf->getChannel(), true); if (PEAR::isError($chan)) { $this->_unknownChannel($this->_pf->getChannel()); } else { $valpack = $chan->getValidationPackage(); // for channel validator packages, always use the default PEAR validator. // otherwise, they can't be installed or packaged $validator = $chan->getValidationObject($this->_pf->getPackage()); if (!$validator) { $this->_stack->push(__FUNCTION__, 'error', array('channel' => $chan->getName(), 'package' => $this->_pf->getPackage(), 'name' => $valpack['_content'], 'version' => $valpack['attribs']['version']), 'package "%channel%/%package%" cannot be properly validated without ' . 'validation package "%channel%/%name%-%version%"'); return $this->_isValid = 0; } $validator->setPackageFile($this->_pf); $validator->validate($state); $failures = $validator->getFailures(); foreach ($failures['errors'] as $error) { $this->_stack->push(__FUNCTION__, 'error', $error, 'Channel validator error: field "%field%" - %reason%'); } foreach ($failures['warnings'] as $warning) { $this->_stack->push(__FUNCTION__, 'warning', $warning, 'Channel validator warning: field "%field%" - %reason%'); } } } $this->_pf->_isValid = $this->_isValid = !$this->_stack->hasErrors('error'); if ($this->_isValid && $state == PEAR_VALIDATE_PACKAGING && !$this->_filesValid) { if ($this->_pf->getPackageType() == 'bundle') { if ($this->_analyzeBundledPackages()) { $this->_filesValid = $this->_pf->_filesValid = true; } else { $this->_pf->_isValid = $this->_isValid = 0; } } else { if (!$this->_analyzePhpFiles()) { $this->_pf->_isValid = $this->_isValid = 0; } else { $this->_filesValid = $this->_pf->_filesValid = true; } } } if ($this->_isValid) { return $this->_pf->_isValid = $this->_isValid = $state; } return $this->_pf->_isValid = $this->_isValid = 0; } function _stupidSchemaValidate($structure, $xml, $root) { if (!is_array($xml)) { $xml = array(); } $keys = array_keys($xml); reset($keys); $key = current($keys); while ($key == 'attribs' || $key == '_contents') { $key = next($keys); } $unfoundtags = $optionaltags = array(); $ret = true; $mismatch = false; foreach ($structure as $struc) { if ($key) { $tag = $xml[$key]; } $test = $this->_processStructure($struc); if (isset($test['choices'])) { $loose = true; foreach ($test['choices'] as $choice) { if ($key == $choice['tag']) { $key = next($keys); while ($key == 'attribs' || $key == '_contents') { $key = next($keys); } $unfoundtags = $optionaltags = array(); $mismatch = false; if ($key && $key != $choice['tag'] && isset($choice['multiple'])) { $unfoundtags[] = $choice['tag']; $optionaltags[] = $choice['tag']; if ($key) { $mismatch = true; } } $ret &= $this->_processAttribs($choice, $tag, $root); continue 2; } else { $unfoundtags[] = $choice['tag']; $mismatch = true; } if (!isset($choice['multiple']) || $choice['multiple'] != '*') { $loose = false; } else { $optionaltags[] = $choice['tag']; } } if (!$loose) { $this->_invalidTagOrder($unfoundtags, $key, $root); return false; } } else { if ($key != $test['tag']) { if (isset($test['multiple']) && $test['multiple'] != '*') { $unfoundtags[] = $test['tag']; $this->_invalidTagOrder($unfoundtags, $key, $root); return false; } else { if ($key) { $mismatch = true; } $unfoundtags[] = $test['tag']; $optionaltags[] = $test['tag']; } if (!isset($test['multiple'])) { $this->_invalidTagOrder($unfoundtags, $key, $root); return false; } continue; } else { $unfoundtags = $optionaltags = array(); $mismatch = false; } $key = next($keys); while ($key == 'attribs' || $key == '_contents') { $key = next($keys); } if ($key && $key != $test['tag'] && isset($test['multiple'])) { $unfoundtags[] = $test['tag']; $optionaltags[] = $test['tag']; $mismatch = true; } $ret &= $this->_processAttribs($test, $tag, $root); continue; } } if (!$mismatch && count($optionaltags)) { // don't error out on any optional tags $unfoundtags = array_diff($unfoundtags, $optionaltags); } if (count($unfoundtags)) { $this->_invalidTagOrder($unfoundtags, $key, $root); } elseif ($key) { // unknown tags $this->_invalidTagOrder('*no tags allowed here*', $key, $root); while ($key = next($keys)) { $this->_invalidTagOrder('*no tags allowed here*', $key, $root); } } return $ret; } function _processAttribs($choice, $tag, $context) { if (isset($choice['attribs'])) { if (!is_array($tag)) { $tag = array($tag); } $tags = $tag; if (!isset($tags[0])) { $tags = array($tags); } $ret = true; foreach ($tags as $i => $tag) { if (!is_array($tag) || !isset($tag['attribs'])) { foreach ($choice['attribs'] as $attrib) { if ($attrib{0} != '?') { $ret &= $this->_tagHasNoAttribs($choice['tag'], $context); continue 2; } } } foreach ($choice['attribs'] as $attrib) { if ($attrib{0} != '?') { if (!isset($tag['attribs'][$attrib])) { $ret &= $this->_tagMissingAttribute($choice['tag'], $attrib, $context); } } } } return $ret; } return true; } function _processStructure($key) { $ret = array(); if (count($pieces = explode('|', $key)) > 1) { $ret['choices'] = array(); foreach ($pieces as $piece) { $ret['choices'][] = $this->_processStructure($piece); } return $ret; } $multi = $key{0}; if ($multi == '+' || $multi == '*') { $ret['multiple'] = $key{0}; $key = substr($key, 1); } if (count($attrs = explode('->', $key)) > 1) { $ret['tag'] = array_shift($attrs); $ret['attribs'] = $attrs; } else { $ret['tag'] = $key; } return $ret; } function _validateStabilityVersion() { $structure = array('release', 'api'); $a = $this->_stupidSchemaValidate($structure, $this->_packageInfo['version'], ''); $a &= $this->_stupidSchemaValidate($structure, $this->_packageInfo['stability'], ''); if ($a) { if (!preg_match('/^\d+(?:\.\d+)*(?:[a-zA-Z]+\d*)?\\z/', $this->_packageInfo['version']['release'])) { $this->_invalidVersion('release', $this->_packageInfo['version']['release']); } if (!preg_match('/^\d+(?:\.\d+)*(?:[a-zA-Z]+\d*)?\\z/', $this->_packageInfo['version']['api'])) { $this->_invalidVersion('api', $this->_packageInfo['version']['api']); } if (!in_array($this->_packageInfo['stability']['release'], array('snapshot', 'devel', 'alpha', 'beta', 'stable'))) { $this->_invalidState('release', $this->_packageInfo['stability']['release']); } if (!in_array($this->_packageInfo['stability']['api'], array('devel', 'alpha', 'beta', 'stable'))) { $this->_invalidState('api', $this->_packageInfo['stability']['api']); } } } function _validateMaintainers() { $structure = array( 'name', 'user', 'email', 'active', ); foreach (array('lead', 'developer', 'contributor', 'helper') as $type) { if (!isset($this->_packageInfo[$type])) { continue; } if (isset($this->_packageInfo[$type][0])) { foreach ($this->_packageInfo[$type] as $lead) { $this->_stupidSchemaValidate($structure, $lead, '<' . $type . '>'); } } else { $this->_stupidSchemaValidate($structure, $this->_packageInfo[$type], '<' . $type . '>'); } } } function _validatePhpDep($dep, $installcondition = false) { $structure = array( 'min', '*max', '*exclude', ); $type = $installcondition ? '' : ''; $this->_stupidSchemaValidate($structure, $dep, $type); if (isset($dep['min'])) { if (!preg_match('/^\d+(?:\.\d+)*(?:[a-zA-Z]+\d*)?(?:-[a-zA-Z0-9]+)?\\z/', $dep['min'])) { $this->_invalidVersion($type . '', $dep['min']); } } if (isset($dep['max'])) { if (!preg_match('/^\d+(?:\.\d+)*(?:[a-zA-Z]+\d*)?(?:-[a-zA-Z0-9]+)?\\z/', $dep['max'])) { $this->_invalidVersion($type . '', $dep['max']); } } if (isset($dep['exclude'])) { if (!is_array($dep['exclude'])) { $dep['exclude'] = array($dep['exclude']); } foreach ($dep['exclude'] as $exclude) { if (!preg_match( '/^\d+(?:\.\d+)*(?:[a-zA-Z]+\d*)?(?:-[a-zA-Z0-9]+)?\\z/', $exclude)) { $this->_invalidVersion($type . '', $exclude); } } } } function _validatePearinstallerDep($dep) { $structure = array( 'min', '*max', '*recommended', '*exclude', ); $this->_stupidSchemaValidate($structure, $dep, ''); if (isset($dep['min'])) { if (!preg_match('/^\d+(?:\.\d+)*(?:[a-zA-Z]+\d*)?\\z/', $dep['min'])) { $this->_invalidVersion('', $dep['min']); } } if (isset($dep['max'])) { if (!preg_match('/^\d+(?:\.\d+)*(?:[a-zA-Z]+\d*)?\\z/', $dep['max'])) { $this->_invalidVersion('', $dep['max']); } } if (isset($dep['recommended'])) { if (!preg_match('/^\d+(?:\.\d+)*(?:[a-zA-Z]+\d*)?\\z/', $dep['recommended'])) { $this->_invalidVersion('', $dep['recommended']); } } if (isset($dep['exclude'])) { if (!is_array($dep['exclude'])) { $dep['exclude'] = array($dep['exclude']); } foreach ($dep['exclude'] as $exclude) { if (!preg_match('/^\d+(?:\.\d+)*(?:[a-zA-Z]+\d*)?\\z/', $exclude)) { $this->_invalidVersion('', $exclude); } } } } function _validatePackageDep($dep, $group, $type = '') { if (isset($dep['uri'])) { if (isset($dep['conflicts'])) { $structure = array( 'name', 'uri', 'conflicts', '*providesextension', ); } else { $structure = array( 'name', 'uri', '*providesextension', ); } } else { if (isset($dep['conflicts'])) { $structure = array( 'name', 'channel', '*min', '*max', '*exclude', 'conflicts', '*providesextension', ); } else { $structure = array( 'name', 'channel', '*min', '*max', '*recommended', '*exclude', '*nodefault', '*providesextension', ); } } if (isset($dep['name'])) { $type .= '' . $dep['name'] . ''; } $this->_stupidSchemaValidate($structure, $dep, '' . $group . $type); if (isset($dep['uri']) && (isset($dep['min']) || isset($dep['max']) || isset($dep['recommended']) || isset($dep['exclude']))) { $this->_uriDepsCannotHaveVersioning('' . $group . $type); } if (isset($dep['channel']) && strtolower($dep['channel']) == '__uri') { $this->_DepchannelCannotBeUri('' . $group . $type); } if (isset($dep['min'])) { if (!preg_match('/^\d+(?:\.\d+)*(?:[a-zA-Z]+\d*)?\\z/', $dep['min'])) { $this->_invalidVersion('' . $group . $type . '', $dep['min']); } } if (isset($dep['max'])) { if (!preg_match('/^\d+(?:\.\d+)*(?:[a-zA-Z]+\d*)?\\z/', $dep['max'])) { $this->_invalidVersion('' . $group . $type . '', $dep['max']); } } if (isset($dep['recommended'])) { if (!preg_match('/^\d+(?:\.\d+)*(?:[a-zA-Z]+\d*)?\\z/', $dep['recommended'])) { $this->_invalidVersion('' . $group . $type . '', $dep['recommended']); } } if (isset($dep['exclude'])) { if (!is_array($dep['exclude'])) { $dep['exclude'] = array($dep['exclude']); } foreach ($dep['exclude'] as $exclude) { if (!preg_match('/^\d+(?:\.\d+)*(?:[a-zA-Z]+\d*)?\\z/', $exclude)) { $this->_invalidVersion('' . $group . $type . '', $exclude); } } } } function _validateSubpackageDep($dep, $group) { $this->_validatePackageDep($dep, $group, ''); if (isset($dep['providesextension'])) { $this->_subpackageCannotProvideExtension(isset($dep['name']) ? $dep['name'] : ''); } if (isset($dep['conflicts'])) { $this->_subpackagesCannotConflict(isset($dep['name']) ? $dep['name'] : ''); } } function _validateExtensionDep($dep, $group = false, $installcondition = false) { if (isset($dep['conflicts'])) { $structure = array( 'name', '*min', '*max', '*exclude', 'conflicts', ); } else { $structure = array( 'name', '*min', '*max', '*recommended', '*exclude', ); } if ($installcondition) { $type = ''; } else { $type = '' . $group . ''; } if (isset($dep['name'])) { $type .= '' . $dep['name'] . ''; } $this->_stupidSchemaValidate($structure, $dep, $type); if (isset($dep['min'])) { if (!preg_match('/^\d+(?:\.\d+)*(?:[a-zA-Z]+\d*)?\\z/', $dep['min'])) { $this->_invalidVersion(substr($type, 1) . '_invalidVersion(substr($type, 1) . '_invalidVersion(substr($type, 1) . '_invalidVersion(substr($type, 1) . '' : ''; if ($this->_stupidSchemaValidate($structure, $dep, $type)) { if ($dep['name'] == '*') { if (array_key_exists('conflicts', $dep)) { $this->_cannotConflictWithAllOs($type); } } } } function _validateArchDep($dep, $installcondition = false) { $structure = array( 'pattern', '*conflicts', ); $type = $installcondition ? '' : ''; $this->_stupidSchemaValidate($structure, $dep, $type); } function _validateInstallConditions($cond, $release) { $structure = array( '*php', '*extension', '*os', '*arch', ); if (!$this->_stupidSchemaValidate($structure, $cond, $release)) { return false; } foreach (array('php', 'extension', 'os', 'arch') as $type) { if (isset($cond[$type])) { $iter = $cond[$type]; if (!is_array($iter) || !isset($iter[0])) { $iter = array($iter); } foreach ($iter as $package) { if ($type == 'extension') { $this->{"_validate{$type}Dep"}($package, false, true); } else { $this->{"_validate{$type}Dep"}($package, true); } } } } } function _validateDependencies() { $structure = array( 'required', '*optional', '*group->name->hint' ); if (!$this->_stupidSchemaValidate($structure, $this->_packageInfo['dependencies'], '')) { return false; } foreach (array('required', 'optional') as $simpledep) { if (isset($this->_packageInfo['dependencies'][$simpledep])) { if ($simpledep == 'optional') { $structure = array( '*package', '*subpackage', '*extension', ); } else { $structure = array( 'php', 'pearinstaller', '*package', '*subpackage', '*extension', '*os', '*arch', ); } if ($this->_stupidSchemaValidate($structure, $this->_packageInfo['dependencies'][$simpledep], "<$simpledep>")) { foreach (array('package', 'subpackage', 'extension') as $type) { if (isset($this->_packageInfo['dependencies'][$simpledep][$type])) { $iter = $this->_packageInfo['dependencies'][$simpledep][$type]; if (!isset($iter[0])) { $iter = array($iter); } foreach ($iter as $package) { if ($type != 'extension') { if (isset($package['uri'])) { if (isset($package['channel'])) { $this->_UrlOrChannel($type, $package['name']); } } else { if (!isset($package['channel'])) { $this->_NoChannel($type, $package['name']); } } } $this->{"_validate{$type}Dep"}($package, "<$simpledep>"); } } } if ($simpledep == 'optional') { continue; } foreach (array('php', 'pearinstaller', 'os', 'arch') as $type) { if (isset($this->_packageInfo['dependencies'][$simpledep][$type])) { $iter = $this->_packageInfo['dependencies'][$simpledep][$type]; if (!isset($iter[0])) { $iter = array($iter); } foreach ($iter as $package) { $this->{"_validate{$type}Dep"}($package); } } } } } } if (isset($this->_packageInfo['dependencies']['group'])) { $groups = $this->_packageInfo['dependencies']['group']; if (!isset($groups[0])) { $groups = array($groups); } $structure = array( '*package', '*subpackage', '*extension', ); foreach ($groups as $group) { if ($this->_stupidSchemaValidate($structure, $group, '')) { if (!PEAR_Validate::validGroupName($group['attribs']['name'])) { $this->_invalidDepGroupName($group['attribs']['name']); } foreach (array('package', 'subpackage', 'extension') as $type) { if (isset($group[$type])) { $iter = $group[$type]; if (!isset($iter[0])) { $iter = array($iter); } foreach ($iter as $package) { if ($type != 'extension') { if (isset($package['uri'])) { if (isset($package['channel'])) { $this->_UrlOrChannelGroup($type, $package['name'], $group['name']); } } else { if (!isset($package['channel'])) { $this->_NoChannelGroup($type, $package['name'], $group['name']); } } } $this->{"_validate{$type}Dep"}($package, ''); } } } } } } } function _validateCompatible() { $compat = $this->_packageInfo['compatible']; if (!isset($compat[0])) { $compat = array($compat); } $required = array('name', 'channel', 'min', 'max', '*exclude'); foreach ($compat as $package) { $type = ''; if (is_array($package) && array_key_exists('name', $package)) { $type .= '' . $package['name'] . ''; } $this->_stupidSchemaValidate($required, $package, $type); if (is_array($package) && array_key_exists('min', $package)) { if (!preg_match('/^\d+(?:\.\d+)*(?:[a-zA-Z]+\d*)?\\z/', $package['min'])) { $this->_invalidVersion(substr($type, 1) . '_invalidVersion(substr($type, 1) . '_invalidVersion(substr($type, 1) . '_NoBundledPackages(); } if (!is_array($list['bundledpackage']) || !isset($list['bundledpackage'][0])) { return $this->_AtLeast2BundledPackages(); } foreach ($list['bundledpackage'] as $package) { if (!is_string($package)) { $this->_bundledPackagesMustBeFilename(); } } } function _validateFilelist($list = false, $allowignore = false, $dirs = '') { $iscontents = false; if (!$list) { $iscontents = true; $list = $this->_packageInfo['contents']; if (isset($this->_packageInfo['bundle'])) { return $this->_validateBundle($list); } } if ($allowignore) { $struc = array( '*install->name->as', '*ignore->name' ); } else { $struc = array( '*dir->name->?baseinstalldir', '*file->name->role->?baseinstalldir->?md5sum' ); if (isset($list['dir']) && isset($list['file'])) { // stave off validation errors without requiring a set order. $_old = $list; if (isset($list['attribs'])) { $list = array('attribs' => $_old['attribs']); } $list['dir'] = $_old['dir']; $list['file'] = $_old['file']; } } if (!isset($list['attribs']) || !isset($list['attribs']['name'])) { $unknown = $allowignore ? '' : ''; $dirname = $iscontents ? '' : $unknown; } else { $dirname = ''; if (preg_match('~/\.\.?(/|\\z)|^\.\.?/~', str_replace('\\', '/', $list['attribs']['name']))) { // file contains .. parent directory or . cur directory $this->_invalidDirName($list['attribs']['name']); } } $res = $this->_stupidSchemaValidate($struc, $list, $dirname); if ($allowignore && $res) { $ignored_or_installed = array(); $this->_pf->getFilelist(); $fcontents = $this->_pf->getContents(); $filelist = array(); if (!isset($fcontents['dir']['file'][0])) { $fcontents['dir']['file'] = array($fcontents['dir']['file']); } foreach ($fcontents['dir']['file'] as $file) { $filelist[$file['attribs']['name']] = true; } if (isset($list['install'])) { if (!isset($list['install'][0])) { $list['install'] = array($list['install']); } foreach ($list['install'] as $file) { if (!isset($filelist[$file['attribs']['name']])) { $this->_notInContents($file['attribs']['name'], 'install'); continue; } if (array_key_exists($file['attribs']['name'], $ignored_or_installed)) { $this->_multipleInstallAs($file['attribs']['name']); } if (!isset($ignored_or_installed[$file['attribs']['name']])) { $ignored_or_installed[$file['attribs']['name']] = array(); } $ignored_or_installed[$file['attribs']['name']][] = 1; if (preg_match('~/\.\.?(/|\\z)|^\.\.?/~', str_replace('\\', '/', $file['attribs']['as']))) { // file contains .. parent directory or . cur directory references $this->_invalidFileInstallAs($file['attribs']['name'], $file['attribs']['as']); } } } if (isset($list['ignore'])) { if (!isset($list['ignore'][0])) { $list['ignore'] = array($list['ignore']); } foreach ($list['ignore'] as $file) { if (!isset($filelist[$file['attribs']['name']])) { $this->_notInContents($file['attribs']['name'], 'ignore'); continue; } if (array_key_exists($file['attribs']['name'], $ignored_or_installed)) { $this->_ignoreAndInstallAs($file['attribs']['name']); } } } } if (!$allowignore && isset($list['file'])) { if (is_string($list['file'])) { $this->_oldStyleFileNotAllowed(); return false; } if (!isset($list['file'][0])) { // single file $list['file'] = array($list['file']); } foreach ($list['file'] as $i => $file) { if (isset($file['attribs']) && isset($file['attribs']['name'])) { if ($file['attribs']['name']{0} == '.' && $file['attribs']['name']{1} == '/') { // name is something like "./doc/whatever.txt" $this->_invalidFileName($file['attribs']['name'], $dirname); } if (preg_match('~/\.\.?(/|\\z)|^\.\.?/~', str_replace('\\', '/', $file['attribs']['name']))) { // file contains .. parent directory or . cur directory $this->_invalidFileName($file['attribs']['name'], $dirname); } } if (isset($file['attribs']) && isset($file['attribs']['role'])) { if (!$this->_validateRole($file['attribs']['role'])) { if (isset($this->_packageInfo['usesrole'])) { $roles = $this->_packageInfo['usesrole']; if (!isset($roles[0])) { $roles = array($roles); } foreach ($roles as $role) { if ($role['role'] = $file['attribs']['role']) { $msg = 'This package contains role "%role%" and requires ' . 'package "%package%" to be used'; if (isset($role['uri'])) { $params = array('role' => $role['role'], 'package' => $role['uri']); } else { $params = array('role' => $role['role'], 'package' => $this->_pf->_registry-> parsedPackageNameToString(array('package' => $role['package'], 'channel' => $role['channel']), true)); } $this->_stack->push('_mustInstallRole', 'error', $params, $msg); } } } $this->_invalidFileRole($file['attribs']['name'], $dirname, $file['attribs']['role']); } } if (!isset($file['attribs'])) { continue; } $save = $file['attribs']; if ($dirs) { $save['name'] = $dirs . '/' . $save['name']; } unset($file['attribs']); if (count($file) && $this->_curState != PEAR_VALIDATE_DOWNLOADING) { // has tasks foreach ($file as $task => $value) { if ($tagClass = $this->_pf->getTask($task)) { if (!is_array($value) || !isset($value[0])) { $value = array($value); } foreach ($value as $v) { $ret = call_user_func(array($tagClass, 'validateXml'), $this->_pf, $v, $this->_pf->_config, $save); if (is_array($ret)) { $this->_invalidTask($task, $ret, isset($save['name']) ? $save['name'] : ''); } } } else { if (isset($this->_packageInfo['usestask'])) { $roles = $this->_packageInfo['usestask']; if (!isset($roles[0])) { $roles = array($roles); } foreach ($roles as $role) { if ($role['task'] = $task) { $msg = 'This package contains task "%task%" and requires ' . 'package "%package%" to be used'; if (isset($role['uri'])) { $params = array('task' => $role['task'], 'package' => $role['uri']); } else { $params = array('task' => $role['task'], 'package' => $this->_pf->_registry-> parsedPackageNameToString(array('package' => $role['package'], 'channel' => $role['channel']), true)); } $this->_stack->push('_mustInstallTask', 'error', $params, $msg); } } } $this->_unknownTask($task, $save['name']); } } } } } if (isset($list['ignore'])) { if (!$allowignore) { $this->_ignoreNotAllowed('ignore'); } } if (isset($list['install'])) { if (!$allowignore) { $this->_ignoreNotAllowed('install'); } } if (isset($list['file'])) { if ($allowignore) { $this->_fileNotAllowed('file'); } } if (isset($list['dir'])) { if ($allowignore) { $this->_fileNotAllowed('dir'); } else { if (!isset($list['dir'][0])) { $list['dir'] = array($list['dir']); } foreach ($list['dir'] as $dir) { if (isset($dir['attribs']) && isset($dir['attribs']['name'])) { if ($dir['attribs']['name'] == '/' || !isset($this->_packageInfo['contents']['dir']['dir'])) { // always use nothing if the filelist has already been flattened $newdirs = ''; } elseif ($dirs == '') { $newdirs = $dir['attribs']['name']; } else { $newdirs = $dirs . '/' . $dir['attribs']['name']; } } else { $newdirs = $dirs; } $this->_validateFilelist($dir, $allowignore, $newdirs); } } } } function _validateRelease() { if (isset($this->_packageInfo['phprelease'])) { $release = 'phprelease'; if (isset($this->_packageInfo['providesextension'])) { $this->_cannotProvideExtension($release); } if (isset($this->_packageInfo['srcpackage']) || isset($this->_packageInfo['srcuri'])) { $this->_cannotHaveSrcpackage($release); } $releases = $this->_packageInfo['phprelease']; if (!is_array($releases)) { return true; } if (!isset($releases[0])) { $releases = array($releases); } foreach ($releases as $rel) { $this->_stupidSchemaValidate(array( '*installconditions', '*filelist', ), $rel, ''); } } foreach (array('', 'zend') as $prefix) { $releasetype = $prefix . 'extsrcrelease'; if (isset($this->_packageInfo[$releasetype])) { $release = $releasetype; if (!isset($this->_packageInfo['providesextension'])) { $this->_mustProvideExtension($release); } if (isset($this->_packageInfo['srcpackage']) || isset($this->_packageInfo['srcuri'])) { $this->_cannotHaveSrcpackage($release); } $releases = $this->_packageInfo[$releasetype]; if (!is_array($releases)) { return true; } if (!isset($releases[0])) { $releases = array($releases); } foreach ($releases as $rel) { $this->_stupidSchemaValidate(array( '*installconditions', '*configureoption->name->prompt->?default', '*binarypackage', '*filelist', ), $rel, '<' . $releasetype . '>'); if (isset($rel['binarypackage'])) { if (!is_array($rel['binarypackage']) || !isset($rel['binarypackage'][0])) { $rel['binarypackage'] = array($rel['binarypackage']); } foreach ($rel['binarypackage'] as $bin) { if (!is_string($bin)) { $this->_binaryPackageMustBePackagename(); } } } } } $releasetype = 'extbinrelease'; if (isset($this->_packageInfo[$releasetype])) { $release = $releasetype; if (!isset($this->_packageInfo['providesextension'])) { $this->_mustProvideExtension($release); } if (isset($this->_packageInfo['channel']) && !isset($this->_packageInfo['srcpackage'])) { $this->_mustSrcPackage($release); } if (isset($this->_packageInfo['uri']) && !isset($this->_packageInfo['srcuri'])) { $this->_mustSrcuri($release); } $releases = $this->_packageInfo[$releasetype]; if (!is_array($releases)) { return true; } if (!isset($releases[0])) { $releases = array($releases); } foreach ($releases as $rel) { $this->_stupidSchemaValidate(array( '*installconditions', '*filelist', ), $rel, '<' . $releasetype . '>'); } } } if (isset($this->_packageInfo['bundle'])) { $release = 'bundle'; if (isset($this->_packageInfo['providesextension'])) { $this->_cannotProvideExtension($release); } if (isset($this->_packageInfo['srcpackage']) || isset($this->_packageInfo['srcuri'])) { $this->_cannotHaveSrcpackage($release); } $releases = $this->_packageInfo['bundle']; if (!is_array($releases) || !isset($releases[0])) { $releases = array($releases); } foreach ($releases as $rel) { $this->_stupidSchemaValidate(array( '*installconditions', '*filelist', ), $rel, ''); } } foreach ($releases as $rel) { if (is_array($rel) && array_key_exists('installconditions', $rel)) { $this->_validateInstallConditions($rel['installconditions'], "<$release>"); } if (is_array($rel) && array_key_exists('filelist', $rel)) { if ($rel['filelist']) { $this->_validateFilelist($rel['filelist'], true); } } } } /** * This is here to allow role extension through plugins * @param string */ function _validateRole($role) { return in_array($role, PEAR_Installer_Role::getValidRoles($this->_pf->getPackageType())); } function _pearVersionTooLow($version) { $this->_stack->push(__FUNCTION__, 'error', array('version' => $version), 'This package.xml requires PEAR version %version% to parse properly, we are ' . 'version @package_version@'); } function _invalidTagOrder($oktags, $actual, $root) { $this->_stack->push(__FUNCTION__, 'error', array('oktags' => $oktags, 'actual' => $actual, 'root' => $root), 'Invalid tag order in %root%, found <%actual%> expected one of "%oktags%"'); } function _ignoreNotAllowed($type) { $this->_stack->push(__FUNCTION__, 'error', array('type' => $type), '<%type%> is not allowed inside global , only inside ' . '//, use and only'); } function _fileNotAllowed($type) { $this->_stack->push(__FUNCTION__, 'error', array('type' => $type), '<%type%> is not allowed inside release , only inside ' . ', use and only'); } function _oldStyleFileNotAllowed() { $this->_stack->push(__FUNCTION__, 'error', array(), 'Old-style name is not allowed. Use' . ''); } function _tagMissingAttribute($tag, $attr, $context) { $this->_stack->push(__FUNCTION__, 'error', array('tag' => $tag, 'attribute' => $attr, 'context' => $context), 'tag <%tag%> in context "%context%" has no attribute "%attribute%"'); } function _tagHasNoAttribs($tag, $context) { $this->_stack->push(__FUNCTION__, 'error', array('tag' => $tag, 'context' => $context), 'tag <%tag%> has no attributes in context "%context%"'); } function _invalidInternalStructure() { $this->_stack->push(__FUNCTION__, 'exception', array(), 'internal array was not generated by compatible parser, or extreme parser error, cannot continue'); } function _invalidFileRole($file, $dir, $role) { $this->_stack->push(__FUNCTION__, 'error', array( 'file' => $file, 'dir' => $dir, 'role' => $role, 'roles' => PEAR_Installer_Role::getValidRoles($this->_pf->getPackageType())), 'File "%file%" in directory "%dir%" has invalid role "%role%", should be one of %roles%'); } function _invalidFileName($file, $dir) { $this->_stack->push(__FUNCTION__, 'error', array( 'file' => $file), 'File "%file%" in directory "%dir%" cannot begin with "./" or contain ".."'); } function _invalidFileInstallAs($file, $as) { $this->_stack->push(__FUNCTION__, 'error', array( 'file' => $file, 'as' => $as), 'File "%file%" cannot contain "./" or contain ".."'); } function _invalidDirName($dir) { $this->_stack->push(__FUNCTION__, 'error', array( 'dir' => $file), 'Directory "%dir%" cannot begin with "./" or contain ".."'); } function _filelistCannotContainFile($filelist) { $this->_stack->push(__FUNCTION__, 'error', array('tag' => $filelist), '<%tag%> can only contain , contains . Use ' . ' as the first dir element'); } function _filelistMustContainDir($filelist) { $this->_stack->push(__FUNCTION__, 'error', array('tag' => $filelist), '<%tag%> must contain . Use as the ' . 'first dir element'); } function _tagCannotBeEmpty($tag) { $this->_stack->push(__FUNCTION__, 'error', array('tag' => $tag), '<%tag%> cannot be empty (<%tag%/>)'); } function _UrlOrChannel($type, $name) { $this->_stack->push(__FUNCTION__, 'error', array('type' => $type, 'name' => $name), 'Required dependency <%type%> "%name%" can have either url OR ' . 'channel attributes, and not both'); } function _NoChannel($type, $name) { $this->_stack->push(__FUNCTION__, 'error', array('type' => $type, 'name' => $name), 'Required dependency <%type%> "%name%" must have either url OR ' . 'channel attributes'); } function _UrlOrChannelGroup($type, $name, $group) { $this->_stack->push(__FUNCTION__, 'error', array('type' => $type, 'name' => $name, 'group' => $group), 'Group "%group%" dependency <%type%> "%name%" can have either url OR ' . 'channel attributes, and not both'); } function _NoChannelGroup($type, $name, $group) { $this->_stack->push(__FUNCTION__, 'error', array('type' => $type, 'name' => $name, 'group' => $group), 'Group "%group%" dependency <%type%> "%name%" must have either url OR ' . 'channel attributes'); } function _unknownChannel($channel) { $this->_stack->push(__FUNCTION__, 'error', array('channel' => $channel), 'Unknown channel "%channel%"'); } function _noPackageVersion() { $this->_stack->push(__FUNCTION__, 'error', array(), 'package.xml tag has no version attribute, or version is not 2.0'); } function _NoBundledPackages() { $this->_stack->push(__FUNCTION__, 'error', array(), 'No tag was found in , required for bundle packages'); } function _AtLeast2BundledPackages() { $this->_stack->push(__FUNCTION__, 'error', array(), 'At least 2 packages must be bundled in a bundle package'); } function _ChannelOrUri($name) { $this->_stack->push(__FUNCTION__, 'error', array('name' => $name), 'Bundled package "%name%" can have either a uri or a channel, not both'); } function _noChildTag($child, $tag) { $this->_stack->push(__FUNCTION__, 'error', array('child' => $child, 'tag' => $tag), 'Tag <%tag%> is missing child tag <%child%>'); } function _invalidVersion($type, $value) { $this->_stack->push(__FUNCTION__, 'error', array('type' => $type, 'value' => $value), 'Version type <%type%> is not a valid version (%value%)'); } function _invalidState($type, $value) { $states = array('stable', 'beta', 'alpha', 'devel'); if ($type != 'api') { $states[] = 'snapshot'; } if (strtolower($value) == 'rc') { $this->_stack->push(__FUNCTION__, 'error', array('version' => $this->_packageInfo['version']['release']), 'RC is not a state, it is a version postfix, try %version%RC1, stability beta'); } $this->_stack->push(__FUNCTION__, 'error', array('type' => $type, 'value' => $value, 'types' => $states), 'Stability type <%type%> is not a valid stability (%value%), must be one of ' . '%types%'); } function _invalidTask($task, $ret, $file) { switch ($ret[0]) { case PEAR_TASK_ERROR_MISSING_ATTRIB : $info = array('attrib' => $ret[1], 'task' => $task, 'file' => $file); $msg = 'task <%task%> is missing attribute "%attrib%" in file %file%'; break; case PEAR_TASK_ERROR_NOATTRIBS : $info = array('task' => $task, 'file' => $file); $msg = 'task <%task%> has no attributes in file %file%'; break; case PEAR_TASK_ERROR_WRONG_ATTRIB_VALUE : $info = array('attrib' => $ret[1], 'values' => $ret[3], 'was' => $ret[2], 'task' => $task, 'file' => $file); $msg = 'task <%task%> attribute "%attrib%" has the wrong value "%was%" '. 'in file %file%, expecting one of "%values%"'; break; case PEAR_TASK_ERROR_INVALID : $info = array('reason' => $ret[1], 'task' => $task, 'file' => $file); $msg = 'task <%task%> in file %file% is invalid because of "%reason%"'; break; } $this->_stack->push(__FUNCTION__, 'error', $info, $msg); } function _unknownTask($task, $file) { $this->_stack->push(__FUNCTION__, 'error', array('task' => $task, 'file' => $file), 'Unknown task "%task%" passed in file '); } function _subpackageCannotProvideExtension($name) { $this->_stack->push(__FUNCTION__, 'error', array('name' => $name), 'Subpackage dependency "%name%" cannot use , ' . 'only package dependencies can use this tag'); } function _subpackagesCannotConflict($name) { $this->_stack->push(__FUNCTION__, 'error', array('name' => $name), 'Subpackage dependency "%name%" cannot use , ' . 'only package dependencies can use this tag'); } function _cannotProvideExtension($release) { $this->_stack->push(__FUNCTION__, 'error', array('release' => $release), '<%release%> packages cannot use , only extbinrelease, extsrcrelease, zendextsrcrelease, and zendextbinrelease can provide a PHP extension'); } function _mustProvideExtension($release) { $this->_stack->push(__FUNCTION__, 'error', array('release' => $release), '<%release%> packages must use to indicate which PHP extension is provided'); } function _cannotHaveSrcpackage($release) { $this->_stack->push(__FUNCTION__, 'error', array('release' => $release), '<%release%> packages cannot specify a source code package, only extension binaries may use the tag'); } function _mustSrcPackage($release) { $this->_stack->push(__FUNCTION__, 'error', array('release' => $release), '/ packages must specify a source code package with '); } function _mustSrcuri($release) { $this->_stack->push(__FUNCTION__, 'error', array('release' => $release), '/ packages must specify a source code package with '); } function _uriDepsCannotHaveVersioning($type) { $this->_stack->push(__FUNCTION__, 'error', array('type' => $type), '%type%: dependencies with a tag cannot have any versioning information'); } function _conflictingDepsCannotHaveVersioning($type) { $this->_stack->push(__FUNCTION__, 'error', array('type' => $type), '%type%: conflicting dependencies cannot have versioning info, use to ' . 'exclude specific versions of a dependency'); } function _DepchannelCannotBeUri($type) { $this->_stack->push(__FUNCTION__, 'error', array('type' => $type), '%type%: channel cannot be __uri, this is a pseudo-channel reserved for uri ' . 'dependencies only'); } function _bundledPackagesMustBeFilename() { $this->_stack->push(__FUNCTION__, 'error', array(), ' tags must contain only the filename of a package release ' . 'in the bundle'); } function _binaryPackageMustBePackagename() { $this->_stack->push(__FUNCTION__, 'error', array(), ' tags must contain the name of a package that is ' . 'a compiled version of this extsrc/zendextsrc package'); } function _fileNotFound($file) { $this->_stack->push(__FUNCTION__, 'error', array('file' => $file), 'File "%file%" in package.xml does not exist'); } function _notInContents($file, $tag) { $this->_stack->push(__FUNCTION__, 'error', array('file' => $file, 'tag' => $tag), '<%tag% name="%file%"> is invalid, file is not in '); } function _cannotValidateNoPathSet() { $this->_stack->push(__FUNCTION__, 'error', array(), 'Cannot validate files, no path to package file is set (use setPackageFile())'); } function _usesroletaskMustHaveChannelOrUri($role, $tag) { $this->_stack->push(__FUNCTION__, 'error', array('role' => $role, 'tag' => $tag), '<%tag%> for role "%role%" must contain either , or and '); } function _usesroletaskMustHavePackage($role, $tag) { $this->_stack->push(__FUNCTION__, 'error', array('role' => $role, 'tag' => $tag), '<%tag%> for role "%role%" must contain '); } function _usesroletaskMustHaveRoleTask($tag, $type) { $this->_stack->push(__FUNCTION__, 'error', array('tag' => $tag, 'type' => $type), '<%tag%> must contain <%type%> defining the %type% to be used'); } function _cannotConflictWithAllOs($type) { $this->_stack->push(__FUNCTION__, 'error', array('tag' => $tag), '%tag% cannot conflict with all OSes'); } function _invalidDepGroupName($name) { $this->_stack->push(__FUNCTION__, 'error', array('name' => $name), 'Invalid dependency group name "%name%"'); } function _multipleToplevelDirNotAllowed() { $this->_stack->push(__FUNCTION__, 'error', array(), 'Multiple top-level tags are not allowed. Enclose them ' . 'in a '); } function _multipleInstallAs($file) { $this->_stack->push(__FUNCTION__, 'error', array('file' => $file), 'Only one tag is allowed for file "%file%"'); } function _ignoreAndInstallAs($file) { $this->_stack->push(__FUNCTION__, 'error', array('file' => $file), 'Cannot have both and tags for file "%file%"'); } function _analyzeBundledPackages() { if (!$this->_isValid) { return false; } if (!$this->_pf->getPackageType() == 'bundle') { return false; } if (!isset($this->_pf->_packageFile)) { return false; } $dir_prefix = dirname($this->_pf->_packageFile); $common = new PEAR_Common; $log = isset($this->_pf->_logger) ? array(&$this->_pf->_logger, 'log') : array($common, 'log'); $info = $this->_pf->getContents(); $info = $info['bundledpackage']; if (!is_array($info)) { $info = array($info); } $pkg = new PEAR_PackageFile($this->_pf->_config); foreach ($info as $package) { if (!file_exists($dir_prefix . DIRECTORY_SEPARATOR . $package)) { $this->_fileNotFound($dir_prefix . DIRECTORY_SEPARATOR . $package); $this->_isValid = 0; continue; } call_user_func_array($log, array(1, "Analyzing bundled package $package")); PEAR::pushErrorHandling(PEAR_ERROR_RETURN); $ret = $pkg->fromAnyFile($dir_prefix . DIRECTORY_SEPARATOR . $package, PEAR_VALIDATE_NORMAL); PEAR::popErrorHandling(); if (PEAR::isError($ret)) { call_user_func_array($log, array(0, "ERROR: package $package is not a valid " . 'package')); $inf = $ret->getUserInfo(); if (is_array($inf)) { foreach ($inf as $err) { call_user_func_array($log, array(1, $err['message'])); } } return false; } } return true; } function _analyzePhpFiles() { if (!$this->_isValid) { return false; } if (!isset($this->_pf->_packageFile)) { $this->_cannotValidateNoPathSet(); return false; } $dir_prefix = dirname($this->_pf->_packageFile); $common = new PEAR_Common; $log = isset($this->_pf->_logger) ? array(&$this->_pf->_logger, 'log') : array(&$common, 'log'); $info = $this->_pf->getContents(); if (!$info || !isset($info['dir']['file'])) { $this->_tagCannotBeEmpty('contents>_fileNotFound($dir_prefix . DIRECTORY_SEPARATOR . $file); $this->_isValid = 0; continue; } if (in_array($fa['role'], PEAR_Installer_Role::getPhpRoles()) && $dir_prefix) { call_user_func_array($log, array(1, "Analyzing $file")); $srcinfo = $this->analyzeSourceCode($dir_prefix . DIRECTORY_SEPARATOR . $file); if ($srcinfo) { $provides = array_merge($provides, $this->_buildProvidesArray($srcinfo)); } } } $this->_packageName = $pn = $this->_pf->getPackage(); $pnl = strlen($pn); foreach ($provides as $key => $what) { if (isset($what['explicit']) || !$what) { // skip conformance checks if the provides entry is // specified in the package.xml file continue; } extract($what); if ($type == 'class') { if (!strncasecmp($name, $pn, $pnl)) { continue; } $this->_stack->push(__FUNCTION__, 'warning', array('file' => $file, 'type' => $type, 'name' => $name, 'package' => $pn), 'in %file%: %type% "%name%" not prefixed with package name "%package%"'); } elseif ($type == 'function') { if (strstr($name, '::') || !strncasecmp($name, $pn, $pnl)) { continue; } $this->_stack->push(__FUNCTION__, 'warning', array('file' => $file, 'type' => $type, 'name' => $name, 'package' => $pn), 'in %file%: %type% "%name%" not prefixed with package name "%package%"'); } } return $this->_isValid; } /** * Analyze the source code of the given PHP file * * @param string Filename of the PHP file * @param boolean whether to analyze $file as the file contents * @return mixed */ function analyzeSourceCode($file, $string = false) { if (!function_exists("token_get_all")) { $this->_stack->push(__FUNCTION__, 'error', array('file' => $file), 'Parser error: token_get_all() function must exist to analyze source code, PHP may have been compiled with --disable-tokenizer'); 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 ($string) { $contents = $file; } else { if (!$fp = @fopen($file, "r")) { return false; } fclose($fp); $contents = file_get_contents($file); } // Silence this function so we can catch PHP Warnings and show our own custom message $tokens = @token_get_all($contents); if (isset($php_errormsg)) { if (isset($this->_stack)) { $pn = $this->_pf->getPackage(); $this->_stack->push(__FUNCTION__, 'warning', array('file' => $file, 'package' => $pn), 'in %file%: Could not process file for unknown reasons,' . ' possibly a PHP parse error in %file% from %package%'); } } /* for ($i = 0; $i < sizeof($tokens); $i++) { @list($token, $data) = $tokens[$i]; if (is_string($token)) { var_dump($token); } else { print token_name($token) . ' '; var_dump(rtrim($data)); } } */ $look_for = 0; $paren_level = 0; $bracket_level = 0; $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]; } else { $token = $tokens[$i]; $data = ''; } if ($inquote) { if ($token != '"' && $token != T_END_HEREDOC) { continue; } else { $inquote = false; continue; } } switch ($token) { case T_WHITESPACE : continue; case ';': if ($interface) { $current_function = ''; $current_function_level = -1; } break; case '"': case T_START_HEREDOC: $inquote = true; break; case T_CURLY_OPEN: case T_DOLLAR_OPEN_CURLY_BRACES: case '{': $brace_level++; continue 2; case '}': $brace_level--; if ($current_class_level == $brace_level) { $current_class = ''; $current_class_level = -1; } if ($current_function_level == $brace_level) { $current_function = ''; $current_function_level = -1; } continue 2; case '[': $bracket_level++; continue 2; 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)) { if (isset($this->_stack)) { $this->_stack->push(__FUNCTION__, 'error', array('file' => $file), 'Parser error: invalid PHP found in file "%file%"'); } else { PEAR::raiseError("Parser error: invalid PHP found in file \"$file\"", PEAR_COMMON_ERROR_INVALIDPHP); } return false; } case T_FUNCTION: case T_NEW: case T_EXTENDS: case T_IMPLEMENTS: $look_for = $token; continue 2; case T_STRING: 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; } $current_function_level = $brace_level; $m = array(); } elseif ($look_for == T_NEW) { $used_classes[$data] = true; } $look_for = 0; continue 2; case T_VARIABLE: $look_for = 0; continue 2; case T_DOC_COMMENT: case T_COMMENT: if (preg_match('!^/\*\*\s!', $data)) { $lastphpdoc = $data; if (preg_match_all('/@nodep\s+(\S+)/', $lastphpdoc, $m)) { $nodeps = array_merge($nodeps, $m[1]); } } continue 2; case T_DOUBLE_COLON: $token = $tokens[$i - 1][0]; if (!($token == T_WHITESPACE || $token == T_STRING || $token == T_STATIC || $token == T_VARIABLE)) { if (isset($this->_stack)) { $this->_stack->push(__FUNCTION__, 'warning', array('file' => $file), 'Parser error: invalid PHP found in file "%file%"'); } else { PEAR::raiseError("Parser error: invalid PHP found in file \"$file\"", PEAR_COMMON_ERROR_INVALIDPHP); } return false; } $class = $tokens[$i - 1][1]; if (strtolower($class) != 'parent') { $used_classes[$class] = true; } continue 2; } } 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, ); } /** * Build a "provides" array from data returned by * analyzeSourceCode(). The format of the built array is like * this: * * array( * 'class;MyClass' => 'array('type' => 'class', 'name' => 'MyClass'), * ... * ) * * * @param array $srcinfo array with information about a source file * as returned by the analyzeSourceCode() method. * * @return void * * @access private * */ function _buildProvidesArray($srcinfo) { if (!$this->_isValid) { return array(); } $providesret = array(); $file = basename($srcinfo['source_file']); $pn = isset($this->_pf) ? $this->_pf->getPackage() : ''; $pnl = strlen($pn); foreach ($srcinfo['declared_classes'] as $class) { $key = "class;$class"; if (isset($providesret[$key])) { continue; } $providesret[$key] = array('file'=> $file, 'type' => 'class', 'name' => $class); if (isset($srcinfo['inheritance'][$class])) { $providesret[$key]['extends'] = $srcinfo['inheritance'][$class]; } } foreach ($srcinfo['declared_methods'] as $class => $methods) { foreach ($methods as $method) { $function = "$class::$method"; $key = "function;$function"; if ($method{0} == '_' || !strcasecmp($method, $class) || isset($providesret[$key])) { continue; } $providesret[$key] = array('file'=> $file, 'type' => 'function', 'name' => $function); } } foreach ($srcinfo['declared_functions'] as $function) { $key = "function;$function"; if ($function{0} == '_' || isset($providesret[$key])) { continue; } if (!strstr($function, '::') && strncasecmp($function, $pn, $pnl)) { $warnings[] = "in1 " . $file . ": function \"$function\" not prefixed with package name \"$pn\""; } $providesret[$key] = array('file'=> $file, 'type' => 'function', 'name' => $function); } return $providesret; } } php-pear-1.10.1+submodules+notgz/PEAR/PackageFile/v2/rw.php000066400000000000000000001731511262614675700232230ustar00rootroot00000000000000 * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a8 */ /** * For base class */ require_once 'PEAR/PackageFile/v2.php'; /** * @category pear * @package PEAR * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version Release: @package_version@ * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a8 */ class PEAR_PackageFile_v2_rw extends PEAR_PackageFile_v2 { /** * @param string Extension name * @return bool success of operation */ function setProvidesExtension($extension) { if (in_array($this->getPackageType(), array('extsrc', 'extbin', 'zendextsrc', 'zendextbin'))) { if (!isset($this->_packageInfo['providesextension'])) { // ensure that the channel tag is set up in the right location $this->_packageInfo = $this->_insertBefore($this->_packageInfo, array('usesrole', 'usestask', 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease', 'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog'), $extension, 'providesextension'); } $this->_packageInfo['providesextension'] = $extension; return true; } return false; } function setPackage($package) { $this->_isValid = 0; if (!isset($this->_packageInfo['attribs'])) { $this->_packageInfo = array_merge(array('attribs' => array( 'version' => '2.0', 'xmlns' => 'http://pear.php.net/dtd/package-2.0', 'xmlns:tasks' => 'http://pear.php.net/dtd/tasks-1.0', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation' => 'http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd', )), $this->_packageInfo); } if (!isset($this->_packageInfo['name'])) { return $this->_packageInfo = array_merge(array('name' => $package), $this->_packageInfo); } $this->_packageInfo['name'] = $package; } /** * set this as a package.xml version 2.1 * @access private */ function _setPackageVersion2_1() { $info = array( 'version' => '2.1', 'xmlns' => 'http://pear.php.net/dtd/package-2.1', 'xmlns:tasks' => 'http://pear.php.net/dtd/tasks-1.0', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation' => 'http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.1 http://pear.php.net/dtd/package-2.1.xsd', ); if (!isset($this->_packageInfo['attribs'])) { $this->_packageInfo = array_merge(array('attribs' => $info), $this->_packageInfo); } else { $this->_packageInfo['attribs'] = $info; } } function setUri($uri) { unset($this->_packageInfo['channel']); $this->_isValid = 0; if (!isset($this->_packageInfo['uri'])) { // ensure that the uri tag is set up in the right location $this->_packageInfo = $this->_insertBefore($this->_packageInfo, array('extends', 'summary', 'description', 'lead', 'developer', 'contributor', 'helper', 'date', 'time', 'version', 'stability', 'license', 'notes', 'contents', 'compatible', 'dependencies', 'providesextension', 'usesrole', 'usestask', 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'zendextsrcrelease', 'zendextbinrelease', 'extbinrelease', 'bundle', 'changelog'), $uri, 'uri'); } $this->_packageInfo['uri'] = $uri; } function setChannel($channel) { unset($this->_packageInfo['uri']); $this->_isValid = 0; if (!isset($this->_packageInfo['channel'])) { // ensure that the channel tag is set up in the right location $this->_packageInfo = $this->_insertBefore($this->_packageInfo, array('extends', 'summary', 'description', 'lead', 'developer', 'contributor', 'helper', 'date', 'time', 'version', 'stability', 'license', 'notes', 'contents', 'compatible', 'dependencies', 'providesextension', 'usesrole', 'usestask', 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'zendextsrcrelease', 'zendextbinrelease', 'extbinrelease', 'bundle', 'changelog'), $channel, 'channel'); } $this->_packageInfo['channel'] = $channel; } function setExtends($extends) { $this->_isValid = 0; if (!isset($this->_packageInfo['extends'])) { // ensure that the extends tag is set up in the right location $this->_packageInfo = $this->_insertBefore($this->_packageInfo, array('summary', 'description', 'lead', 'developer', 'contributor', 'helper', 'date', 'time', 'version', 'stability', 'license', 'notes', 'contents', 'compatible', 'dependencies', 'providesextension', 'usesrole', 'usestask', 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'zendextsrcrelease', 'zendextbinrelease', 'extbinrelease', 'bundle', 'changelog'), $extends, 'extends'); } $this->_packageInfo['extends'] = $extends; } function setSummary($summary) { $this->_isValid = 0; if (!isset($this->_packageInfo['summary'])) { // ensure that the summary tag is set up in the right location $this->_packageInfo = $this->_insertBefore($this->_packageInfo, array('description', 'lead', 'developer', 'contributor', 'helper', 'date', 'time', 'version', 'stability', 'license', 'notes', 'contents', 'compatible', 'dependencies', 'providesextension', 'usesrole', 'usestask', 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'zendextsrcrelease', 'zendextbinrelease', 'extbinrelease', 'bundle', 'changelog'), $summary, 'summary'); } $this->_packageInfo['summary'] = $summary; } function setDescription($desc) { $this->_isValid = 0; if (!isset($this->_packageInfo['description'])) { // ensure that the description tag is set up in the right location $this->_packageInfo = $this->_insertBefore($this->_packageInfo, array('lead', 'developer', 'contributor', 'helper', 'date', 'time', 'version', 'stability', 'license', 'notes', 'contents', 'compatible', 'dependencies', 'providesextension', 'usesrole', 'usestask', 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'zendextsrcrelease', 'zendextbinrelease', 'extbinrelease', 'bundle', 'changelog'), $desc, 'description'); } $this->_packageInfo['description'] = $desc; } /** * Adds a new maintainer - no checking of duplicates is performed, use * updatemaintainer for that purpose. */ function addMaintainer($role, $handle, $name, $email, $active = 'yes') { if (!in_array($role, array('lead', 'developer', 'contributor', 'helper'))) { return false; } if (isset($this->_packageInfo[$role])) { if (!isset($this->_packageInfo[$role][0])) { $this->_packageInfo[$role] = array($this->_packageInfo[$role]); } $this->_packageInfo[$role][] = array( 'name' => $name, 'user' => $handle, 'email' => $email, 'active' => $active, ); } else { $testarr = array('lead', 'developer', 'contributor', 'helper', 'date', 'time', 'version', 'stability', 'license', 'notes', 'contents', 'compatible', 'dependencies', 'providesextension', 'usesrole', 'usestask', 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease', 'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog'); foreach (array('lead', 'developer', 'contributor', 'helper') as $testrole) { array_shift($testarr); if ($role == $testrole) { break; } } if (!isset($this->_packageInfo[$role])) { // ensure that the extends tag is set up in the right location $this->_packageInfo = $this->_insertBefore($this->_packageInfo, $testarr, array(), $role); } $this->_packageInfo[$role] = array( 'name' => $name, 'user' => $handle, 'email' => $email, 'active' => $active, ); } $this->_isValid = 0; } function updateMaintainer($newrole, $handle, $name, $email, $active = 'yes') { $found = false; foreach (array('lead', 'developer', 'contributor', 'helper') as $role) { if (!isset($this->_packageInfo[$role])) { continue; } $info = $this->_packageInfo[$role]; if (!isset($info[0])) { if ($info['user'] == $handle) { $found = true; break; } } foreach ($info as $i => $maintainer) { if (is_array($maintainer) && $maintainer['user'] == $handle) { $found = $i; break 2; } } } if ($found === false) { return $this->addMaintainer($newrole, $handle, $name, $email, $active); } if ($found !== false) { if ($found === true) { unset($this->_packageInfo[$role]); } else { unset($this->_packageInfo[$role][$found]); $this->_packageInfo[$role] = array_values($this->_packageInfo[$role]); } } $this->addMaintainer($newrole, $handle, $name, $email, $active); $this->_isValid = 0; } function deleteMaintainer($handle) { $found = false; foreach (array('lead', 'developer', 'contributor', 'helper') as $role) { if (!isset($this->_packageInfo[$role])) { continue; } if (!isset($this->_packageInfo[$role][0])) { $this->_packageInfo[$role] = array($this->_packageInfo[$role]); } foreach ($this->_packageInfo[$role] as $i => $maintainer) { if ($maintainer['user'] == $handle) { $found = $i; break; } } if ($found !== false) { unset($this->_packageInfo[$role][$found]); if (!count($this->_packageInfo[$role]) && $role == 'lead') { $this->_isValid = 0; } if (!count($this->_packageInfo[$role])) { unset($this->_packageInfo[$role]); return true; } $this->_packageInfo[$role] = array_values($this->_packageInfo[$role]); if (count($this->_packageInfo[$role]) == 1) { $this->_packageInfo[$role] = $this->_packageInfo[$role][0]; } return true; } if (count($this->_packageInfo[$role]) == 1) { $this->_packageInfo[$role] = $this->_packageInfo[$role][0]; } } return false; } function setReleaseVersion($version) { if (isset($this->_packageInfo['version']) && isset($this->_packageInfo['version']['release'])) { unset($this->_packageInfo['version']['release']); } $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $version, array( 'version' => array('stability', 'license', 'notes', 'contents', 'compatible', 'dependencies', 'providesextension', 'usesrole', 'usestask', 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'zendextsrcrelease', 'zendextbinrelease', 'extbinrelease', 'bundle', 'changelog'), 'release' => array('api'))); $this->_isValid = 0; } function setAPIVersion($version) { if (isset($this->_packageInfo['version']) && isset($this->_packageInfo['version']['api'])) { unset($this->_packageInfo['version']['api']); } $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $version, array( 'version' => array('stability', 'license', 'notes', 'contents', 'compatible', 'dependencies', 'providesextension', 'usesrole', 'usestask', 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'zendextsrcrelease', 'zendextbinrelease', 'extbinrelease', 'bundle', 'changelog'), 'api' => array())); $this->_isValid = 0; } /** * snapshot|devel|alpha|beta|stable */ function setReleaseStability($state) { if (isset($this->_packageInfo['stability']) && isset($this->_packageInfo['stability']['release'])) { unset($this->_packageInfo['stability']['release']); } $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $state, array( 'stability' => array('license', 'notes', 'contents', 'compatible', 'dependencies', 'providesextension', 'usesrole', 'usestask', 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'zendextsrcrelease', 'zendextbinrelease', 'extbinrelease', 'bundle', 'changelog'), 'release' => array('api'))); $this->_isValid = 0; } /** * @param devel|alpha|beta|stable */ function setAPIStability($state) { if (isset($this->_packageInfo['stability']) && isset($this->_packageInfo['stability']['api'])) { unset($this->_packageInfo['stability']['api']); } $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $state, array( 'stability' => array('license', 'notes', 'contents', 'compatible', 'dependencies', 'providesextension', 'usesrole', 'usestask', 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'zendextsrcrelease', 'zendextbinrelease', 'extbinrelease', 'bundle', 'changelog'), 'api' => array())); $this->_isValid = 0; } function setLicense($license, $uri = false, $filesource = false) { if (!isset($this->_packageInfo['license'])) { // ensure that the license tag is set up in the right location $this->_packageInfo = $this->_insertBefore($this->_packageInfo, array('notes', 'contents', 'compatible', 'dependencies', 'providesextension', 'usesrole', 'usestask', 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'zendextsrcrelease', 'zendextbinrelease', 'extbinrelease', 'bundle', 'changelog'), 0, 'license'); } if ($uri || $filesource) { $attribs = array(); if ($uri) { $attribs['uri'] = $uri; } $uri = true; // for test below if ($filesource) { $attribs['filesource'] = $filesource; } } $license = $uri ? array('attribs' => $attribs, '_content' => $license) : $license; $this->_packageInfo['license'] = $license; $this->_isValid = 0; } function setNotes($notes) { $this->_isValid = 0; if (!isset($this->_packageInfo['notes'])) { // ensure that the notes tag is set up in the right location $this->_packageInfo = $this->_insertBefore($this->_packageInfo, array('contents', 'compatible', 'dependencies', 'providesextension', 'usesrole', 'usestask', 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'zendextsrcrelease', 'zendextbinrelease', 'extbinrelease', 'bundle', 'changelog'), $notes, 'notes'); } $this->_packageInfo['notes'] = $notes; } /** * This is only used at install-time, after all serialization * is over. * @param string file name * @param string installed path */ function setInstalledAs($file, $path) { if ($path) { return $this->_packageInfo['filelist'][$file]['installed_as'] = $path; } unset($this->_packageInfo['filelist'][$file]['installed_as']); } /** * This is only used at install-time, after all serialization * is over. */ function installedFile($file, $atts) { if (isset($this->_packageInfo['filelist'][$file])) { $this->_packageInfo['filelist'][$file] = array_merge($this->_packageInfo['filelist'][$file], $atts['attribs']); } else { $this->_packageInfo['filelist'][$file] = $atts['attribs']; } } /** * Reset the listing of package contents * @param string base installation dir for the whole package, if any */ function clearContents($baseinstall = false) { $this->_filesValid = false; $this->_isValid = 0; if (!isset($this->_packageInfo['contents'])) { $this->_packageInfo = $this->_insertBefore($this->_packageInfo, array('compatible', 'dependencies', 'providesextension', 'usesrole', 'usestask', 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease', 'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog'), array(), 'contents'); } if ($this->getPackageType() != 'bundle') { $this->_packageInfo['contents'] = array('dir' => array('attribs' => array('name' => '/'))); if ($baseinstall) { $this->_packageInfo['contents']['dir']['attribs']['baseinstalldir'] = $baseinstall; } } else { $this->_packageInfo['contents'] = array('bundledpackage' => array()); } } /** * @param string relative path of the bundled package. */ function addBundledPackage($path) { if ($this->getPackageType() != 'bundle') { return false; } $this->_filesValid = false; $this->_isValid = 0; $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $path, array( 'contents' => array('compatible', 'dependencies', 'providesextension', 'usesrole', 'usestask', 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease', 'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog'), 'bundledpackage' => array())); } /** * @param string file name * @param PEAR_Task_Common a read/write task */ function addTaskToFile($filename, $task) { if (!method_exists($task, 'getXml')) { return false; } if (!method_exists($task, 'getName')) { return false; } if (!method_exists($task, 'validate')) { return false; } if (!$task->validate()) { return false; } if (!isset($this->_packageInfo['contents']['dir']['file'])) { return false; } $this->getTasksNs(); // discover the tasks namespace if not done already $files = $this->_packageInfo['contents']['dir']['file']; if (!isset($files[0])) { $files = array($files); $ind = false; } else { $ind = true; } foreach ($files as $i => $file) { if (isset($file['attribs'])) { if ($file['attribs']['name'] == $filename) { if ($ind) { $t = isset($this->_packageInfo['contents']['dir']['file'][$i] ['attribs'][$this->_tasksNs . ':' . $task->getName()]) ? $this->_packageInfo['contents']['dir']['file'][$i] ['attribs'][$this->_tasksNs . ':' . $task->getName()] : false; if ($t && !isset($t[0])) { $this->_packageInfo['contents']['dir']['file'][$i] [$this->_tasksNs . ':' . $task->getName()] = array($t); } $this->_packageInfo['contents']['dir']['file'][$i][$this->_tasksNs . ':' . $task->getName()][] = $task->getXml(); } else { $t = isset($this->_packageInfo['contents']['dir']['file'] ['attribs'][$this->_tasksNs . ':' . $task->getName()]) ? $this->_packageInfo['contents']['dir']['file'] ['attribs'][$this->_tasksNs . ':' . $task->getName()] : false; if ($t && !isset($t[0])) { $this->_packageInfo['contents']['dir']['file'] [$this->_tasksNs . ':' . $task->getName()] = array($t); } $this->_packageInfo['contents']['dir']['file'][$this->_tasksNs . ':' . $task->getName()][] = $task->getXml(); } return true; } } } return false; } /** * @param string path to the file * @param string filename * @param array extra attributes */ function addFile($dir, $file, $attrs) { if ($this->getPackageType() == 'bundle') { return false; } $this->_filesValid = false; $this->_isValid = 0; $dir = preg_replace(array('!\\\\+!', '!/+!'), array('/', '/'), $dir); if ($dir == '/' || $dir == '') { $dir = ''; } else { $dir .= '/'; } $attrs['name'] = $dir . $file; if (!isset($this->_packageInfo['contents'])) { // ensure that the contents tag is set up $this->_packageInfo = $this->_insertBefore($this->_packageInfo, array('compatible', 'dependencies', 'providesextension', 'usesrole', 'usestask', 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease', 'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog'), array(), 'contents'); } if (isset($this->_packageInfo['contents']['dir']['file'])) { if (!isset($this->_packageInfo['contents']['dir']['file'][0])) { $this->_packageInfo['contents']['dir']['file'] = array($this->_packageInfo['contents']['dir']['file']); } $this->_packageInfo['contents']['dir']['file'][]['attribs'] = $attrs; } else { $this->_packageInfo['contents']['dir']['file']['attribs'] = $attrs; } } /** * @param string Dependent package name * @param string Dependent package's channel name * @param string minimum version of specified package that this release is guaranteed to be * compatible with * @param string maximum version of specified package that this release is guaranteed to be * compatible with * @param string versions of specified package that this release is not compatible with */ function addCompatiblePackage($name, $channel, $min, $max, $exclude = false) { $this->_isValid = 0; $set = array( 'name' => $name, 'channel' => $channel, 'min' => $min, 'max' => $max, ); if ($exclude) { $set['exclude'] = $exclude; } $this->_isValid = 0; $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $set, array( 'compatible' => array('dependencies', 'providesextension', 'usesrole', 'usestask', 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease', 'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog') )); } /** * Removes the tag entirely */ function resetUsesrole() { if (isset($this->_packageInfo['usesrole'])) { unset($this->_packageInfo['usesrole']); } } /** * @param string * @param string package name or uri * @param string channel name if non-uri */ function addUsesrole($role, $packageOrUri, $channel = false) { $set = array('role' => $role); if ($channel) { $set['package'] = $packageOrUri; $set['channel'] = $channel; } else { $set['uri'] = $packageOrUri; } $this->_isValid = 0; $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $set, array( 'usesrole' => array('usestask', 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease', 'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog') )); } /** * Removes the tag entirely */ function resetUsestask() { if (isset($this->_packageInfo['usestask'])) { unset($this->_packageInfo['usestask']); } } /** * @param string * @param string package name or uri * @param string channel name if non-uri */ function addUsestask($task, $packageOrUri, $channel = false) { $set = array('task' => $task); if ($channel) { $set['package'] = $packageOrUri; $set['channel'] = $channel; } else { $set['uri'] = $packageOrUri; } $this->_isValid = 0; $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $set, array( 'usestask' => array('srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease', 'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog') )); } /** * Remove all compatible tags */ function clearCompatible() { unset($this->_packageInfo['compatible']); } /** * Reset dependencies prior to adding new ones */ function clearDeps() { if (!isset($this->_packageInfo['dependencies'])) { $this->_packageInfo = $this->_mergeTag($this->_packageInfo, array(), array( 'dependencies' => array('providesextension', 'usesrole', 'usestask', 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease', 'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog'))); } $this->_packageInfo['dependencies'] = array(); } /** * @param string minimum PHP version allowed * @param string maximum PHP version allowed * @param array $exclude incompatible PHP versions */ function setPhpDep($min, $max = false, $exclude = false) { $this->_isValid = 0; $dep = array( 'min' => $min, ); if ($max) { $dep['max'] = $max; } if ($exclude) { if (count($exclude) == 1) { $exclude = $exclude[0]; } $dep['exclude'] = $exclude; } if (isset($this->_packageInfo['dependencies']['required']['php'])) { $this->_stack->push(__FUNCTION__, 'warning', array('dep' => $this->_packageInfo['dependencies']['required']['php']), 'warning: PHP dependency already exists, overwriting'); unset($this->_packageInfo['dependencies']['required']['php']); } $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $dep, array( 'dependencies' => array('providesextension', 'usesrole', 'usestask', 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease', 'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog'), 'required' => array('optional', 'group'), 'php' => array('pearinstaller', 'package', 'subpackage', 'extension', 'os', 'arch') )); return true; } /** * @param string minimum allowed PEAR installer version * @param string maximum allowed PEAR installer version * @param string recommended PEAR installer version * @param array incompatible version of the PEAR installer */ function setPearinstallerDep($min, $max = false, $recommended = false, $exclude = false) { $this->_isValid = 0; $dep = array( 'min' => $min, ); if ($max) { $dep['max'] = $max; } if ($recommended) { $dep['recommended'] = $recommended; } if ($exclude) { if (count($exclude) == 1) { $exclude = $exclude[0]; } $dep['exclude'] = $exclude; } if (isset($this->_packageInfo['dependencies']['required']['pearinstaller'])) { $this->_stack->push(__FUNCTION__, 'warning', array('dep' => $this->_packageInfo['dependencies']['required']['pearinstaller']), 'warning: PEAR Installer dependency already exists, overwriting'); unset($this->_packageInfo['dependencies']['required']['pearinstaller']); } $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $dep, array( 'dependencies' => array('providesextension', 'usesrole', 'usestask', 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease', 'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog'), 'required' => array('optional', 'group'), 'pearinstaller' => array('package', 'subpackage', 'extension', 'os', 'arch') )); } /** * Mark a package as conflicting with this package * @param string package name * @param string package channel * @param string extension this package provides, if any * @param string|false minimum version required * @param string|false maximum version allowed * @param array|false versions to exclude from installation */ function addConflictingPackageDepWithChannel($name, $channel, $providesextension = false, $min = false, $max = false, $exclude = false) { $this->_isValid = 0; $dep = $this->_constructDep($name, $channel, false, $min, $max, false, $exclude, $providesextension, false, true); $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $dep, array( 'dependencies' => array('providesextension', 'usesrole', 'usestask', 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease', 'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog'), 'required' => array('optional', 'group'), 'package' => array('subpackage', 'extension', 'os', 'arch') )); } /** * Mark a package as conflicting with this package * @param string package name * @param string package channel * @param string extension this package provides, if any */ function addConflictingPackageDepWithUri($name, $uri, $providesextension = false) { $this->_isValid = 0; $dep = array( 'name' => $name, 'uri' => $uri, 'conflicts' => '', ); if ($providesextension) { $dep['providesextension'] = $providesextension; } $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $dep, array( 'dependencies' => array('providesextension', 'usesrole', 'usestask', 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease', 'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog'), 'required' => array('optional', 'group'), 'package' => array('subpackage', 'extension', 'os', 'arch') )); } function addDependencyGroup($name, $hint) { $this->_isValid = 0; $this->_packageInfo = $this->_mergeTag($this->_packageInfo, array('attribs' => array('name' => $name, 'hint' => $hint)), array( 'dependencies' => array('providesextension', 'usesrole', 'usestask', 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease', 'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog'), 'group' => array(), )); } /** * @param string package name * @param string|false channel name, false if this is a uri * @param string|false uri name, false if this is a channel * @param string|false minimum version required * @param string|false maximum version allowed * @param string|false recommended installation version * @param array|false versions to exclude from installation * @param string extension this package provides, if any * @param bool if true, tells the installer to ignore the default optional dependency group * when installing this package * @param bool if true, tells the installer to negate this dependency (conflicts) * @return array * @access private */ function _constructDep($name, $channel, $uri, $min, $max, $recommended, $exclude, $providesextension = false, $nodefault = false, $conflicts = false) { $dep = array( 'name' => $name, ); if ($channel) { $dep['channel'] = $channel; } elseif ($uri) { $dep['uri'] = $uri; } if ($min) { $dep['min'] = $min; } if ($max) { $dep['max'] = $max; } if ($recommended) { $dep['recommended'] = $recommended; } if ($exclude) { if (is_array($exclude) && count($exclude) == 1) { $exclude = $exclude[0]; } $dep['exclude'] = $exclude; } if ($conflicts) { $dep['conflicts'] = ''; } if ($nodefault) { $dep['nodefault'] = ''; } if ($providesextension) { $dep['providesextension'] = $providesextension; } return $dep; } /** * @param package|subpackage * @param string group name * @param string package name * @param string package channel * @param string minimum version * @param string maximum version * @param string recommended version * @param array|false optional excluded versions * @param string extension this package provides, if any * @param bool if true, tells the installer to ignore the default optional dependency group * when installing this package * @return bool false if the dependency group has not been initialized with * {@link addDependencyGroup()}, or a subpackage is added with * a providesextension */ function addGroupPackageDepWithChannel($type, $groupname, $name, $channel, $min = false, $max = false, $recommended = false, $exclude = false, $providesextension = false, $nodefault = false) { if ($type == 'subpackage' && $providesextension) { return false; // subpackages must be php packages } $dep = $this->_constructDep($name, $channel, false, $min, $max, $recommended, $exclude, $providesextension, $nodefault); return $this->_addGroupDependency($type, $dep, $groupname); } /** * @param package|subpackage * @param string group name * @param string package name * @param string package uri * @param string extension this package provides, if any * @param bool if true, tells the installer to ignore the default optional dependency group * when installing this package * @return bool false if the dependency group has not been initialized with * {@link addDependencyGroup()} */ function addGroupPackageDepWithURI($type, $groupname, $name, $uri, $providesextension = false, $nodefault = false) { if ($type == 'subpackage' && $providesextension) { return false; // subpackages must be php packages } $dep = $this->_constructDep($name, false, $uri, false, false, false, false, $providesextension, $nodefault); return $this->_addGroupDependency($type, $dep, $groupname); } /** * @param string group name (must be pre-existing) * @param string extension name * @param string minimum version allowed * @param string maximum version allowed * @param string recommended version * @param array incompatible versions */ function addGroupExtensionDep($groupname, $name, $min = false, $max = false, $recommended = false, $exclude = false) { $this->_isValid = 0; $dep = $this->_constructDep($name, false, false, $min, $max, $recommended, $exclude); return $this->_addGroupDependency('extension', $dep, $groupname); } /** * @param package|subpackage|extension * @param array dependency contents * @param string name of the dependency group to add this to * @return boolean * @access private */ function _addGroupDependency($type, $dep, $groupname) { $arr = array('subpackage', 'extension'); if ($type != 'package') { array_shift($arr); } if ($type == 'extension') { array_shift($arr); } if (!isset($this->_packageInfo['dependencies']['group'])) { return false; } else { if (!isset($this->_packageInfo['dependencies']['group'][0])) { if ($this->_packageInfo['dependencies']['group']['attribs']['name'] == $groupname) { $this->_packageInfo['dependencies']['group'] = $this->_mergeTag( $this->_packageInfo['dependencies']['group'], $dep, array( $type => $arr )); $this->_isValid = 0; return true; } else { return false; } } else { foreach ($this->_packageInfo['dependencies']['group'] as $i => $group) { if ($group['attribs']['name'] == $groupname) { $this->_packageInfo['dependencies']['group'][$i] = $this->_mergeTag( $this->_packageInfo['dependencies']['group'][$i], $dep, array( $type => $arr )); $this->_isValid = 0; return true; } } return false; } } } /** * @param optional|required * @param string package name * @param string package channel * @param string minimum version * @param string maximum version * @param string recommended version * @param string extension this package provides, if any * @param bool if true, tells the installer to ignore the default optional dependency group * when installing this package * @param array|false optional excluded versions */ function addPackageDepWithChannel($type, $name, $channel, $min = false, $max = false, $recommended = false, $exclude = false, $providesextension = false, $nodefault = false) { if (!in_array($type, array('optional', 'required'), true)) { $type = 'required'; } $this->_isValid = 0; $arr = array('optional', 'group'); if ($type != 'required') { array_shift($arr); } $dep = $this->_constructDep($name, $channel, false, $min, $max, $recommended, $exclude, $providesextension, $nodefault); $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $dep, array( 'dependencies' => array('providesextension', 'usesrole', 'usestask', 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease', 'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog'), $type => $arr, 'package' => array('subpackage', 'extension', 'os', 'arch') )); } /** * @param optional|required * @param string name of the package * @param string uri of the package * @param string extension this package provides, if any * @param bool if true, tells the installer to ignore the default optional dependency group * when installing this package */ function addPackageDepWithUri($type, $name, $uri, $providesextension = false, $nodefault = false) { $this->_isValid = 0; $arr = array('optional', 'group'); if ($type != 'required') { array_shift($arr); } $dep = $this->_constructDep($name, false, $uri, false, false, false, false, $providesextension, $nodefault); $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $dep, array( 'dependencies' => array('providesextension', 'usesrole', 'usestask', 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease', 'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog'), $type => $arr, 'package' => array('subpackage', 'extension', 'os', 'arch') )); } /** * @param optional|required optional, required * @param string package name * @param string package channel * @param string minimum version * @param string maximum version * @param string recommended version * @param array incompatible versions * @param bool if true, tells the installer to ignore the default optional dependency group * when installing this package */ function addSubpackageDepWithChannel($type, $name, $channel, $min = false, $max = false, $recommended = false, $exclude = false, $nodefault = false) { $this->_isValid = 0; $arr = array('optional', 'group'); if ($type != 'required') { array_shift($arr); } $dep = $this->_constructDep($name, $channel, false, $min, $max, $recommended, $exclude, $nodefault); $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $dep, array( 'dependencies' => array('providesextension', 'usesrole', 'usestask', 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease', 'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog'), $type => $arr, 'subpackage' => array('extension', 'os', 'arch') )); } /** * @param optional|required optional, required * @param string package name * @param string package uri for download * @param bool if true, tells the installer to ignore the default optional dependency group * when installing this package */ function addSubpackageDepWithUri($type, $name, $uri, $nodefault = false) { $this->_isValid = 0; $arr = array('optional', 'group'); if ($type != 'required') { array_shift($arr); } $dep = $this->_constructDep($name, false, $uri, false, false, false, false, $nodefault); $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $dep, array( 'dependencies' => array('providesextension', 'usesrole', 'usestask', 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease', 'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog'), $type => $arr, 'subpackage' => array('extension', 'os', 'arch') )); } /** * @param optional|required optional, required * @param string extension name * @param string minimum version * @param string maximum version * @param string recommended version * @param array incompatible versions */ function addExtensionDep($type, $name, $min = false, $max = false, $recommended = false, $exclude = false) { $this->_isValid = 0; $arr = array('optional', 'group'); if ($type != 'required') { array_shift($arr); } $dep = $this->_constructDep($name, false, false, $min, $max, $recommended, $exclude); $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $dep, array( 'dependencies' => array('providesextension', 'usesrole', 'usestask', 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease', 'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog'), $type => $arr, 'extension' => array('os', 'arch') )); } /** * @param string Operating system name * @param boolean true if this package cannot be installed on this OS */ function addOsDep($name, $conflicts = false) { $this->_isValid = 0; $dep = array('name' => $name); if ($conflicts) { $dep['conflicts'] = ''; } $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $dep, array( 'dependencies' => array('providesextension', 'usesrole', 'usestask', 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease', 'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog'), 'required' => array('optional', 'group'), 'os' => array('arch') )); } /** * @param string Architecture matching pattern * @param boolean true if this package cannot be installed on this architecture */ function addArchDep($pattern, $conflicts = false) { $this->_isValid = 0; $dep = array('pattern' => $pattern); if ($conflicts) { $dep['conflicts'] = ''; } $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $dep, array( 'dependencies' => array('providesextension', 'usesrole', 'usestask', 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease', 'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog'), 'required' => array('optional', 'group'), 'arch' => array() )); } /** * Set the kind of package, and erase all release tags * * - a php package is a PEAR-style package * - an extbin package is a PECL-style extension binary * - an extsrc package is a PECL-style source for a binary * - an zendextbin package is a PECL-style zend extension binary * - an zendextsrc package is a PECL-style source for a zend extension binary * - a bundle package is a collection of other pre-packaged packages * @param php|extbin|extsrc|zendextsrc|zendextbin|bundle * @return bool success */ function setPackageType($type) { $this->_isValid = 0; if (!in_array($type, array('php', 'extbin', 'extsrc', 'zendextsrc', 'zendextbin', 'bundle'))) { return false; } if (in_array($type, array('zendextsrc', 'zendextbin'))) { $this->_setPackageVersion2_1(); } if ($type != 'bundle') { $type .= 'release'; } foreach (array('phprelease', 'extbinrelease', 'extsrcrelease', 'zendextsrcrelease', 'zendextbinrelease', 'bundle') as $test) { unset($this->_packageInfo[$test]); } if (!isset($this->_packageInfo[$type])) { // ensure that the release tag is set up $this->_packageInfo = $this->_insertBefore($this->_packageInfo, array('changelog'), array(), $type); } $this->_packageInfo[$type] = array(); return true; } /** * @return bool true if package type is set up */ function addRelease() { if ($type = $this->getPackageType()) { if ($type != 'bundle') { $type .= 'release'; } $this->_packageInfo = $this->_mergeTag($this->_packageInfo, array(), array($type => array('changelog'))); return true; } return false; } /** * Get the current release tag in order to add to it * @param bool returns only releases that have installcondition if true * @return array|null */ function &_getCurrentRelease($strict = true) { if ($p = $this->getPackageType()) { if ($strict) { if ($p == 'extsrc' || $p == 'zendextsrc') { $a = null; return $a; } } if ($p != 'bundle') { $p .= 'release'; } if (isset($this->_packageInfo[$p][0])) { return $this->_packageInfo[$p][count($this->_packageInfo[$p]) - 1]; } else { return $this->_packageInfo[$p]; } } else { $a = null; return $a; } } /** * Add a file to the current release that should be installed under a different name * @param string path to file * @param string name the file should be installed as */ function addInstallAs($path, $as) { $r = &$this->_getCurrentRelease(); if ($r === null) { return false; } $this->_isValid = 0; $r = $this->_mergeTag($r, array('attribs' => array('name' => $path, 'as' => $as)), array( 'filelist' => array(), 'install' => array('ignore') )); } /** * Add a file to the current release that should be ignored * @param string path to file * @return bool success of operation */ function addIgnore($path) { $r = &$this->_getCurrentRelease(); if ($r === null) { return false; } $this->_isValid = 0; $r = $this->_mergeTag($r, array('attribs' => array('name' => $path)), array( 'filelist' => array(), 'ignore' => array() )); } /** * Add an extension binary package for this extension source code release * * Note that the package must be from the same channel as the extension source package * @param string */ function addBinarypackage($package) { if ($this->getPackageType() != 'extsrc' && $this->getPackageType() != 'zendextsrc') { return false; } $r = &$this->_getCurrentRelease(false); if ($r === null) { return false; } $this->_isValid = 0; $r = $this->_mergeTag($r, $package, array( 'binarypackage' => array('filelist'), )); } /** * Add a configureoption to an extension source package * @param string * @param string * @param string */ function addConfigureOption($name, $prompt, $default = null) { if ($this->getPackageType() != 'extsrc' && $this->getPackageType() != 'zendextsrc') { return false; } $r = &$this->_getCurrentRelease(false); if ($r === null) { return false; } $opt = array('attribs' => array('name' => $name, 'prompt' => $prompt)); if ($default !== null) { $opt['attribs']['default'] = $default; } $this->_isValid = 0; $r = $this->_mergeTag($r, $opt, array( 'configureoption' => array('binarypackage', 'filelist'), )); } /** * Set an installation condition based on php version for the current release set * @param string minimum version * @param string maximum version * @param false|array incompatible versions of PHP */ function setPhpInstallCondition($min, $max, $exclude = false) { $r = &$this->_getCurrentRelease(); if ($r === null) { return false; } $this->_isValid = 0; if (isset($r['installconditions']['php'])) { unset($r['installconditions']['php']); } $dep = array('min' => $min, 'max' => $max); if ($exclude) { if (is_array($exclude) && count($exclude) == 1) { $exclude = $exclude[0]; } $dep['exclude'] = $exclude; } if ($this->getPackageType() == 'extsrc' || $this->getPackageType() == 'zendextsrc') { $r = $this->_mergeTag($r, $dep, array( 'installconditions' => array('configureoption', 'binarypackage', 'filelist'), 'php' => array('extension', 'os', 'arch') )); } else { $r = $this->_mergeTag($r, $dep, array( 'installconditions' => array('filelist'), 'php' => array('extension', 'os', 'arch') )); } } /** * @param optional|required optional, required * @param string extension name * @param string minimum version * @param string maximum version * @param string recommended version * @param array incompatible versions */ function addExtensionInstallCondition($name, $min = false, $max = false, $recommended = false, $exclude = false) { $r = &$this->_getCurrentRelease(); if ($r === null) { return false; } $this->_isValid = 0; $dep = $this->_constructDep($name, false, false, $min, $max, $recommended, $exclude); if ($this->getPackageType() == 'extsrc' || $this->getPackageType() == 'zendextsrc') { $r = $this->_mergeTag($r, $dep, array( 'installconditions' => array('configureoption', 'binarypackage', 'filelist'), 'extension' => array('os', 'arch') )); } else { $r = $this->_mergeTag($r, $dep, array( 'installconditions' => array('filelist'), 'extension' => array('os', 'arch') )); } } /** * Set an installation condition based on operating system for the current release set * @param string OS name * @param bool whether this OS is incompatible with the current release */ function setOsInstallCondition($name, $conflicts = false) { $r = &$this->_getCurrentRelease(); if ($r === null) { return false; } $this->_isValid = 0; if (isset($r['installconditions']['os'])) { unset($r['installconditions']['os']); } $dep = array('name' => $name); if ($conflicts) { $dep['conflicts'] = ''; } if ($this->getPackageType() == 'extsrc' || $this->getPackageType() == 'zendextsrc') { $r = $this->_mergeTag($r, $dep, array( 'installconditions' => array('configureoption', 'binarypackage', 'filelist'), 'os' => array('arch') )); } else { $r = $this->_mergeTag($r, $dep, array( 'installconditions' => array('filelist'), 'os' => array('arch') )); } } /** * Set an installation condition based on architecture for the current release set * @param string architecture pattern * @param bool whether this arch is incompatible with the current release */ function setArchInstallCondition($pattern, $conflicts = false) { $r = &$this->_getCurrentRelease(); if ($r === null) { return false; } $this->_isValid = 0; if (isset($r['installconditions']['arch'])) { unset($r['installconditions']['arch']); } $dep = array('pattern' => $pattern); if ($conflicts) { $dep['conflicts'] = ''; } if ($this->getPackageType() == 'extsrc' || $this->getPackageType() == 'zendextsrc') { $r = $this->_mergeTag($r, $dep, array( 'installconditions' => array('configureoption', 'binarypackage', 'filelist'), 'arch' => array() )); } else { $r = $this->_mergeTag($r, $dep, array( 'installconditions' => array('filelist'), 'arch' => array() )); } } /** * For extension binary releases, this is used to specify either the * static URI to a source package, or the package name and channel of the extsrc/zendextsrc * package it is based on. * @param string Package name, or full URI to source package (extsrc/zendextsrc type) */ function setSourcePackage($packageOrUri) { $this->_isValid = 0; if (isset($this->_packageInfo['channel'])) { $this->_packageInfo = $this->_insertBefore($this->_packageInfo, array('phprelease', 'extsrcrelease', 'extbinrelease', 'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog'), $packageOrUri, 'srcpackage'); } else { $this->_packageInfo = $this->_insertBefore($this->_packageInfo, array('phprelease', 'extsrcrelease', 'extbinrelease', 'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog'), $packageOrUri, 'srcuri'); } } /** * Generate a valid change log entry from the current package.xml * @param string|false */ function generateChangeLogEntry($notes = false) { return array( 'version' => array( 'release' => $this->getVersion('release'), 'api' => $this->getVersion('api'), ), 'stability' => $this->getStability(), 'date' => $this->getDate(), 'license' => $this->getLicense(true), 'notes' => $notes ? $notes : $this->getNotes() ); } /** * @param string release version to set change log notes for * @param array output of {@link generateChangeLogEntry()} */ function setChangelogEntry($releaseversion, $contents) { if (!isset($this->_packageInfo['changelog'])) { $this->_packageInfo['changelog']['release'] = $contents; return; } if (!isset($this->_packageInfo['changelog']['release'][0])) { if ($this->_packageInfo['changelog']['release']['version']['release'] == $releaseversion) { $this->_packageInfo['changelog']['release'] = array( $this->_packageInfo['changelog']['release']); } else { $this->_packageInfo['changelog']['release'] = array( $this->_packageInfo['changelog']['release']); return $this->_packageInfo['changelog']['release'][] = $contents; } } foreach($this->_packageInfo['changelog']['release'] as $index => $changelog) { if (isset($changelog['version']) && strnatcasecmp($changelog['version']['release'], $releaseversion) == 0) { $curlog = $index; } } if (isset($curlog)) { $this->_packageInfo['changelog']['release'][$curlog] = $contents; } else { $this->_packageInfo['changelog']['release'][] = $contents; } } /** * Remove the changelog entirely */ function clearChangeLog() { unset($this->_packageInfo['changelog']); } }php-pear-1.10.1+submodules+notgz/PEAR/Packager.php000066400000000000000000000170521262614675700216230ustar00rootroot00000000000000 * @author Tomas V. V. Cox * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @link http://pear.php.net/package/PEAR * @since File available since Release 0.1 */ /** * base class */ require_once 'PEAR/Common.php'; require_once 'PEAR/PackageFile.php'; require_once 'System.php'; /** * Administration class used to make a PEAR release tarball. * * @category pear * @package PEAR * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version Release: @package_version@ * @link http://pear.php.net/package/PEAR * @since Class available since Release 0.1 */ class PEAR_Packager extends PEAR_Common { /** * @var PEAR_Registry */ var $_registry; function package($pkgfile = null, $compress = true, $pkg2 = null) { // {{{ validate supplied package.xml file if (empty($pkgfile)) { $pkgfile = 'package.xml'; } PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); $pkg = new PEAR_PackageFile($this->config, $this->debug); $pf = &$pkg->fromPackageFile($pkgfile, PEAR_VALIDATE_NORMAL); $main = &$pf; PEAR::staticPopErrorHandling(); if (PEAR::isError($pf)) { if (is_array($pf->getUserInfo())) { foreach ($pf->getUserInfo() as $error) { $this->log(0, 'Error: ' . $error['message']); } } $this->log(0, $pf->getMessage()); return $this->raiseError("Cannot package, errors in package file"); } foreach ($pf->getValidationWarnings() as $warning) { $this->log(1, 'Warning: ' . $warning['message']); } // }}} if ($pkg2) { $this->log(0, 'Attempting to process the second package file'); PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); $pf2 = &$pkg->fromPackageFile($pkg2, PEAR_VALIDATE_NORMAL); PEAR::staticPopErrorHandling(); if (PEAR::isError($pf2)) { if (is_array($pf2->getUserInfo())) { foreach ($pf2->getUserInfo() as $error) { $this->log(0, 'Error: ' . $error['message']); } } $this->log(0, $pf2->getMessage()); return $this->raiseError("Cannot package, errors in second package file"); } foreach ($pf2->getValidationWarnings() as $warning) { $this->log(1, 'Warning: ' . $warning['message']); } if ($pf2->getPackagexmlVersion() == '2.0' || $pf2->getPackagexmlVersion() == '2.1' ) { $main = &$pf2; $other = &$pf; } else { $main = &$pf; $other = &$pf2; } if ($main->getPackagexmlVersion() != '2.0' && $main->getPackagexmlVersion() != '2.1') { return PEAR::raiseError('Error: cannot package two package.xml version 1.0, can ' . 'only package together a package.xml 1.0 and package.xml 2.0'); } if ($other->getPackagexmlVersion() != '1.0') { return PEAR::raiseError('Error: cannot package two package.xml version 2.0, can ' . 'only package together a package.xml 1.0 and package.xml 2.0'); } } $main->setLogger($this); if (!$main->validate(PEAR_VALIDATE_PACKAGING)) { foreach ($main->getValidationWarnings() as $warning) { $this->log(0, 'Error: ' . $warning['message']); } return $this->raiseError("Cannot package, errors in package"); } foreach ($main->getValidationWarnings() as $warning) { $this->log(1, 'Warning: ' . $warning['message']); } if ($pkg2) { $other->setLogger($this); $a = false; if (!$other->validate(PEAR_VALIDATE_NORMAL) || $a = !$main->isEquivalent($other)) { foreach ($other->getValidationWarnings() as $warning) { $this->log(0, 'Error: ' . $warning['message']); } foreach ($main->getValidationWarnings() as $warning) { $this->log(0, 'Error: ' . $warning['message']); } if ($a) { return $this->raiseError('The two package.xml files are not equivalent!'); } return $this->raiseError("Cannot package, errors in package"); } foreach ($other->getValidationWarnings() as $warning) { $this->log(1, 'Warning: ' . $warning['message']); } $gen = &$main->getDefaultGenerator(); $tgzfile = $gen->toTgz2($this, $other, $compress); if (PEAR::isError($tgzfile)) { return $tgzfile; } $dest_package = basename($tgzfile); $pkgdir = dirname($pkgfile); // TAR the Package ------------------------------------------- $this->log(1, "Package $dest_package done"); if (file_exists("$pkgdir/CVS/Root")) { $cvsversion = preg_replace('/[^a-z0-9]/i', '_', $pf->getVersion()); $cvstag = "RELEASE_$cvsversion"; $this->log(1, 'Tag the released code with "pear cvstag ' . $main->getPackageFile() . '"'); $this->log(1, "(or set the CVS tag $cvstag by hand)"); } elseif (file_exists("$pkgdir/.svn")) { $svnversion = preg_replace('/[^a-z0-9]/i', '.', $pf->getVersion()); $svntag = $pf->getName() . "-$svnversion"; $this->log(1, 'Tag the released code with "pear svntag ' . $main->getPackageFile() . '"'); $this->log(1, "(or set the SVN tag $svntag by hand)"); } } else { // this branch is executed for single packagefile packaging $gen = &$pf->getDefaultGenerator(); $tgzfile = $gen->toTgz($this, $compress); if (PEAR::isError($tgzfile)) { $this->log(0, $tgzfile->getMessage()); return $this->raiseError("Cannot package, errors in package"); } $dest_package = basename($tgzfile); $pkgdir = dirname($pkgfile); // TAR the Package ------------------------------------------- $this->log(1, "Package $dest_package done"); if (file_exists("$pkgdir/CVS/Root")) { $cvsversion = preg_replace('/[^a-z0-9]/i', '_', $pf->getVersion()); $cvstag = "RELEASE_$cvsversion"; $this->log(1, "Tag the released code with `pear cvstag $pkgfile'"); $this->log(1, "(or set the CVS tag $cvstag by hand)"); } elseif (file_exists("$pkgdir/.svn")) { $svnversion = preg_replace('/[^a-z0-9]/i', '.', $pf->getVersion()); $svntag = $pf->getName() . "-$svnversion"; $this->log(1, "Tag the released code with `pear svntag $pkgfile'"); $this->log(1, "(or set the SVN tag $svntag by hand)"); } } return $dest_package; } }php-pear-1.10.1+submodules+notgz/PEAR/REST.php000066400000000000000000000430061262614675700206610ustar00rootroot00000000000000 * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ /** * For downloading xml files */ require_once 'PEAR.php'; require_once 'PEAR/XMLParser.php'; /** * Intelligently retrieve data, following hyperlinks if necessary, and re-directing * as well * @category pear * @package PEAR * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version Release: @package_version@ * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ class PEAR_REST { var $config; var $_options; function __construct(&$config, $options = array()) { $this->config = &$config; $this->_options = $options; } /** * Retrieve REST data, but always retrieve the local cache if it is available. * * This is useful for elements that should never change, such as information on a particular * release * @param string full URL to this resource * @param array|false contents of the accept-encoding header * @param boolean if true, xml will be returned as a string, otherwise, xml will be * parsed using PEAR_XMLParser * @return string|array */ function retrieveCacheFirst($url, $accept = false, $forcestring = false, $channel = false) { $cachefile = $this->config->get('cache_dir') . DIRECTORY_SEPARATOR . md5($url) . 'rest.cachefile'; if (file_exists($cachefile)) { return unserialize(implode('', file($cachefile))); } return $this->retrieveData($url, $accept, $forcestring, $channel); } /** * Retrieve a remote REST resource * @param string full URL to this resource * @param array|false contents of the accept-encoding header * @param boolean if true, xml will be returned as a string, otherwise, xml will be * parsed using PEAR_XMLParser * @return string|array */ function retrieveData($url, $accept = false, $forcestring = false, $channel = false) { $cacheId = $this->getCacheId($url); if ($ret = $this->useLocalCache($url, $cacheId)) { return $ret; } $file = $trieddownload = false; if (!isset($this->_options['offline'])) { $trieddownload = true; $file = $this->downloadHttp($url, $cacheId ? $cacheId['lastChange'] : false, $accept, $channel); } if (PEAR::isError($file)) { if ($file->getCode() !== -9276) { return $file; } $trieddownload = false; $file = false; // use local copy if available on socket connect error } if (!$file) { $ret = $this->getCache($url); if (!PEAR::isError($ret) && $trieddownload) { // reset the age of the cache if the server says it was unmodified $result = $this->saveCache($url, $ret, null, true, $cacheId); if (PEAR::isError($result)) { return PEAR::raiseError($result->getMessage()); } } return $ret; } if (is_array($file)) { $headers = $file[2]; $lastmodified = $file[1]; $content = $file[0]; } else { $headers = array(); $lastmodified = false; $content = $file; } if ($forcestring) { $result = $this->saveCache($url, $content, $lastmodified, false, $cacheId); if (PEAR::isError($result)) { return PEAR::raiseError($result->getMessage()); } return $content; } if (isset($headers['content-type'])) { $content_type = explode(";", $headers['content-type']); $content_type = $content_type[0]; switch ($content_type) { case 'text/xml' : case 'application/xml' : case 'text/plain' : if ($content_type === 'text/plain') { $check = substr($content, 0, 5); if ($check !== 'parse($content); PEAR::popErrorHandling(); if (PEAR::isError($err)) { return PEAR::raiseError('Invalid xml downloaded from "' . $url . '": ' . $err->getMessage()); } $content = $parser->getData(); case 'text/html' : default : // use it as a string } } else { // assume XML $parser = new PEAR_XMLParser; $parser->parse($content); $content = $parser->getData(); } $result = $this->saveCache($url, $content, $lastmodified, false, $cacheId); if (PEAR::isError($result)) { return PEAR::raiseError($result->getMessage()); } return $content; } function useLocalCache($url, $cacheid = null) { if ($cacheid === null) { $cacheidfile = $this->config->get('cache_dir') . DIRECTORY_SEPARATOR . md5($url) . 'rest.cacheid'; if (!file_exists($cacheidfile)) { return false; } $cacheid = unserialize(implode('', file($cacheidfile))); } $cachettl = $this->config->get('cache_ttl'); // If cache is newer than $cachettl seconds, we use the cache! if (time() - $cacheid['age'] < $cachettl) { return $this->getCache($url); } return false; } function getCacheId($url) { $cacheidfile = $this->config->get('cache_dir') . DIRECTORY_SEPARATOR . md5($url) . 'rest.cacheid'; if (!file_exists($cacheidfile)) { return false; } $ret = unserialize(implode('', file($cacheidfile))); return $ret; } function getCache($url) { $cachefile = $this->config->get('cache_dir') . DIRECTORY_SEPARATOR . md5($url) . 'rest.cachefile'; if (!file_exists($cachefile)) { return PEAR::raiseError('No cached content available for "' . $url . '"'); } return unserialize(implode('', file($cachefile))); } /** * @param string full URL to REST resource * @param string original contents of the REST resource * @param array HTTP Last-Modified and ETag headers * @param bool if true, then the cache id file should be regenerated to * trigger a new time-to-live value */ function saveCache($url, $contents, $lastmodified, $nochange = false, $cacheid = null) { $cache_dir = $this->config->get('cache_dir'); $d = $cache_dir . DIRECTORY_SEPARATOR . md5($url); $cacheidfile = $d . 'rest.cacheid'; $cachefile = $d . 'rest.cachefile'; if (!is_dir($cache_dir)) { if (System::mkdir(array('-p', $cache_dir)) === false) { return PEAR::raiseError("The value of config option cache_dir ($cache_dir) is not a directory and attempts to create the directory failed."); } } if (!is_writeable($cache_dir)) { // If writing to the cache dir is not going to work, silently do nothing. // An ugly hack, but retains compat with PEAR 1.9.1 where many commands // work fine as non-root user (w/out write access to default cache dir). return true; } if ($cacheid === null && $nochange) { $cacheid = unserialize(implode('', file($cacheidfile))); } $idData = serialize(array( 'age' => time(), 'lastChange' => ($nochange ? $cacheid['lastChange'] : $lastmodified), )); $result = $this->saveCacheFile($cacheidfile, $idData); if (PEAR::isError($result)) { return $result; } elseif ($nochange) { return true; } $result = $this->saveCacheFile($cachefile, serialize($contents)); if (PEAR::isError($result)) { if (file_exists($cacheidfile)) { @unlink($cacheidfile); } return $result; } return true; } function saveCacheFile($file, $contents) { $len = strlen($contents); $cachefile_fp = @fopen($file, 'xb'); // x is the O_CREAT|O_EXCL mode if ($cachefile_fp !== false) { // create file if (fwrite($cachefile_fp, $contents, $len) < $len) { fclose($cachefile_fp); return PEAR::raiseError("Could not write $file."); } } else { // update file $cachefile_fp = @fopen($file, 'r+b'); // do not truncate file if (!$cachefile_fp) { return PEAR::raiseError("Could not open $file for writing."); } if (OS_WINDOWS) { $not_symlink = !is_link($file); // see bug #18834 } else { $cachefile_lstat = lstat($file); $cachefile_fstat = fstat($cachefile_fp); $not_symlink = $cachefile_lstat['mode'] == $cachefile_fstat['mode'] && $cachefile_lstat['ino'] == $cachefile_fstat['ino'] && $cachefile_lstat['dev'] == $cachefile_fstat['dev'] && $cachefile_fstat['nlink'] === 1; } if ($not_symlink) { ftruncate($cachefile_fp, 0); // NOW truncate if (fwrite($cachefile_fp, $contents, $len) < $len) { fclose($cachefile_fp); return PEAR::raiseError("Could not write $file."); } } else { fclose($cachefile_fp); $link = function_exists('readlink') ? readlink($file) : $file; return PEAR::raiseError('SECURITY ERROR: Will not write to ' . $file . ' as it is symlinked to ' . $link . ' - Possible symlink attack'); } } fclose($cachefile_fp); return true; } /** * Efficiently Download a file through HTTP. Returns downloaded file as a string in-memory * This is best used for small files * * If an HTTP proxy has been configured (http_proxy PEAR_Config * setting), the proxy will be used. * * @param string $url the URL to download * @param string $save_dir directory to save file in * @param false|string|array $lastmodified header values to check against for caching * use false to return the header values from this download * @param false|array $accept Accept headers to send * @return string|array Returns the contents of the downloaded file or a PEAR * error on failure. If the error is caused by * socket-related errors, the error object will * have the fsockopen error code available through * getCode(). If caching is requested, then return the header * values. * * @access public */ function downloadHttp($url, $lastmodified = null, $accept = false, $channel = false) { static $redirect = 0; // always reset , so we are clean case of error $wasredirect = $redirect; $redirect = 0; $info = parse_url($url); if (!isset($info['scheme']) || !in_array($info['scheme'], array('http', 'https'))) { return PEAR::raiseError('Cannot download non-http URL "' . $url . '"'); } if (!isset($info['host'])) { return PEAR::raiseError('Cannot download from non-URL "' . $url . '"'); } $host = isset($info['host']) ? $info['host'] : null; $port = isset($info['port']) ? $info['port'] : null; $path = isset($info['path']) ? $info['path'] : null; $schema = (isset($info['scheme']) && $info['scheme'] == 'https') ? 'https' : 'http'; $proxy_host = $proxy_port = $proxy_user = $proxy_pass = ''; if ($this->config->get('http_proxy')&& $proxy = parse_url($this->config->get('http_proxy')) ) { $proxy_host = isset($proxy['host']) ? $proxy['host'] : null; if ($schema === 'https') { $proxy_host = 'ssl://' . $proxy_host; } $proxy_port = isset($proxy['port']) ? $proxy['port'] : 8080; $proxy_user = isset($proxy['user']) ? urldecode($proxy['user']) : null; $proxy_pass = isset($proxy['pass']) ? urldecode($proxy['pass']) : null; $proxy_schema = (isset($proxy['scheme']) && $proxy['scheme'] == 'https') ? 'https' : 'http'; } if (empty($port)) { $port = (isset($info['scheme']) && $info['scheme'] == 'https') ? 443 : 80; } if (isset($proxy['host'])) { $request = "GET $url HTTP/1.1\r\n"; } else { $request = "GET $path HTTP/1.1\r\n"; } $request .= "Host: $host\r\n"; $ifmodifiedsince = ''; if (is_array($lastmodified)) { if (isset($lastmodified['Last-Modified'])) { $ifmodifiedsince = 'If-Modified-Since: ' . $lastmodified['Last-Modified'] . "\r\n"; } if (isset($lastmodified['ETag'])) { $ifmodifiedsince .= "If-None-Match: $lastmodified[ETag]\r\n"; } } else { $ifmodifiedsince = ($lastmodified ? "If-Modified-Since: $lastmodified\r\n" : ''); } $request .= $ifmodifiedsince . "User-Agent: PEAR/@package_version@/PHP/" . PHP_VERSION . "\r\n"; $username = $this->config->get('username', null, $channel); $password = $this->config->get('password', null, $channel); if ($username && $password) { $tmp = base64_encode("$username:$password"); $request .= "Authorization: Basic $tmp\r\n"; } if ($proxy_host != '' && $proxy_user != '') { $request .= 'Proxy-Authorization: Basic ' . base64_encode($proxy_user . ':' . $proxy_pass) . "\r\n"; } if ($accept) { $request .= 'Accept: ' . implode(', ', $accept) . "\r\n"; } $request .= "Accept-Encoding:\r\n"; $request .= "Connection: close\r\n"; $request .= "\r\n"; if ($proxy_host != '') { $fp = @fsockopen($proxy_host, $proxy_port, $errno, $errstr, 15); if (!$fp) { return PEAR::raiseError("Connection to `$proxy_host:$proxy_port' failed: $errstr", -9276); } } else { if ($schema === 'https') { $host = 'ssl://' . $host; } $fp = @fsockopen($host, $port, $errno, $errstr); if (!$fp) { return PEAR::raiseError("Connection to `$host:$port' failed: $errstr", $errno); } } fwrite($fp, $request); $headers = array(); $reply = 0; while ($line = trim(fgets($fp, 1024))) { if (preg_match('/^([^:]+):\s+(.*)\s*\\z/', $line, $matches)) { $headers[strtolower($matches[1])] = trim($matches[2]); } elseif (preg_match('|^HTTP/1.[01] ([0-9]{3}) |', $line, $matches)) { $reply = (int)$matches[1]; if ($reply == 304 && ($lastmodified || ($lastmodified === false))) { return false; } if (!in_array($reply, array(200, 301, 302, 303, 305, 307))) { return PEAR::raiseError("File $schema://$host:$port$path not valid (received: $line)"); } } } if ($reply != 200) { if (!isset($headers['location'])) { return PEAR::raiseError("File $schema://$host:$port$path not valid (redirected but no location)"); } if ($wasredirect > 4) { return PEAR::raiseError("File $schema://$host:$port$path not valid (redirection looped more than 5 times)"); } $redirect = $wasredirect + 1; return $this->downloadHttp($headers['location'], $lastmodified, $accept, $channel); } $length = isset($headers['content-length']) ? $headers['content-length'] : -1; $data = ''; while ($chunk = @fread($fp, 8192)) { $data .= $chunk; } fclose($fp); if ($lastmodified === false || $lastmodified) { if (isset($headers['etag'])) { $lastmodified = array('ETag' => $headers['etag']); } if (isset($headers['last-modified'])) { if (is_array($lastmodified)) { $lastmodified['Last-Modified'] = $headers['last-modified']; } else { $lastmodified = $headers['last-modified']; } } return array($data, $lastmodified, $headers); } return $data; } } php-pear-1.10.1+submodules+notgz/PEAR/REST/000077500000000000000000000000001262614675700201455ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/PEAR/REST/10.php000066400000000000000000000776331262614675700211160ustar00rootroot00000000000000 * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a12 */ /** * For downloading REST xml/txt files */ require_once 'PEAR/REST.php'; /** * Implement REST 1.0 * * @category pear * @package PEAR * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version Release: @package_version@ * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a12 */ class PEAR_REST_10 { /** * @var PEAR_REST */ var $_rest; function __construct($config, $options = array()) { $this->_rest = new PEAR_REST($config, $options); } /** * Retrieve information about a remote package to be downloaded from a REST server * * @param string $base The uri to prepend to all REST calls * @param array $packageinfo an array of format: *
     *  array(
     *   'package' => 'packagename',
     *   'channel' => 'channelname',
     *  ['state' => 'alpha' (or valid state),]
     *  -or-
     *  ['version' => '1.whatever']
     * 
* @param string $prefstate Current preferred_state config variable value * @param bool $installed the installed version of this package to compare against * @return array|false|PEAR_Error see {@link _returnDownloadURL()} */ function getDownloadURL($base, $packageinfo, $prefstate, $installed, $channel = false) { $states = $this->betterStates($prefstate, true); if (!$states) { return PEAR::raiseError('"' . $prefstate . '" is not a valid state'); } $channel = $packageinfo['channel']; $package = $packageinfo['package']; $state = isset($packageinfo['state']) ? $packageinfo['state'] : null; $version = isset($packageinfo['version']) ? $packageinfo['version'] : null; $restFile = $base . 'r/' . strtolower($package) . '/allreleases.xml'; $info = $this->_rest->retrieveData($restFile, false, false, $channel); if (PEAR::isError($info)) { return PEAR::raiseError('No releases available for package "' . $channel . '/' . $package . '"'); } if (!isset($info['r'])) { return false; } $release = $found = false; if (!is_array($info['r']) || !isset($info['r'][0])) { $info['r'] = array($info['r']); } foreach ($info['r'] as $release) { if (!isset($this->_rest->_options['force']) && ($installed && version_compare($release['v'], $installed, '<'))) { continue; } if (isset($state)) { // try our preferred state first if ($release['s'] == $state) { $found = true; break; } // see if there is something newer and more stable // bug #7221 if (in_array($release['s'], $this->betterStates($state), true)) { $found = true; break; } } elseif (isset($version)) { if ($release['v'] == $version) { $found = true; break; } } else { if (in_array($release['s'], $states)) { $found = true; break; } } } return $this->_returnDownloadURL($base, $package, $release, $info, $found, false, $channel); } function getDepDownloadURL($base, $xsdversion, $dependency, $deppackage, $prefstate = 'stable', $installed = false, $channel = false) { $states = $this->betterStates($prefstate, true); if (!$states) { return PEAR::raiseError('"' . $prefstate . '" is not a valid state'); } $channel = $dependency['channel']; $package = $dependency['name']; $state = isset($dependency['state']) ? $dependency['state'] : null; $version = isset($dependency['version']) ? $dependency['version'] : null; $restFile = $base . 'r/' . strtolower($package) . '/allreleases.xml'; $info = $this->_rest->retrieveData($restFile, false, false, $channel); if (PEAR::isError($info)) { return PEAR::raiseError('Package "' . $deppackage['channel'] . '/' . $deppackage['package'] . '" dependency "' . $channel . '/' . $package . '" has no releases'); } if (!is_array($info) || !isset($info['r'])) { return false; } $exclude = array(); $min = $max = $recommended = false; if ($xsdversion == '1.0') { switch ($dependency['rel']) { case 'ge' : $min = $dependency['version']; break; case 'gt' : $min = $dependency['version']; $exclude = array($dependency['version']); break; case 'eq' : $recommended = $dependency['version']; break; case 'lt' : $max = $dependency['version']; $exclude = array($dependency['version']); break; case 'le' : $max = $dependency['version']; break; case 'ne' : $exclude = array($dependency['version']); break; } } else { $min = isset($dependency['min']) ? $dependency['min'] : false; $max = isset($dependency['max']) ? $dependency['max'] : false; $recommended = isset($dependency['recommended']) ? $dependency['recommended'] : false; if (isset($dependency['exclude'])) { if (!isset($dependency['exclude'][0])) { $exclude = array($dependency['exclude']); } } } $release = $found = false; if (!is_array($info['r']) || !isset($info['r'][0])) { $info['r'] = array($info['r']); } foreach ($info['r'] as $release) { if (!isset($this->_rest->_options['force']) && ($installed && version_compare($release['v'], $installed, '<'))) { continue; } if (in_array($release['v'], $exclude)) { // skip excluded versions continue; } // allow newer releases to say "I'm OK with the dependent package" if ($xsdversion == '2.0' && isset($release['co'])) { if (!is_array($release['co']) || !isset($release['co'][0])) { $release['co'] = array($release['co']); } foreach ($release['co'] as $entry) { if (isset($entry['x']) && !is_array($entry['x'])) { $entry['x'] = array($entry['x']); } elseif (!isset($entry['x'])) { $entry['x'] = array(); } if ($entry['c'] == $deppackage['channel'] && strtolower($entry['p']) == strtolower($deppackage['package']) && version_compare($deppackage['version'], $entry['min'], '>=') && version_compare($deppackage['version'], $entry['max'], '<=') && !in_array($release['v'], $entry['x'])) { $recommended = $release['v']; break; } } } if ($recommended) { if ($release['v'] != $recommended) { // if we want a specific // version, then skip all others continue; } else { if (!in_array($release['s'], $states)) { // the stability is too low, but we must return the // recommended version if possible return $this->_returnDownloadURL($base, $package, $release, $info, true, false, $channel); } } } if ($min && version_compare($release['v'], $min, 'lt')) { // skip too old versions continue; } if ($max && version_compare($release['v'], $max, 'gt')) { // skip too new versions continue; } if ($installed && version_compare($release['v'], $installed, '<')) { continue; } if (in_array($release['s'], $states)) { // if in the preferred state... $found = true; // ... then use it break; } } return $this->_returnDownloadURL($base, $package, $release, $info, $found, false, $channel); } /** * Take raw data and return the array needed for processing a download URL * * @param string $base REST base uri * @param string $package Package name * @param array $release an array of format array('v' => version, 's' => state) * describing the release to download * @param array $info list of all releases as defined by allreleases.xml * @param bool|null $found determines whether the release was found or this is the next * best alternative. If null, then versions were skipped because * of PHP dependency * @return array|PEAR_Error * @access private */ function _returnDownloadURL($base, $package, $release, $info, $found, $phpversion = false, $channel = false) { if (!$found) { $release = $info['r'][0]; } $packageLower = strtolower($package); $pinfo = $this->_rest->retrieveCacheFirst($base . 'p/' . $packageLower . '/' . 'info.xml', false, false, $channel); if (PEAR::isError($pinfo)) { return PEAR::raiseError('Package "' . $package . '" does not have REST info xml available'); } $releaseinfo = $this->_rest->retrieveCacheFirst($base . 'r/' . $packageLower . '/' . $release['v'] . '.xml', false, false, $channel); if (PEAR::isError($releaseinfo)) { return PEAR::raiseError('Package "' . $package . '" Version "' . $release['v'] . '" does not have REST xml available'); } $packagexml = $this->_rest->retrieveCacheFirst($base . 'r/' . $packageLower . '/' . 'deps.' . $release['v'] . '.txt', false, true, $channel); if (PEAR::isError($packagexml)) { return PEAR::raiseError('Package "' . $package . '" Version "' . $release['v'] . '" does not have REST dependency information available'); } $packagexml = unserialize($packagexml); if (!$packagexml) { $packagexml = array(); } $allinfo = $this->_rest->retrieveData($base . 'r/' . $packageLower . '/allreleases.xml', false, false, $channel); if (PEAR::isError($allinfo)) { return $allinfo; } if (!is_array($allinfo['r']) || !isset($allinfo['r'][0])) { $allinfo['r'] = array($allinfo['r']); } $compatible = false; foreach ($allinfo['r'] as $release) { if ($release['v'] != $releaseinfo['v']) { continue; } if (!isset($release['co'])) { break; } $compatible = array(); if (!is_array($release['co']) || !isset($release['co'][0])) { $release['co'] = array($release['co']); } foreach ($release['co'] as $entry) { $comp = array(); $comp['name'] = $entry['p']; $comp['channel'] = $entry['c']; $comp['min'] = $entry['min']; $comp['max'] = $entry['max']; if (isset($entry['x']) && !is_array($entry['x'])) { $comp['exclude'] = $entry['x']; } $compatible[] = $comp; } if (count($compatible) == 1) { $compatible = $compatible[0]; } break; } $deprecated = false; if (isset($pinfo['dc']) && isset($pinfo['dp'])) { if (is_array($pinfo['dp'])) { $deprecated = array('channel' => (string) $pinfo['dc'], 'package' => trim($pinfo['dp']['_content'])); } else { $deprecated = array('channel' => (string) $pinfo['dc'], 'package' => trim($pinfo['dp'])); } } $return = array( 'version' => $releaseinfo['v'], 'info' => $packagexml, 'package' => $releaseinfo['p']['_content'], 'stability' => $releaseinfo['st'], 'compatible' => $compatible, 'deprecated' => $deprecated, ); if ($found) { $return['url'] = $releaseinfo['g']; return $return; } $return['php'] = $phpversion; return $return; } function listPackages($base, $channel = false) { $packagelist = $this->_rest->retrieveData($base . 'p/packages.xml', false, false, $channel); if (PEAR::isError($packagelist)) { return $packagelist; } if (!is_array($packagelist) || !isset($packagelist['p'])) { return array(); } if (!is_array($packagelist['p'])) { $packagelist['p'] = array($packagelist['p']); } return $packagelist['p']; } /** * List all categories of a REST server * * @param string $base base URL of the server * @return array of categorynames */ function listCategories($base, $channel = false) { $categories = array(); // c/categories.xml does not exist; // check for every package its category manually // This is SLOOOWWWW : /// $packagelist = $this->_rest->retrieveData($base . 'p/packages.xml', false, false, $channel); if (PEAR::isError($packagelist)) { return $packagelist; } if (!is_array($packagelist) || !isset($packagelist['p'])) { $ret = array(); return $ret; } if (!is_array($packagelist['p'])) { $packagelist['p'] = array($packagelist['p']); } PEAR::pushErrorHandling(PEAR_ERROR_RETURN); foreach ($packagelist['p'] as $package) { $inf = $this->_rest->retrieveData($base . 'p/' . strtolower($package) . '/info.xml', false, false, $channel); if (PEAR::isError($inf)) { PEAR::popErrorHandling(); return $inf; } $cat = $inf['ca']['_content']; if (!isset($categories[$cat])) { $categories[$cat] = $inf['ca']; } } return array_values($categories); } /** * List a category of a REST server * * @param string $base base URL of the server * @param string $category name of the category * @param boolean $info also download full package info * @return array of packagenames */ function listCategory($base, $category, $info = false, $channel = false) { // gives '404 Not Found' error when category doesn't exist $packagelist = $this->_rest->retrieveData($base.'c/'.urlencode($category).'/packages.xml', false, false, $channel); if (PEAR::isError($packagelist)) { return $packagelist; } if (!is_array($packagelist) || !isset($packagelist['p'])) { return array(); } if (!is_array($packagelist['p']) || !isset($packagelist['p'][0])) { // only 1 pkg $packagelist = array($packagelist['p']); } else { $packagelist = $packagelist['p']; } if ($info == true) { // get individual package info PEAR::pushErrorHandling(PEAR_ERROR_RETURN); foreach ($packagelist as $i => $packageitem) { $url = sprintf('%s'.'r/%s/latest.txt', $base, strtolower($packageitem['_content'])); $version = $this->_rest->retrieveData($url, false, false, $channel); if (PEAR::isError($version)) { break; // skipit } $url = sprintf('%s'.'r/%s/%s.xml', $base, strtolower($packageitem['_content']), $version); $info = $this->_rest->retrieveData($url, false, false, $channel); if (PEAR::isError($info)) { break; // skipit } $packagelist[$i]['info'] = $info; } PEAR::popErrorHandling(); } return $packagelist; } function listAll($base, $dostable, $basic = true, $searchpackage = false, $searchsummary = false, $channel = false) { $packagelist = $this->_rest->retrieveData($base . 'p/packages.xml', false, false, $channel); if (PEAR::isError($packagelist)) { return $packagelist; } if ($this->_rest->config->get('verbose') > 0) { $ui = &PEAR_Frontend::singleton(); $ui->log('Retrieving data...0%', true); } $ret = array(); if (!is_array($packagelist) || !isset($packagelist['p'])) { return $ret; } if (!is_array($packagelist['p'])) { $packagelist['p'] = array($packagelist['p']); } // only search-packagename = quicksearch ! if ($searchpackage && (!$searchsummary || empty($searchpackage))) { $newpackagelist = array(); foreach ($packagelist['p'] as $package) { if (!empty($searchpackage) && stristr($package, $searchpackage) !== false) { $newpackagelist[] = $package; } } $packagelist['p'] = $newpackagelist; } PEAR::pushErrorHandling(PEAR_ERROR_RETURN); $next = .1; foreach ($packagelist['p'] as $progress => $package) { if ($this->_rest->config->get('verbose') > 0) { if ($progress / count($packagelist['p']) >= $next) { if ($next == .5) { $ui->log('50%', false); } else { $ui->log('.', false); } $next += .1; } } if ($basic) { // remote-list command if ($dostable) { $latest = $this->_rest->retrieveData($base . 'r/' . strtolower($package) . '/stable.txt', false, false, $channel); } else { $latest = $this->_rest->retrieveData($base . 'r/' . strtolower($package) . '/latest.txt', false, false, $channel); } if (PEAR::isError($latest)) { $latest = false; } $info = array('stable' => $latest); } else { // list-all command $inf = $this->_rest->retrieveData($base . 'p/' . strtolower($package) . '/info.xml', false, false, $channel); if (PEAR::isError($inf)) { PEAR::popErrorHandling(); return $inf; } if ($searchpackage) { $found = (!empty($searchpackage) && stristr($package, $searchpackage) !== false); if (!$found && !(isset($searchsummary) && !empty($searchsummary) && (stristr($inf['s'], $searchsummary) !== false || stristr($inf['d'], $searchsummary) !== false))) { continue; }; } $releases = $this->_rest->retrieveData($base . 'r/' . strtolower($package) . '/allreleases.xml', false, false, $channel); if (PEAR::isError($releases)) { continue; } if (!isset($releases['r'][0])) { $releases['r'] = array($releases['r']); } unset($latest); unset($unstable); unset($stable); unset($state); foreach ($releases['r'] as $release) { if (!isset($latest)) { if ($dostable && $release['s'] == 'stable') { $latest = $release['v']; $state = 'stable'; } if (!$dostable) { $latest = $release['v']; $state = $release['s']; } } if (!isset($stable) && $release['s'] == 'stable') { $stable = $release['v']; if (!isset($unstable)) { $unstable = $stable; } } if (!isset($unstable) && $release['s'] != 'stable') { $latest = $unstable = $release['v']; $state = $release['s']; } if (isset($latest) && !isset($state)) { $state = $release['s']; } if (isset($latest) && isset($stable) && isset($unstable)) { break; } } $deps = array(); if (!isset($unstable)) { $unstable = false; $state = 'stable'; if (isset($stable)) { $latest = $unstable = $stable; } } else { $latest = $unstable; } if (!isset($latest)) { $latest = false; } if ($latest) { $d = $this->_rest->retrieveCacheFirst($base . 'r/' . strtolower($package) . '/deps.' . $latest . '.txt', false, false, $channel); if (!PEAR::isError($d)) { $d = unserialize($d); if ($d) { if (isset($d['required'])) { if (!class_exists('PEAR_PackageFile_v2')) { require_once 'PEAR/PackageFile/v2.php'; } if (!isset($pf)) { $pf = new PEAR_PackageFile_v2; } $pf->setDeps($d); $tdeps = $pf->getDeps(); } else { $tdeps = $d; } foreach ($tdeps as $dep) { if ($dep['type'] !== 'pkg') { continue; } $deps[] = $dep; } } } } if (!isset($stable)) { $stable = '-n/a-'; } if (!$searchpackage) { $info = array('stable' => $latest, 'summary' => $inf['s'], 'description' => $inf['d'], 'deps' => $deps, 'category' => $inf['ca']['_content'], 'unstable' => $unstable, 'state' => $state); } else { $info = array('stable' => $stable, 'summary' => $inf['s'], 'description' => $inf['d'], 'deps' => $deps, 'category' => $inf['ca']['_content'], 'unstable' => $unstable, 'state' => $state); } } $ret[$package] = $info; } PEAR::popErrorHandling(); return $ret; } function listLatestUpgrades($base, $pref_state, $installed, $channel, &$reg) { $packagelist = $this->_rest->retrieveData($base . 'p/packages.xml', false, false, $channel); if (PEAR::isError($packagelist)) { return $packagelist; } $ret = array(); if (!is_array($packagelist) || !isset($packagelist['p'])) { return $ret; } if (!is_array($packagelist['p'])) { $packagelist['p'] = array($packagelist['p']); } foreach ($packagelist['p'] as $package) { if (!isset($installed[strtolower($package)])) { continue; } $inst_version = $reg->packageInfo($package, 'version', $channel); $inst_state = $reg->packageInfo($package, 'release_state', $channel); PEAR::pushErrorHandling(PEAR_ERROR_RETURN); $info = $this->_rest->retrieveData($base . 'r/' . strtolower($package) . '/allreleases.xml', false, false, $channel); PEAR::popErrorHandling(); if (PEAR::isError($info)) { continue; // no remote releases } if (!isset($info['r'])) { continue; } $release = $found = false; if (!is_array($info['r']) || !isset($info['r'][0])) { $info['r'] = array($info['r']); } // $info['r'] is sorted by version number usort($info['r'], array($this, '_sortReleasesByVersionNumber')); foreach ($info['r'] as $release) { if ($inst_version && version_compare($release['v'], $inst_version, '<=')) { // not newer than the one installed break; } // new version > installed version if (!$pref_state) { // every state is a good state $found = true; break; } else { $new_state = $release['s']; // if new state >= installed state: go if (in_array($new_state, $this->betterStates($inst_state, true))) { $found = true; break; } else { // only allow to lower the state of package, // if new state >= preferred state: go if (in_array($new_state, $this->betterStates($pref_state, true))) { $found = true; break; } } } } if (!$found) { continue; } $relinfo = $this->_rest->retrieveCacheFirst($base . 'r/' . strtolower($package) . '/' . $release['v'] . '.xml', false, false, $channel); if (PEAR::isError($relinfo)) { return $relinfo; } $ret[$package] = array( 'version' => $release['v'], 'state' => $release['s'], 'filesize' => $relinfo['f'], ); } return $ret; } function packageInfo($base, $package, $channel = false) { PEAR::pushErrorHandling(PEAR_ERROR_RETURN); $pinfo = $this->_rest->retrieveData($base . 'p/' . strtolower($package) . '/info.xml', false, false, $channel); if (PEAR::isError($pinfo)) { PEAR::popErrorHandling(); return PEAR::raiseError('Unknown package: "' . $package . '" in channel "' . $channel . '"' . "\n". 'Debug: ' . $pinfo->getMessage()); } $releases = array(); $allreleases = $this->_rest->retrieveData($base . 'r/' . strtolower($package) . '/allreleases.xml', false, false, $channel); if (!PEAR::isError($allreleases)) { if (!class_exists('PEAR_PackageFile_v2')) { require_once 'PEAR/PackageFile/v2.php'; } if (!is_array($allreleases['r']) || !isset($allreleases['r'][0])) { $allreleases['r'] = array($allreleases['r']); } $pf = new PEAR_PackageFile_v2; foreach ($allreleases['r'] as $release) { $ds = $this->_rest->retrieveCacheFirst($base . 'r/' . strtolower($package) . '/deps.' . $release['v'] . '.txt', false, false, $channel); if (PEAR::isError($ds)) { continue; } if (!isset($latest)) { $latest = $release['v']; } $pf->setDeps(unserialize($ds)); $ds = $pf->getDeps(); $info = $this->_rest->retrieveCacheFirst($base . 'r/' . strtolower($package) . '/' . $release['v'] . '.xml', false, false, $channel); if (PEAR::isError($info)) { continue; } $releases[$release['v']] = array( 'doneby' => $info['m'], 'license' => $info['l'], 'summary' => $info['s'], 'description' => $info['d'], 'releasedate' => $info['da'], 'releasenotes' => $info['n'], 'state' => $release['s'], 'deps' => $ds ? $ds : array(), ); } } else { $latest = ''; } PEAR::popErrorHandling(); if (isset($pinfo['dc']) && isset($pinfo['dp'])) { if (is_array($pinfo['dp'])) { $deprecated = array('channel' => (string) $pinfo['dc'], 'package' => trim($pinfo['dp']['_content'])); } else { $deprecated = array('channel' => (string) $pinfo['dc'], 'package' => trim($pinfo['dp'])); } } else { $deprecated = false; } if (!isset($latest)) { $latest = ''; } return array( 'name' => $pinfo['n'], 'channel' => $pinfo['c'], 'category' => $pinfo['ca']['_content'], 'stable' => $latest, 'license' => $pinfo['l'], 'summary' => $pinfo['s'], 'description' => $pinfo['d'], 'releases' => $releases, 'deprecated' => $deprecated, ); } /** * Return an array containing all of the states that are more stable than * or equal to the passed in state * * @param string Release state * @param boolean Determines whether to include $state in the list * @return false|array False if $state is not a valid release state */ function betterStates($state, $include = false) { static $states = array('snapshot', 'devel', 'alpha', 'beta', 'stable'); $i = array_search($state, $states); if ($i === false) { return false; } if ($include) { $i--; } return array_slice($states, $i + 1); } /** * Sort releases by version number * * @access private */ function _sortReleasesByVersionNumber($a, $b) { if (version_compare($a['v'], $b['v'], '=')) { return 0; } if (version_compare($a['v'], $b['v'], '>')) { return -1; } if (version_compare($a['v'], $b['v'], '<')) { return 1; } } } php-pear-1.10.1+submodules+notgz/PEAR/REST/11.php000066400000000000000000000257631262614675700211140ustar00rootroot00000000000000 * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.3 */ /** * For downloading REST xml/txt files */ require_once 'PEAR/REST.php'; /** * Implement REST 1.1 * * @category pear * @package PEAR * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version Release: @package_version@ * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.3 */ class PEAR_REST_11 { /** * @var PEAR_REST */ var $_rest; function __construct($config, $options = array()) { $this->_rest = new PEAR_REST($config, $options); } function listAll($base, $dostable, $basic = true, $searchpackage = false, $searchsummary = false, $channel = false) { $categorylist = $this->_rest->retrieveData($base . 'c/categories.xml', false, false, $channel); if (PEAR::isError($categorylist)) { return $categorylist; } $ret = array(); if (!is_array($categorylist['c']) || !isset($categorylist['c'][0])) { $categorylist['c'] = array($categorylist['c']); } PEAR::pushErrorHandling(PEAR_ERROR_RETURN); foreach ($categorylist['c'] as $progress => $category) { $category = $category['_content']; $packagesinfo = $this->_rest->retrieveData($base . 'c/' . urlencode($category) . '/packagesinfo.xml', false, false, $channel); if (PEAR::isError($packagesinfo)) { continue; } if (!is_array($packagesinfo) || !isset($packagesinfo['pi'])) { continue; } if (!is_array($packagesinfo['pi']) || !isset($packagesinfo['pi'][0])) { $packagesinfo['pi'] = array($packagesinfo['pi']); } foreach ($packagesinfo['pi'] as $packageinfo) { if (empty($packageinfo)) { continue; } $info = $packageinfo['p']; $package = $info['n']; $releases = isset($packageinfo['a']) ? $packageinfo['a'] : false; unset($latest); unset($unstable); unset($stable); unset($state); if ($releases) { if (!isset($releases['r'][0])) { $releases['r'] = array($releases['r']); } foreach ($releases['r'] as $release) { if (!isset($latest)) { if ($dostable && $release['s'] == 'stable') { $latest = $release['v']; $state = 'stable'; } if (!$dostable) { $latest = $release['v']; $state = $release['s']; } } if (!isset($stable) && $release['s'] == 'stable') { $stable = $release['v']; if (!isset($unstable)) { $unstable = $stable; } } if (!isset($unstable) && $release['s'] != 'stable') { $unstable = $release['v']; $state = $release['s']; } if (isset($latest) && !isset($state)) { $state = $release['s']; } if (isset($latest) && isset($stable) && isset($unstable)) { break; } } } if ($basic) { // remote-list command if (!isset($latest)) { $latest = false; } if ($dostable) { // $state is not set if there are no releases if (isset($state) && $state == 'stable') { $ret[$package] = array('stable' => $latest); } else { $ret[$package] = array('stable' => '-n/a-'); } } else { $ret[$package] = array('stable' => $latest); } continue; } // list-all command if (!isset($unstable)) { $unstable = false; $state = 'stable'; if (isset($stable)) { $latest = $unstable = $stable; } } else { $latest = $unstable; } if (!isset($latest)) { $latest = false; } $deps = array(); if ($latest && isset($packageinfo['deps'])) { if (!is_array($packageinfo['deps']) || !isset($packageinfo['deps'][0]) ) { $packageinfo['deps'] = array($packageinfo['deps']); } $d = false; foreach ($packageinfo['deps'] as $dep) { if ($dep['v'] == $latest) { $d = unserialize($dep['d']); } } if ($d) { if (isset($d['required'])) { if (!class_exists('PEAR_PackageFile_v2')) { require_once 'PEAR/PackageFile/v2.php'; } if (!isset($pf)) { $pf = new PEAR_PackageFile_v2; } $pf->setDeps($d); $tdeps = $pf->getDeps(); } else { $tdeps = $d; } foreach ($tdeps as $dep) { if ($dep['type'] !== 'pkg') { continue; } $deps[] = $dep; } } } $info = array( 'stable' => $latest, 'summary' => $info['s'], 'description' => $info['d'], 'deps' => $deps, 'category' => $info['ca']['_content'], 'unstable' => $unstable, 'state' => $state ); $ret[$package] = $info; } } PEAR::popErrorHandling(); return $ret; } /** * List all categories of a REST server * * @param string $base base URL of the server * @return array of categorynames */ function listCategories($base, $channel = false) { $categorylist = $this->_rest->retrieveData($base . 'c/categories.xml', false, false, $channel); if (PEAR::isError($categorylist)) { return $categorylist; } if (!is_array($categorylist) || !isset($categorylist['c'])) { return array(); } if (isset($categorylist['c']['_content'])) { // only 1 category $categorylist['c'] = array($categorylist['c']); } return $categorylist['c']; } /** * List packages in a category of a REST server * * @param string $base base URL of the server * @param string $category name of the category * @param boolean $info also download full package info * @return array of packagenames */ function listCategory($base, $category, $info = false, $channel = false) { if ($info == false) { $url = '%s'.'c/%s/packages.xml'; } else { $url = '%s'.'c/%s/packagesinfo.xml'; } $url = sprintf($url, $base, urlencode($category)); // gives '404 Not Found' error when category doesn't exist $packagelist = $this->_rest->retrieveData($url, false, false, $channel); if (PEAR::isError($packagelist)) { return $packagelist; } if (!is_array($packagelist)) { return array(); } if ($info == false) { if (!isset($packagelist['p'])) { return array(); } if (!is_array($packagelist['p']) || !isset($packagelist['p'][0])) { // only 1 pkg $packagelist = array($packagelist['p']); } else { $packagelist = $packagelist['p']; } return $packagelist; } // info == true if (!isset($packagelist['pi'])) { return array(); } if (!is_array($packagelist['pi']) || !isset($packagelist['pi'][0])) { // only 1 pkg $packagelist_pre = array($packagelist['pi']); } else { $packagelist_pre = $packagelist['pi']; } $packagelist = array(); foreach ($packagelist_pre as $i => $item) { // compatibility with r/.xml if (isset($item['a']['r'][0])) { // multiple releases $item['p']['v'] = $item['a']['r'][0]['v']; $item['p']['st'] = $item['a']['r'][0]['s']; } elseif (isset($item['a'])) { // first and only release $item['p']['v'] = $item['a']['r']['v']; $item['p']['st'] = $item['a']['r']['s']; } $packagelist[$i] = array('attribs' => $item['p']['r'], '_content' => $item['p']['n'], 'info' => $item['p']); } return $packagelist; } /** * Return an array containing all of the states that are more stable than * or equal to the passed in state * * @param string Release state * @param boolean Determines whether to include $state in the list * @return false|array False if $state is not a valid release state */ function betterStates($state, $include = false) { static $states = array('snapshot', 'devel', 'alpha', 'beta', 'stable'); $i = array_search($state, $states); if ($i === false) { return false; } if ($include) { $i--; } return array_slice($states, $i + 1); } } ?> php-pear-1.10.1+submodules+notgz/PEAR/REST/13.php000066400000000000000000000354411262614675700211100ustar00rootroot00000000000000 * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a12 */ /** * For downloading REST xml/txt files */ require_once 'PEAR/REST.php'; require_once 'PEAR/REST/10.php'; /** * Implement REST 1.3 * * @category pear * @package PEAR * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version Release: @package_version@ * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a12 */ class PEAR_REST_13 extends PEAR_REST_10 { /** * Retrieve information about a remote package to be downloaded from a REST server * * This is smart enough to resolve the minimum PHP version dependency prior to download * @param string $base The uri to prepend to all REST calls * @param array $packageinfo an array of format: *
     *  array(
     *   'package' => 'packagename',
     *   'channel' => 'channelname',
     *  ['state' => 'alpha' (or valid state),]
     *  -or-
     *  ['version' => '1.whatever']
     * 
* @param string $prefstate Current preferred_state config variable value * @param bool $installed the installed version of this package to compare against * @return array|false|PEAR_Error see {@link _returnDownloadURL()} */ function getDownloadURL($base, $packageinfo, $prefstate, $installed, $channel = false) { $states = $this->betterStates($prefstate, true); if (!$states) { return PEAR::raiseError('"' . $prefstate . '" is not a valid state'); } $channel = $packageinfo['channel']; $package = $packageinfo['package']; $state = isset($packageinfo['state']) ? $packageinfo['state'] : null; $version = isset($packageinfo['version']) ? $packageinfo['version'] : null; $restFile = $base . 'r/' . strtolower($package) . '/allreleases2.xml'; $info = $this->_rest->retrieveData($restFile, false, false, $channel); if (PEAR::isError($info)) { return PEAR::raiseError('No releases available for package "' . $channel . '/' . $package . '"'); } if (!isset($info['r'])) { return false; } $release = $found = false; if (!is_array($info['r']) || !isset($info['r'][0])) { $info['r'] = array($info['r']); } $skippedphp = false; foreach ($info['r'] as $release) { if (!isset($this->_rest->_options['force']) && ($installed && version_compare($release['v'], $installed, '<'))) { continue; } if (isset($state)) { // try our preferred state first if ($release['s'] == $state) { if (!isset($version) && version_compare($release['m'], phpversion(), '>')) { // skip releases that require a PHP version newer than our PHP version $skippedphp = $release; continue; } $found = true; break; } // see if there is something newer and more stable // bug #7221 if (in_array($release['s'], $this->betterStates($state), true)) { if (!isset($version) && version_compare($release['m'], phpversion(), '>')) { // skip releases that require a PHP version newer than our PHP version $skippedphp = $release; continue; } $found = true; break; } } elseif (isset($version)) { if ($release['v'] == $version) { if (!isset($this->_rest->_options['force']) && !isset($version) && version_compare($release['m'], phpversion(), '>')) { // skip releases that require a PHP version newer than our PHP version $skippedphp = $release; continue; } $found = true; break; } } else { if (in_array($release['s'], $states)) { if (version_compare($release['m'], phpversion(), '>')) { // skip releases that require a PHP version newer than our PHP version $skippedphp = $release; continue; } $found = true; break; } } } if (!$found && $skippedphp) { $found = null; } return $this->_returnDownloadURL($base, $package, $release, $info, $found, $skippedphp, $channel); } function getDepDownloadURL($base, $xsdversion, $dependency, $deppackage, $prefstate = 'stable', $installed = false, $channel = false) { $states = $this->betterStates($prefstate, true); if (!$states) { return PEAR::raiseError('"' . $prefstate . '" is not a valid state'); } $channel = $dependency['channel']; $package = $dependency['name']; $state = isset($dependency['state']) ? $dependency['state'] : null; $version = isset($dependency['version']) ? $dependency['version'] : null; $restFile = $base . 'r/' . strtolower($package) .'/allreleases2.xml'; $info = $this->_rest->retrieveData($restFile, false, false, $channel); if (PEAR::isError($info)) { return PEAR::raiseError('Package "' . $deppackage['channel'] . '/' . $deppackage['package'] . '" dependency "' . $channel . '/' . $package . '" has no releases'); } if (!is_array($info) || !isset($info['r'])) { return false; } $exclude = array(); $min = $max = $recommended = false; if ($xsdversion == '1.0') { $pinfo['package'] = $dependency['name']; $pinfo['channel'] = 'pear.php.net'; // this is always true - don't change this switch ($dependency['rel']) { case 'ge' : $min = $dependency['version']; break; case 'gt' : $min = $dependency['version']; $exclude = array($dependency['version']); break; case 'eq' : $recommended = $dependency['version']; break; case 'lt' : $max = $dependency['version']; $exclude = array($dependency['version']); break; case 'le' : $max = $dependency['version']; break; case 'ne' : $exclude = array($dependency['version']); break; } } else { $pinfo['package'] = $dependency['name']; $min = isset($dependency['min']) ? $dependency['min'] : false; $max = isset($dependency['max']) ? $dependency['max'] : false; $recommended = isset($dependency['recommended']) ? $dependency['recommended'] : false; if (isset($dependency['exclude'])) { if (!isset($dependency['exclude'][0])) { $exclude = array($dependency['exclude']); } } } $skippedphp = $found = $release = false; if (!is_array($info['r']) || !isset($info['r'][0])) { $info['r'] = array($info['r']); } foreach ($info['r'] as $release) { if (!isset($this->_rest->_options['force']) && ($installed && version_compare($release['v'], $installed, '<'))) { continue; } if (in_array($release['v'], $exclude)) { // skip excluded versions continue; } // allow newer releases to say "I'm OK with the dependent package" if ($xsdversion == '2.0' && isset($release['co'])) { if (!is_array($release['co']) || !isset($release['co'][0])) { $release['co'] = array($release['co']); } foreach ($release['co'] as $entry) { if (isset($entry['x']) && !is_array($entry['x'])) { $entry['x'] = array($entry['x']); } elseif (!isset($entry['x'])) { $entry['x'] = array(); } if ($entry['c'] == $deppackage['channel'] && strtolower($entry['p']) == strtolower($deppackage['package']) && version_compare($deppackage['version'], $entry['min'], '>=') && version_compare($deppackage['version'], $entry['max'], '<=') && !in_array($release['v'], $entry['x'])) { if (version_compare($release['m'], phpversion(), '>')) { // skip dependency releases that require a PHP version // newer than our PHP version $skippedphp = $release; continue; } $recommended = $release['v']; break; } } } if ($recommended) { if ($release['v'] != $recommended) { // if we want a specific // version, then skip all others continue; } if (!in_array($release['s'], $states)) { // the stability is too low, but we must return the // recommended version if possible return $this->_returnDownloadURL($base, $package, $release, $info, true, false, $channel); } } if ($min && version_compare($release['v'], $min, 'lt')) { // skip too old versions continue; } if ($max && version_compare($release['v'], $max, 'gt')) { // skip too new versions continue; } if ($installed && version_compare($release['v'], $installed, '<')) { continue; } if (in_array($release['s'], $states)) { // if in the preferred state... if (version_compare($release['m'], phpversion(), '>')) { // skip dependency releases that require a PHP version // newer than our PHP version $skippedphp = $release; continue; } $found = true; // ... then use it break; } } if (!$found && $skippedphp) { $found = null; } return $this->_returnDownloadURL($base, $package, $release, $info, $found, $skippedphp, $channel); } /** * List package upgrades but take the PHP version into account. */ function listLatestUpgrades($base, $pref_state, $installed, $channel, &$reg) { $packagelist = $this->_rest->retrieveData($base . 'p/packages.xml', false, false, $channel); if (PEAR::isError($packagelist)) { return $packagelist; } $ret = array(); if (!is_array($packagelist) || !isset($packagelist['p'])) { return $ret; } if (!is_array($packagelist['p'])) { $packagelist['p'] = array($packagelist['p']); } foreach ($packagelist['p'] as $package) { if (!isset($installed[strtolower($package)])) { continue; } $inst_version = $reg->packageInfo($package, 'version', $channel); $inst_state = $reg->packageInfo($package, 'release_state', $channel); PEAR::pushErrorHandling(PEAR_ERROR_RETURN); $info = $this->_rest->retrieveData($base . 'r/' . strtolower($package) . '/allreleases2.xml', false, false, $channel); PEAR::popErrorHandling(); if (PEAR::isError($info)) { continue; // no remote releases } if (!isset($info['r'])) { continue; } $release = $found = false; if (!is_array($info['r']) || !isset($info['r'][0])) { $info['r'] = array($info['r']); } // $info['r'] is sorted by version number usort($info['r'], array($this, '_sortReleasesByVersionNumber')); foreach ($info['r'] as $release) { if ($inst_version && version_compare($release['v'], $inst_version, '<=')) { // not newer than the one installed break; } if (version_compare($release['m'], phpversion(), '>')) { // skip dependency releases that require a PHP version // newer than our PHP version continue; } // new version > installed version if (!$pref_state) { // every state is a good state $found = true; break; } else { $new_state = $release['s']; // if new state >= installed state: go if (in_array($new_state, $this->betterStates($inst_state, true))) { $found = true; break; } else { // only allow to lower the state of package, // if new state >= preferred state: go if (in_array($new_state, $this->betterStates($pref_state, true))) { $found = true; break; } } } } if (!$found) { continue; } $relinfo = $this->_rest->retrieveCacheFirst($base . 'r/' . strtolower($package) . '/' . $release['v'] . '.xml', false, false, $channel); if (PEAR::isError($relinfo)) { return $relinfo; } $ret[$package] = array( 'version' => $release['v'], 'state' => $release['s'], 'filesize' => $relinfo['f'], ); } return $ret; } }php-pear-1.10.1+submodules+notgz/PEAR/REST/14.php000066400000000000000000000073151262614675700211100ustar00rootroot00000000000000 * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version CVS: $Id: $ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.9 */ /** * For downloading REST xml/txt files */ require_once 'PEAR/REST.php'; require_once 'PEAR/REST/13.php'; /** * Implement REST 1.4 * * @category pear * @package PEAR * @author Helgi Þormar Þorbjörnsson * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version Release: @package_version@ * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.9 */ class PEAR_REST_14 extends PEAR_REST_13 { function listLatestUpgrades($base, $pref_state, $installed, $channel, &$reg) { $packagelist = $this->_rest->retrieveData($base . 'p/latestpackages.xml', false, false, $channel); if (PEAR::isError($packagelist)) { return $packagelist; } $ret = array(); if (!is_array($packagelist) || !isset($packagelist['p'])) { return $ret; } if (isset($packagelist['p']['n'])) { $packagelist['p'] = array($packagelist['p']); } foreach ($packagelist['p'] as $package) { if (!isset($installed[strtolower($package['n'])])) { continue; } $inst_version = $reg->packageInfo($package['n'], 'version', $channel); $inst_state = $reg->packageInfo($package['n'], 'release_state', $channel); $release = $found = false; $data = array(); if (isset($package['alpha'])) { $data['alpha'] = $package['alpha']; } if (isset($package['beta'])) { $data['beta'] = $package['beta']; } if (isset($package['stable'])) { $data['stable'] = $package['stable']; } foreach ($data as $state => $release) { if ($inst_version && version_compare($release['v'], $inst_version, '<=')) { // not newer than the one installed break; } // new version > installed version if (!$pref_state) { // every state is a good state $found = true; $release['state'] = $state; break; } else { $new_state = $state; // if new state >= installed state: go if (in_array($new_state, $this->betterStates($inst_state, true))) { $found = true; $release['state'] = $state; break; } else { // only allow to lower the state of package, // if new state >= preferred state: go if (in_array($new_state, $this->betterStates($pref_state, true))) { $found = true; $release['state'] = $state; break; } } } } if (!$found) { continue; } $ret[$package] = array( 'version' => $release['v'], 'state' => $release['s'], 'filesize' => $release['f'], ); } return $ret; } }php-pear-1.10.1+submodules+notgz/PEAR/Registry.php000066400000000000000000002236101262614675700217150ustar00rootroot00000000000000 * @author Tomas V. V. Cox * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @link http://pear.php.net/package/PEAR * @since File available since Release 0.1 */ /** * for PEAR_Error */ require_once 'PEAR.php'; require_once 'PEAR/DependencyDB.php'; define('PEAR_REGISTRY_ERROR_LOCK', -2); define('PEAR_REGISTRY_ERROR_FORMAT', -3); define('PEAR_REGISTRY_ERROR_FILE', -4); define('PEAR_REGISTRY_ERROR_CONFLICT', -5); define('PEAR_REGISTRY_ERROR_CHANNEL_FILE', -6); /** * Administration class used to maintain the installed package database. * @category pear * @package PEAR * @author Stig Bakken * @author Tomas V. V. Cox * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version Release: @package_version@ * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ class PEAR_Registry extends PEAR { /** * File containing all channel information. * @var string */ var $channels = ''; /** Directory where registry files are stored. * @var string */ var $statedir = ''; /** File where the file map is stored * @var string */ var $filemap = ''; /** Directory where registry files for channels are stored. * @var string */ var $channelsdir = ''; /** Name of file used for locking the registry * @var string */ var $lockfile = ''; /** File descriptor used during locking * @var resource */ var $lock_fp = null; /** Mode used during locking * @var int */ var $lock_mode = 0; // XXX UNUSED /** Cache of package information. Structure: * array( * 'package' => array('id' => ... ), * ... ) * @var array */ var $pkginfo_cache = array(); /** Cache of file map. Structure: * array( '/path/to/file' => 'package', ... ) * @var array */ var $filemap_cache = array(); /** * @var false|PEAR_ChannelFile */ var $_pearChannel; /** * @var false|PEAR_ChannelFile */ var $_peclChannel; /** * @var false|PEAR_ChannelFile */ var $_docChannel; /** * @var PEAR_DependencyDB */ var $_dependencyDB; /** * @var PEAR_Config */ var $_config; /** * PEAR_Registry constructor. * * @param string (optional) PEAR install directory (for .php files) * @param PEAR_ChannelFile PEAR_ChannelFile object representing the PEAR channel, if * default values are not desired. Only used the very first time a PEAR * repository is initialized * @param PEAR_ChannelFile PEAR_ChannelFile object representing the PECL channel, if * default values are not desired. Only used the very first time a PEAR * repository is initialized * * @access public */ function __construct($pear_install_dir = PEAR_INSTALL_DIR, $pear_channel = false, $pecl_channel = false, $pear_metadata_dir = '') { parent::__construct(); $this->setInstallDir($pear_install_dir, $pear_metadata_dir); $this->_pearChannel = $pear_channel; $this->_peclChannel = $pecl_channel; $this->_config = false; } function setInstallDir($pear_install_dir = PEAR_INSTALL_DIR, $pear_metadata_dir = '') { $ds = DIRECTORY_SEPARATOR; $this->install_dir = $pear_install_dir; if (!$pear_metadata_dir) { $pear_metadata_dir = $pear_install_dir; } $this->channelsdir = $pear_metadata_dir.$ds.'.channels'; $this->statedir = $pear_metadata_dir.$ds.'.registry'; $this->filemap = $pear_metadata_dir.$ds.'.filemap'; $this->lockfile = $pear_metadata_dir.$ds.'.lock'; } function hasWriteAccess() { if (!file_exists($this->install_dir)) { $dir = $this->install_dir; while ($dir && $dir != '.') { $olddir = $dir; $dir = dirname($dir); if ($dir != '.' && file_exists($dir)) { if (is_writeable($dir)) { return true; } return false; } if ($dir == $olddir) { // this can happen in safe mode return @is_writable($dir); } } return false; } return is_writeable($this->install_dir); } function setConfig(&$config, $resetInstallDir = true) { $this->_config = &$config; if ($resetInstallDir) { $this->setInstallDir($config->get('php_dir'), $config->get('metadata_dir')); } } function _initializeChannelDirs() { static $running = false; if (!$running) { $running = true; $ds = DIRECTORY_SEPARATOR; if (!is_dir($this->channelsdir) || !file_exists($this->channelsdir . $ds . 'pear.php.net.reg') || !file_exists($this->channelsdir . $ds . 'pecl.php.net.reg') || !file_exists($this->channelsdir . $ds . 'doc.php.net.reg') || !file_exists($this->channelsdir . $ds . '__uri.reg')) { if (!file_exists($this->channelsdir . $ds . 'pear.php.net.reg')) { $pear_channel = $this->_pearChannel; if (!is_a($pear_channel, 'PEAR_ChannelFile') || !$pear_channel->validate()) { if (!class_exists('PEAR_ChannelFile')) { require_once 'PEAR/ChannelFile.php'; } $pear_channel = new PEAR_ChannelFile; $pear_channel->setAlias('pear'); $pear_channel->setServer('pear.php.net'); $pear_channel->setSummary('PHP Extension and Application Repository'); $pear_channel->setDefaultPEARProtocols(); $pear_channel->setBaseURL('REST1.0', 'http://pear.php.net/rest/'); $pear_channel->setBaseURL('REST1.1', 'http://pear.php.net/rest/'); $pear_channel->setBaseURL('REST1.3', 'http://pear.php.net/rest/'); //$pear_channel->setBaseURL('REST1.4', 'http://pear.php.net/rest/'); } else { $pear_channel->setServer('pear.php.net'); $pear_channel->setAlias('pear'); } $pear_channel->validate(); $this->_addChannel($pear_channel); } if (!file_exists($this->channelsdir . $ds . 'pecl.php.net.reg')) { $pecl_channel = $this->_peclChannel; if (!is_a($pecl_channel, 'PEAR_ChannelFile') || !$pecl_channel->validate()) { if (!class_exists('PEAR_ChannelFile')) { require_once 'PEAR/ChannelFile.php'; } $pecl_channel = new PEAR_ChannelFile; $pecl_channel->setAlias('pecl'); $pecl_channel->setServer('pecl.php.net'); $pecl_channel->setSummary('PHP Extension Community Library'); $pecl_channel->setDefaultPEARProtocols(); $pecl_channel->setBaseURL('REST1.0', 'http://pecl.php.net/rest/'); $pecl_channel->setBaseURL('REST1.1', 'http://pecl.php.net/rest/'); $pecl_channel->setValidationPackage('PEAR_Validator_PECL', '1.0'); } else { $pecl_channel->setServer('pecl.php.net'); $pecl_channel->setAlias('pecl'); } $pecl_channel->validate(); $this->_addChannel($pecl_channel); } if (!file_exists($this->channelsdir . $ds . 'doc.php.net.reg')) { $doc_channel = $this->_docChannel; if (!is_a($doc_channel, 'PEAR_ChannelFile') || !$doc_channel->validate()) { if (!class_exists('PEAR_ChannelFile')) { require_once 'PEAR/ChannelFile.php'; } $doc_channel = new PEAR_ChannelFile; $doc_channel->setAlias('phpdocs'); $doc_channel->setServer('doc.php.net'); $doc_channel->setSummary('PHP Documentation Team'); $doc_channel->setDefaultPEARProtocols(); $doc_channel->setBaseURL('REST1.0', 'http://doc.php.net/rest/'); $doc_channel->setBaseURL('REST1.1', 'http://doc.php.net/rest/'); $doc_channel->setBaseURL('REST1.3', 'http://doc.php.net/rest/'); } else { $doc_channel->setServer('doc.php.net'); $doc_channel->setAlias('doc'); } $doc_channel->validate(); $this->_addChannel($doc_channel); } if (!file_exists($this->channelsdir . $ds . '__uri.reg')) { if (!class_exists('PEAR_ChannelFile')) { require_once 'PEAR/ChannelFile.php'; } $private = new PEAR_ChannelFile; $private->setName('__uri'); $private->setDefaultPEARProtocols(); $private->setBaseURL('REST1.0', '****'); $private->setSummary('Pseudo-channel for static packages'); $this->_addChannel($private); } $this->_rebuildFileMap(); } $running = false; } } function _initializeDirs() { $ds = DIRECTORY_SEPARATOR; // XXX Compatibility code should be removed in the future // rename all registry files if any to lowercase if (!OS_WINDOWS && file_exists($this->statedir) && is_dir($this->statedir) && $handle = opendir($this->statedir)) { $dest = $this->statedir . $ds; while (false !== ($file = readdir($handle))) { if (preg_match('/^.*[A-Z].*\.reg\\z/', $file)) { rename($dest . $file, $dest . strtolower($file)); } } closedir($handle); } $this->_initializeChannelDirs(); if (!file_exists($this->filemap)) { $this->_rebuildFileMap(); } $this->_initializeDepDB(); } function _initializeDepDB() { if (!isset($this->_dependencyDB)) { static $initializing = false; if (!$initializing) { $initializing = true; if (!$this->_config) { // never used? $file = OS_WINDOWS ? 'pear.ini' : '.pearrc'; $this->_config = new PEAR_Config($this->statedir . DIRECTORY_SEPARATOR . $file); $this->_config->setRegistry($this); $this->_config->set('php_dir', $this->install_dir); } $this->_dependencyDB = &PEAR_DependencyDB::singleton($this->_config); if (PEAR::isError($this->_dependencyDB)) { // attempt to recover by removing the dep db if (file_exists($this->_config->get('metadata_dir', null, 'pear.php.net') . DIRECTORY_SEPARATOR . '.depdb')) { @unlink($this->_config->get('metadata_dir', null, 'pear.php.net') . DIRECTORY_SEPARATOR . '.depdb'); } $this->_dependencyDB = &PEAR_DependencyDB::singleton($this->_config); if (PEAR::isError($this->_dependencyDB)) { echo $this->_dependencyDB->getMessage(); echo 'Unrecoverable error'; exit(1); } } $initializing = false; } } } /** * PEAR_Registry destructor. Makes sure no locks are forgotten. * * @access private */ function _PEAR_Registry() { parent::_PEAR(); if (is_resource($this->lock_fp)) { $this->_unlock(); } } /** * Make sure the directory where we keep registry files exists. * * @return bool TRUE if directory exists, FALSE if it could not be * created * * @access private */ function _assertStateDir($channel = false) { if ($channel && $this->_getChannelFromAlias($channel) != 'pear.php.net') { return $this->_assertChannelStateDir($channel); } static $init = false; if (!file_exists($this->statedir)) { if (!$this->hasWriteAccess()) { return false; } require_once 'System.php'; if (!System::mkdir(array('-p', $this->statedir))) { return $this->raiseError("could not create directory '{$this->statedir}'"); } $init = true; } elseif (!is_dir($this->statedir)) { return $this->raiseError('Cannot create directory ' . $this->statedir . ', ' . 'it already exists and is not a directory'); } $ds = DIRECTORY_SEPARATOR; if (!file_exists($this->channelsdir)) { if (!file_exists($this->channelsdir . $ds . 'pear.php.net.reg') || !file_exists($this->channelsdir . $ds . 'pecl.php.net.reg') || !file_exists($this->channelsdir . $ds . 'doc.php.net.reg') || !file_exists($this->channelsdir . $ds . '__uri.reg')) { $init = true; } } elseif (!is_dir($this->channelsdir)) { return $this->raiseError('Cannot create directory ' . $this->channelsdir . ', ' . 'it already exists and is not a directory'); } if ($init) { static $running = false; if (!$running) { $running = true; $this->_initializeDirs(); $running = false; $init = false; } } else { $this->_initializeDepDB(); } return true; } /** * Make sure the directory where we keep registry files exists for a non-standard channel. * * @param string channel name * @return bool TRUE if directory exists, FALSE if it could not be * created * * @access private */ function _assertChannelStateDir($channel) { $ds = DIRECTORY_SEPARATOR; if (!$channel || $this->_getChannelFromAlias($channel) == 'pear.php.net') { if (!file_exists($this->channelsdir . $ds . 'pear.php.net.reg')) { $this->_initializeChannelDirs(); } return $this->_assertStateDir($channel); } $channelDir = $this->_channelDirectoryName($channel); if (!is_dir($this->channelsdir) || !file_exists($this->channelsdir . $ds . 'pear.php.net.reg')) { $this->_initializeChannelDirs(); } if (!file_exists($channelDir)) { if (!$this->hasWriteAccess()) { return false; } require_once 'System.php'; if (!System::mkdir(array('-p', $channelDir))) { return $this->raiseError("could not create directory '" . $channelDir . "'"); } } elseif (!is_dir($channelDir)) { return $this->raiseError("could not create directory '" . $channelDir . "', already exists and is not a directory"); } return true; } /** * Make sure the directory where we keep registry files for channels exists * * @return bool TRUE if directory exists, FALSE if it could not be * created * * @access private */ function _assertChannelDir() { if (!file_exists($this->channelsdir)) { if (!$this->hasWriteAccess()) { return false; } require_once 'System.php'; if (!System::mkdir(array('-p', $this->channelsdir))) { return $this->raiseError("could not create directory '{$this->channelsdir}'"); } } elseif (!is_dir($this->channelsdir)) { return $this->raiseError("could not create directory '{$this->channelsdir}" . "', it already exists and is not a directory"); } if (!file_exists($this->channelsdir . DIRECTORY_SEPARATOR . '.alias')) { if (!$this->hasWriteAccess()) { return false; } require_once 'System.php'; if (!System::mkdir(array('-p', $this->channelsdir . DIRECTORY_SEPARATOR . '.alias'))) { return $this->raiseError("could not create directory '{$this->channelsdir}/.alias'"); } } elseif (!is_dir($this->channelsdir . DIRECTORY_SEPARATOR . '.alias')) { return $this->raiseError("could not create directory '{$this->channelsdir}" . "/.alias', it already exists and is not a directory"); } return true; } /** * Get the name of the file where data for a given package is stored. * * @param string channel name, or false if this is a PEAR package * @param string package name * * @return string registry file name * * @access public */ function _packageFileName($package, $channel = false) { if ($channel && $this->_getChannelFromAlias($channel) != 'pear.php.net') { return $this->_channelDirectoryName($channel) . DIRECTORY_SEPARATOR . strtolower($package) . '.reg'; } return $this->statedir . DIRECTORY_SEPARATOR . strtolower($package) . '.reg'; } /** * Get the name of the file where data for a given channel is stored. * @param string channel name * @return string registry file name */ function _channelFileName($channel, $noaliases = false) { if (!$noaliases) { if (file_exists($this->_getChannelAliasFileName($channel))) { $channel = implode('', file($this->_getChannelAliasFileName($channel))); } } return $this->channelsdir . DIRECTORY_SEPARATOR . str_replace('/', '_', strtolower($channel)) . '.reg'; } /** * @param string * @return string */ function _getChannelAliasFileName($alias) { return $this->channelsdir . DIRECTORY_SEPARATOR . '.alias' . DIRECTORY_SEPARATOR . str_replace('/', '_', strtolower($alias)) . '.txt'; } /** * Get the name of a channel from its alias */ function _getChannelFromAlias($channel) { if (!$this->_channelExists($channel)) { if ($channel == 'pear.php.net') { return 'pear.php.net'; } if ($channel == 'pecl.php.net') { return 'pecl.php.net'; } if ($channel == 'doc.php.net') { return 'doc.php.net'; } if ($channel == '__uri') { return '__uri'; } return false; } $channel = strtolower($channel); if (file_exists($this->_getChannelAliasFileName($channel))) { // translate an alias to an actual channel return implode('', file($this->_getChannelAliasFileName($channel))); } return $channel; } /** * Get the alias of a channel from its alias or its name */ function _getAlias($channel) { if (!$this->_channelExists($channel)) { if ($channel == 'pear.php.net') { return 'pear'; } if ($channel == 'pecl.php.net') { return 'pecl'; } if ($channel == 'doc.php.net') { return 'phpdocs'; } return false; } $channel = $this->_getChannel($channel); if (PEAR::isError($channel)) { return $channel; } return $channel->getAlias(); } /** * Get the name of the file where data for a given package is stored. * * @param string channel name, or false if this is a PEAR package * @param string package name * * @return string registry file name * * @access public */ function _channelDirectoryName($channel) { if (!$channel || $this->_getChannelFromAlias($channel) == 'pear.php.net') { return $this->statedir; } $ch = $this->_getChannelFromAlias($channel); if (!$ch) { $ch = $channel; } return $this->statedir . DIRECTORY_SEPARATOR . strtolower('.channel.' . str_replace('/', '_', $ch)); } function _openPackageFile($package, $mode, $channel = false) { if (!$this->_assertStateDir($channel)) { return null; } if (!in_array($mode, array('r', 'rb')) && !$this->hasWriteAccess()) { return null; } $file = $this->_packageFileName($package, $channel); if (!file_exists($file) && $mode == 'r' || $mode == 'rb') { return null; } $fp = @fopen($file, $mode); if (!$fp) { return null; } return $fp; } function _closePackageFile($fp) { fclose($fp); } function _openChannelFile($channel, $mode) { if (!$this->_assertChannelDir()) { return null; } if (!in_array($mode, array('r', 'rb')) && !$this->hasWriteAccess()) { return null; } $file = $this->_channelFileName($channel); if (!file_exists($file) && $mode == 'r' || $mode == 'rb') { return null; } $fp = @fopen($file, $mode); if (!$fp) { return null; } return $fp; } function _closeChannelFile($fp) { fclose($fp); } function _rebuildFileMap() { if (!class_exists('PEAR_Installer_Role')) { require_once 'PEAR/Installer/Role.php'; } $channels = $this->_listAllPackages(); $files = array(); foreach ($channels as $channel => $packages) { foreach ($packages as $package) { $version = $this->_packageInfo($package, 'version', $channel); $filelist = $this->_packageInfo($package, 'filelist', $channel); if (!is_array($filelist)) { continue; } foreach ($filelist as $name => $attrs) { if (isset($attrs['attribs'])) { $attrs = $attrs['attribs']; } // it is possible for conflicting packages in different channels to // conflict with data files/doc files if ($name == 'dirtree') { continue; } if (isset($attrs['role']) && !in_array($attrs['role'], PEAR_Installer_Role::getInstallableRoles())) { // these are not installed continue; } if (isset($attrs['role']) && !in_array($attrs['role'], PEAR_Installer_Role::getBaseinstallRoles())) { $attrs['baseinstalldir'] = $package; } if (isset($attrs['baseinstalldir'])) { $file = $attrs['baseinstalldir'].DIRECTORY_SEPARATOR.$name; } else { $file = $name; } $file = preg_replace(',^/+,', '', $file); if ($channel != 'pear.php.net') { if (!isset($files[$attrs['role']])) { $files[$attrs['role']] = array(); } $files[$attrs['role']][$file] = array(strtolower($channel), strtolower($package)); } else { if (!isset($files[$attrs['role']])) { $files[$attrs['role']] = array(); } $files[$attrs['role']][$file] = strtolower($package); } } } } $this->_assertStateDir(); if (!$this->hasWriteAccess()) { return false; } $fp = @fopen($this->filemap, 'wb'); if (!$fp) { return false; } $this->filemap_cache = $files; fwrite($fp, serialize($files)); fclose($fp); return true; } function _readFileMap() { if (!file_exists($this->filemap)) { return array(); } $fp = @fopen($this->filemap, 'r'); if (!$fp) { return $this->raiseError('PEAR_Registry: could not open filemap "' . $this->filemap . '"', PEAR_REGISTRY_ERROR_FILE, null, null, $php_errormsg); } clearstatcache(); $fsize = filesize($this->filemap); fclose($fp); $data = file_get_contents($this->filemap); $tmp = unserialize($data); if (!$tmp && $fsize > 7) { return $this->raiseError('PEAR_Registry: invalid filemap data', PEAR_REGISTRY_ERROR_FORMAT, null, null, $data); } $this->filemap_cache = $tmp; return true; } /** * Lock the registry. * * @param integer lock mode, one of LOCK_EX, LOCK_SH or LOCK_UN. * See flock manual for more information. * * @return bool TRUE on success, FALSE if locking failed, or a * PEAR error if some other error occurs (such as the * lock file not being writable). * * @access private */ function _lock($mode = LOCK_EX) { if (stristr(php_uname(), 'Windows 9')) { return true; } if ($mode != LOCK_UN && is_resource($this->lock_fp)) { // XXX does not check type of lock (LOCK_SH/LOCK_EX) return true; } if (!$this->_assertStateDir()) { if ($mode == LOCK_EX) { return $this->raiseError('Registry directory is not writeable by the current user'); } return true; } $open_mode = 'w'; // XXX People reported problems with LOCK_SH and 'w' if ($mode === LOCK_SH || $mode === LOCK_UN) { if (!file_exists($this->lockfile)) { touch($this->lockfile); } $open_mode = 'r'; } if (!is_resource($this->lock_fp)) { $this->lock_fp = @fopen($this->lockfile, $open_mode); } if (!is_resource($this->lock_fp)) { $this->lock_fp = null; return $this->raiseError("could not create lock file" . (isset($php_errormsg) ? ": " . $php_errormsg : "")); } if (!(int)flock($this->lock_fp, $mode)) { switch ($mode) { case LOCK_SH: $str = 'shared'; break; case LOCK_EX: $str = 'exclusive'; break; case LOCK_UN: $str = 'unlock'; break; default: $str = 'unknown'; break; } //is resource at this point, close it on error. fclose($this->lock_fp); $this->lock_fp = null; return $this->raiseError("could not acquire $str lock ($this->lockfile)", PEAR_REGISTRY_ERROR_LOCK); } return true; } function _unlock() { $ret = $this->_lock(LOCK_UN); if (is_resource($this->lock_fp)) { fclose($this->lock_fp); } $this->lock_fp = null; return $ret; } function _packageExists($package, $channel = false) { return file_exists($this->_packageFileName($package, $channel)); } /** * Determine whether a channel exists in the registry * * @param string Channel name * @param bool if true, then aliases will be ignored * @return boolean */ function _channelExists($channel, $noaliases = false) { $a = file_exists($this->_channelFileName($channel, $noaliases)); if (!$a && $channel == 'pear.php.net') { return true; } if (!$a && $channel == 'pecl.php.net') { return true; } if (!$a && $channel == 'doc.php.net') { return true; } return $a; } /** * Determine whether a mirror exists within the deafult channel in the registry * * @param string Channel name * @param string Mirror name * * @return boolean */ function _mirrorExists($channel, $mirror) { $data = $this->_channelInfo($channel); if (!isset($data['servers']['mirror'])) { return false; } foreach ($data['servers']['mirror'] as $m) { if ($m['attribs']['host'] == $mirror) { return true; } } return false; } /** * @param PEAR_ChannelFile Channel object * @param donotuse * @param string Last-Modified HTTP tag from remote request * @return boolean|PEAR_Error True on creation, false if it already exists */ function _addChannel($channel, $update = false, $lastmodified = false) { if (!is_a($channel, 'PEAR_ChannelFile')) { return false; } if (!$channel->validate()) { return false; } if (file_exists($this->_channelFileName($channel->getName()))) { if (!$update) { return false; } $checker = $this->_getChannel($channel->getName()); if (PEAR::isError($checker)) { return $checker; } if ($channel->getAlias() != $checker->getAlias()) { if (file_exists($this->_getChannelAliasFileName($checker->getAlias()))) { @unlink($this->_getChannelAliasFileName($checker->getAlias())); } } } else { if ($update && !in_array($channel->getName(), array('pear.php.net', 'pecl.php.net', 'doc.php.net'))) { return false; } } $ret = $this->_assertChannelDir(); if (PEAR::isError($ret)) { return $ret; } $ret = $this->_assertChannelStateDir($channel->getName()); if (PEAR::isError($ret)) { return $ret; } if ($channel->getAlias() != $channel->getName()) { if (file_exists($this->_getChannelAliasFileName($channel->getAlias())) && $this->_getChannelFromAlias($channel->getAlias()) != $channel->getName()) { $channel->setAlias($channel->getName()); } if (!$this->hasWriteAccess()) { return false; } $fp = @fopen($this->_getChannelAliasFileName($channel->getAlias()), 'w'); if (!$fp) { return false; } fwrite($fp, $channel->getName()); fclose($fp); } if (!$this->hasWriteAccess()) { return false; } $fp = @fopen($this->_channelFileName($channel->getName()), 'wb'); if (!$fp) { return false; } $info = $channel->toArray(); if ($lastmodified) { $info['_lastmodified'] = $lastmodified; } else { $info['_lastmodified'] = date('r'); } fwrite($fp, serialize($info)); fclose($fp); return true; } /** * Deletion fails if there are any packages installed from the channel * @param string|PEAR_ChannelFile channel name * @return boolean|PEAR_Error True on deletion, false if it doesn't exist */ function _deleteChannel($channel) { if (!is_string($channel)) { if (!is_a($channel, 'PEAR_ChannelFile')) { return false; } if (!$channel->validate()) { return false; } $channel = $channel->getName(); } if ($this->_getChannelFromAlias($channel) == '__uri') { return false; } if ($this->_getChannelFromAlias($channel) == 'pecl.php.net') { return false; } if ($this->_getChannelFromAlias($channel) == 'doc.php.net') { return false; } if (!$this->_channelExists($channel)) { return false; } if (!$channel || $this->_getChannelFromAlias($channel) == 'pear.php.net') { return false; } $channel = $this->_getChannelFromAlias($channel); if ($channel == 'pear.php.net') { return false; } $test = $this->_listChannelPackages($channel); if (count($test)) { return false; } $test = @rmdir($this->_channelDirectoryName($channel)); if (!$test) { return false; } $file = $this->_getChannelAliasFileName($this->_getAlias($channel)); if (file_exists($file)) { $test = @unlink($file); if (!$test) { return false; } } $file = $this->_channelFileName($channel); $ret = true; if (file_exists($file)) { $ret = @unlink($file); } return $ret; } /** * Determine whether a channel exists in the registry * @param string Channel Alias * @return boolean */ function _isChannelAlias($alias) { return file_exists($this->_getChannelAliasFileName($alias)); } /** * @param string|null * @param string|null * @param string|null * @return array|null * @access private */ function _packageInfo($package = null, $key = null, $channel = 'pear.php.net') { if ($package === null) { if ($channel === null) { $channels = $this->_listChannels(); $ret = array(); foreach ($channels as $channel) { $channel = strtolower($channel); $ret[$channel] = array(); $packages = $this->_listPackages($channel); foreach ($packages as $package) { $ret[$channel][] = $this->_packageInfo($package, null, $channel); } } return $ret; } $ps = $this->_listPackages($channel); if (!count($ps)) { return array(); } return array_map(array(&$this, '_packageInfo'), $ps, array_fill(0, count($ps), null), array_fill(0, count($ps), $channel)); } $fp = $this->_openPackageFile($package, 'r', $channel); if ($fp === null) { return null; } clearstatcache(); $this->_closePackageFile($fp); $data = file_get_contents($this->_packageFileName($package, $channel)); $data = unserialize($data); if ($key === null) { return $data; } // compatibility for package.xml version 2.0 if (isset($data['old'][$key])) { return $data['old'][$key]; } if (isset($data[$key])) { return $data[$key]; } return null; } /** * @param string Channel name * @param bool whether to strictly retrieve info of channels, not just aliases * @return array|null */ function _channelInfo($channel, $noaliases = false) { if (!$this->_channelExists($channel, $noaliases)) { return null; } $fp = $this->_openChannelFile($channel, 'r'); if ($fp === null) { return null; } clearstatcache(); $this->_closeChannelFile($fp); $data = file_get_contents($this->_channelFileName($channel)); $data = unserialize($data); return $data; } function _listChannels() { $channellist = array(); if (!file_exists($this->channelsdir) || !is_dir($this->channelsdir)) { return array('pear.php.net', 'pecl.php.net', 'doc.php.net', '__uri'); } $dp = opendir($this->channelsdir); while ($ent = readdir($dp)) { if ($ent{0} == '.' || substr($ent, -4) != '.reg') { continue; } if ($ent == '__uri.reg') { $channellist[] = '__uri'; continue; } $channellist[] = str_replace('_', '/', substr($ent, 0, -4)); } closedir($dp); if (!in_array('pear.php.net', $channellist)) { $channellist[] = 'pear.php.net'; } if (!in_array('pecl.php.net', $channellist)) { $channellist[] = 'pecl.php.net'; } if (!in_array('doc.php.net', $channellist)) { $channellist[] = 'doc.php.net'; } if (!in_array('__uri', $channellist)) { $channellist[] = '__uri'; } natsort($channellist); return $channellist; } function _listPackages($channel = false) { if ($channel && $this->_getChannelFromAlias($channel) != 'pear.php.net') { return $this->_listChannelPackages($channel); } if (!file_exists($this->statedir) || !is_dir($this->statedir)) { return array(); } $pkglist = array(); $dp = opendir($this->statedir); if (!$dp) { return $pkglist; } while ($ent = readdir($dp)) { if ($ent{0} == '.' || substr($ent, -4) != '.reg') { continue; } $pkglist[] = substr($ent, 0, -4); } closedir($dp); return $pkglist; } function _listChannelPackages($channel) { $pkglist = array(); if (!file_exists($this->_channelDirectoryName($channel)) || !is_dir($this->_channelDirectoryName($channel))) { return array(); } $dp = opendir($this->_channelDirectoryName($channel)); if (!$dp) { return $pkglist; } while ($ent = readdir($dp)) { if ($ent{0} == '.' || substr($ent, -4) != '.reg') { continue; } $pkglist[] = substr($ent, 0, -4); } closedir($dp); return $pkglist; } function _listAllPackages() { $ret = array(); foreach ($this->_listChannels() as $channel) { $ret[$channel] = $this->_listPackages($channel); } return $ret; } /** * Add an installed package to the registry * @param string package name * @param array package info (parsed by PEAR_Common::infoFrom*() methods) * @return bool success of saving * @access private */ function _addPackage($package, $info) { if ($this->_packageExists($package)) { return false; } $fp = $this->_openPackageFile($package, 'wb'); if ($fp === null) { return false; } $info['_lastmodified'] = time(); fwrite($fp, serialize($info)); $this->_closePackageFile($fp); if (isset($info['filelist'])) { $this->_rebuildFileMap(); } return true; } /** * @param PEAR_PackageFile_v1|PEAR_PackageFile_v2 * @return bool * @access private */ function _addPackage2($info) { if (!is_a($info, 'PEAR_PackageFile_v1') && !is_a($info, 'PEAR_PackageFile_v2')) { return false; } if (!$info->validate()) { if (class_exists('PEAR_Common')) { $ui = PEAR_Frontend::singleton(); if ($ui) { foreach ($info->getValidationWarnings() as $err) { $ui->log($err['message'], true); } } } return false; } $channel = $info->getChannel(); $package = $info->getPackage(); $save = $info; if ($this->_packageExists($package, $channel)) { return false; } if (!$this->_channelExists($channel, true)) { return false; } $info = $info->toArray(true); if (!$info) { return false; } $fp = $this->_openPackageFile($package, 'wb', $channel); if ($fp === null) { return false; } $info['_lastmodified'] = time(); fwrite($fp, serialize($info)); $this->_closePackageFile($fp); $this->_rebuildFileMap(); return true; } /** * @param string Package name * @param array parsed package.xml 1.0 * @param bool this parameter is only here for BC. Don't use it. * @access private */ function _updatePackage($package, $info, $merge = true) { $oldinfo = $this->_packageInfo($package); if (empty($oldinfo)) { return false; } $fp = $this->_openPackageFile($package, 'w'); if ($fp === null) { return false; } if (is_object($info)) { $info = $info->toArray(); } $info['_lastmodified'] = time(); $newinfo = $info; if ($merge) { $info = array_merge($oldinfo, $info); } else { $diff = $info; } fwrite($fp, serialize($info)); $this->_closePackageFile($fp); if (isset($newinfo['filelist'])) { $this->_rebuildFileMap(); } return true; } /** * @param PEAR_PackageFile_v1|PEAR_PackageFile_v2 * @return bool * @access private */ function _updatePackage2($info) { if (!$this->_packageExists($info->getPackage(), $info->getChannel())) { return false; } $fp = $this->_openPackageFile($info->getPackage(), 'w', $info->getChannel()); if ($fp === null) { return false; } $save = $info; $info = $save->getArray(true); $info['_lastmodified'] = time(); fwrite($fp, serialize($info)); $this->_closePackageFile($fp); $this->_rebuildFileMap(); return true; } /** * @param string Package name * @param string Channel name * @return PEAR_PackageFile_v1|PEAR_PackageFile_v2|null * @access private */ function &_getPackage($package, $channel = 'pear.php.net') { $info = $this->_packageInfo($package, null, $channel); if ($info === null) { return $info; } $a = $this->_config; if (!$a) { $this->_config = new PEAR_Config; $this->_config->set('php_dir', $this->statedir); } if (!class_exists('PEAR_PackageFile')) { require_once 'PEAR/PackageFile.php'; } $pkg = new PEAR_PackageFile($this->_config); $pf = &$pkg->fromArray($info); return $pf; } /** * @param string channel name * @param bool whether to strictly retrieve channel names * @return PEAR_ChannelFile|PEAR_Error * @access private */ function &_getChannel($channel, $noaliases = false) { $ch = false; if ($this->_channelExists($channel, $noaliases)) { $chinfo = $this->_channelInfo($channel, $noaliases); if ($chinfo) { if (!class_exists('PEAR_ChannelFile')) { require_once 'PEAR/ChannelFile.php'; } $ch = &PEAR_ChannelFile::fromArrayWithErrors($chinfo); } } if ($ch) { if ($ch->validate()) { return $ch; } foreach ($ch->getErrors(true) as $err) { $message = $err['message'] . "\n"; } $ch = PEAR::raiseError($message); return $ch; } if ($this->_getChannelFromAlias($channel) == 'pear.php.net') { // the registry is not properly set up, so use defaults if (!class_exists('PEAR_ChannelFile')) { require_once 'PEAR/ChannelFile.php'; } $pear_channel = new PEAR_ChannelFile; $pear_channel->setServer('pear.php.net'); $pear_channel->setAlias('pear'); $pear_channel->setSummary('PHP Extension and Application Repository'); $pear_channel->setDefaultPEARProtocols(); $pear_channel->setBaseURL('REST1.0', 'http://pear.php.net/rest/'); $pear_channel->setBaseURL('REST1.1', 'http://pear.php.net/rest/'); $pear_channel->setBaseURL('REST1.3', 'http://pear.php.net/rest/'); return $pear_channel; } if ($this->_getChannelFromAlias($channel) == 'pecl.php.net') { // the registry is not properly set up, so use defaults if (!class_exists('PEAR_ChannelFile')) { require_once 'PEAR/ChannelFile.php'; } $pear_channel = new PEAR_ChannelFile; $pear_channel->setServer('pecl.php.net'); $pear_channel->setAlias('pecl'); $pear_channel->setSummary('PHP Extension Community Library'); $pear_channel->setDefaultPEARProtocols(); $pear_channel->setBaseURL('REST1.0', 'http://pecl.php.net/rest/'); $pear_channel->setBaseURL('REST1.1', 'http://pecl.php.net/rest/'); $pear_channel->setValidationPackage('PEAR_Validator_PECL', '1.0'); return $pear_channel; } if ($this->_getChannelFromAlias($channel) == 'doc.php.net') { // the registry is not properly set up, so use defaults if (!class_exists('PEAR_ChannelFile')) { require_once 'PEAR/ChannelFile.php'; } $doc_channel = new PEAR_ChannelFile; $doc_channel->setServer('doc.php.net'); $doc_channel->setAlias('phpdocs'); $doc_channel->setSummary('PHP Documentation Team'); $doc_channel->setDefaultPEARProtocols(); $doc_channel->setBaseURL('REST1.0', 'http://doc.php.net/rest/'); $doc_channel->setBaseURL('REST1.1', 'http://doc.php.net/rest/'); $doc_channel->setBaseURL('REST1.3', 'http://doc.php.net/rest/'); return $doc_channel; } if ($this->_getChannelFromAlias($channel) == '__uri') { // the registry is not properly set up, so use defaults if (!class_exists('PEAR_ChannelFile')) { require_once 'PEAR/ChannelFile.php'; } $private = new PEAR_ChannelFile; $private->setName('__uri'); $private->setDefaultPEARProtocols(); $private->setBaseURL('REST1.0', '****'); $private->setSummary('Pseudo-channel for static packages'); return $private; } return $ch; } /** * @param string Package name * @param string Channel name * @return bool */ function packageExists($package, $channel = 'pear.php.net') { if (PEAR::isError($e = $this->_lock(LOCK_SH))) { return $e; } $ret = $this->_packageExists($package, $channel); $this->_unlock(); return $ret; } // }}} // {{{ channelExists() /** * @param string channel name * @param bool if true, then aliases will be ignored * @return bool */ function channelExists($channel, $noaliases = false) { if (PEAR::isError($e = $this->_lock(LOCK_SH))) { return $e; } $ret = $this->_channelExists($channel, $noaliases); $this->_unlock(); return $ret; } // }}} /** * @param string channel name mirror is in * @param string mirror name * * @return bool */ function mirrorExists($channel, $mirror) { if (PEAR::isError($e = $this->_lock(LOCK_SH))) { return $e; } $ret = $this->_mirrorExists($channel, $mirror); $this->_unlock(); return $ret; } // {{{ isAlias() /** * Determines whether the parameter is an alias of a channel * @param string * @return bool */ function isAlias($alias) { if (PEAR::isError($e = $this->_lock(LOCK_SH))) { return $e; } $ret = $this->_isChannelAlias($alias); $this->_unlock(); return $ret; } // }}} // {{{ packageInfo() /** * @param string|null * @param string|null * @param string * @return array|null */ function packageInfo($package = null, $key = null, $channel = 'pear.php.net') { if (PEAR::isError($e = $this->_lock(LOCK_SH))) { return $e; } $ret = $this->_packageInfo($package, $key, $channel); $this->_unlock(); return $ret; } // }}} // {{{ channelInfo() /** * Retrieve a raw array of channel data. * * Do not use this, instead use {@link getChannel()} for normal * operations. Array structure is undefined in this method * @param string channel name * @param bool whether to strictly retrieve information only on non-aliases * @return array|null|PEAR_Error */ function channelInfo($channel = null, $noaliases = false) { if (PEAR::isError($e = $this->_lock(LOCK_SH))) { return $e; } $ret = $this->_channelInfo($channel, $noaliases); $this->_unlock(); return $ret; } // }}} /** * @param string */ function channelName($channel) { if (PEAR::isError($e = $this->_lock(LOCK_SH))) { return $e; } $ret = $this->_getChannelFromAlias($channel); $this->_unlock(); return $ret; } /** * @param string */ function channelAlias($channel) { if (PEAR::isError($e = $this->_lock(LOCK_SH))) { return $e; } $ret = $this->_getAlias($channel); $this->_unlock(); return $ret; } // {{{ listPackages() function listPackages($channel = false) { if (PEAR::isError($e = $this->_lock(LOCK_SH))) { return $e; } $ret = $this->_listPackages($channel); $this->_unlock(); return $ret; } // }}} // {{{ listAllPackages() function listAllPackages() { if (PEAR::isError($e = $this->_lock(LOCK_SH))) { return $e; } $ret = $this->_listAllPackages(); $this->_unlock(); return $ret; } // }}} // {{{ listChannel() function listChannels() { if (PEAR::isError($e = $this->_lock(LOCK_SH))) { return $e; } $ret = $this->_listChannels(); $this->_unlock(); return $ret; } // }}} // {{{ addPackage() /** * Add an installed package to the registry * @param string|PEAR_PackageFile_v1|PEAR_PackageFile_v2 package name or object * that will be passed to {@link addPackage2()} * @param array package info (parsed by PEAR_Common::infoFrom*() methods) * @return bool success of saving */ function addPackage($package, $info) { if (is_object($info)) { return $this->addPackage2($info); } if (PEAR::isError($e = $this->_lock(LOCK_EX))) { return $e; } $ret = $this->_addPackage($package, $info); $this->_unlock(); if ($ret) { if (!class_exists('PEAR_PackageFile_v1')) { require_once 'PEAR/PackageFile/v1.php'; } $pf = new PEAR_PackageFile_v1; $pf->setConfig($this->_config); $pf->fromArray($info); $this->_dependencyDB->uninstallPackage($pf); $this->_dependencyDB->installPackage($pf); } return $ret; } // }}} // {{{ addPackage2() function addPackage2($info) { if (!is_object($info)) { return $this->addPackage($info['package'], $info); } if (PEAR::isError($e = $this->_lock(LOCK_EX))) { return $e; } $ret = $this->_addPackage2($info); $this->_unlock(); if ($ret) { $this->_dependencyDB->uninstallPackage($info); $this->_dependencyDB->installPackage($info); } return $ret; } // }}} // {{{ updateChannel() /** * For future expandibility purposes, separate this * @param PEAR_ChannelFile */ function updateChannel($channel, $lastmodified = null) { if ($channel->getName() == '__uri') { return false; } return $this->addChannel($channel, $lastmodified, true); } // }}} // {{{ deleteChannel() /** * Deletion fails if there are any packages installed from the channel * @param string|PEAR_ChannelFile channel name * @return boolean|PEAR_Error True on deletion, false if it doesn't exist */ function deleteChannel($channel) { if (PEAR::isError($e = $this->_lock(LOCK_EX))) { return $e; } $ret = $this->_deleteChannel($channel); $this->_unlock(); if ($ret && is_a($this->_config, 'PEAR_Config')) { $this->_config->setChannels($this->listChannels()); } return $ret; } // }}} // {{{ addChannel() /** * @param PEAR_ChannelFile Channel object * @param string Last-Modified header from HTTP for caching * @return boolean|PEAR_Error True on creation, false if it already exists */ function addChannel($channel, $lastmodified = false, $update = false) { if (!is_a($channel, 'PEAR_ChannelFile') || !$channel->validate()) { return false; } if (PEAR::isError($e = $this->_lock(LOCK_EX))) { return $e; } $ret = $this->_addChannel($channel, $update, $lastmodified); $this->_unlock(); if (!$update && $ret && is_a($this->_config, 'PEAR_Config')) { $this->_config->setChannels($this->listChannels()); } return $ret; } // }}} // {{{ deletePackage() function deletePackage($package, $channel = 'pear.php.net') { if (PEAR::isError($e = $this->_lock(LOCK_EX))) { return $e; } $file = $this->_packageFileName($package, $channel); $ret = file_exists($file) ? @unlink($file) : false; $this->_rebuildFileMap(); $this->_unlock(); $p = array('channel' => $channel, 'package' => $package); $this->_dependencyDB->uninstallPackage($p); return $ret; } // }}} // {{{ updatePackage() function updatePackage($package, $info, $merge = true) { if (is_object($info)) { return $this->updatePackage2($info, $merge); } if (PEAR::isError($e = $this->_lock(LOCK_EX))) { return $e; } $ret = $this->_updatePackage($package, $info, $merge); $this->_unlock(); if ($ret) { if (!class_exists('PEAR_PackageFile_v1')) { require_once 'PEAR/PackageFile/v1.php'; } $pf = new PEAR_PackageFile_v1; $pf->setConfig($this->_config); $pf->fromArray($this->packageInfo($package)); $this->_dependencyDB->uninstallPackage($pf); $this->_dependencyDB->installPackage($pf); } return $ret; } // }}} // {{{ updatePackage2() function updatePackage2($info) { if (!is_object($info)) { return $this->updatePackage($info['package'], $info, $merge); } if (!$info->validate(PEAR_VALIDATE_DOWNLOADING)) { return false; } if (PEAR::isError($e = $this->_lock(LOCK_EX))) { return $e; } $ret = $this->_updatePackage2($info); $this->_unlock(); if ($ret) { $this->_dependencyDB->uninstallPackage($info); $this->_dependencyDB->installPackage($info); } return $ret; } // }}} // {{{ getChannel() /** * @param string channel name * @param bool whether to strictly return raw channels (no aliases) * @return PEAR_ChannelFile|PEAR_Error */ function getChannel($channel, $noaliases = false) { if (PEAR::isError($e = $this->_lock(LOCK_SH))) { return $e; } $ret = $this->_getChannel($channel, $noaliases); $this->_unlock(); if (!$ret) { return PEAR::raiseError('Unknown channel: ' . $channel); } return $ret; } // }}} // {{{ getPackage() /** * @param string package name * @param string channel name * @return PEAR_PackageFile_v1|PEAR_PackageFile_v2|null */ function &getPackage($package, $channel = 'pear.php.net') { if (PEAR::isError($e = $this->_lock(LOCK_SH))) { return $e; } $pf = &$this->_getPackage($package, $channel); $this->_unlock(); return $pf; } // }}} /** * Get PEAR_PackageFile_v[1/2] objects representing the contents of * a dependency group that are installed. * * This is used at uninstall-time * @param array * @return array|false */ function getInstalledGroup($group) { $ret = array(); if (isset($group['package'])) { if (!isset($group['package'][0])) { $group['package'] = array($group['package']); } foreach ($group['package'] as $package) { $depchannel = isset($package['channel']) ? $package['channel'] : '__uri'; $p = &$this->getPackage($package['name'], $depchannel); if ($p) { $save = &$p; $ret[] = &$save; } } } if (isset($group['subpackage'])) { if (!isset($group['subpackage'][0])) { $group['subpackage'] = array($group['subpackage']); } foreach ($group['subpackage'] as $package) { $depchannel = isset($package['channel']) ? $package['channel'] : '__uri'; $p = &$this->getPackage($package['name'], $depchannel); if ($p) { $save = &$p; $ret[] = &$save; } } } if (!count($ret)) { return false; } return $ret; } // {{{ getChannelValidator() /** * @param string channel name * @return PEAR_Validate|false */ function &getChannelValidator($channel) { $chan = $this->getChannel($channel); if (PEAR::isError($chan)) { return $chan; } $val = $chan->getValidationObject(); return $val; } // }}} // {{{ getChannels() /** * @param string channel name * @return array an array of PEAR_ChannelFile objects representing every installed channel */ function &getChannels() { $ret = array(); if (PEAR::isError($e = $this->_lock(LOCK_SH))) { return $e; } foreach ($this->_listChannels() as $channel) { $e = &$this->_getChannel($channel); if (!$e || PEAR::isError($e)) { continue; } $ret[] = $e; } $this->_unlock(); return $ret; } // }}} // {{{ checkFileMap() /** * Test whether a file or set of files belongs to a package. * * If an array is passed in * @param string|array file path, absolute or relative to the pear * install dir * @param string|array name of PEAR package or array('package' => name, 'channel' => * channel) of a package that will be ignored * @param string API version - 1.1 will exclude any files belonging to a package * @param array private recursion variable * @return array|false which package and channel the file belongs to, or an empty * string if the file does not belong to an installed package, * or belongs to the second parameter's package */ function checkFileMap($path, $package = false, $api = '1.0', $attrs = false) { if (is_array($path)) { static $notempty; if (empty($notempty)) { if (!class_exists('PEAR_Installer_Role')) { require_once 'PEAR/Installer/Role.php'; } $notempty = create_function('$a','return !empty($a);'); } $package = is_array($package) ? array(strtolower($package[0]), strtolower($package[1])) : strtolower($package); $pkgs = array(); foreach ($path as $name => $attrs) { if (is_array($attrs)) { if (isset($attrs['install-as'])) { $name = $attrs['install-as']; } if (!in_array($attrs['role'], PEAR_Installer_Role::getInstallableRoles())) { // these are not installed continue; } if (!in_array($attrs['role'], PEAR_Installer_Role::getBaseinstallRoles())) { $attrs['baseinstalldir'] = is_array($package) ? $package[1] : $package; } if (isset($attrs['baseinstalldir'])) { $name = $attrs['baseinstalldir'] . DIRECTORY_SEPARATOR . $name; } } $pkgs[$name] = $this->checkFileMap($name, $package, $api, $attrs); if (PEAR::isError($pkgs[$name])) { return $pkgs[$name]; } } return array_filter($pkgs, $notempty); } if (empty($this->filemap_cache)) { if (PEAR::isError($e = $this->_lock(LOCK_SH))) { return $e; } $err = $this->_readFileMap(); $this->_unlock(); if (PEAR::isError($err)) { return $err; } } if (!$attrs) { $attrs = array('role' => 'php'); // any old call would be for PHP role only } if (isset($this->filemap_cache[$attrs['role']][$path])) { if ($api >= '1.1' && $this->filemap_cache[$attrs['role']][$path] == $package) { return false; } return $this->filemap_cache[$attrs['role']][$path]; } $l = strlen($this->install_dir); if (substr($path, 0, $l) == $this->install_dir) { $path = preg_replace('!^'.DIRECTORY_SEPARATOR.'+!', '', substr($path, $l)); } if (isset($this->filemap_cache[$attrs['role']][$path])) { if ($api >= '1.1' && $this->filemap_cache[$attrs['role']][$path] == $package) { return false; } return $this->filemap_cache[$attrs['role']][$path]; } return false; } // }}} // {{{ flush() /** * Force a reload of the filemap * @since 1.5.0RC3 */ function flushFileMap() { $this->filemap_cache = null; clearstatcache(); // ensure that the next read gets the full, current filemap } // }}} // {{{ apiVersion() /** * Get the expected API version. Channels API is version 1.1, as it is backwards * compatible with 1.0 * @return string */ function apiVersion() { return '1.1'; } // }}} /** * Parse a package name, or validate a parsed package name array * @param string|array pass in an array of format * array( * 'package' => 'pname', * ['channel' => 'channame',] * ['version' => 'version',] * ['state' => 'state',] * ['group' => 'groupname']) * or a string of format * [channel://][channame/]pname[-version|-state][/group=groupname] * @return array|PEAR_Error */ function parsePackageName($param, $defaultchannel = 'pear.php.net') { $saveparam = $param; if (is_array($param)) { // convert to string for error messages $saveparam = $this->parsedPackageNameToString($param); // process the array if (!isset($param['package'])) { return PEAR::raiseError('parsePackageName(): array $param ' . 'must contain a valid package name in index "param"', 'package', null, null, $param); } if (!isset($param['uri'])) { if (!isset($param['channel'])) { $param['channel'] = $defaultchannel; } } else { $param['channel'] = '__uri'; } } else { $components = @parse_url((string) $param); if (isset($components['scheme'])) { if ($components['scheme'] == 'http') { // uri package $param = array('uri' => $param, 'channel' => '__uri'); } elseif($components['scheme'] != 'channel') { return PEAR::raiseError('parsePackageName(): only channel:// uris may ' . 'be downloaded, not "' . $param . '"', 'invalid', null, null, $param); } } if (!isset($components['path'])) { return PEAR::raiseError('parsePackageName(): array $param ' . 'must contain a valid package name in "' . $param . '"', 'package', null, null, $param); } if (isset($components['host'])) { // remove the leading "/" $components['path'] = substr($components['path'], 1); } if (!isset($components['scheme'])) { if (strpos($components['path'], '/') !== false) { if ($components['path']{0} == '/') { return PEAR::raiseError('parsePackageName(): this is not ' . 'a package name, it begins with "/" in "' . $param . '"', 'invalid', null, null, $param); } $parts = explode('/', $components['path']); $components['host'] = array_shift($parts); if (count($parts) > 1) { $components['path'] = array_pop($parts); $components['host'] .= '/' . implode('/', $parts); } else { $components['path'] = implode('/', $parts); } } else { $components['host'] = $defaultchannel; } } else { if (strpos($components['path'], '/')) { $parts = explode('/', $components['path']); $components['path'] = array_pop($parts); $components['host'] .= '/' . implode('/', $parts); } } if (is_array($param)) { $param['package'] = $components['path']; } else { $param = array( 'package' => $components['path'] ); if (isset($components['host'])) { $param['channel'] = $components['host']; } } if (isset($components['fragment'])) { $param['group'] = $components['fragment']; } if (isset($components['user'])) { $param['user'] = $components['user']; } if (isset($components['pass'])) { $param['pass'] = $components['pass']; } if (isset($components['query'])) { parse_str($components['query'], $param['opts']); } // check for extension $pathinfo = pathinfo($param['package']); if (isset($pathinfo['extension']) && in_array(strtolower($pathinfo['extension']), array('tgz', 'tar'))) { $param['extension'] = $pathinfo['extension']; $param['package'] = substr($pathinfo['basename'], 0, strlen($pathinfo['basename']) - 4); } // check for version if (strpos($param['package'], '-')) { $test = explode('-', $param['package']); if (count($test) != 2) { return PEAR::raiseError('parsePackageName(): only one version/state ' . 'delimiter "-" is allowed in "' . $saveparam . '"', 'version', null, null, $param); } list($param['package'], $param['version']) = $test; } } // validation $info = $this->channelExists($param['channel']); if (PEAR::isError($info)) { return $info; } if (!$info) { return PEAR::raiseError('unknown channel "' . $param['channel'] . '" in "' . $saveparam . '"', 'channel', null, null, $param); } $chan = $this->getChannel($param['channel']); if (PEAR::isError($chan)) { return $chan; } if (!$chan) { return PEAR::raiseError("Exception: corrupt registry, could not " . "retrieve channel " . $param['channel'] . " information", 'registry', null, null, $param); } $param['channel'] = $chan->getName(); $validate = $chan->getValidationObject(); $vpackage = $chan->getValidationPackage(); // validate package name if (!$validate->validPackageName($param['package'], $vpackage['_content'])) { return PEAR::raiseError('parsePackageName(): invalid package name "' . $param['package'] . '" in "' . $saveparam . '"', 'package', null, null, $param); } if (isset($param['group'])) { if (!PEAR_Validate::validGroupName($param['group'])) { return PEAR::raiseError('parsePackageName(): dependency group "' . $param['group'] . '" is not a valid group name in "' . $saveparam . '"', 'group', null, null, $param); } } if (isset($param['state'])) { if (!in_array(strtolower($param['state']), $validate->getValidStates())) { return PEAR::raiseError('parsePackageName(): state "' . $param['state'] . '" is not a valid state in "' . $saveparam . '"', 'state', null, null, $param); } } if (isset($param['version'])) { if (isset($param['state'])) { return PEAR::raiseError('parsePackageName(): cannot contain both ' . 'a version and a stability (state) in "' . $saveparam . '"', 'version/state', null, null, $param); } // check whether version is actually a state if (in_array(strtolower($param['version']), $validate->getValidStates())) { $param['state'] = strtolower($param['version']); unset($param['version']); } else { if (!$validate->validVersion($param['version'])) { return PEAR::raiseError('parsePackageName(): "' . $param['version'] . '" is neither a valid version nor a valid state in "' . $saveparam . '"', 'version/state', null, null, $param); } } } return $param; } /** * @param array * @return string */ function parsedPackageNameToString($parsed, $brief = false) { if (is_string($parsed)) { return $parsed; } if (is_object($parsed)) { $p = $parsed; $parsed = array( 'package' => $p->getPackage(), 'channel' => $p->getChannel(), 'version' => $p->getVersion(), ); } if (isset($parsed['uri'])) { return $parsed['uri']; } if ($brief) { if ($channel = $this->channelAlias($parsed['channel'])) { return $channel . '/' . $parsed['package']; } } $upass = ''; if (isset($parsed['user'])) { $upass = $parsed['user']; if (isset($parsed['pass'])) { $upass .= ':' . $parsed['pass']; } $upass = "$upass@"; } $ret = 'channel://' . $upass . $parsed['channel'] . '/' . $parsed['package']; if (isset($parsed['version']) || isset($parsed['state'])) { $ver = isset($parsed['version']) ? $parsed['version'] : ''; $ver .= isset($parsed['state']) ? $parsed['state'] : ''; $ret .= '-' . $ver; } if (isset($parsed['extension'])) { $ret .= '.' . $parsed['extension']; } if (isset($parsed['opts'])) { $ret .= '?'; foreach ($parsed['opts'] as $name => $value) { $parsed['opts'][$name] = "$name=$value"; } $ret .= implode('&', $parsed['opts']); } if (isset($parsed['group'])) { $ret .= '#' . $parsed['group']; } return $ret; } } php-pear-1.10.1+submodules+notgz/PEAR/RunTest.php000066400000000000000000001062121262614675700215070ustar00rootroot00000000000000 * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @link http://pear.php.net/package/PEAR * @since File available since Release 1.3.3 */ /** * for error handling */ require_once 'PEAR.php'; require_once 'PEAR/Config.php'; define('DETAILED', 1); putenv("PHP_PEAR_RUNTESTS=1"); /** * Simplified version of PHP's test suite * * Try it with: * * $ php -r 'include "../PEAR/RunTest.php"; $t=new PEAR_RunTest; $o=$t->run("./pear_system.phpt");print_r($o);' * * * @category pear * @package PEAR * @author Tomas V.V.Cox * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version Release: @package_version@ * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.3.3 */ class PEAR_RunTest { var $_headers = array(); var $_logger; var $_options; var $_php; var $tests_count; var $xdebug_loaded; /** * Saved value of php executable, used to reset $_php when we * have a test that uses cgi * * @var unknown_type */ var $_savephp; var $ini_overwrites = array( 'output_handler=', 'open_basedir=', 'disable_functions=', 'output_buffering=Off', 'display_errors=1', 'log_errors=0', 'html_errors=0', 'track_errors=1', 'report_memleaks=0', 'report_zend_debug=0', 'docref_root=', 'docref_ext=.html', 'error_prepend_string=', 'error_append_string=', 'auto_prepend_file=', 'auto_append_file=', 'xdebug.default_enable=0', 'allow_url_fopen=1', ); /** * An object that supports the PEAR_Common->log() signature, or null * @param PEAR_Common|null */ function __construct($logger = null, $options = array()) { if (!defined('E_DEPRECATED')) { define('E_DEPRECATED', 0); } if (!defined('E_STRICT')) { define('E_STRICT', 0); } $this->ini_overwrites[] = 'error_reporting=' . (E_ALL & ~(E_DEPRECATED | E_STRICT)); if (is_null($logger)) { require_once 'PEAR/Common.php'; $logger = new PEAR_Common; } $this->_logger = $logger; $this->_options = $options; $conf = &PEAR_Config::singleton(); $this->_php = $conf->get('php_bin'); } /** * Taken from php-src/run-tests.php * * @param string $commandline command name * @param array $env * @param string $stdin standard input to pass to the command * @return unknown */ function system_with_timeout($commandline, $env = null, $stdin = null) { $data = ''; $proc = proc_open($commandline, array( 0 => array('pipe', 'r'), 1 => array('pipe', 'w'), 2 => array('pipe', 'w') ), $pipes, null, $env, array('suppress_errors' => true)); if (!$proc) { return false; } if (is_string($stdin)) { fwrite($pipes[0], $stdin); } fclose($pipes[0]); while (true) { /* hide errors from interrupted syscalls */ $r = $pipes; $e = $w = null; $n = @stream_select($r, $w, $e, 60); if ($n === 0) { /* timed out */ $data .= "\n ** ERROR: process timed out **\n"; proc_terminate($proc); return array(1234567890, $data); } else if ($n > 0) { $line = fread($pipes[1], 8192); if (strlen($line) == 0) { /* EOF */ break; } $data .= $line; } } if (function_exists('proc_get_status')) { $stat = proc_get_status($proc); if ($stat['signaled']) { $data .= "\nTermsig=".$stat['stopsig']; } } $code = proc_close($proc); if (function_exists('proc_get_status')) { $code = $stat['exitcode']; } return array($code, $data); } /** * Turns a PHP INI string into an array * * Turns -d "include_path=/foo/bar" into this: * array( * 'include_path' => array( * 'operator' => '-d', * 'value' => '/foo/bar', * ) * ) * Works both with quotes and without * * @param string an PHP INI string, -d "include_path=/foo/bar" * @return array */ function iniString2array($ini_string) { if (!$ini_string) { return array(); } $split = preg_split('/[\s]|=/', $ini_string, -1, PREG_SPLIT_NO_EMPTY); $key = $split[1][0] == '"' ? substr($split[1], 1) : $split[1]; $value = $split[2][strlen($split[2]) - 1] == '"' ? substr($split[2], 0, -1) : $split[2]; // FIXME review if this is really the struct to go with $array = array($key => array('operator' => $split[0], 'value' => $value)); return $array; } function settings2array($settings, $ini_settings) { foreach ($settings as $setting) { if (strpos($setting, '=') !== false) { $setting = explode('=', $setting, 2); $name = trim(strtolower($setting[0])); $value = trim($setting[1]); $ini_settings[$name] = $value; } } return $ini_settings; } function settings2params($ini_settings) { $settings = ''; foreach ($ini_settings as $name => $value) { if (is_array($value)) { $operator = $value['operator']; $value = $value['value']; } else { $operator = '-d'; } $value = addslashes($value); $settings .= " $operator \"$name=$value\""; } return $settings; } function _preparePhpBin($php, $file, $ini_settings) { $file = escapeshellarg($file); $cmd = $php . $ini_settings . ' -f ' . $file; return $cmd; } function runPHPUnit($file, $ini_settings = '') { if (!file_exists($file) && file_exists(getcwd() . DIRECTORY_SEPARATOR . $file)) { $file = realpath(getcwd() . DIRECTORY_SEPARATOR . $file); } elseif (file_exists($file)) { $file = realpath($file); } $cmd = $this->_preparePhpBin($this->_php, $file, $ini_settings); if (isset($this->_logger)) { $this->_logger->log(2, 'Running command "' . $cmd . '"'); } $savedir = getcwd(); // in case the test moves us around chdir(dirname($file)); echo `$cmd`; chdir($savedir); return 'PASSED'; // we have no way of knowing this information so assume passing } /** * Runs an individual test case. * * @param string The filename of the test * @param array|string INI settings to be applied to the test run * @param integer Number what the current running test is of the * whole test suite being runned. * * @return string|object Returns PASSED, WARNED, FAILED depending on how the * test came out. * PEAR Error when the tester it self fails */ function run($file, $ini_settings = array(), $test_number = 1) { $this->_restorePHPBinary(); if (empty($this->_options['cgi'])) { // try to see if php-cgi is in the path $res = $this->system_with_timeout('php-cgi -v'); if (false !== $res && !(is_array($res) && in_array($res[0], array(-1, 127)))) { $this->_options['cgi'] = 'php-cgi'; } } if (1 < $len = strlen($this->tests_count)) { $test_number = str_pad($test_number, $len, ' ', STR_PAD_LEFT); $test_nr = "[$test_number/$this->tests_count] "; } else { $test_nr = ''; } $file = realpath($file); $section_text = $this->_readFile($file); if (PEAR::isError($section_text)) { return $section_text; } if (isset($section_text['POST_RAW']) && isset($section_text['UPLOAD'])) { return PEAR::raiseError("Cannot contain both POST_RAW and UPLOAD in test file: $file"); } $cwd = getcwd(); $pass_options = ''; if (!empty($this->_options['ini'])) { $pass_options = $this->_options['ini']; } if (is_string($ini_settings)) { $ini_settings = $this->iniString2array($ini_settings); } $ini_settings = $this->settings2array($this->ini_overwrites, $ini_settings); if ($section_text['INI']) { if (strpos($section_text['INI'], '{PWD}') !== false) { $section_text['INI'] = str_replace('{PWD}', dirname($file), $section_text['INI']); } $ini = preg_split( "/[\n\r]+/", $section_text['INI']); $ini_settings = $this->settings2array($ini, $ini_settings); } $ini_settings = $this->settings2params($ini_settings); $shortname = str_replace($cwd . DIRECTORY_SEPARATOR, '', $file); $tested = trim($section_text['TEST']); $tested.= !isset($this->_options['simple']) ? "[$shortname]" : ' '; if (!empty($section_text['POST']) || !empty($section_text['POST_RAW']) || !empty($section_text['UPLOAD']) || !empty($section_text['GET']) || !empty($section_text['COOKIE']) || !empty($section_text['EXPECTHEADERS'])) { if (empty($this->_options['cgi'])) { if (!isset($this->_options['quiet'])) { $this->_logger->log(0, "SKIP $test_nr$tested (reason: --cgi option needed for this test, type 'pear help run-tests')"); } if (isset($this->_options['tapoutput'])) { return array('ok', ' # skip --cgi option needed for this test, "pear help run-tests" for info'); } return 'SKIPPED'; } $this->_savePHPBinary(); $this->_php = $this->_options['cgi']; } $temp_dir = realpath(dirname($file)); $main_file_name = basename($file, 'phpt'); $diff_filename = $temp_dir . DIRECTORY_SEPARATOR . $main_file_name.'diff'; $log_filename = $temp_dir . DIRECTORY_SEPARATOR . $main_file_name.'log'; $exp_filename = $temp_dir . DIRECTORY_SEPARATOR . $main_file_name.'exp'; $output_filename = $temp_dir . DIRECTORY_SEPARATOR . $main_file_name.'out'; $memcheck_filename = $temp_dir . DIRECTORY_SEPARATOR . $main_file_name.'mem'; $temp_file = $temp_dir . DIRECTORY_SEPARATOR . $main_file_name.'php'; $temp_skipif = $temp_dir . DIRECTORY_SEPARATOR . $main_file_name.'skip.php'; $temp_clean = $temp_dir . DIRECTORY_SEPARATOR . $main_file_name.'clean.php'; $tmp_post = $temp_dir . DIRECTORY_SEPARATOR . uniqid('phpt.'); // unlink old test results $this->_cleanupOldFiles($file); // Check if test should be skipped. $res = $this->_runSkipIf($section_text, $temp_skipif, $tested, $ini_settings); if (count($res) != 2) { return $res; } $info = $res['info']; $warn = $res['warn']; // We've satisfied the preconditions - run the test! if (isset($this->_options['coverage']) && $this->xdebug_loaded) { $xdebug_file = $temp_dir . DIRECTORY_SEPARATOR . $main_file_name . 'xdebug'; $text = "\n" . 'function coverage_shutdown() {' . "\n" . ' $xdebug = var_export(xdebug_get_code_coverage(), true);'; if (!function_exists('file_put_contents')) { $text .= "\n" . ' $fh = fopen(\'' . $xdebug_file . '\', "wb");' . "\n" . ' if ($fh !== false) {' . "\n" . ' fwrite($fh, $xdebug);' . "\n" . ' fclose($fh);' . "\n" . ' }'; } else { $text .= "\n" . ' file_put_contents(\'' . $xdebug_file . '\', $xdebug);'; } // Workaround for http://pear.php.net/bugs/bug.php?id=17292 $lines = explode("\n", $section_text['FILE']); $numLines = count($lines); $namespace = ''; $coverage_shutdown = 'coverage_shutdown'; if ( substr($lines[0], 0, 2) == 'save_text($temp_file, "save_text($temp_file, $section_text['FILE']); } $args = $section_text['ARGS'] ? ' -- '.$section_text['ARGS'] : ''; $cmd = $this->_preparePhpBin($this->_php, $temp_file, $ini_settings); $cmd.= "$args 2>&1"; if (isset($this->_logger)) { $this->_logger->log(2, 'Running command "' . $cmd . '"'); } // Reset environment from any previous test. $env = $this->_resetEnv($section_text, $temp_file); $section_text = $this->_processUpload($section_text, $file); if (PEAR::isError($section_text)) { return $section_text; } if (array_key_exists('POST_RAW', $section_text) && !empty($section_text['POST_RAW'])) { $post = trim($section_text['POST_RAW']); $raw_lines = explode("\n", $post); $request = ''; $started = false; foreach ($raw_lines as $i => $line) { if (empty($env['CONTENT_TYPE']) && preg_match('/^Content-Type:(.*)/i', $line, $res)) { $env['CONTENT_TYPE'] = trim(str_replace("\r", '', $res[1])); continue; } if ($started) { $request .= "\n"; } $started = true; $request .= $line; } $env['CONTENT_LENGTH'] = strlen($request); $env['REQUEST_METHOD'] = 'POST'; $this->save_text($tmp_post, $request); $cmd = "$this->_php$pass_options$ini_settings \"$temp_file\" 2>&1 < $tmp_post"; } elseif (array_key_exists('POST', $section_text) && !empty($section_text['POST'])) { $post = trim($section_text['POST']); $this->save_text($tmp_post, $post); $content_length = strlen($post); $env['REQUEST_METHOD'] = 'POST'; $env['CONTENT_TYPE'] = 'application/x-www-form-urlencoded'; $env['CONTENT_LENGTH'] = $content_length; $cmd = "$this->_php$pass_options$ini_settings \"$temp_file\" 2>&1 < $tmp_post"; } else { $env['REQUEST_METHOD'] = 'GET'; $env['CONTENT_TYPE'] = ''; $env['CONTENT_LENGTH'] = ''; } if (OS_WINDOWS && isset($section_text['RETURNS'])) { ob_start(); system($cmd, $return_value); $out = ob_get_contents(); ob_end_clean(); $section_text['RETURNS'] = (int) trim($section_text['RETURNS']); $returnfail = ($return_value != $section_text['RETURNS']); } else { $returnfail = false; $stdin = isset($section_text['STDIN']) ? $section_text['STDIN'] : null; $out = $this->system_with_timeout($cmd, $env, $stdin); $return_value = $out[0]; $out = $out[1]; } $output = preg_replace('/\r\n/', "\n", trim($out)); if (isset($tmp_post) && realpath($tmp_post) && file_exists($tmp_post)) { @unlink(realpath($tmp_post)); } chdir($cwd); // in case the test moves us around /* when using CGI, strip the headers from the output */ $output = $this->_stripHeadersCGI($output); if (isset($section_text['EXPECTHEADERS'])) { $testheaders = $this->_processHeaders($section_text['EXPECTHEADERS']); $missing = array_diff_assoc($testheaders, $this->_headers); $changed = ''; foreach ($missing as $header => $value) { if (isset($this->_headers[$header])) { $changed .= "-$header: $value\n+$header: "; $changed .= $this->_headers[$header]; } else { $changed .= "-$header: $value\n"; } } if ($missing) { // tack on failed headers to output: $output .= "\n====EXPECTHEADERS FAILURE====:\n$changed"; } } $this->_testCleanup($section_text, $temp_clean); // Does the output match what is expected? do { if (isset($section_text['EXPECTF']) || isset($section_text['EXPECTREGEX'])) { if (isset($section_text['EXPECTF'])) { $wanted = trim($section_text['EXPECTF']); } else { $wanted = trim($section_text['EXPECTREGEX']); } $wanted_re = preg_replace('/\r\n/', "\n", $wanted); if (isset($section_text['EXPECTF'])) { $wanted_re = preg_quote($wanted_re, '/'); // Stick to basics $wanted_re = str_replace("%s", ".+?", $wanted_re); //not greedy $wanted_re = str_replace("%i", "[+\-]?[0-9]+", $wanted_re); $wanted_re = str_replace("%d", "[0-9]+", $wanted_re); $wanted_re = str_replace("%x", "[0-9a-fA-F]+", $wanted_re); $wanted_re = str_replace("%f", "[+\-]?\.?[0-9]+\.?[0-9]*(E-?[0-9]+)?", $wanted_re); $wanted_re = str_replace("%c", ".", $wanted_re); // %f allows two points "-.0.0" but that is the best *simple* expression } /* DEBUG YOUR REGEX HERE var_dump($wanted_re); print(str_repeat('=', 80) . "\n"); var_dump($output); */ if (!$returnfail && preg_match("/^$wanted_re\$/s", $output)) { if (file_exists($temp_file)) { unlink($temp_file); } if (array_key_exists('FAIL', $section_text)) { break; } if (!isset($this->_options['quiet'])) { $this->_logger->log(0, "PASS $test_nr$tested$info"); } if (isset($this->_options['tapoutput'])) { return array('ok', ' - ' . $tested); } return 'PASSED'; } } else { if (isset($section_text['EXPECTFILE'])) { $f = $temp_dir . '/' . trim($section_text['EXPECTFILE']); if (!($fp = @fopen($f, 'rb'))) { return PEAR::raiseError('--EXPECTFILE-- section file ' . $f . ' not found'); } fclose($fp); $section_text['EXPECT'] = file_get_contents($f); } if (isset($section_text['EXPECT'])) { $wanted = preg_replace('/\r\n/', "\n", trim($section_text['EXPECT'])); } else { $wanted = ''; } // compare and leave on success if (!$returnfail && 0 == strcmp($output, $wanted)) { if (file_exists($temp_file)) { unlink($temp_file); } if (array_key_exists('FAIL', $section_text)) { break; } if (!isset($this->_options['quiet'])) { $this->_logger->log(0, "PASS $test_nr$tested$info"); } if (isset($this->_options['tapoutput'])) { return array('ok', ' - ' . $tested); } return 'PASSED'; } } } while (false); if (array_key_exists('FAIL', $section_text)) { // we expect a particular failure // this is only used for testing PEAR_RunTest $expectf = isset($section_text['EXPECTF']) ? $wanted_re : null; $faildiff = $this->generate_diff($wanted, $output, null, $expectf); $faildiff = preg_replace('/\r/', '', $faildiff); $wanted = preg_replace('/\r/', '', trim($section_text['FAIL'])); if ($faildiff == $wanted) { if (!isset($this->_options['quiet'])) { $this->_logger->log(0, "PASS $test_nr$tested$info"); } if (isset($this->_options['tapoutput'])) { return array('ok', ' - ' . $tested); } return 'PASSED'; } unset($section_text['EXPECTF']); $output = $faildiff; if (isset($section_text['RETURNS'])) { return PEAR::raiseError('Cannot have both RETURNS and FAIL in the same test: ' . $file); } } // Test failed so we need to report details. $txt = $warn ? 'WARN ' : 'FAIL '; $this->_logger->log(0, $txt . $test_nr . $tested . $info); // write .exp $res = $this->_writeLog($exp_filename, $wanted); if (PEAR::isError($res)) { return $res; } // write .out $res = $this->_writeLog($output_filename, $output); if (PEAR::isError($res)) { return $res; } // write .diff $returns = isset($section_text['RETURNS']) ? array(trim($section_text['RETURNS']), $return_value) : null; $expectf = isset($section_text['EXPECTF']) ? $wanted_re : null; $data = $this->generate_diff($wanted, $output, $returns, $expectf); $res = $this->_writeLog($diff_filename, $data); if (isset($this->_options['showdiff'])) { $this->_logger->log(0, "========DIFF========"); $this->_logger->log(0, $data); $this->_logger->log(0, "========DONE========"); } if (PEAR::isError($res)) { return $res; } // write .log $data = " ---- EXPECTED OUTPUT $wanted ---- ACTUAL OUTPUT $output ---- FAILED "; if ($returnfail) { $data .= " ---- EXPECTED RETURN $section_text[RETURNS] ---- ACTUAL RETURN $return_value "; } $res = $this->_writeLog($log_filename, $data); if (PEAR::isError($res)) { return $res; } if (isset($this->_options['tapoutput'])) { $wanted = explode("\n", $wanted); $wanted = "# Expected output:\n#\n#" . implode("\n#", $wanted); $output = explode("\n", $output); $output = "#\n#\n# Actual output:\n#\n#" . implode("\n#", $output); return array($wanted . $output . 'not ok', ' - ' . $tested); } return $warn ? 'WARNED' : 'FAILED'; } function generate_diff($wanted, $output, $rvalue, $wanted_re) { $w = explode("\n", $wanted); $o = explode("\n", $output); $wr = explode("\n", $wanted_re); $w1 = array_diff_assoc($w, $o); $o1 = array_diff_assoc($o, $w); $o2 = $w2 = array(); foreach ($w1 as $idx => $val) { if (!$wanted_re || !isset($wr[$idx]) || !isset($o1[$idx]) || !preg_match('/^' . $wr[$idx] . '\\z/', $o1[$idx])) { $w2[sprintf("%03d<", $idx)] = sprintf("%03d- ", $idx + 1) . $val; } } foreach ($o1 as $idx => $val) { if (!$wanted_re || !isset($wr[$idx]) || !preg_match('/^' . $wr[$idx] . '\\z/', $val)) { $o2[sprintf("%03d>", $idx)] = sprintf("%03d+ ", $idx + 1) . $val; } } $diff = array_merge($w2, $o2); ksort($diff); $extra = $rvalue ? "##EXPECTED: $rvalue[0]\r\n##RETURNED: $rvalue[1]" : ''; return implode("\r\n", $diff) . $extra; } // Write the given text to a temporary file, and return the filename. function save_text($filename, $text) { if (!$fp = fopen($filename, 'w')) { return PEAR::raiseError("Cannot open file '" . $filename . "' (save_text)"); } fwrite($fp, $text); fclose($fp); if (1 < DETAILED) echo " FILE $filename {{{ $text }}} "; } function _cleanupOldFiles($file) { $temp_dir = realpath(dirname($file)); $mainFileName = basename($file, 'phpt'); $diff_filename = $temp_dir . DIRECTORY_SEPARATOR . $mainFileName.'diff'; $log_filename = $temp_dir . DIRECTORY_SEPARATOR . $mainFileName.'log'; $exp_filename = $temp_dir . DIRECTORY_SEPARATOR . $mainFileName.'exp'; $output_filename = $temp_dir . DIRECTORY_SEPARATOR . $mainFileName.'out'; $memcheck_filename = $temp_dir . DIRECTORY_SEPARATOR . $mainFileName.'mem'; $temp_file = $temp_dir . DIRECTORY_SEPARATOR . $mainFileName.'php'; $temp_skipif = $temp_dir . DIRECTORY_SEPARATOR . $mainFileName.'skip.php'; $temp_clean = $temp_dir . DIRECTORY_SEPARATOR . $mainFileName.'clean.php'; $tmp_post = $temp_dir . DIRECTORY_SEPARATOR . uniqid('phpt.'); // unlink old test results @unlink($diff_filename); @unlink($log_filename); @unlink($exp_filename); @unlink($output_filename); @unlink($memcheck_filename); @unlink($temp_file); @unlink($temp_skipif); @unlink($tmp_post); @unlink($temp_clean); } function _runSkipIf($section_text, $temp_skipif, $tested, $ini_settings) { $info = ''; $warn = false; if (array_key_exists('SKIPIF', $section_text) && trim($section_text['SKIPIF'])) { $this->save_text($temp_skipif, $section_text['SKIPIF']); $output = $this->system_with_timeout("$this->_php$ini_settings -f \"$temp_skipif\""); $output = $output[1]; $loutput = ltrim($output); unlink($temp_skipif); if (!strncasecmp('skip', $loutput, 4)) { $skipreason = "SKIP $tested"; if (preg_match('/^\s*skip\s*(.+)\s*/i', $output, $m)) { $skipreason .= '(reason: ' . $m[1] . ')'; } if (!isset($this->_options['quiet'])) { $this->_logger->log(0, $skipreason); } if (isset($this->_options['tapoutput'])) { return array('ok', ' # skip ' . $reason); } return 'SKIPPED'; } if (!strncasecmp('info', $loutput, 4) && preg_match('/^\s*info\s*(.+)\s*/i', $output, $m)) { $info = " (info: $m[1])"; } if (!strncasecmp('warn', $loutput, 4) && preg_match('/^\s*warn\s*(.+)\s*/i', $output, $m)) { $warn = true; /* only if there is a reason */ $info = " (warn: $m[1])"; } } return array('warn' => $warn, 'info' => $info); } function _stripHeadersCGI($output) { $this->headers = array(); if (!empty($this->_options['cgi']) && $this->_php == $this->_options['cgi'] && preg_match("/^(.*?)(?:\n\n(.*)|\\z)/s", $output, $match)) { $output = isset($match[2]) ? trim($match[2]) : ''; $this->_headers = $this->_processHeaders($match[1]); } return $output; } /** * Return an array that can be used with array_diff() to compare headers * * @param string $text */ function _processHeaders($text) { $headers = array(); $rh = preg_split("/[\n\r]+/", $text); foreach ($rh as $line) { if (strpos($line, ':')!== false) { $line = explode(':', $line, 2); $headers[trim($line[0])] = trim($line[1]); } } return $headers; } function _readFile($file) { // Load the sections of the test file. $section_text = array( 'TEST' => '(unnamed test)', 'SKIPIF' => '', 'GET' => '', 'COOKIE' => '', 'POST' => '', 'ARGS' => '', 'INI' => '', 'CLEAN' => '', ); if (!is_file($file) || !$fp = fopen($file, "r")) { return PEAR::raiseError("Cannot open test file: $file"); } $section = ''; while (!feof($fp)) { $line = fgets($fp); // Match the beginning of a section. if (preg_match('/^--([_A-Z]+)--/', $line, $r)) { $section = $r[1]; $section_text[$section] = ''; continue; } elseif (empty($section)) { fclose($fp); return PEAR::raiseError("Invalid sections formats in test file: $file"); } // Add to the section text. $section_text[$section] .= $line; } fclose($fp); return $section_text; } function _writeLog($logname, $data) { if (!$log = fopen($logname, 'w')) { return PEAR::raiseError("Cannot create test log - $logname"); } fwrite($log, $data); fclose($log); } function _resetEnv($section_text, $temp_file) { $env = $_ENV; $env['REDIRECT_STATUS'] = ''; $env['QUERY_STRING'] = ''; $env['PATH_TRANSLATED'] = ''; $env['SCRIPT_FILENAME'] = ''; $env['REQUEST_METHOD'] = ''; $env['CONTENT_TYPE'] = ''; $env['CONTENT_LENGTH'] = ''; if (!empty($section_text['ENV'])) { if (strpos($section_text['ENV'], '{PWD}') !== false) { $section_text['ENV'] = str_replace('{PWD}', dirname($temp_file), $section_text['ENV']); } foreach (explode("\n", trim($section_text['ENV'])) as $e) { $e = explode('=', trim($e), 2); if (!empty($e[0]) && isset($e[1])) { $env[$e[0]] = $e[1]; } } } if (array_key_exists('GET', $section_text)) { $env['QUERY_STRING'] = trim($section_text['GET']); } else { $env['QUERY_STRING'] = ''; } if (array_key_exists('COOKIE', $section_text)) { $env['HTTP_COOKIE'] = trim($section_text['COOKIE']); } else { $env['HTTP_COOKIE'] = ''; } $env['REDIRECT_STATUS'] = '1'; $env['PATH_TRANSLATED'] = $temp_file; $env['SCRIPT_FILENAME'] = $temp_file; return $env; } function _processUpload($section_text, $file) { if (array_key_exists('UPLOAD', $section_text) && !empty($section_text['UPLOAD'])) { $upload_files = trim($section_text['UPLOAD']); $upload_files = explode("\n", $upload_files); $request = "Content-Type: multipart/form-data; boundary=---------------------------20896060251896012921717172737\n" . "-----------------------------20896060251896012921717172737\n"; foreach ($upload_files as $fileinfo) { $fileinfo = explode('=', $fileinfo); if (count($fileinfo) != 2) { return PEAR::raiseError("Invalid UPLOAD section in test file: $file"); } if (!realpath(dirname($file) . '/' . $fileinfo[1])) { return PEAR::raiseError("File for upload does not exist: $fileinfo[1] " . "in test file: $file"); } $file_contents = file_get_contents(dirname($file) . '/' . $fileinfo[1]); $fileinfo[1] = basename($fileinfo[1]); $request .= "Content-Disposition: form-data; name=\"$fileinfo[0]\"; filename=\"$fileinfo[1]\"\n"; $request .= "Content-Type: text/plain\n\n"; $request .= $file_contents . "\n" . "-----------------------------20896060251896012921717172737\n"; } if (array_key_exists('POST', $section_text) && !empty($section_text['POST'])) { // encode POST raw $post = trim($section_text['POST']); $post = explode('&', $post); foreach ($post as $i => $post_info) { $post_info = explode('=', $post_info); if (count($post_info) != 2) { return PEAR::raiseError("Invalid POST data in test file: $file"); } $post_info[0] = rawurldecode($post_info[0]); $post_info[1] = rawurldecode($post_info[1]); $post[$i] = $post_info; } foreach ($post as $post_info) { $request .= "Content-Disposition: form-data; name=\"$post_info[0]\"\n\n"; $request .= $post_info[1] . "\n" . "-----------------------------20896060251896012921717172737\n"; } unset($section_text['POST']); } $section_text['POST_RAW'] = $request; } return $section_text; } function _testCleanup($section_text, $temp_clean) { if ($section_text['CLEAN']) { $this->_restorePHPBinary(); // perform test cleanup $this->save_text($temp_clean, $section_text['CLEAN']); $output = $this->system_with_timeout("$this->_php $temp_clean 2>&1"); if (strlen($output[1])) { echo "BORKED --CLEAN-- section! output:\n", $output[1]; } if (file_exists($temp_clean)) { unlink($temp_clean); } } } function _savePHPBinary() { $this->_savephp = $this->_php; } function _restorePHPBinary() { if (isset($this->_savephp)) { $this->_php = $this->_savephp; unset($this->_savephp); } } } php-pear-1.10.1+submodules+notgz/PEAR/Start.php000066400000000000000000000345231262614675700212050ustar00rootroot00000000000000 'Installation base ($prefix)', 'temp_dir' => 'Temporary directory for processing', 'download_dir' => 'Temporary directory for downloads', 'bin_dir' => 'Binaries directory', 'php_dir' => 'PHP code directory ($php_dir)', 'doc_dir' => 'Documentation directory', 'data_dir' => 'Data directory', 'cfg_dir' => 'User-modifiable configuration files directory', 'www_dir' => 'Public Web Files directory', 'man_dir' => 'System manual pages directory', 'test_dir' => 'Tests directory', 'pear_conf' => 'Name of configuration file', ); var $localInstall; var $PEARConfig; var $tarball = array(); var $ptmp; function __construct() { parent::__construct(); if (OS_WINDOWS) { $this->configPrompt['php_bin'] = 'Path to CLI php.exe'; $this->config[] = 'php_bin'; $this->prefix = getcwd(); if (!@is_dir($this->prefix)) { if (@is_dir('c:\php5')) { $this->prefix = 'c:\php5'; } elseif (@is_dir('c:\php4')) { $this->prefix = 'c:\php4'; } elseif (@is_dir('c:\php')) { $this->prefix = 'c:\php'; } } $slash = "\\"; if (strrpos($this->prefix, '\\') === (strlen($this->prefix) - 1)) { $slash = ''; } $this->localInstall = false; $this->bin_dir = '$prefix'; $this->temp_dir = '$prefix' . $slash . 'tmp'; $this->download_dir = '$prefix' . $slash . 'tmp'; $this->php_dir = '$prefix' . $slash . 'pear'; $this->doc_dir = '$prefix' . $slash . 'docs'; $this->data_dir = '$prefix' . $slash . 'data'; $this->test_dir = '$prefix' . $slash . 'tests'; $this->www_dir = '$prefix' . $slash . 'www'; $this->man_dir = '$prefix' . $slash . 'man'; $this->cfg_dir = '$prefix' . $slash . 'cfg'; $this->pear_conf = PEAR_CONFIG_SYSCONFDIR . '\\pear.ini'; /* * Detects php.exe */ $this->validPHPBin = true; if ($t = $this->safeGetenv('PHP_PEAR_PHP_BIN')) { $this->php_bin = dirname($t); } elseif ($t = $this->safeGetenv('PHP_BIN')) { $this->php_bin = dirname($t); } elseif ($t = System::which('php')) { $this->php_bin = dirname($t); } elseif (is_file($this->prefix . '\cli\php.exe')) { $this->php_bin = $this->prefix . '\cli'; } elseif (is_file($this->prefix . '\php.exe')) { $this->php_bin = $this->prefix; } $phpexe = OS_WINDOWS ? '\\php.exe' : '/php'; if ($this->php_bin && !is_file($this->php_bin . $phpexe)) { $this->php_bin = ''; } else { if (strpos($this->php_bin, ':') === 0) { $this->php_bin = getcwd() . DIRECTORY_SEPARATOR . $this->php_bin; } } if (!is_file($this->php_bin . $phpexe)) { if (is_file('c:/php/cli/php.exe')) { $this->php_bin = 'c"\\php\\cli'; } elseif (is_file('c:/php5/php.exe')) { $this->php_bin = 'c:\\php5'; } elseif (is_file('c:/php4/cli/php.exe')) { $this->php_bin = 'c:\\php4\\cli'; } else { $this->validPHPBin = false; } } } else { $this->prefix = dirname(PHP_BINDIR); $this->pear_conf = PEAR_CONFIG_SYSCONFDIR . '/pear.conf'; if ($this->getCurrentUser() != 'root') { $this->prefix = $this->safeGetenv('HOME') . '/pear'; $this->pear_conf = $this->safeGetenv('HOME') . '.pearrc'; } $this->bin_dir = '$prefix/bin'; $this->php_dir = '$prefix/share/pear'; $this->temp_dir = '/tmp/pear/install'; $this->download_dir = '/tmp/pear/install'; $this->doc_dir = '$prefix/docs'; $this->www_dir = '$prefix/www'; $this->cfg_dir = '$prefix/cfg'; $this->data_dir = '$prefix/data'; $this->test_dir = '$prefix/tests'; $this->man_dir = '$prefix/man'; // check if the user has installed PHP with PHP or GNU layout if (@is_dir("$this->prefix/lib/php/.registry")) { $this->php_dir = '$prefix/lib/php'; } elseif (@is_dir("$this->prefix/share/pear/lib/.registry")) { $this->php_dir = '$prefix/share/pear/lib'; $this->doc_dir = '$prefix/share/pear/docs'; $this->data_dir = '$prefix/share/pear/data'; $this->test_dir = '$prefix/share/pear/tests'; } elseif (@is_dir("$this->prefix/share/php/.registry")) { $this->php_dir = '$prefix/share/php'; } } } /** * Get the name of the user running the script. * Only needed on unix for now. * * @return string Name of the user ("root", "cweiske") */ function getCurrentUser() { if (isset($_ENV['USER'])) { return $_ENV['USER']; } else { return trim(`whoami`); } } function safeGetenv($var) { if (is_array($_ENV) && isset($_ENV[$var])) { return $_ENV[$var]; } return getenv($var); } function show($stuff) { print $stuff; } function locatePackagesToInstall() { $dp = @opendir(dirname(__FILE__) . '/go-pear-tarballs'); if (empty($dp)) { return PEAR::raiseError("while locating packages to install: opendir('" . dirname(__FILE__) . "/go-pear-tarballs') failed"); } $potentials = array(); while (false !== ($entry = readdir($dp))) { if ($entry{0} == '.' || !in_array(substr($entry, -4), array('.tar', '.tgz'))) { continue; } $potentials[] = $entry; } closedir($dp); $notfound = array(); foreach ($this->corePackages as $package) { foreach ($potentials as $i => $candidate) { if (preg_match('/^' . $package . '-' . _PEAR_COMMON_PACKAGE_VERSION_PREG . '\.(tar|tgz)\\z/', $candidate)) { $this->tarball[$package] = dirname(__FILE__) . '/go-pear-tarballs/' . $candidate; unset($potentials[$i]); continue 2; } } $notfound[] = $package; } if (count($notfound)) { return PEAR::raiseError("No tarballs found for core packages: " . implode(', ', $notfound)); } $this->tarball = array_merge($this->tarball, $potentials); } function setupTempStuff() { if (!($this->ptmp = System::mktemp(array('-d')))) { $this->show("System's Tempdir failed, trying to use \$prefix/tmp ..."); $res = System::mkDir(array($this->prefix . '/tmp')); if (!$res) { return PEAR::raiseError('mkdir ' . $this->prefix . '/tmp ... failed'); } $_temp = tempnam($this->prefix . '/tmp', 'gope'); System::rm(array('-rf', $_temp)); System::mkdir(array('-p','-m', '0700', $_temp)); $this->ptmp = $this->prefix . '/tmp'; $ok = @chdir($this->ptmp); if (!$ok) { // This should not happen, really ;) $this->bail('chdir ' . $this->ptmp . ' ... failed'); } print "ok\n"; // Adjust TEMPDIR envvars if (!isset($_ENV)) { $_ENV = array(); }; $_ENV['TMPDIR'] = $_ENV['TEMP'] = $this->prefix . '/tmp'; } return @chdir($this->ptmp); } /** * Try to detect the kind of SAPI used by the * the given php.exe. * @author Pierrre-Alain Joye */ function win32DetectPHPSAPI() { if ($this->php_bin != '') { if (OS_WINDOWS) { exec('"' . $this->php_bin . '\\php.exe" -v', $res); } else { exec('"' . $this->php_bin . '/php" -v', $res); } if (is_array($res)) { if (isset($res[0]) && strpos($res[0],"(cli)")) { return 'cli'; } if (isset($res[0]) && strpos($res[0],"cgi")) { return 'cgi'; } if (isset($res[0]) && strpos($res[0],"cgi-fcgi")) { return 'cgi'; } return 'unknown'; } } return 'unknown'; } function doInstall() { print "Beginning install...\n"; // finish php_bin config if (OS_WINDOWS) { $this->php_bin .= '\\php.exe'; } else { $this->php_bin .= '/php'; } $this->PEARConfig = &PEAR_Config::singleton($this->pear_conf, $this->pear_conf); $this->PEARConfig->set('preferred_state', 'stable'); foreach ($this->config as $var) { if ($var == 'pear_conf' || $var == 'prefix') { continue; } $this->PEARConfig->set($var, $this->$var); } $this->PEARConfig->store(); // $this->PEARConfig->set('verbose', 6); print "Configuration written to $this->pear_conf...\n"; $this->registry = &$this->PEARConfig->getRegistry(); print "Initialized registry...\n"; $install = &PEAR_Command::factory('install', $this->PEARConfig); print "Preparing to install...\n"; $options = array( 'nodeps' => true, 'force' => true, 'upgrade' => true, ); foreach ($this->tarball as $pkg => $src) { print "installing $src...\n"; } $install->run('install', $options, array_values($this->tarball)); } function postProcessConfigVars() { foreach ($this->config as $n => $var) { for ($m = 1; $m <= count($this->config); $m++) { $var2 = $this->config[$m]; $this->$var = str_replace('$'.$var2, $this->$var2, $this->$var); } } foreach ($this->config as $var) { $dir = $this->$var; if (!preg_match('/_dir\\z/', $var)) { continue; } if (!@is_dir($dir)) { if (!System::mkDir(array('-p', $dir))) { $root = OS_WINDOWS ? 'administrator' : 'root'; return PEAR::raiseError("Unable to create {$this->configPrompt[$var]} $dir. Run this script as $root or pick another location.\n"); } } } } /** * Get the php.ini file used with the current * process or with the given php.exe * * Horrible hack, but well ;) * * Not used yet, will add the support later * @author Pierre-Alain Joye */ function getPhpiniPath() { $pathIni = get_cfg_var('cfg_file_path'); if ($pathIni && is_file($pathIni)) { return $pathIni; } // Oh well, we can keep this too :) // I dunno if get_cfg_var() is safe on every OS if (OS_WINDOWS) { // on Windows, we can be pretty sure that there is a php.ini // file somewhere do { $php_ini = PHP_CONFIG_FILE_PATH . DIRECTORY_SEPARATOR . 'php.ini'; if (@file_exists($php_ini)) { break; } $php_ini = 'c:\winnt\php.ini'; if (@file_exists($php_ini)) { break; } $php_ini = 'c:\windows\php.ini'; } while (false); } else { $php_ini = PHP_CONFIG_FILE_PATH . DIRECTORY_SEPARATOR . 'php.ini'; } if (@is_file($php_ini)) { return $php_ini; } // We re running in hackz&troubles :) ob_implicit_flush(false); ob_start(); phpinfo(INFO_GENERAL); $strInfo = ob_get_contents(); ob_end_clean(); ob_implicit_flush(true); if (php_sapi_name() != 'cli') { $strInfo = strip_tags($strInfo,''); $arrayInfo = explode("", $strInfo ); $cli = false; } else { $arrayInfo = explode("\n", $strInfo); $cli = true; } foreach ($arrayInfo as $val) { if (strpos($val,"php.ini")) { if ($cli) { list(,$pathIni) = explode('=>', $val); } else { $pathIni = strip_tags(trim($val)); } $pathIni = trim($pathIni); if (is_file($pathIni)) { return $pathIni; } } } return false; } } ?> php-pear-1.10.1+submodules+notgz/PEAR/Start/000077500000000000000000000000001262614675700204655ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/PEAR/Start/CLI.php000066400000000000000000000514571262614675700216210ustar00rootroot00000000000000tty = OS_WINDOWS ? @fopen('\con', 'r') : @fopen('/dev/tty', 'r'); if (!$this->tty) { $this->tty = fopen('php://stdin', 'r'); } $this->origpwd = getcwd(); $this->config = array_keys($this->configPrompt); // make indices run from 1... array_unshift($this->config, ""); unset($this->config[0]); reset($this->config); $this->descLength = max(array_map('strlen', $this->configPrompt)); $this->descFormat = "%-{$this->descLength}s"; $this->first = key($this->config); end($this->config); $this->last = key($this->config); PEAR_Command::setFrontendType('CLI'); } function _PEAR_Start_CLI() { if ($this->tty) { @fclose($this->tty); } if ($this->cscript) { @unlink($this->cscript); } } function run() { if (PEAR::isError($err = $this->locatePackagesToInstall())) { return $err; } $this->startupQuestion(); $this->setupTempStuff(); $this->getInstallLocations(); $this->displayPreamble(); if (PEAR::isError($err = $this->postProcessConfigVars())) { return $err; } $this->doInstall(); $this->finishInstall(); } function startupQuestion() { if (OS_WINDOWS) { print " Are you installing a system-wide PEAR or a local copy? (system|local) [system] : "; $tmp = trim(fgets($this->tty, 1024)); if (!empty($tmp) && strtolower($tmp) !== 'system') { print "Please confirm local copy by typing 'yes' : "; $tmp = trim(fgets($this->tty, 1024)); if (strtolower($tmp) == 'yes') { $slash = "\\"; if (strrpos($this->prefix, '\\') === (strlen($this->prefix) - 1)) { $slash = ''; } $this->localInstall = true; $this->pear_conf = '$prefix' . $slash . 'pear.ini'; } } } else { if ($this->getCurrentUser() == 'root') { return; } $this->pear_conf = $this->safeGetenv('HOME') . '/.pearrc'; } } function getInstallLocations() { while (true) { print " Below is a suggested file layout for your new PEAR installation. To change individual locations, type the number in front of the directory. Type 'all' to change all of them or simply press Enter to accept these locations. "; foreach ($this->config as $n => $var) { $fullvar = $this->$var; foreach ($this->config as $blah => $unused) { foreach ($this->config as $m => $var2) { $fullvar = str_replace('$'.$var2, $this->$var2, $fullvar); } } printf("%2d. $this->descFormat : %s\n", $n, $this->configPrompt[$var], $fullvar); } print "\n$this->first-$this->last, 'all' or Enter to continue: "; $tmp = trim(fgets($this->tty, 1024)); if (empty($tmp)) { if (OS_WINDOWS && !$this->validPHPBin) { echo "**ERROR** Please, enter the php.exe path. "; } else { break; } } if (isset($this->config[(int)$tmp])) { $var = $this->config[(int)$tmp]; $desc = $this->configPrompt[$var]; $current = $this->$var; if (WIN32GUI && $var != 'pear_conf'){ $tmp = $this->win32BrowseForFolder("Choose a Folder for $desc [$current] :"); $tmp.= '\\'; } else { print "(Use \$prefix as a shortcut for '$this->prefix', etc.) $desc [$current] : "; $tmp = trim(fgets($this->tty, 1024)); } $old = $this->$var; $this->$var = $$var = $tmp; if (OS_WINDOWS && $var=='php_bin') { if ($this->validatePhpExecutable($tmp)) { $this->php_bin = $tmp; } else { $this->php_bin = $old; } } } elseif ($tmp == 'all') { foreach ($this->config as $n => $var) { $desc = $this->configPrompt[$var]; $current = $this->$var; print "$desc [$current] : "; $tmp = trim(fgets($this->tty, 1024)); if (!empty($tmp)) { $this->$var = $tmp; } } } } } function validatePhpExecutable($tmp) { if (OS_WINDOWS) { if (strpos($tmp, 'php.exe')) { $tmp = str_replace('php.exe', '', $tmp); } if (file_exists($tmp . DIRECTORY_SEPARATOR . 'php.exe')) { $tmp = $tmp . DIRECTORY_SEPARATOR . 'php.exe'; $this->php_bin_sapi = $this->win32DetectPHPSAPI(); if ($this->php_bin_sapi=='cgi'){ print " ****************************************************************************** NOTICE! We found php.exe under $this->php_bin, it uses a $this->php_bin_sapi SAPI. PEAR commandline tool works well with it. If you have a CLI php.exe available, we recommend using it. Press Enter to continue..."; $tmp = trim(fgets($this->tty, 1024)); } elseif ($this->php_bin_sapi=='unknown') { print " ****************************************************************************** WARNING! We found php.exe under $this->php_bin, it uses an $this->php_bin_sapi SAPI. PEAR commandline tool has NOT been tested with it. If you have a CLI (or CGI) php.exe available, we strongly recommend using it. Press Enter to continue..."; $tmp = trim(fgets($this->tty, 1024)); } echo "php.exe (sapi: $this->php_bin_sapi) found.\n\n"; return $this->validPHPBin = true; } else { echo "**ERROR**: not a folder, or no php.exe found in this folder. Press Enter to continue..."; $tmp = trim(fgets($this->tty, 1024)); return $this->validPHPBin = false; } } } /** * Create a vbs script to browse the getfolder dialog, called * by cscript, if it's available. * $label is the label text in the header of the dialog box * * TODO: * - Do not show Control panel * - Replace WSH with calls to w32 as soon as callbacks work * @author Pierrre-Alain Joye */ function win32BrowseForFolder($label) { $wsh_browserfolder = 'Option Explicit Dim ArgObj, var1, var2, sa, sFld Set ArgObj = WScript.Arguments Const BIF_EDITBOX = &H10 Const BIF_NEWDIALOGSTYLE = &H40 Const BIF_RETURNONLYFSDIRS = &H0001 Const BIF_DONTGOBELOWDOMAIN = &H0002 Const BIF_STATUSTEXT = &H0004 Const BIF_RETURNFSANCESTORS = &H0008 Const BIF_VALIDATE = &H0020 Const BIF_BROWSEFORCOMPUTER = &H1000 Const BIF_BROWSEFORPRINTER = &H2000 Const BIF_BROWSEINCLUDEFILES = &H4000 Const OFN_LONGNAMES = &H200000 Const OFN_NOLONGNAMES = &H40000 Const ssfDRIVES = &H11 Const ssfNETWORK = &H12 Set sa = CreateObject("Shell.Application") var1=ArgObj(0) Set sFld = sa.BrowseForFolder(0, var1, BIF_EDITBOX + BIF_VALIDATE + BIF_BROWSEINCLUDEFILES + BIF_RETURNFSANCESTORS+BIF_NEWDIALOGSTYLE , ssfDRIVES ) if not sFld is nothing Then if not left(sFld.items.item.path,1)=":" Then WScript.Echo sFld.items.item.path Else WScript.Echo "invalid" End If Else WScript.Echo "cancel" End If '; if (!$this->cscript) { $this->cscript = $this->ptmp . DIRECTORY_SEPARATOR . "bf.vbs"; // TODO: use file_put_contents() $fh = fopen($this->cscript, "wb+"); fwrite($fh, $wsh_browserfolder, strlen($wsh_browserfolder)); fclose($fh); } exec('cscript ' . escapeshellarg($this->cscript) . ' "' . escapeshellarg($label) . '" //noLogo', $arPath); if (!count($arPath) || $arPath[0]=='' || $arPath[0]=='cancel') { return ''; } elseif ($arPath[0]=='invalid') { echo "Invalid Path.\n"; return ''; } return $arPath[0]; } function displayPreamble() { if (OS_WINDOWS) { /* * Checks PHP SAPI version under windows/CLI */ if ($this->php_bin == '') { print " We do not find any php.exe, please select the php.exe folder (CLI is recommended, usually in c:\php\cli\php.exe) "; $this->validPHPBin = false; } elseif (strlen($this->php_bin)) { $this->php_bin_sapi = $this->win32DetectPHPSAPI(); $this->validPHPBin = true; switch ($this->php_bin_sapi) { case 'cli': break; case 'cgi': case 'cgi-fcgi': print " *NOTICE* We found php.exe under $this->php_bin, it uses a $this->php_bin_sapi SAPI. PEAR commandline tool works well with it, if you have a CLI php.exe available, we recommend using it. "; break; default: print " *WARNING* We found php.exe under $this->php_bin, it uses an unknown SAPI. PEAR commandline tool has not been tested with it, if you have a CLI (or CGI) php.exe available, we strongly recommend using it. "; break; } } } } function finishInstall() { $sep = OS_WINDOWS ? ';' : ':'; $include_path = explode($sep, ini_get('include_path')); if (OS_WINDOWS) { $found = false; $t = strtolower($this->php_dir); foreach ($include_path as $path) { if ($t == strtolower($path)) { $found = true; break; } } } else { $found = in_array($this->php_dir, $include_path); } if (!$found) { print " ****************************************************************************** WARNING! The include_path defined in the currently used php.ini does not contain the PEAR PHP directory you just specified: <$this->php_dir> If the specified directory is also not in the include_path used by your scripts, you will have problems getting any PEAR packages working. "; if ($php_ini = $this->getPhpiniPath()) { print "\n\nWould you like to alter php.ini <$php_ini>? [Y/n] : "; $alter_phpini = !stristr(fgets($this->tty, 1024), "n"); if ($alter_phpini) { $this->alterPhpIni($php_ini); } else { if (OS_WINDOWS) { print " Please look over your php.ini file to make sure $this->php_dir is in your include_path."; } else { print " I will add a workaround for this in the 'pear' command to make sure the installer works, but please look over your php.ini or Apache configuration to make sure $this->php_dir is in your include_path. "; } } } print " Current include path : ".ini_get('include_path')." Configured directory : $this->php_dir Currently used php.ini (guess) : $php_ini "; print "Press Enter to continue: "; fgets($this->tty, 1024); } $pear_cmd = $this->bin_dir . DIRECTORY_SEPARATOR . 'pear'; $pear_cmd = OS_WINDOWS ? strtolower($pear_cmd).'.bat' : $pear_cmd; // check that the installed pear and the one in the path are the same (if any) $pear_old = System::which(OS_WINDOWS ? 'pear.bat' : 'pear', $this->bin_dir); if ($pear_old && ($pear_old != $pear_cmd)) { // check if it is a link or symlink $islink = OS_WINDOWS ? false : is_link($pear_old) ; if ($islink && readlink($pear_old) != $pear_cmd) { print "\n** WARNING! The link $pear_old does not point to the " . "installed $pear_cmd\n"; } elseif (!$this->localInstall && is_writable($pear_old) && !is_dir($pear_old)) { rename($pear_old, "{$pear_old}_old"); print "\n** WARNING! Backed up old pear to {$pear_old}_old\n"; } else { print "\n** WARNING! Old version found at $pear_old, please remove it or ". "be sure to use the new $pear_cmd command\n"; } } print "\nThe 'pear' command is now at your service at $pear_cmd\n"; // Alert the user if the pear cmd is not in PATH $old_dir = $pear_old ? dirname($pear_old) : false; if (!$this->which('pear', $old_dir)) { print " ** The 'pear' command is not currently in your PATH, so you need to ** use '$pear_cmd' until you have added ** '$this->bin_dir' to your PATH environment variable. "; print "Run it without parameters to see the available actions, try 'pear list' to see what packages are installed, or 'pear help' for help. For more information about PEAR, see: http://pear.php.net/faq.php http://pear.php.net/manual/ Thanks for using go-pear! "; } if (OS_WINDOWS && !$this->localInstall) { $this->win32CreateRegEnv(); } } /** * System::which() does not allow path exclusion */ function which($program, $dont_search_in = false) { if (OS_WINDOWS) { if ($_path = $this->safeGetEnv('Path')) { $dirs = explode(';', $_path); } else { $dirs = explode(';', $this->safeGetEnv('PATH')); } foreach ($dirs as $i => $dir) { $dirs[$i] = strtolower(realpath($dir)); } if ($dont_search_in) { $dont_search_in = strtolower(realpath($dont_search_in)); } if ($dont_search_in && ($key = array_search($dont_search_in, $dirs)) !== false) { unset($dirs[$key]); } foreach ($dirs as $dir) { $dir = str_replace('\\\\', '\\', $dir); if (!strlen($dir)) { continue; } if ($dir{strlen($dir) - 1} != '\\') { $dir .= '\\'; } $tmp = $dir . $program; $info = pathinfo($tmp); if (isset($info['extension']) && in_array(strtolower($info['extension']), array('exe', 'com', 'bat', 'cmd'))) { if (file_exists($tmp)) { return strtolower($tmp); } } elseif (file_exists($ret = $tmp . '.exe') || file_exists($ret = $tmp . '.com') || file_exists($ret = $tmp . '.bat') || file_exists($ret = $tmp . '.cmd')) { return strtolower($ret); } } } else { $dirs = explode(':', $this->safeGetEnv('PATH')); if ($dont_search_in && ($key = array_search($dont_search_in, $dirs)) !== false) { unset($dirs[$key]); } foreach ($dirs as $dir) { if (is_executable("$dir/$program")) { return "$dir/$program"; } } } return false; } /** * Not optimized, but seems to work, if some nice * peardev will test it? :) * * @author Pierre-Alain Joye */ function alterPhpIni($pathIni='') { $foundAt = array(); $iniSep = OS_WINDOWS ? ';' : ':'; if ($pathIni=='') { $pathIni = $this->getPhpiniPath(); } $arrayIni = file($pathIni); $i=0; $found=0; // Looks for each active include_path directives foreach ($arrayIni as $iniLine) { $iniLine = trim($iniLine); $iniLine = str_replace(array("\n", "\r"), array('', ''), $iniLine); if (preg_match("/^\s*include_path/", $iniLine)) { $foundAt[] = $i; $found++; } $i++; } if ($found) { $includeLine = $arrayIni[$foundAt[0]]; list(, $currentPath) = explode('=', $includeLine); $currentPath = trim($currentPath); if (substr($currentPath,0,1) == '"') { $currentPath = substr($currentPath, 1, strlen($currentPath) - 2); } $arrayPath = explode($iniSep, $currentPath); $newPath = array(); if ($arrayPath[0]=='.') { $newPath[0] = '.'; $newPath[1] = $this->php_dir; array_shift($arrayPath); } else { $newPath[0] = $this->php_dir; } foreach ($arrayPath as $path) { $newPath[]= $path; } } else { $newPath = array(); $newPath[0] = '.'; $newPath[1] = $this->php_dir; $foundAt[] = count($arrayIni); // add a new line if none is present } $nl = OS_WINDOWS ? "\r\n" : "\n"; $includepath = 'include_path="' . implode($iniSep,$newPath) . '"'; $newInclude = "$nl$nl;***** Added by go-pear$nl" . $includepath . $nl . ";*****" . $nl . $nl; $arrayIni[$foundAt[0]] = $newInclude; for ($i=1; $i<$found; $i++) { $arrayIni[$foundAt[$i]]=';' . trim($arrayIni[$foundAt[$i]]); } $newIni = implode("", $arrayIni); if (!($fh = @fopen($pathIni, "wb+"))) { $prefixIni = $this->prefix . DIRECTORY_SEPARATOR . "php.ini-gopear"; $fh = fopen($prefixIni, "wb+"); if (!$fh) { echo " ****************************************************************************** WARNING: Cannot write to $pathIni nor in $this->prefix/php.ini-gopear. Please modify manually your php.ini by adding: $includepath "; return false; } else { fwrite($fh, $newIni, strlen($newIni)); fclose($fh); echo " ****************************************************************************** WARNING: Cannot write to $pathIni, but php.ini was successfully created at <$this->prefix/php.ini-gopear>. Please replace the file <$pathIni> with <$prefixIni> or modify your php.ini by adding: $includepath "; } } else { fwrite($fh, $newIni, strlen($newIni)); fclose($fh); echo " php.ini <$pathIni> include_path updated. "; } return true; } /** * Generates a registry addOn for Win32 platform * This addon set PEAR environment variables * @author Pierrre-Alain Joye */ function win32CreateRegEnv() { $nl = "\r\n"; $reg ='REGEDIT4'.$nl. '[HKEY_CURRENT_USER\Environment]'. $nl . '"PHP_PEAR_SYSCONF_DIR"="' . addslashes($this->prefix) . '"' . $nl . '"PHP_PEAR_INSTALL_DIR"="' . addslashes($this->php_dir) . '"' . $nl . '"PHP_PEAR_DOC_DIR"="' . addslashes($this->doc_dir) . '"' . $nl . '"PHP_PEAR_BIN_DIR"="' . addslashes($this->bin_dir) . '"' . $nl . '"PHP_PEAR_DATA_DIR"="' . addslashes($this->data_dir) . '"' . $nl . '"PHP_PEAR_PHP_BIN"="' . addslashes($this->php_bin) . '"' . $nl . '"PHP_PEAR_TEST_DIR"="' . addslashes($this->test_dir) . '"' . $nl; $fh = fopen($this->prefix . DIRECTORY_SEPARATOR . 'PEAR_ENV.reg', 'wb'); if($fh){ fwrite($fh, $reg, strlen($reg)); fclose($fh); echo " * WINDOWS ENVIRONMENT VARIABLES * For convenience, a REG file is available under {$this->prefix}PEAR_ENV.reg . This file creates ENV variables for the current user. Double-click this file to add it to the current user registry. "; } } function displayHTMLProgress() { } } ?> php-pear-1.10.1+submodules+notgz/PEAR/Task/000077500000000000000000000000001262614675700202725ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/PEAR/Task/Common.php000066400000000000000000000140511262614675700222340ustar00rootroot00000000000000 * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ /**#@+ * Error codes for task validation routines */ define('PEAR_TASK_ERROR_NOATTRIBS', 1); define('PEAR_TASK_ERROR_MISSING_ATTRIB', 2); define('PEAR_TASK_ERROR_WRONG_ATTRIB_VALUE', 3); define('PEAR_TASK_ERROR_INVALID', 4); /**#@-*/ define('PEAR_TASK_PACKAGE', 1); define('PEAR_TASK_INSTALL', 2); define('PEAR_TASK_PACKAGEANDINSTALL', 3); /** * A task is an operation that manipulates the contents of a file. * * Simple tasks operate on 1 file. Multiple tasks are executed after all files have been * processed and installed, and are designed to operate on all files containing the task. * The Post-install script task simply takes advantage of the fact that it will be run * after installation, replace is a simple task. * * Combining tasks is possible, but ordering is significant. * * * * * * * This will first replace any instance of @data-dir@ in the test.php file * with the path to the current data directory. Then, it will include the * test.php file and run the script it contains to configure the package post-installation. * * @category pear * @package PEAR * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version Release: @package_version@ * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 * @abstract */ class PEAR_Task_Common { /** * Valid types for this version are 'simple' and 'multiple' * * - simple tasks operate on the contents of a file and write out changes to disk * - multiple tasks operate on the contents of many files and write out the * changes directly to disk * * Child task classes must override this property. * * @access protected */ protected $type = 'simple'; /** * Determines which install phase this task is executed under */ public $phase = PEAR_TASK_INSTALL; /** * @access protected */ protected $config; /** * @access protected */ protected $registry; /** * @access protected */ public $logger; /** * @access protected */ protected $installphase; /** * @param PEAR_Config * @param PEAR_Common */ function __construct(&$config, &$logger, $phase) { $this->config = &$config; $this->registry = &$config->getRegistry(); $this->logger = &$logger; $this->installphase = $phase; if ($this->type == 'multiple') { $GLOBALS['_PEAR_TASK_POSTINSTANCES'][get_class($this)][] = &$this; } } /** * Validate the basic contents of a task tag. * * @param PEAR_PackageFile_v2 * @param array * @param PEAR_Config * @param array the entire parsed tag * * @return true|array On error, return an array in format: * array(PEAR_TASK_ERROR_???[, param1][, param2][, ...]) * * For PEAR_TASK_ERROR_MISSING_ATTRIB, pass the attribute name in * For PEAR_TASK_ERROR_WRONG_ATTRIB_VALUE, pass the attribute name and * an array of legal values in * * @abstract */ public static function validateXml($pkg, $xml, $config, $fileXml) { } /** * Initialize a task instance with the parameters * * @param array raw, parsed xml * @param array attributes from the tag containing this task * @param string|null last installed version of this package * @abstract */ public function init($xml, $fileAttributes, $lastVersion) { } /** * Begin a task processing session. All multiple tasks will be processed * after each file has been successfully installed, all simple tasks should * perform their task here and return any errors using the custom * throwError() method to allow forward compatibility * * This method MUST NOT write out any changes to disk * * @param PEAR_PackageFile_v2 * @param string file contents * @param string the eventual final file location (informational only) * @return string|false|PEAR_Error false to skip this file, PEAR_Error to fail * (use $this->throwError), otherwise return the new contents * @abstract */ public function startSession($pkg, $contents, $dest) { } /** * This method is used to process each of the tasks for a particular * multiple class type. Simple tasks need not implement this method. * * @param array an array of tasks * @access protected */ public static function run($tasks) { } /** * @final */ public static function hasPostinstallTasks() { return isset($GLOBALS['_PEAR_TASK_POSTINSTANCES']); } /** * @final */ public static function runPostinstallTasks() { foreach ($GLOBALS['_PEAR_TASK_POSTINSTANCES'] as $class => $tasks) { $err = call_user_func( array($class, 'run'), $GLOBALS['_PEAR_TASK_POSTINSTANCES'][$class] ); if ($err) { return PEAR_Task_Common::throwError($err); } } unset($GLOBALS['_PEAR_TASK_POSTINSTANCES']); } /** * Determines whether a role is a script * @return bool */ public function isScript() { return $this->type == 'script'; } public function throwError($msg, $code = -1) { include_once 'PEAR.php'; return PEAR::raiseError($msg, $code); } } php-pear-1.10.1+submodules+notgz/PEAR/Task/Postinstallscript.php000066400000000000000000000344401262614675700245510ustar00rootroot00000000000000 * * PHP versions 4 and 5 * * @category pear * @package PEAR * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ /** * Base class */ require_once 'PEAR/Task/Common.php'; /** * Implements the postinstallscript file task. * * Note that post-install scripts are handled separately from installation, by the * "pear run-scripts" command * * @category pear * @package PEAR * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version Release: @package_version@ * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ class PEAR_Task_Postinstallscript extends PEAR_Task_Common { public $type = 'script'; public $_class; public $_params; public $_obj; /** * * @var PEAR_PackageFile_v2 */ public $_pkg; public $_contents; public $phase = PEAR_TASK_INSTALL; /** * Validate the raw xml at parsing-time. * * This also attempts to validate the script to make sure it meets the criteria * for a post-install script * * @param PEAR_PackageFile_v2 * @param array The XML contents of the tag * @param PEAR_Config * @param array the entire parsed tag */ public static function validateXml($pkg, $xml, $config, $fileXml) { if ($fileXml['role'] != 'php') { return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "'. $fileXml['name'].'" must be role="php"', ); } PEAR::pushErrorHandling(PEAR_ERROR_RETURN); $file = $pkg->getFileContents($fileXml['name']); if (PEAR::isError($file)) { PEAR::popErrorHandling(); return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "'. $fileXml['name'].'" is not valid: '. $file->getMessage(), ); } elseif ($file === null) { return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "'. $fileXml['name'].'" could not be retrieved for processing!', ); } else { $analysis = $pkg->analyzeSourceCode($file, true); if (!$analysis) { PEAR::popErrorHandling(); $warnings = ''; foreach ($pkg->getValidationWarnings() as $warn) { $warnings .= $warn['message']."\n"; } return array(PEAR_TASK_ERROR_INVALID, 'Analysis of post-install script "'. $fileXml['name'].'" failed: '.$warnings, ); } if (count($analysis['declared_classes']) != 1) { PEAR::popErrorHandling(); return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "'. $fileXml['name'].'" must declare exactly 1 class', ); } $class = $analysis['declared_classes'][0]; if ($class != str_replace( array('/', '.php'), array('_', ''), $fileXml['name'] ).'_postinstall') { PEAR::popErrorHandling(); return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "'. $fileXml['name'].'" class "'.$class.'" must be named "'. str_replace( array('/', '.php'), array('_', ''), $fileXml['name'] ).'_postinstall"', ); } if (!isset($analysis['declared_methods'][$class])) { PEAR::popErrorHandling(); return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "'. $fileXml['name'].'" must declare methods init() and run()', ); } $methods = array('init' => 0, 'run' => 1); foreach ($analysis['declared_methods'][$class] as $method) { if (isset($methods[$method])) { unset($methods[$method]); } } if (count($methods)) { PEAR::popErrorHandling(); return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "'. $fileXml['name'].'" must declare methods init() and run()', ); } } PEAR::popErrorHandling(); $definedparams = array(); $tasksNamespace = $pkg->getTasksNs().':'; if (!isset($xml[$tasksNamespace.'paramgroup']) && isset($xml['paramgroup'])) { // in order to support the older betas, which did not expect internal tags // to also use the namespace $tasksNamespace = ''; } if (isset($xml[$tasksNamespace.'paramgroup'])) { $params = $xml[$tasksNamespace.'paramgroup']; if (!is_array($params) || !isset($params[0])) { $params = array($params); } foreach ($params as $param) { if (!isset($param[$tasksNamespace.'id'])) { return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "'. $fileXml['name'].'" must have '. 'an '.$tasksNamespace.'id> tag', ); } if (isset($param[$tasksNamespace.'name'])) { if (!in_array($param[$tasksNamespace.'name'], $definedparams)) { return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "'. $fileXml['name'].'" '.$tasksNamespace. 'paramgroup> id "'.$param[$tasksNamespace.'id']. '" parameter "'.$param[$tasksNamespace.'name']. '" has not been previously defined', ); } if (!isset($param[$tasksNamespace.'conditiontype'])) { return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "'. $fileXml['name'].'" '.$tasksNamespace. 'paramgroup> id "'.$param[$tasksNamespace.'id']. '" must have a '.$tasksNamespace. 'conditiontype> tag containing either "=", '. '"!=", or "preg_match"', ); } if (!in_array( $param[$tasksNamespace.'conditiontype'], array('=', '!=', 'preg_match') )) { return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "'. $fileXml['name'].'" '.$tasksNamespace. 'paramgroup> id "'.$param[$tasksNamespace.'id']. '" must have a '.$tasksNamespace. 'conditiontype> tag containing either "=", '. '"!=", or "preg_match"', ); } if (!isset($param[$tasksNamespace.'value'])) { return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "'. $fileXml['name'].'" '.$tasksNamespace. 'paramgroup> id "'.$param[$tasksNamespace.'id']. '" must have a '.$tasksNamespace. 'value> tag containing expected parameter value', ); } } if (isset($param[$tasksNamespace.'instructions'])) { if (!is_string($param[$tasksNamespace.'instructions'])) { return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "'. $fileXml['name'].'" '.$tasksNamespace. 'paramgroup> id "'.$param[$tasksNamespace.'id']. '" '.$tasksNamespace.'instructions> must be simple text', ); } } if (!isset($param[$tasksNamespace.'param'])) { continue; // is no longer required } $subparams = $param[$tasksNamespace.'param']; if (!is_array($subparams) || !isset($subparams[0])) { $subparams = array($subparams); } foreach ($subparams as $subparam) { if (!isset($subparam[$tasksNamespace.'name'])) { return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "'. $fileXml['name'].'" parameter for '. $tasksNamespace.'paramgroup> id "'. $param[$tasksNamespace.'id'].'" must have '. 'a '.$tasksNamespace.'name> tag', ); } if (!preg_match( '/[a-zA-Z0-9]+/', $subparam[$tasksNamespace.'name'] )) { return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "'. $fileXml['name'].'" parameter "'. $subparam[$tasksNamespace.'name']. '" for '.$tasksNamespace.'paramgroup> id "'. $param[$tasksNamespace.'id']. '" is not a valid name. Must contain only alphanumeric characters', ); } if (!isset($subparam[$tasksNamespace.'prompt'])) { return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "'. $fileXml['name'].'" parameter "'. $subparam[$tasksNamespace.'name']. '" for '.$tasksNamespace.'paramgroup> id "'. $param[$tasksNamespace.'id']. '" must have a '.$tasksNamespace.'prompt> tag', ); } if (!isset($subparam[$tasksNamespace.'type'])) { return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "'. $fileXml['name'].'" parameter "'. $subparam[$tasksNamespace.'name']. '" for '.$tasksNamespace.'paramgroup> id "'. $param[$tasksNamespace.'id']. '" must have a '.$tasksNamespace.'type> tag', ); } $definedparams[] = $param[$tasksNamespace.'id'].'::'. $subparam[$tasksNamespace.'name']; } } } return true; } /** * Initialize a task instance with the parameters * @param array $xml raw, parsed xml * @param array $fileattribs attributes from the tag containing * this task * @param string|null $lastversion last installed version of this package, * if any (useful for upgrades) */ public function init($xml, $fileattribs, $lastversion) { $this->_class = str_replace('/', '_', $fileattribs['name']); $this->_filename = $fileattribs['name']; $this->_class = str_replace('.php', '', $this->_class).'_postinstall'; $this->_params = $xml; $this->_lastversion = $lastversion; } /** * Strip the tasks: namespace from internal params * * @access private */ public function _stripNamespace($params = null) { if ($params === null) { $params = array(); if (!is_array($this->_params)) { return; } foreach ($this->_params as $i => $param) { if (is_array($param)) { $param = $this->_stripNamespace($param); } $params[str_replace($this->_pkg->getTasksNs().':', '', $i)] = $param; } $this->_params = $params; } else { $newparams = array(); foreach ($params as $i => $param) { if (is_array($param)) { $param = $this->_stripNamespace($param); } $newparams[str_replace($this->_pkg->getTasksNs().':', '', $i)] = $param; } return $newparams; } } /** * Unlike other tasks, the installed file name is passed in instead of the * file contents, because this task is handled post-installation * * @param mixed $pkg PEAR_PackageFile_v1|PEAR_PackageFile_v2 * @param string $contents file name * * @return bool|PEAR_Error false to skip this file, PEAR_Error to fail * (use $this->throwError) */ public function startSession($pkg, $contents) { if ($this->installphase != PEAR_TASK_INSTALL) { return false; } // remove the tasks: namespace if present $this->_pkg = $pkg; $this->_stripNamespace(); $this->logger->log( 0, 'Including external post-installation script "'. $contents.'" - any errors are in this script' ); include_once $contents; if (class_exists($this->_class)) { $this->logger->log(0, 'Inclusion succeeded'); } else { return $this->throwError( 'init of post-install script class "'.$this->_class .'" failed' ); } $this->_obj = new $this->_class(); $this->logger->log(1, 'running post-install script "'.$this->_class.'->init()"'); PEAR::pushErrorHandling(PEAR_ERROR_RETURN); $res = $this->_obj->init($this->config, $pkg, $this->_lastversion); PEAR::popErrorHandling(); if ($res) { $this->logger->log(0, 'init succeeded'); } else { return $this->throwError( 'init of post-install script "'.$this->_class. '->init()" failed' ); } $this->_contents = $contents; return true; } /** * No longer used * * @see PEAR_PackageFile_v2::runPostinstallScripts() * @param array an array of tasks * @param string install or upgrade * @access protected */ public static function run() { } } php-pear-1.10.1+submodules+notgz/PEAR/Task/Postinstallscript/000077500000000000000000000000001262614675700240335ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/PEAR/Task/Postinstallscript/rw.php000066400000000000000000000140551262614675700252010ustar00rootroot00000000000000 - read/write version * * PHP versions 4 and 5 * * @category pear * @package PEAR * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a10 */ /** * Base class */ require_once 'PEAR/Task/Postinstallscript.php'; /** * Abstracts the postinstallscript file task xml. * @category pear * @package PEAR * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version Release: @package_version@ * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a10 */ class PEAR_Task_Postinstallscript_rw extends PEAR_Task_Postinstallscript { /** * parent package file object * * @var PEAR_PackageFile_v2_rw */ public $_pkg; /** * Enter description here... * * @param PEAR_PackageFile_v2_rw $pkg Package * @param PEAR_Config $config Config * @param PEAR_Frontend $logger Logger * @param array $fileXml XML * * @return PEAR_Task_Postinstallscript_rw */ function __construct(&$pkg, &$config, &$logger, $fileXml) { parent::__construct($config, $logger, PEAR_TASK_PACKAGE); $this->_contents = $fileXml; $this->_pkg = &$pkg; $this->_params = array(); } public function validate() { return $this->validateXml($this->_pkg, $this->_params, $this->config, $this->_contents); } public function getName() { return 'postinstallscript'; } /** * add a simple to the post-install script * * Order is significant, so call this method in the same * sequence the users should see the paramgroups. The $params * parameter should either be the result of a call to {@link getParam()} * or an array of calls to getParam(). * * Use {@link addConditionTypeGroup()} to add a containing * a tag * * @param string $id id as seen by the script * @param array|false $params array of getParam() calls, or false for no params * @param string|false $instructions */ public function addParamGroup($id, $params = false, $instructions = false) { if ($params && isset($params[0]) && !isset($params[1])) { $params = $params[0]; } $stuff = array( $this->_pkg->getTasksNs().':id' => $id, ); if ($instructions) { $stuff[$this->_pkg->getTasksNs().':instructions'] = $instructions; } if ($params) { $stuff[$this->_pkg->getTasksNs().':param'] = $params; } $this->_params[$this->_pkg->getTasksNs().':paramgroup'][] = $stuff; } /** * Add a complex to the post-install script with conditions * * This inserts a with * * Order is significant, so call this method in the same * sequence the users should see the paramgroups. The $params * parameter should either be the result of a call to {@link getParam()} * or an array of calls to getParam(). * * Use {@link addParamGroup()} to add a simple * * @param string $id id as seen by the script * @param string $oldgroup id of the section referenced by * * @param string $param name of the from the older section referenced * by * @param string $value value to match of the parameter * @param string $conditiontype one of '=', '!=', 'preg_match' * @param array|false $params array of getParam() calls, or false for no params * @param string|false $instructions */ public function addConditionTypeGroup($id, $oldgroup, $param, $value, $conditiontype = '=', $params = false, $instructions = false ) { if ($params && isset($params[0]) && !isset($params[1])) { $params = $params[0]; } $stuff = array( $this->_pkg->getTasksNs().':id' => $id, ); if ($instructions) { $stuff[$this->_pkg->getTasksNs().':instructions'] = $instructions; } $stuff[$this->_pkg->getTasksNs().':name'] = $oldgroup.'::'.$param; $stuff[$this->_pkg->getTasksNs().':conditiontype'] = $conditiontype; $stuff[$this->_pkg->getTasksNs().':value'] = $value; if ($params) { $stuff[$this->_pkg->getTasksNs().':param'] = $params; } $this->_params[$this->_pkg->getTasksNs().':paramgroup'][] = $stuff; } public function getXml() { return $this->_params; } /** * Use to set up a param tag for use in creating a paramgroup * * @param mixed $name Name of parameter * @param mixed $prompt Prompt * @param string $type Type, defaults to 'string' * @param mixed $default Default value * * @return array */ public static function getParam( $name, $prompt, $type = 'string', $default = null ) { if ($default !== null) { return array( $this->_pkg->getTasksNs().':name' => $name, $this->_pkg->getTasksNs().':prompt' => $prompt, $this->_pkg->getTasksNs().':type' => $type, $this->_pkg->getTasksNs().':default' => $default, ); } return array( $this->_pkg->getTasksNs().':name' => $name, $this->_pkg->getTasksNs().':prompt' => $prompt, $this->_pkg->getTasksNs().':type' => $type, ); } } php-pear-1.10.1+submodules+notgz/PEAR/Task/Replace.php000066400000000000000000000154031262614675700223610ustar00rootroot00000000000000 * * PHP versions 4 and 5 * * @category pear * @package PEAR * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ /** * Base class */ require_once 'PEAR/Task/Common.php'; /** * Implements the replace file task. * @category pear * @package PEAR * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version Release: @package_version@ * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ class PEAR_Task_Replace extends PEAR_Task_Common { public $type = 'simple'; public $phase = PEAR_TASK_PACKAGEANDINSTALL; public $_replacements; /** * Validate the raw xml at parsing-time. * * @param PEAR_PackageFile_v2 * @param array raw, parsed xml * @param PEAR_Config */ public static function validateXml($pkg, $xml, $config, $fileXml) { if (!isset($xml['attribs'])) { return array(PEAR_TASK_ERROR_NOATTRIBS); } if (!isset($xml['attribs']['type'])) { return array(PEAR_TASK_ERROR_MISSING_ATTRIB, 'type'); } if (!isset($xml['attribs']['to'])) { return array(PEAR_TASK_ERROR_MISSING_ATTRIB, 'to'); } if (!isset($xml['attribs']['from'])) { return array(PEAR_TASK_ERROR_MISSING_ATTRIB, 'from'); } if ($xml['attribs']['type'] == 'pear-config') { if (!in_array($xml['attribs']['to'], $config->getKeys())) { return array(PEAR_TASK_ERROR_WRONG_ATTRIB_VALUE, 'to', $xml['attribs']['to'], $config->getKeys(), ); } } elseif ($xml['attribs']['type'] == 'php-const') { if (defined($xml['attribs']['to'])) { return true; } else { return array(PEAR_TASK_ERROR_WRONG_ATTRIB_VALUE, 'to', $xml['attribs']['to'], array('valid PHP constant'), ); } } elseif ($xml['attribs']['type'] == 'package-info') { if (in_array( $xml['attribs']['to'], array('name', 'summary', 'channel', 'notes', 'extends', 'description', 'release_notes', 'license', 'release-license', 'license-uri', 'version', 'api-version', 'state', 'api-state', 'release_date', 'date', 'time', ) )) { return true; } else { return array(PEAR_TASK_ERROR_WRONG_ATTRIB_VALUE, 'to', $xml['attribs']['to'], array('name', 'summary', 'channel', 'notes', 'extends', 'description', 'release_notes', 'license', 'release-license', 'license-uri', 'version', 'api-version', 'state', 'api-state', 'release_date', 'date', 'time', ), ); } } else { return array(PEAR_TASK_ERROR_WRONG_ATTRIB_VALUE, 'type', $xml['attribs']['type'], array('pear-config', 'package-info', 'php-const'), ); } return true; } /** * Initialize a task instance with the parameters * @param array raw, parsed xml * @param unused * @param unused */ public function init($xml, $attribs, $lastVersion = null) { $this->_replacements = isset($xml['attribs']) ? array($xml) : $xml; } /** * Do a package.xml 1.0 replacement, with additional package-info fields available * * See validateXml() source for the complete list of allowed fields * * @param PEAR_PackageFile_v1|PEAR_PackageFile_v2 * @param string file contents * @param string the eventual final file location (informational only) * @return string|false|PEAR_Error false to skip this file, PEAR_Error to fail * (use $this->throwError), otherwise return the new contents */ public function startSession($pkg, $contents, $dest) { $subst_from = $subst_to = array(); foreach ($this->_replacements as $a) { $a = $a['attribs']; $to = ''; if ($a['type'] == 'pear-config') { if ($this->installphase == PEAR_TASK_PACKAGE) { return false; } if ($a['to'] == 'master_server') { $chan = $this->registry->getChannel($pkg->getChannel()); if (!PEAR::isError($chan)) { $to = $chan->getServer(); } else { $this->logger->log(0, "$dest: invalid pear-config replacement: $a[to]"); return false; } } else { if ($this->config->isDefinedLayer('ftp')) { // try the remote config file first $to = $this->config->get($a['to'], 'ftp', $pkg->getChannel()); if (is_null($to)) { // then default to local $to = $this->config->get($a['to'], null, $pkg->getChannel()); } } else { $to = $this->config->get($a['to'], null, $pkg->getChannel()); } } if (is_null($to)) { $this->logger->log(0, "$dest: invalid pear-config replacement: $a[to]"); return false; } } elseif ($a['type'] == 'php-const') { if ($this->installphase == PEAR_TASK_PACKAGE) { return false; } if (defined($a['to'])) { $to = constant($a['to']); } else { $this->logger->log(0, "$dest: invalid php-const replacement: $a[to]"); return false; } } else { if ($t = $pkg->packageInfo($a['to'])) { $to = $t; } else { $this->logger->log(0, "$dest: invalid package-info replacement: $a[to]"); return false; } } if (!is_null($to)) { $subst_from[] = $a['from']; $subst_to[] = $to; } } $this->logger->log( 3, "doing ".sizeof($subst_from). " substitution(s) for $dest" ); if (sizeof($subst_from)) { $contents = str_replace($subst_from, $subst_to, $contents); } return $contents; } } php-pear-1.10.1+submodules+notgz/PEAR/Task/Replace/000077500000000000000000000000001262614675700216455ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/PEAR/Task/Replace/rw.php000066400000000000000000000030411262614675700230040ustar00rootroot00000000000000 - read/write version * * PHP versions 4 and 5 * * @category pear * @package PEAR * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a10 */ /** * Base class */ require_once 'PEAR/Task/Replace.php'; /** * Abstracts the replace task xml. * @category pear * @package PEAR * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version Release: @package_version@ * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a10 */ class PEAR_Task_Replace_rw extends PEAR_Task_Replace { public function __construct(&$pkg, &$config, &$logger, $fileXml) { parent::__construct($config, $logger, PEAR_TASK_PACKAGE); $this->_contents = $fileXml; $this->_pkg = &$pkg; $this->_params = array(); } public function validate() { return $this->validateXml($this->_pkg, $this->_params, $this->config, $this->_contents); } public function setInfo($from, $to, $type) { $this->_params = array('attribs' => array('from' => $from, 'to' => $to, 'type' => $type)); } public function getName() { return 'replace'; } public function getXml() { return $this->_params; } } php-pear-1.10.1+submodules+notgz/PEAR/Task/Unixeol.php000066400000000000000000000044111262614675700224260ustar00rootroot00000000000000 * * PHP versions 4 and 5 * * @category pear * @package PEAR * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ /** * Base class */ require_once 'PEAR/Task/Common.php'; /** * Implements the unix line endings file task. * @category pear * @package PEAR * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version Release: @package_version@ * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ class PEAR_Task_Unixeol extends PEAR_Task_Common { public $type = 'simple'; public $phase = PEAR_TASK_PACKAGE; public $_replacements; /** * Validate the raw xml at parsing-time. * * @param PEAR_PackageFile_v2 * @param array raw, parsed xml * @param PEAR_Config */ public static function validateXml($pkg, $xml, $config, $fileXml) { if ($xml != '') { return array(PEAR_TASK_ERROR_INVALID, 'no attributes allowed'); } return true; } /** * Initialize a task instance with the parameters * @param array raw, parsed xml * @param unused * @param unused */ public function init($xml, $attribs, $lastVersion = null) { } /** * Replace all line endings with line endings customized for the current OS * * See validateXml() source for the complete list of allowed fields * * @param PEAR_PackageFile_v1|PEAR_PackageFile_v2 * @param string file contents * @param string the eventual final file location (informational only) * @return string|false|PEAR_Error false to skip this file, PEAR_Error to fail * (use $this->throwError), otherwise return the new contents */ public function startSession($pkg, $contents, $dest) { $this->logger->log(3, "replacing all line endings with \\n in $dest"); return preg_replace("/\r\n|\n\r|\r|\n/", "\n", $contents); } } php-pear-1.10.1+submodules+notgz/PEAR/Task/Unixeol/000077500000000000000000000000001262614675700217155ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/PEAR/Task/Unixeol/rw.php000066400000000000000000000024461262614675700230640ustar00rootroot00000000000000 - read/write version * * PHP versions 4 and 5 * * @category pear * @package PEAR * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a10 */ /** * Base class */ require_once 'PEAR/Task/Unixeol.php'; /** * Abstracts the unixeol task xml. * @category pear * @package PEAR * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version Release: @package_version@ * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a10 */ class PEAR_Task_Unixeol_rw extends PEAR_Task_Unixeol { function __construct(&$pkg, &$config, &$logger, $fileXml) { parent::__construct($config, $logger, PEAR_TASK_PACKAGE); $this->_contents = $fileXml; $this->_pkg = &$pkg; $this->_params = array(); } public function validate() { return true; } public function getName() { return 'unixeol'; } public function getXml() { return ''; } } ?> php-pear-1.10.1+submodules+notgz/PEAR/Task/Windowseol.php000066400000000000000000000043751262614675700231460ustar00rootroot00000000000000 * * PHP versions 4 and 5 * * @category pear * @package PEAR * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ /** * Base class */ require_once 'PEAR/Task/Common.php'; /** * Implements the windows line endsings file task. * * @category pear * @package PEAR * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version Release: @package_version@ * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ class PEAR_Task_Windowseol extends PEAR_Task_Common { public $type = 'simple'; public $phase = PEAR_TASK_PACKAGE; public $_replacements; /** * Validate the raw xml at parsing-time. * * @param PEAR_PackageFile_v2 * @param array raw, parsed xml * @param PEAR_Config */ public static function validateXml($pkg, $xml, $config, $fileXml) { if ($xml != '') { return array(PEAR_TASK_ERROR_INVALID, 'no attributes allowed'); } return true; } /** * Initialize a task instance with the parameters * @param array raw, parsed xml * @param unused * @param unused */ public function init($xml, $attribs, $lastVersion = null) { } /** * Replace all line endings with windows line endings * * See validateXml() source for the complete list of allowed fields * * @param PEAR_PackageFile_v1|PEAR_PackageFile_v2 * @param string file contents * @param string the eventual final file location (informational only) * @return string|false|PEAR_Error false to skip this file, PEAR_Error to fail * (use $this->throwError), otherwise return the new contents */ public function startSession($pkg, $contents, $dest) { $this->logger->log(3, "replacing all line endings with \\r\\n in $dest"); return preg_replace("/\r\n|\n\r|\r|\n/", "\r\n", $contents); } } php-pear-1.10.1+submodules+notgz/PEAR/Task/Windowseol/000077500000000000000000000000001262614675700224245ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/PEAR/Task/Windowseol/rw.php000066400000000000000000000024631262614675700235720ustar00rootroot00000000000000 - read/write version * * PHP versions 4 and 5 * * @category pear * @package PEAR * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a10 */ /** * Base class */ require_once 'PEAR/Task/Windowseol.php'; /** * Abstracts the windowseol task xml. * * @category pear * @package PEAR * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version Release: @package_version@ * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a10 */ class PEAR_Task_Windowseol_rw extends PEAR_Task_Windowseol { function __construct(&$pkg, &$config, &$logger, $fileXml) { parent::__construct($config, $logger, PEAR_TASK_PACKAGE); $this->_contents = $fileXml; $this->_pkg = &$pkg; $this->_params = array(); } public function validate() { return true; } public function getName() { return 'windowseol'; } public function getXml() { return ''; } } ?> php-pear-1.10.1+submodules+notgz/PEAR/Validate.php000066400000000000000000000527771262614675700216540ustar00rootroot00000000000000 * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ /**#@+ * Constants for install stage */ define('PEAR_VALIDATE_INSTALLING', 1); define('PEAR_VALIDATE_UNINSTALLING', 2); // this is not bit-mapped like the others define('PEAR_VALIDATE_NORMAL', 3); define('PEAR_VALIDATE_DOWNLOADING', 4); // this is not bit-mapped like the others define('PEAR_VALIDATE_PACKAGING', 7); /**#@-*/ require_once 'PEAR/Common.php'; require_once 'PEAR/Validator/PECL.php'; /** * Validation class for package.xml - channel-level advanced validation * @category pear * @package PEAR * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version Release: @package_version@ * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ class PEAR_Validate { var $packageregex = _PEAR_COMMON_PACKAGE_NAME_PREG; /** * @var PEAR_PackageFile_v1|PEAR_PackageFile_v2 */ var $_packagexml; /** * @var int one of the PEAR_VALIDATE_* constants */ var $_state = PEAR_VALIDATE_NORMAL; /** * Format: ('error' => array('field' => name, 'reason' => reason), 'warning' => same) * @var array * @access private */ var $_failures = array('error' => array(), 'warning' => array()); /** * Override this method to handle validation of normal package names * @param string * @return bool * @access protected */ function _validPackageName($name) { return (bool) preg_match('/^' . $this->packageregex . '\\z/', $name); } /** * @param string package name to validate * @param string name of channel-specific validation package * @final */ function validPackageName($name, $validatepackagename = false) { if ($validatepackagename) { if (strtolower($name) == strtolower($validatepackagename)) { return (bool) preg_match('/^[a-zA-Z0-9_]+(?:\.[a-zA-Z0-9_]+)*\\z/', $name); } } return $this->_validPackageName($name); } /** * This validates a bundle name, and bundle names must conform * to the PEAR naming convention, so the method is final and static. * @param string * @final */ public static function validGroupName($name) { return (bool) preg_match('/^' . _PEAR_COMMON_PACKAGE_NAME_PREG . '\\z/', $name); } /** * Determine whether $state represents a valid stability level * @param string * @return bool * @final */ public static function validState($state) { return in_array($state, array('snapshot', 'devel', 'alpha', 'beta', 'stable')); } /** * Get a list of valid stability levels * @return array * @final */ public static function getValidStates() { return array('snapshot', 'devel', 'alpha', 'beta', 'stable'); } /** * Determine whether a version is a properly formatted version number that can be used * by version_compare * @param string * @return bool * @final */ public static function validVersion($ver) { return (bool) preg_match(PEAR_COMMON_PACKAGE_VERSION_PREG, $ver); } /** * @param PEAR_PackageFile_v1|PEAR_PackageFile_v2 */ function setPackageFile(&$pf) { $this->_packagexml = &$pf; } /** * @access private */ function _addFailure($field, $reason) { $this->_failures['errors'][] = array('field' => $field, 'reason' => $reason); } /** * @access private */ function _addWarning($field, $reason) { $this->_failures['warnings'][] = array('field' => $field, 'reason' => $reason); } function getFailures() { $failures = $this->_failures; $this->_failures = array('warnings' => array(), 'errors' => array()); return $failures; } /** * @param int one of the PEAR_VALIDATE_* constants */ function validate($state = null) { if (!isset($this->_packagexml)) { return false; } if ($state !== null) { $this->_state = $state; } $this->_failures = array('warnings' => array(), 'errors' => array()); $this->validatePackageName(); $this->validateVersion(); $this->validateMaintainers(); $this->validateDate(); $this->validateSummary(); $this->validateDescription(); $this->validateLicense(); $this->validateNotes(); if ($this->_packagexml->getPackagexmlVersion() == '1.0') { $this->validateState(); $this->validateFilelist(); } elseif ($this->_packagexml->getPackagexmlVersion() == '2.0' || $this->_packagexml->getPackagexmlVersion() == '2.1') { $this->validateTime(); $this->validateStability(); $this->validateDeps(); $this->validateMainFilelist(); $this->validateReleaseFilelist(); //$this->validateGlobalTasks(); $this->validateChangelog(); } return !((bool) count($this->_failures['errors'])); } /** * @access protected */ function validatePackageName() { if ($this->_state == PEAR_VALIDATE_PACKAGING || $this->_state == PEAR_VALIDATE_NORMAL) { if (($this->_packagexml->getPackagexmlVersion() == '2.0' || $this->_packagexml->getPackagexmlVersion() == '2.1') && $this->_packagexml->getExtends()) { $version = $this->_packagexml->getVersion() . ''; $name = $this->_packagexml->getPackage(); $a = explode('.', $version); $test = array_shift($a); if ($test == '0') { return true; } $vlen = strlen($test); $majver = substr($name, strlen($name) - $vlen); while ($majver && !is_numeric($majver{0})) { $majver = substr($majver, 1); } if ($majver != $test) { $this->_addWarning('package', "package $name extends package " . $this->_packagexml->getExtends() . ' and so the name should ' . 'have a postfix equal to the major version like "' . $this->_packagexml->getExtends() . $test . '"'); return true; } elseif (substr($name, 0, strlen($name) - $vlen) != $this->_packagexml->getExtends()) { $this->_addWarning('package', "package $name extends package " . $this->_packagexml->getExtends() . ' and so the name must ' . 'be an extension like "' . $this->_packagexml->getExtends() . $test . '"'); return true; } } } if (!$this->validPackageName($this->_packagexml->getPackage())) { $this->_addFailure('name', 'package name "' . $this->_packagexml->getPackage() . '" is invalid'); return false; } } /** * @access protected */ function validateVersion() { if ($this->_state != PEAR_VALIDATE_PACKAGING) { if (!$this->validVersion($this->_packagexml->getVersion())) { $this->_addFailure('version', 'Invalid version number "' . $this->_packagexml->getVersion() . '"'); } return false; } $version = $this->_packagexml->getVersion(); $versioncomponents = explode('.', $version); if (count($versioncomponents) != 3) { $this->_addWarning('version', 'A version number should have 3 decimals (x.y.z)'); return true; } $name = $this->_packagexml->getPackage(); // version must be based upon state switch ($this->_packagexml->getState()) { case 'snapshot' : return true; case 'devel' : if ($versioncomponents[0] . 'a' == '0a') { return true; } if ($versioncomponents[0] == 0) { $versioncomponents[0] = '0'; $this->_addWarning('version', 'version "' . $version . '" should be "' . implode('.' ,$versioncomponents) . '"'); } else { $this->_addWarning('version', 'packages with devel stability must be < version 1.0.0'); } return true; break; case 'alpha' : case 'beta' : // check for a package that extends a package, // like Foo and Foo2 if ($this->_state == PEAR_VALIDATE_PACKAGING) { if (substr($versioncomponents[2], 1, 2) == 'rc') { $this->_addFailure('version', 'Release Candidate versions ' . 'must have capital RC, not lower-case rc'); return false; } } if (!$this->_packagexml->getExtends()) { if ($versioncomponents[0] == '1') { if ($versioncomponents[2]{0} == '0') { if ($versioncomponents[2] == '0') { // version 1.*.0000 $this->_addWarning('version', 'version 1.' . $versioncomponents[1] . '.0 probably should not be alpha or beta'); return true; } elseif (strlen($versioncomponents[2]) > 1) { // version 1.*.0RC1 or 1.*.0beta24 etc. return true; } else { // version 1.*.0 $this->_addWarning('version', 'version 1.' . $versioncomponents[1] . '.0 probably should not be alpha or beta'); return true; } } else { $this->_addWarning('version', 'bugfix versions (1.3.x where x > 0) probably should ' . 'not be alpha or beta'); return true; } } elseif ($versioncomponents[0] != '0') { $this->_addWarning('version', 'major versions greater than 1 are not allowed for packages ' . 'without an tag or an identical postfix (foo2 v2.0.0)'); return true; } if ($versioncomponents[0] . 'a' == '0a') { return true; } if ($versioncomponents[0] == 0) { $versioncomponents[0] = '0'; $this->_addWarning('version', 'version "' . $version . '" should be "' . implode('.' ,$versioncomponents) . '"'); } } else { $vlen = strlen($versioncomponents[0] . ''); $majver = substr($name, strlen($name) - $vlen); while ($majver && !is_numeric($majver{0})) { $majver = substr($majver, 1); } if (($versioncomponents[0] != 0) && $majver != $versioncomponents[0]) { $this->_addWarning('version', 'first version number "' . $versioncomponents[0] . '" must match the postfix of ' . 'package name "' . $name . '" (' . $majver . ')'); return true; } if ($versioncomponents[0] == $majver) { if ($versioncomponents[2]{0} == '0') { if ($versioncomponents[2] == '0') { // version 2.*.0000 $this->_addWarning('version', "version $majver." . $versioncomponents[1] . '.0 probably should not be alpha or beta'); return false; } elseif (strlen($versioncomponents[2]) > 1) { // version 2.*.0RC1 or 2.*.0beta24 etc. return true; } else { // version 2.*.0 $this->_addWarning('version', "version $majver." . $versioncomponents[1] . '.0 cannot be alpha or beta'); return true; } } else { $this->_addWarning('version', "bugfix versions ($majver.x.y where y > 0) should " . 'not be alpha or beta'); return true; } } elseif ($versioncomponents[0] != '0') { $this->_addWarning('version', "only versions 0.x.y and $majver.x.y are allowed for alpha/beta releases"); return true; } if ($versioncomponents[0] . 'a' == '0a') { return true; } if ($versioncomponents[0] == 0) { $versioncomponents[0] = '0'; $this->_addWarning('version', 'version "' . $version . '" should be "' . implode('.' ,$versioncomponents) . '"'); } } return true; break; case 'stable' : if ($versioncomponents[0] == '0') { $this->_addWarning('version', 'versions less than 1.0.0 cannot ' . 'be stable'); return true; } if (!is_numeric($versioncomponents[2])) { if (preg_match('/\d+(rc|a|alpha|b|beta)\d*/i', $versioncomponents[2])) { $this->_addWarning('version', 'version "' . $version . '" or any ' . 'RC/beta/alpha version cannot be stable'); return true; } } // check for a package that extends a package, // like Foo and Foo2 if ($this->_packagexml->getExtends()) { $vlen = strlen($versioncomponents[0] . ''); $majver = substr($name, strlen($name) - $vlen); while ($majver && !is_numeric($majver{0})) { $majver = substr($majver, 1); } if (($versioncomponents[0] != 0) && $majver != $versioncomponents[0]) { $this->_addWarning('version', 'first version number "' . $versioncomponents[0] . '" must match the postfix of ' . 'package name "' . $name . '" (' . $majver . ')'); return true; } } elseif ($versioncomponents[0] > 1) { $this->_addWarning('version', 'major version x in x.y.z may not be greater than ' . '1 for any package that does not have an tag'); } return true; break; default : return false; break; } } /** * @access protected */ function validateMaintainers() { // maintainers can only be truly validated server-side for most channels // but allow this customization for those who wish it return true; } /** * @access protected */ function validateDate() { if ($this->_state == PEAR_VALIDATE_NORMAL || $this->_state == PEAR_VALIDATE_PACKAGING) { if (!preg_match('/(\d\d\d\d)\-(\d\d)\-(\d\d)/', $this->_packagexml->getDate(), $res) || count($res) < 4 || !checkdate($res[2], $res[3], $res[1]) ) { $this->_addFailure('date', 'invalid release date "' . $this->_packagexml->getDate() . '"'); return false; } if ($this->_state == PEAR_VALIDATE_PACKAGING && $this->_packagexml->getDate() != date('Y-m-d')) { $this->_addWarning('date', 'Release Date "' . $this->_packagexml->getDate() . '" is not today'); } } return true; } /** * @access protected */ function validateTime() { if (!$this->_packagexml->getTime()) { // default of no time value set return true; } // packager automatically sets time, so only validate if pear validate is called if ($this->_state = PEAR_VALIDATE_NORMAL) { if (!preg_match('/\d\d:\d\d:\d\d/', $this->_packagexml->getTime())) { $this->_addFailure('time', 'invalid release time "' . $this->_packagexml->getTime() . '"'); return false; } $result = preg_match('|\d{2}\:\d{2}\:\d{2}|', $this->_packagexml->getTime(), $matches); if ($result === false || empty($matches)) { $this->_addFailure('time', 'invalid release time "' . $this->_packagexml->getTime() . '"'); return false; } } return true; } /** * @access protected */ function validateState() { // this is the closest to "final" php4 can get if (!PEAR_Validate::validState($this->_packagexml->getState())) { if (strtolower($this->_packagexml->getState() == 'rc')) { $this->_addFailure('state', 'RC is not a state, it is a version ' . 'postfix, use ' . $this->_packagexml->getVersion() . 'RC1, state beta'); } $this->_addFailure('state', 'invalid release state "' . $this->_packagexml->getState() . '", must be one of: ' . implode(', ', PEAR_Validate::getValidStates())); return false; } return true; } /** * @access protected */ function validateStability() { $ret = true; $packagestability = $this->_packagexml->getState(); $apistability = $this->_packagexml->getState('api'); if (!PEAR_Validate::validState($packagestability)) { $this->_addFailure('state', 'invalid release stability "' . $this->_packagexml->getState() . '", must be one of: ' . implode(', ', PEAR_Validate::getValidStates())); $ret = false; } $apistates = PEAR_Validate::getValidStates(); array_shift($apistates); // snapshot is not allowed if (!in_array($apistability, $apistates)) { $this->_addFailure('state', 'invalid API stability "' . $this->_packagexml->getState('api') . '", must be one of: ' . implode(', ', $apistates)); $ret = false; } return $ret; } /** * @access protected */ function validateSummary() { return true; } /** * @access protected */ function validateDescription() { return true; } /** * @access protected */ function validateLicense() { return true; } /** * @access protected */ function validateNotes() { return true; } /** * for package.xml 2.0 only - channels can't use package.xml 1.0 * @access protected */ function validateDependencies() { return true; } /** * for package.xml 1.0 only * @access private */ function _validateFilelist() { return true; // placeholder for now } /** * for package.xml 2.0 only * @access protected */ function validateMainFilelist() { return true; // placeholder for now } /** * for package.xml 2.0 only * @access protected */ function validateReleaseFilelist() { return true; // placeholder for now } /** * @access protected */ function validateChangelog() { return true; } /** * @access protected */ function validateFilelist() { return true; } /** * @access protected */ function validateDeps() { return true; } }php-pear-1.10.1+submodules+notgz/PEAR/Validator/000077500000000000000000000000001262614675700213155ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/PEAR/Validator/PECL.php000066400000000000000000000041031262614675700225470ustar00rootroot00000000000000 * @copyright 1997-2006 The PHP Group * @license http://opensource.org/licenses/bsd-license.php New BSD License * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a5 */ /** * This is the parent class for all validators */ require_once 'PEAR/Validate.php'; /** * Channel Validator for the pecl.php.net channel * @category pear * @package PEAR * @author Greg Beaver * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version Release: @package_version@ * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a5 */ class PEAR_Validator_PECL extends PEAR_Validate { function validateVersion() { if ($this->_state == PEAR_VALIDATE_PACKAGING) { $version = $this->_packagexml->getVersion(); $versioncomponents = explode('.', $version); $last = array_pop($versioncomponents); if (substr($last, 1, 2) == 'rc') { $this->_addFailure('version', 'Release Candidate versions must have ' . 'upper-case RC, not lower-case rc'); return false; } } return true; } function validatePackageName() { $ret = parent::validatePackageName(); if ($this->_packagexml->getPackageType() == 'extsrc' || $this->_packagexml->getPackageType() == 'zendextsrc') { if (strtolower($this->_packagexml->getPackage()) != strtolower($this->_packagexml->getProvidesExtension())) { $this->_addWarning('providesextension', 'package name "' . $this->_packagexml->getPackage() . '" is different from extension name "' . $this->_packagexml->getProvidesExtension() . '"'); } } return $ret; } } ?>php-pear-1.10.1+submodules+notgz/PEAR/Warning.php000066400000000000000000000305451262614675700215150ustar00rootroot00000000000000 | // +----------------------------------------------------------------------+ // require_once 'PEAR/Exception.php'; /** * Exception class for internal PEAR_Warning exceptions * @package PEAR */ class PEAR_WarningException extends PEAR_Exception {} interface PEAR_WarningInterface { /** * Get the severity of this warning ('warning', 'notice') * @return string */ public function getLevel(); } /** * Warning mechanism for PEAR PHP5-only packages. * * For users: * * Unlike PEAR_ErrorStack, PEAR_Warning is designed to be used on a transactional basis. * * * doSomethingComplex(); * if (PEAR_Warning::hasWarnings()) { * $warnings = PEAR_Warning::end(); * throw new Mypackage_Exception('unclean doSomethingComplex', $warnings); * } else { * $c->doSomethingElse(); * } * ?> * * * Only warnings that occur between ::begin() and ::end() will be processed. Remember, * a warning is a non-fatal error, exceptions will be used for unrecoverable errors in * all PEAR packages, and you should follow this model to be safe! * * For developers: * * This class can be used globally or locally. For global use, a * series of static methods have been provided. The class is designed * for lazy loading, and so the following code will work, and increase * efficiency on production servers: * * * * * * This means that PEAR_Warning can literally be used without the need for * require_once 'PEAR/Warning.php';! * * You can also pass in an exception class as a warning * * * * * * An interface is provided to allow for severity differentiation * * * _level = $level; * parent::__construct($message, $p1, $p2); * } * * public function getLevel() * { * return $this->_level; * } * } * PEAR_Warning::add(new MyPackage_Warning('some info', 'notice')); * ?> * * * This can be used with {@link setErrorHandling()} to ignore warnings of different severities * for complex error situations. * * For local situations like an internal warning system for a parser that may become the cause * of a single PEAR_Exception, PEAR_Warning can also be instantiated and used without any connection * to the global warning stack. * @package PEAR */ class PEAR_Warning { /** * properties used for global warning stacks */ protected static $_hasWarnings = false; protected static $warnings = array(); protected static $go = false; protected static $levels = array('warning', 'notice'); private static $_observers = array(); private static $_uniqueid = 0; /** * properties used for instantiation of private warning stack */ private $_warnings = array(); private $_go = false; private $_context; /** * Begin tracking all global warnings */ static public function begin() { if (class_exists('PEAR_ErrorStack')) { PEAR_ErrorStack::setPEARWarningCallback(array('PEAR_Warning', '_catch')); } self::$go = true; self::$_hasWarnings = false; } /** * @return bool */ static public function hasWarnings() { return self::$_hasWarnings; } /** * Stop tracking global warnings * @return array an array of all warnings in array and PEAR_Exception format * suitable for use as a PEAR_Exception cause */ static public function end() { if (class_exists('PEAR_ErrorStack')) { PEAR_ErrorStack::setPEARWarningCallback(false); } self::$go = false; self::$_hasWarnings = false; $a = self::$warnings; self::$warnings = array(); return $a; } /** * @param mixed A valid callback that accepts either a * PEAR_Exception or PEAR_ErrorStack-style array * @param string The name of the observer. Use this if you want * to remove it later with removeObserver(). * {@link getUniqueId()} can be used to generate a label */ public static function addObserver($callback, $label = 'default') { self::$_observers[$label] = $callback; } /** * @param mixed observer ID */ public static function removeObserver($label = 'default') { unset(self::$_observers[$label]); } /** * @return int unique identifier for an observer */ public static function getUniqueId() { return self::$_uniqueid++; } /** * Set the warning levels that should be captured by the warning mechanism * * WARNING: no error checking or spell checking. * @param array */ public static function setErrorHandling($levels) { self::$_levels = $levels; } /** * Add a warning to the global warning stack. * * Note: if you want file/line context, use an exception object * @param PEAR_Exception|string|int Either pass in an exception to use as the warning, or an * error code or some other error class differentiation technique * @param string Package is required if $codeOrException is not a PEAR_Exception object * @param string Error message, use %param% to do automatic parameter replacement from $params * @param array Error parameters * @param string Error level, use the English name * @throws PEAR_WarningException if $codeOrException is not a PEAR_Exception and $package is not set */ static public function add($codeOrException, $package = '', $msg = '', $params = array(), $level = 'warning') { if ($codeOrException instanceof PEAR_Exception) { if ($codeOrException instanceof PEAR_WarningInterface) { if (in_array($codeOrException->getLevel(), self::$levels)) { self::_signal($codeOrException); } } else { self::_signal($codeOrException); } } else { if (empty($package)) { throw new PEAR_WarningException('Package must be set for a non-exception warning'); } if (in_array($level, self::$levels)) { $warning = self::_formatWarning($codeOrException, $package, $level, $msg, $params); self::_signal($warning); } } if (self::$go) { self::$_hasWarnings = true; self::$warnings[] = $warning; } } /** * @param string the package name, or other context information that can be used * to differentiate this warning from warnings thrown by other packages * @throws PEAR_WarningException if $context is not a string */ public function __construct($context) { if (!is_string($context)) { throw new PEAR_WarningException('$context constructor argument must be a string'); } $this->_context = $context; } /** * Local stack function for adding a warning - note that package is not needed, as it is * defined in the constructor. * * Note: if you want file/line context, use an exception object * @param PEAR_Exception|string|int Either pass in an exception to use as the warning, or an * error code or some other error class differentiation technique * @param string Error message, use %param% to do automatic parameter replacement from $params * @param array Error parameters * @param string Error level, use the English name */ public function localAdd($code, $msg = '', $params = array(), $level = 'warning') { if ($codeOrException instanceof PEAR_Exception) { $this->_warnings[] = $codeOrException; } else { $warning = self::_formatWarning($codeOrException, $this->_context, $level, $msg); $this->_warnings[] = $warning; } } /** * Begin a local warning stack session */ public function localBegin() { $this->_warnings = array(); $this->_go = true; } /** * End a local warning stack session * @return array */ public function localEnd() { $a = $this->_warnings; $this->_warnings = array(); $this->_go = false; return $a; } /** * Do not use this function directly - it should only be used by PEAR_ErrorStack * @access private */ static public function _catch($err) { self::_signal($err); } private static function _signal($warning) { foreach (self::$_observers as $func) { if (is_callable($func)) { call_user_func($func, $this); continue; } settype($func, 'array'); switch ($func[0]) { case PEAR_EXCEPTION_PRINT : $f = (isset($func[1])) ? $func[1] : '%s'; printf($f, $this->getMessage()); break; case PEAR_EXCEPTION_TRIGGER : $f = (isset($func[1])) ? $func[1] : E_USER_NOTICE; trigger_error($this->getMessage(), $f); break; case PEAR_EXCEPTION_DIE : $f = (isset($func[1])) ? $func[1] : '%s'; die(printf($f, $this->getMessage())); break; default: trigger_error('invalid observer type', E_USER_WARNING); } } } static private function _formatWarning($code, $package, $level, $msg, $params, $backtrace) { return array('package' => $package, 'code' => $code, 'level' => $level, 'message' => self::_formatMessage($msg, $params), 'params' => $params); } static private function _formatMessage($msg, $params) { if (count($params)) { foreach ($params as $name => $val) { if (strpos($msg, '%' . $name . '%') !== false) { if (is_array($val)) { // don't pass in an array that you expect to display unless it is 1-dimensional! $val = implode(', ', $val); } if (is_object($val)) { if (method_exists($val, '__toString')) { $val = $val->__toString(); } else { $val = 'Object'; } } $msg = str_replace('%' . $name . '%', $val, $msg); } } } return $msg; } } ?>php-pear-1.10.1+submodules+notgz/PEAR/XMLParser.php000066400000000000000000000154111262614675700217200ustar00rootroot00000000000000 * @author Stephan Schmidt (original XML_Unserializer code) * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license New BSD License * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ /** * Parser for any xml file * @category pear * @package PEAR * @author Greg Beaver * @author Stephan Schmidt (original XML_Unserializer code) * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license New BSD License * @version Release: @package_version@ * @link http://pear.php.net/package/PEAR * @since Class available since Release 1.4.0a1 */ class PEAR_XMLParser { /** * unserilialized data * @var string $_serializedData */ var $_unserializedData = null; /** * name of the root tag * @var string $_root */ var $_root = null; /** * stack for all data that is found * @var array $_dataStack */ var $_dataStack = array(); /** * stack for all values that are generated * @var array $_valStack */ var $_valStack = array(); /** * current tag depth * @var int $_depth */ var $_depth = 0; /** * The XML encoding to use * @var string $encoding */ var $encoding = 'ISO-8859-1'; /** * @return array */ function getData() { return $this->_unserializedData; } /** * @param string xml content * @return true|PEAR_Error */ function parse($data) { if (!extension_loaded('xml')) { include_once 'PEAR.php'; return PEAR::raiseError("XML Extension not found", 1); } $this->_dataStack = $this->_valStack = array(); $this->_depth = 0; if ( strpos($data, 'encoding="UTF-8"') || strpos($data, 'encoding="utf-8"') || strpos($data, "encoding='UTF-8'") || strpos($data, "encoding='utf-8'") ) { $this->encoding = 'UTF-8'; } $xp = xml_parser_create($this->encoding); xml_parser_set_option($xp, XML_OPTION_CASE_FOLDING, 0); xml_set_object($xp, $this); xml_set_element_handler($xp, 'startHandler', 'endHandler'); xml_set_character_data_handler($xp, 'cdataHandler'); if (!xml_parse($xp, $data)) { $msg = xml_error_string(xml_get_error_code($xp)); $line = xml_get_current_line_number($xp); xml_parser_free($xp); include_once 'PEAR.php'; return PEAR::raiseError("XML Error: '$msg' on line '$line'", 2); } xml_parser_free($xp); return true; } /** * Start element handler for XML parser * * @access private * @param object $parser XML parser object * @param string $element XML element * @param array $attribs attributes of XML tag * @return void */ function startHandler($parser, $element, $attribs) { $this->_depth++; $this->_dataStack[$this->_depth] = null; $val = array( 'name' => $element, 'value' => null, 'type' => 'string', 'childrenKeys' => array(), 'aggregKeys' => array() ); if (count($attribs) > 0) { $val['children'] = array(); $val['type'] = 'array'; $val['children']['attribs'] = $attribs; } array_push($this->_valStack, $val); } /** * post-process data * * @param string $data * @param string $element element name */ function postProcess($data, $element) { return trim($data); } /** * End element handler for XML parser * * @access private * @param object XML parser object * @param string * @return void */ function endHandler($parser, $element) { $value = array_pop($this->_valStack); $data = $this->postProcess($this->_dataStack[$this->_depth], $element); // adjust type of the value switch (strtolower($value['type'])) { // unserialize an array case 'array': if ($data !== '') { $value['children']['_content'] = $data; } $value['value'] = isset($value['children']) ? $value['children'] : array(); break; /* * unserialize a null value */ case 'null': $data = null; break; /* * unserialize any scalar value */ default: settype($data, $value['type']); $value['value'] = $data; break; } $parent = array_pop($this->_valStack); if ($parent === null) { $this->_unserializedData = &$value['value']; $this->_root = &$value['name']; return true; } // parent has to be an array if (!isset($parent['children']) || !is_array($parent['children'])) { $parent['children'] = array(); if ($parent['type'] != 'array') { $parent['type'] = 'array'; } } if (!empty($value['name'])) { // there already has been a tag with this name if (in_array($value['name'], $parent['childrenKeys'])) { // no aggregate has been created for this tag if (!in_array($value['name'], $parent['aggregKeys'])) { if (isset($parent['children'][$value['name']])) { $parent['children'][$value['name']] = array($parent['children'][$value['name']]); } else { $parent['children'][$value['name']] = array(); } array_push($parent['aggregKeys'], $value['name']); } array_push($parent['children'][$value['name']], $value['value']); } else { $parent['children'][$value['name']] = &$value['value']; array_push($parent['childrenKeys'], $value['name']); } } else { array_push($parent['children'],$value['value']); } array_push($this->_valStack, $parent); $this->_depth--; } /** * Handler for character data * * @access private * @param object XML parser object * @param string CDATA * @return void */ function cdataHandler($parser, $cdata) { $this->_dataStack[$this->_depth] .= $cdata; } }php-pear-1.10.1+submodules+notgz/README.CONTRIBUTING000066400000000000000000000265561262614675700214450ustar00rootroot00000000000000$Id$ ==CONTRIBUTING GUIDE FOR PEAR CORE DEVELOPERS== Author: Gregory Beaver INTRODUCTION ------------ Thank you for assisting in development of the premiere PHP installer! Over the years, certain protocols have developed for handling releases, documenting changes to the code, and coordinating efforts with the PHP core development team. This document attempts to explain what it means to be a maintainer of the PEAR package, and how to properly do maintenance. This document assumes two things: 1) you have already applied for a CVS account at http://www.php.net/cvs-php.php 2) you have already applied for a PEAR account at http://pear.php.net/account-request.php Fear not! PEAR is slowly but surely evolving, and this document will hopefully only become smaller and simpler as this takes place. Keep your fingers crossed! Table of Contents ----------------- 1. Fixing bugs/Adding features 2. Writing regression tests 3. Releasing PEAR 4. synchronizing PEAR with the PHP release (PHP >= 5.1.0) 5. http://pear.php.net/go-pear and testing 6. pear.php.net and rest 1. FIXING BUGS/ADDING FEATURES ------------------------------ In most cases, bugs or features are opened at the official bug tracker located at: http://pear.php.net/package/PEAR/bugs When you fix a bug, or implement feature requested, please follow this checklist: 1) assign the bug to yourself in the bug tracker 2) write a .phpt-based regression test that verifies the bug, or tests the new feature. The test should be written prior to any code changes, and should attempt to work properly, but fail due to the bug in PEAR or non-existing feature. Please name the test after the bug tracker number to make it easier to find. If you fix bug #12345 name the test "bug12345.phpt." If the bug was in the PEAR_Installer class, please save it in pear-core/tests/PEAR_Installer/bug12345.phpt 3) fix the bug, or add the new feature. 4) upgrade your local PEAR installation via "pear upgrade -f package2.xml" 5) do a few simple tests to see if you have fixed the bug. This should include running the regression test that you wrote. If the test is named bug12345.phpt, use "pear run-tests tests/PEAR_Installer/bug12345.phpt" from the pear-core directory 6) if the code did not fix the problem, go back to step 3 :) 7) run the remaining regression tests to ensure that you did not break existing features with your bugfix/feature addition. cd tests pear run-tests -rq if any tests fail, examine the .out files (as in bug12345.out) to determine the cause of failure. 8) add an entry to the release notes in both package2.xml and package-PEAR.xml. Please use the full bug summary as in: * Fix Bug #12345: Foo failure in --packagingroot option [your pear username] 9) Don't be afraid to ask the older developers for help or clarification!! 2. WRITING REGRESSION TESTS --------------------------- PEAR's regression tests are based on the versatile .phpt format, which is somewhat documented at: (official resource) http://qa.php.net/write-test.php (unofficial resource) http://weierophinney.net/matthew/archives/65-phpt-Tutorial.html In addition to these fine and succinct tutorials, take a quick peek at the source of existing unit tests, such as those in pear-core/tests/PEAR_Installer/ Each test in PEAR should make use of a simple principle: only display output when there is an error. This will allow simple cross-platform/cross-PHP version testing. In addition, use the utility PEAR_PHPTest class found in tests/phpt_test.php.inc. This will allow tremendous flexibility in testing. Don't be afraid to ask the older developers for help or clarification! 3. RELEASING PEAR ----------------- When releasing a new version of PEAR, follow these simple steps: 1) set the release date in package2.xml and package-PEAR.xml to 1 week from the current date. 2) run this command: pear package package2.xml package-PEAR.xml and fix any errors 3) upload the subsequent .tgz file (PEAR-1.4.6.tgz for PEAR version 1.4.6) to a private location where others can download it 4) post a message to the pear-qa@lists.php.net mailing list asking people to install the package, and try to break it, by running all commands, and running the unit tests 5) if all goes well, release the package through http://pear.php.net/release-upload.php on the release date in package2.xml. ALWAYS RELEASE A PACKAGE THAT HAS BEEN TESTED BY AT LEAST 1 INDEPENDENT SOURCE. We've had too many broken releases rushed out in the past. If you're not sure, ask one of the older devs for help 6) After another week, when it is clear that PEAR is working, you may need to coordinate the release with PHP developers. 4. SYNCHRONIZING PEAR WITH THE PHP RELEASE (PHP >= 5.1.0) -------------------------------------------------------- PHP 5.1.0 and newer make use of a new technology, the PHP archive, or "phar". The UNIX build of PHP uses install-pear-nozlib.phar, and the windows build uses go-pear.phar. To create these files, follow these simple steps: cvs -d :pserver:yourcvs@cvs.php.net:/repository login [replace yourcvs with your login] cvs -d :pserver:yourcvs@cvs.php.net:/repository co pear-core cd pear-core/PEAR mkdir go-pear-tarballs cd go-pear-tarballs pear download -Z PEAR-stable Archive_Tar-stable Console_Getopt-stable XML_Util-stable cd ../.. pear install PHP_Archive php make-installpear-nozlib-phar.php php make-gopear-phar.php Note that PHP 5.1 is required in order to create the archives, and they can be created on either unix or windows. Now, these files need to reside in the document root of pear.php.net. However, the files are stored in cvs at pear/installphars and are released as the package pearweb_phars. As such, you will need to ask someone with karma to commit them if you do not have karma, and to release the pearweb_phars package as well. To use these files, do the following: 1) UNIX cp install-pear-nozlib.phar /path/to/php-src/pear cd /path/to/php-src make install-pear 2) WINDOWS php go-pear.phar That's it! In fact, the go-pear.bat that comes with PHP 5.1.x simply contains that line, so that people can simply type "go-pear" to install PEAR. The code used to run go-pear.phar is located in pear-core/go-pear-phar.php. This file ultimately loads pear-core/PEAR/Start.php and pear-core/PEAR/Start/CLI.php. These files are based off of the code in the web-based go-pear, which is discussed in the next section. 5. HTTP://PEAR.PHP.NET/GO-PEAR AND TESTING --------------------------------- One of the most common methods used to install PEAR is http://pear.php.net/go-pear go-pear is actually a file located in CVS at cvs.php.net in pearweb/public_html/go-pear and it contains, in a single PHP file, all of the code necessary to download PEAR and run it. Unfortunately, this also makes it difficult to debug and to maintain, as there are more than a few hacks to make it work within a single file. However, it does the best it could under the circumstances, and contains code to install the CLI and the web-based frontend, as well as to download the necessary packages. Testing this code is very difficult, and it is important to test on windows, and to familiarize yourself with related bugs that have been encountered (a search of http://www.beeblex.com is a good place to start). If you are a brave and wonderful person, and are willing to write ApacheTest-based tests for go-pear, we would enshrine you in the halls of glory for at least a year or so :). The main thing to remember is that you need to be aware of how go-pear works, so that you can be aware of its needs in relation to PEAR. 6. PEAR.PHP.NET AND REST ------------------------------- Perhaps the most complex aspect of maintaining the PEAR installer is the interaction with pear.php.net. The PEAR installer uses one protocols to access package information, REST (Representative State Transfer) to represent abstract meta-data about packages, and to respond to specific queries about this data. There used to be support for XML-RPC (XML remote procedure call) in older version of PEAR but got removed due to XML-RPC backends being obsoleted and not used anywhere. PEAR prior to version 1.4.0 exclusively uses XML-RPC, and specifically interacts with http://pear.php.net/xmlrpc.php, which is located at cvs.php.net in pearweb/public_html/xmlrpc.php. This file in turn accesses pearweb/include/pear-database.php, which contains all of the specific functions used by the PEAR installer. pear-database.php contains a number of xml-rpc functions not used at all by the installer. Fortunately, a complete list of functions used by the installer is documented in http://pear.php.net/channel.xml. REST is a description of a rather loose way of representing data, and can mean many things but is most commonly distilled into "Every resource has one unique URL for accessing and representing this resource." PEAR implements this using static XML files, located at http://pear.php.net/rest. These files are auto-generated, and for more information on how and what is generated, check the online manual, and the code at pearweb/include/pear-rest.php. What is important to understand is that pear.php.net has had tremendous load issues recently. The largest URL accessed at pear.php.net is xmlrpc.php, which returns a tremendous amount of data. Any changes to the PEAR installer can have a profound effect on the performance of pear.php.net. REST is actually a major step forward because it distributes this load more effectively and eliminates all dynamic code processing, but until PEAR 1.3.x disappears, xmlrpc will continue to be a noticeable load on the server. Consider all changes with care! To implement a new feature or fix a bug, if you need to access some information remotely in a different way, always attempt to do this with the existing layout first. Only add new REST as XML-RPC has bee phased out and the installer contains no such code. If you plan to maintain the remote access portion of PEAR, it is imperative to become intimately familiar with how the website works. Check out pearweb from CVS and study it, set up a local copy and take a day to make it work - this is no small endeavor, I assure you, but it is worth it for local testing. Once you have a working local mirror, simply update your local channel.xml for PEAR with a mirror and select that mirror. Save this file as "mychannel.xml": pear.php.net pear PHP Extension and Application Repository http://pear.php.net/rest/ http://pear.php.net/rest/ http://localhost/rest/ http://localhost/rest/ Then: pear channel-update mychannel.xml pear config-set preferred_mirror localhost This will instruct the PEAR installer on your machine to access your local copy of pearweb as if it were the remote one. This can be used to debug complex server interactions without requiring any internet access whatsoever. Again, as with all other tasks, consult one of the experienced developers if you need assistance setting up pearweb locally, or have any questions!php-pear-1.10.1+submodules+notgz/README.rst000066400000000000000000000052071262614675700203340ustar00rootroot00000000000000************************* PEAR - The PEAR Installer ************************* .. image:: https://travis-ci.org/pear/pear-core.svg?branch=stable :target: https://travis-ci.org/pear/pear-core ========================================= What is the PEAR Installer? What is PEAR? ========================================= PEAR is the PHP Extension and Application Repository, found at http://pear.php.net. The **PEAR Installer** is this software, which contains executable files and PHP code that is used to **download and install** PEAR code from pear.php.net. PEAR contains useful **software libraries and applications** such as MDB2 (database abstraction), HTML_QuickForm (HTML forms management), PhpDocumentor (auto-documentation generator), DB_DataObject (Data Access Abstraction), and many hundreds more. Browse all available packages at http://pear.php.net, the list is constantly growing and updating to reflect improvements in the PHP language. .. warning:: Do not run PEAR without installing it - if you downloaded this tarball manually, you MUST install it. Read the instructions in INSTALL prior to use. ============= Documentation ============= Documentation for PEAR can be found at http://pear.php.net/manual/. Installation documentation can be found in the INSTALL file included in this tarball. ===== Tests ===== Run the tests without installation as follows:: $ ./scripts/pear.sh run-tests -r tests You should have the ``Text_Diff`` package installed to get nicer error output. To run the tests with another PHP version, modify ``php_bin`` and set the ``PHP_PEAR_PHP_BIN`` environment variable:: $ pear config-set php_bin /usr/local/bin/php7 $ PHP_PEAR_PHP_BIN=/usr/local/bin/php7 ./scripts/pear.sh run-tests -r tests Happy PHPing, we hope PEAR will be a great tool for your development work! Test dependencies ================= * ``zlib`` ========= Releasing ========= Create a PEAR package as well as phars for pear-less installation:: $ rm -f PEAR-*.tgz $ pear package package2.xml $ cd go-pear-tarballs $ rm -f PEAR-* $ cp ../PEAR-*.tgz . $ gunzip PEAR-*.tgz $ pear download -Z Archive_Tar Console_Getopt Structures_Graph XML_Util $ mkdir src && cd src $ for i in ../*.tar; do tar xvf $i; done $ mv *\/* . $ cd ../../ $ php make-gopear-phar.php $ php make-installpear-nozlib-phar.php (Or simply run ``build-release.sh``). ``go-pear.phar`` is contains the PEAR installer installer that asks questions where to install it. It is available from http://pear.php.net/go-pear.phar. ``install-pear-nozlib.phar`` installs PEAR automatically without asking anything. It is shipped with PHP itself. php-pear-1.10.1+submodules+notgz/System.php000066400000000000000000000475131262614675700206500ustar00rootroot00000000000000 * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @link http://pear.php.net/package/PEAR * @since File available since Release 0.1 */ /** * base class */ require_once 'PEAR.php'; require_once 'Console/Getopt.php'; $GLOBALS['_System_temp_files'] = array(); /** * System offers cross plattform compatible system functions * * Static functions for different operations. Should work under * Unix and Windows. The names and usage has been taken from its respectively * GNU commands. The functions will return (bool) false on error and will * trigger the error with the PHP trigger_error() function (you can silence * the error by prefixing a '@' sign after the function call, but this * is not recommended practice. Instead use an error handler with * {@link set_error_handler()}). * * Documentation on this class you can find in: * http://pear.php.net/manual/ * * Example usage: * if (!@System::rm('-r file1 dir1')) { * print "could not delete file1 or dir1"; * } * * In case you need to to pass file names with spaces, * pass the params as an array: * * System::rm(array('-r', $file1, $dir1)); * * @category pear * @package System * @author Tomas V.V. Cox * @copyright 1997-2006 The PHP Group * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version Release: @package_version@ * @link http://pear.php.net/package/PEAR * @since Class available since Release 0.1 * @static */ class System { /** * returns the commandline arguments of a function * * @param string $argv the commandline * @param string $short_options the allowed option short-tags * @param string $long_options the allowed option long-tags * @return array the given options and there values */ public static function _parseArgs($argv, $short_options, $long_options = null) { if (!is_array($argv) && $argv !== null) { /* // Quote all items that are a short option $av = preg_split('/(\A| )--?[a-z0-9]+[ =]?((? $a) { if (empty($a)) { continue; } $argv[$k] = trim($a) ; } } return Console_Getopt::getopt2($argv, $short_options, $long_options); } /** * Output errors with PHP trigger_error(). You can silence the errors * with prefixing a "@" sign to the function call: @System::mkdir(..); * * @param mixed $error a PEAR error or a string with the error message * @return bool false */ protected static function raiseError($error) { if (PEAR::isError($error)) { $error = $error->getMessage(); } trigger_error($error, E_USER_WARNING); return false; } /** * Creates a nested array representing the structure of a directory * * System::_dirToStruct('dir1', 0) => * Array * ( * [dirs] => Array * ( * [0] => dir1 * ) * * [files] => Array * ( * [0] => dir1/file2 * [1] => dir1/file3 * ) * ) * @param string $sPath Name of the directory * @param integer $maxinst max. deep of the lookup * @param integer $aktinst starting deep of the lookup * @param bool $silent if true, do not emit errors. * @return array the structure of the dir */ protected static function _dirToStruct($sPath, $maxinst, $aktinst = 0, $silent = false) { $struct = array('dirs' => array(), 'files' => array()); if (($dir = @opendir($sPath)) === false) { if (!$silent) { System::raiseError("Could not open dir $sPath"); } return $struct; // XXX could not open error } $struct['dirs'][] = $sPath = realpath($sPath); // XXX don't add if '.' or '..' ? $list = array(); while (false !== ($file = readdir($dir))) { if ($file != '.' && $file != '..') { $list[] = $file; } } closedir($dir); natsort($list); if ($aktinst < $maxinst || $maxinst == 0) { foreach ($list as $val) { $path = $sPath . DIRECTORY_SEPARATOR . $val; if (is_dir($path) && !is_link($path)) { $tmp = System::_dirToStruct($path, $maxinst, $aktinst+1, $silent); $struct = array_merge_recursive($struct, $tmp); } else { $struct['files'][] = $path; } } } return $struct; } /** * Creates a nested array representing the structure of a directory and files * * @param array $files Array listing files and dirs * @return array * @static * @see System::_dirToStruct() */ protected static function _multipleToStruct($files) { $struct = array('dirs' => array(), 'files' => array()); settype($files, 'array'); foreach ($files as $file) { if (is_dir($file) && !is_link($file)) { $tmp = System::_dirToStruct($file, 0); $struct = array_merge_recursive($tmp, $struct); } else { if (!in_array($file, $struct['files'])) { $struct['files'][] = $file; } } } return $struct; } /** * The rm command for removing files. * Supports multiple files and dirs and also recursive deletes * * @param string $args the arguments for rm * @return mixed PEAR_Error or true for success * @static * @access public */ public static function rm($args) { $opts = System::_parseArgs($args, 'rf'); // "f" does nothing but I like it :-) if (PEAR::isError($opts)) { return System::raiseError($opts); } foreach ($opts[0] as $opt) { if ($opt[0] == 'r') { $do_recursive = true; } } $ret = true; if (isset($do_recursive)) { $struct = System::_multipleToStruct($opts[1]); foreach ($struct['files'] as $file) { if (!@unlink($file)) { $ret = false; } } rsort($struct['dirs']); foreach ($struct['dirs'] as $dir) { if (!@rmdir($dir)) { $ret = false; } } } else { foreach ($opts[1] as $file) { $delete = (is_dir($file)) ? 'rmdir' : 'unlink'; if (!@$delete($file)) { $ret = false; } } } return $ret; } /** * Make directories. * * The -p option will create parent directories * @param string $args the name of the director(y|ies) to create * @return bool True for success */ public static function mkDir($args) { $opts = System::_parseArgs($args, 'pm:'); if (PEAR::isError($opts)) { return System::raiseError($opts); } $mode = 0777; // default mode foreach ($opts[0] as $opt) { if ($opt[0] == 'p') { $create_parents = true; } elseif ($opt[0] == 'm') { // if the mode is clearly an octal number (starts with 0) // convert it to decimal if (strlen($opt[1]) && $opt[1]{0} == '0') { $opt[1] = octdec($opt[1]); } else { // convert to int $opt[1] += 0; } $mode = $opt[1]; } } $ret = true; if (isset($create_parents)) { foreach ($opts[1] as $dir) { $dirstack = array(); while ((!file_exists($dir) || !is_dir($dir)) && $dir != DIRECTORY_SEPARATOR) { array_unshift($dirstack, $dir); $dir = dirname($dir); } while ($newdir = array_shift($dirstack)) { if (!is_writeable(dirname($newdir))) { $ret = false; break; } if (!mkdir($newdir, $mode)) { $ret = false; } } } } else { foreach($opts[1] as $dir) { if ((@file_exists($dir) || !is_dir($dir)) && !mkdir($dir, $mode)) { $ret = false; } } } return $ret; } /** * Concatenate files * * Usage: * 1) $var = System::cat('sample.txt test.txt'); * 2) System::cat('sample.txt test.txt > final.txt'); * 3) System::cat('sample.txt test.txt >> final.txt'); * * Note: as the class use fopen, urls should work also (test that) * * @param string $args the arguments * @return boolean true on success */ public static function &cat($args) { $ret = null; $files = array(); if (!is_array($args)) { $args = preg_split('/\s+/', $args, -1, PREG_SPLIT_NO_EMPTY); } $count_args = count($args); for ($i = 0; $i < $count_args; $i++) { if ($args[$i] == '>') { $mode = 'wb'; $outputfile = $args[$i+1]; break; } elseif ($args[$i] == '>>') { $mode = 'ab+'; $outputfile = $args[$i+1]; break; } else { $files[] = $args[$i]; } } $outputfd = false; if (isset($mode)) { if (!$outputfd = fopen($outputfile, $mode)) { $err = System::raiseError("Could not open $outputfile"); return $err; } $ret = true; } foreach ($files as $file) { if (!$fd = fopen($file, 'r')) { System::raiseError("Could not open $file"); continue; } while ($cont = fread($fd, 2048)) { if (is_resource($outputfd)) { fwrite($outputfd, $cont); } else { $ret .= $cont; } } fclose($fd); } if (is_resource($outputfd)) { fclose($outputfd); } return $ret; } /** * Creates temporary files or directories. This function will remove * the created files when the scripts finish its execution. * * Usage: * 1) $tempfile = System::mktemp("prefix"); * 2) $tempdir = System::mktemp("-d prefix"); * 3) $tempfile = System::mktemp(); * 4) $tempfile = System::mktemp("-t /var/tmp prefix"); * * prefix -> The string that will be prepended to the temp name * (defaults to "tmp"). * -d -> A temporary dir will be created instead of a file. * -t -> The target dir where the temporary (file|dir) will be created. If * this param is missing by default the env vars TMP on Windows or * TMPDIR in Unix will be used. If these vars are also missing * c:\windows\temp or /tmp will be used. * * @param string $args The arguments * @return mixed the full path of the created (file|dir) or false * @see System::tmpdir() */ public static function mktemp($args = null) { static $first_time = true; $opts = System::_parseArgs($args, 't:d'); if (PEAR::isError($opts)) { return System::raiseError($opts); } foreach ($opts[0] as $opt) { if ($opt[0] == 'd') { $tmp_is_dir = true; } elseif ($opt[0] == 't') { $tmpdir = $opt[1]; } } $prefix = (isset($opts[1][0])) ? $opts[1][0] : 'tmp'; if (!isset($tmpdir)) { $tmpdir = System::tmpdir(); } if (!System::mkDir(array('-p', $tmpdir))) { return false; } $tmp = tempnam($tmpdir, $prefix); if (isset($tmp_is_dir)) { unlink($tmp); // be careful possible race condition here if (!mkdir($tmp, 0700)) { return System::raiseError("Unable to create temporary directory $tmpdir"); } } $GLOBALS['_System_temp_files'][] = $tmp; if (isset($tmp_is_dir)) { //$GLOBALS['_System_temp_files'][] = dirname($tmp); } if ($first_time) { PEAR::registerShutdownFunc(array('System', '_removeTmpFiles')); $first_time = false; } return $tmp; } /** * Remove temporary files created my mkTemp. This function is executed * at script shutdown time */ public static function _removeTmpFiles() { if (count($GLOBALS['_System_temp_files'])) { $delete = $GLOBALS['_System_temp_files']; array_unshift($delete, '-r'); System::rm($delete); $GLOBALS['_System_temp_files'] = array(); } } /** * Get the path of the temporal directory set in the system * by looking in its environments variables. * Note: php.ini-recommended removes the "E" from the variables_order setting, * making unavaible the $_ENV array, that s why we do tests with _ENV * * @return string The temporary directory on the system */ public static function tmpdir() { if (OS_WINDOWS) { if ($var = isset($_ENV['TMP']) ? $_ENV['TMP'] : getenv('TMP')) { return $var; } if ($var = isset($_ENV['TEMP']) ? $_ENV['TEMP'] : getenv('TEMP')) { return $var; } if ($var = isset($_ENV['USERPROFILE']) ? $_ENV['USERPROFILE'] : getenv('USERPROFILE')) { return $var; } if ($var = isset($_ENV['windir']) ? $_ENV['windir'] : getenv('windir')) { return $var; } return getenv('SystemRoot') . '\temp'; } if ($var = isset($_ENV['TMPDIR']) ? $_ENV['TMPDIR'] : getenv('TMPDIR')) { return $var; } return realpath('/tmp'); } /** * The "which" command (show the full path of a command) * * @param string $program The command to search for * @param mixed $fallback Value to return if $program is not found * * @return mixed A string with the full path or false if not found * @author Stig Bakken */ public static function which($program, $fallback = false) { // enforce API if (!is_string($program) || '' == $program) { return $fallback; } // full path given if (basename($program) != $program) { $path_elements[] = dirname($program); $program = basename($program); } else { $path = getenv('PATH'); if (!$path) { $path = getenv('Path'); // some OSes are just stupid enough to do this } $path_elements = explode(PATH_SEPARATOR, $path); } if (OS_WINDOWS) { $exe_suffixes = getenv('PATHEXT') ? explode(PATH_SEPARATOR, getenv('PATHEXT')) : array('.exe','.bat','.cmd','.com'); // allow passing a command.exe param if (strpos($program, '.') !== false) { array_unshift($exe_suffixes, ''); } } else { $exe_suffixes = array(''); } foreach ($exe_suffixes as $suff) { foreach ($path_elements as $dir) { $file = $dir . DIRECTORY_SEPARATOR . $program . $suff; if (is_executable($file)) { return $file; } } } return $fallback; } /** * The "find" command * * Usage: * * System::find($dir); * System::find("$dir -type d"); * System::find("$dir -type f"); * System::find("$dir -name *.php"); * System::find("$dir -name *.php -name *.htm*"); * System::find("$dir -maxdepth 1"); * * Params implmented: * $dir -> Start the search at this directory * -type d -> return only directories * -type f -> return only files * -maxdepth -> max depth of recursion * -name -> search pattern (bash style). Multiple -name param allowed * * @param mixed Either array or string with the command line * @return array Array of found files */ public static function find($args) { if (!is_array($args)) { $args = preg_split('/\s+/', $args, -1, PREG_SPLIT_NO_EMPTY); } $dir = realpath(array_shift($args)); if (!$dir) { return array(); } $patterns = array(); $depth = 0; $do_files = $do_dirs = true; $args_count = count($args); for ($i = 0; $i < $args_count; $i++) { switch ($args[$i]) { case '-type': if (in_array($args[$i+1], array('d', 'f'))) { if ($args[$i+1] == 'd') { $do_files = false; } else { $do_dirs = false; } } $i++; break; case '-name': $name = preg_quote($args[$i+1], '#'); // our magic characters ? and * have just been escaped, // so now we change the escaped versions to PCRE operators $name = strtr($name, array('\?' => '.', '\*' => '.*')); $patterns[] = '('.$name.')'; $i++; break; case '-maxdepth': $depth = $args[$i+1]; break; } } $path = System::_dirToStruct($dir, $depth, 0, true); if ($do_files && $do_dirs) { $files = array_merge($path['files'], $path['dirs']); } elseif ($do_dirs) { $files = $path['dirs']; } else { $files = $path['files']; } if (count($patterns)) { $dsq = preg_quote(DIRECTORY_SEPARATOR, '#'); $pattern = '#(^|'.$dsq.')'.implode('|', $patterns).'($|'.$dsq.')#'; $ret = array(); $files_count = count($files); for ($i = 0; $i < $files_count; $i++) { // only search in the part of the file below the current directory $filepart = basename($files[$i]); if (preg_match($pattern, $filepart)) { $ret[] = $files[$i]; } } return $ret; } return $files; } }php-pear-1.10.1+submodules+notgz/build-release.sh000077500000000000000000000007651262614675700217250ustar00rootroot00000000000000#!/bin/sh # package up PEAR set -e set -x rm -f PEAR-*.tgz pear package package2.xml [ -d go-pear-tarballs ] && rm -r go-pear-tarballs mkdir go-pear-tarballs cd go-pear-tarballs rm -f PEAR-* cp ../PEAR-*.tgz . gunzip PEAR-*.tgz pear download -Z Archive_Tar Console_Getopt Structures_Graph XML_Util mkdir src && cd src for i in ../*.tar; do tar xvf $i; done mv *\/* . || true cd ../../ rm go-pear.phar install-pear-nozlib.phar || true php make-gopear-phar.php php make-installpear-nozlib-phar.php php-pear-1.10.1+submodules+notgz/catalog000066400000000000000000000001031262614675700201700ustar00rootroot00000000000000PUBLIC "-//PHP Group//DTD PEAR Package 1.0//EN//XML" "package.dtd" php-pear-1.10.1+submodules+notgz/docs/000077500000000000000000000000001262614675700175715ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/docs/Archive_Tar.txt000066400000000000000000000411401262614675700225210ustar00rootroot00000000000000Documentation for class Archive_Tar =================================== Last update : 2001-08-15 Overview : ---------- The Archive_Tar class helps in creating and managing GNU TAR format files compressed by GNU ZIP or not. The class offers basic functions like creating an archive, adding files in the archive, extracting files from the archive and listing the archive content. It also provide advanced functions that allow the adding and extraction of files with path manipulation. Sample : -------- // ----- Creating the object (uncompressed archive) $tar_object = new Archive_Tar("tarname.tar"); $tar_object->setErrorHandling(PEAR_ERROR_PRINT); // ----- Creating the archive $v_list[0]="file.txt"; $v_list[1]="data/"; $v_list[2]="file.log"; $tar_object->create($v_list); // ----- Adding files $v_list[0]="dev/file.txt"; $v_list[1]="dev/data/"; $v_list[2]="log/file.log"; $tar_object->add($v_list); // ----- Adding more files $tar_object->add("release/newfile.log release/readme.txt"); // ----- Listing the content if (($v_list = $tar_object->listContent()) != 0) for ($i=0; $i"; echo " .size :'".$v_list[$i][size]."'
"; echo " .mtime :'".$v_list[$i][mtime]."' (".date("l dS of F Y h:i:s A", $v_list[$i][mtime]).")
"; echo " .mode :'".$v_list[$i][mode]."'
"; echo " .uid :'".$v_list[$i][uid]."'
"; echo " .gid :'".$v_list[$i][gid]."'
"; echo " .typeflag :'".$v_list[$i][typeflag]."'
"; } // ----- Extracting the archive in directory "install" $tar_object->extract("install"); Public arguments : ------------------ None Public Methods : ---------------- Method : Archive_Tar($p_tarname, $compress = false) Description : Archive_Tar Class constructor. This flavour of the constructor only declare a new Archive_Tar object, identifying it by the name of the tar file. If the compress argument is set the tar will be read or created as a gzip compressed TAR file. Arguments : $p_tarname : A valid filename for the tar archive file. $p_compress : true/false. Indicate if the archive need to be compressed or not. Return value : The Archive_Tar object. Sample : $tar_object = new Archive_Tar("tarname.tar"); $tar_object_compressed = new Archive_Tar("tarname.tgz", true); How it works : Initialize the object. Method : create($p_filelist) Description : This method creates the archive file and add the files / directories that are listed in $p_filelist. If the file already exists and is writable, it is replaced by the new tar. It is a create and not an add. If the file exists and is read-only or is a directory it is not replaced. The method return false and a PEAR error text. The $p_filelist parameter can be an array of string, each string representing a filename or a directory name with their path if needed. It can also be a single string with names separated by a single blank. See also createModify() method for more details. Arguments : $p_filelist : An array of filenames and directory names, or a single string with names separated by a single blank space. Return value : true on success, false on error. Sample 1 : $tar_object = new Archive_Tar("tarname.tar"); $tar_object->setErrorHandling(PEAR_ERROR_PRINT); // Optional error handling $v_list[0]="file.txt"; $v_list[1]="data/"; (Optional '/' at the end) $v_list[2]="file.log"; $tar_object->create($v_list); Sample 2 : $tar_object = new Archive_Tar("tarname.tar"); $tar_object->setErrorHandling(PEAR_ERROR_PRINT); // Optional error handling $tar_object->create("file.txt data/ file.log"); How it works : Just calling the createModify() method with the right parameters. Method : createModify($p_filelist, $p_add_dir, $p_remove_dir = "") Description : This method creates the archive file and add the files / directories that are listed in $p_filelist. If the file already exists and is writable, it is replaced by the new tar. It is a create and not an add. If the file exists and is read-only or is a directory it is not replaced. The method return false and a PEAR error text. The $p_filelist parameter can be an array of string, each string representing a filename or a directory name with their path if needed. It can also be a single string with names separated by a single blank. The path indicated in $p_remove_dir will be removed from the memorized path of each file / directory listed when this path exists. By default nothing is removed (empty path "") The path indicated in $p_add_dir will be added at the beginning of the memorized path of each file / directory listed. However it can be set to empty "". The adding of a path is done after the removing of path. The path add/remove ability enables the user to prepare an archive for extraction in a different path than the origin files are. See also addModify() method for file adding properties. Arguments : $p_filelist : An array of filenames and directory names, or a single string with names separated by a single blank space. $p_add_dir : A string which contains a path to be added to the memorized path of each element in the list. $p_remove_dir : A string which contains a path to be removed from the memorized path of each element in the list, when relevant. Return value : true on success, false on error. Sample 1 : $tar_object = new Archive_Tar("tarname.tar"); $tar_object->setErrorHandling(PEAR_ERROR_PRINT); // Optional error handling $v_list[0]="file.txt"; $v_list[1]="data/"; (Optional '/' at the end) $v_list[2]="file.log"; $tar_object->createModify($v_list, "install"); // files are stored in the archive as : // install/file.txt // install/data // install/data/file1.txt // install/data/... all the files and sub-dirs of data/ // install/file.log Sample 2 : $tar_object = new Archive_Tar("tarname.tar"); $tar_object->setErrorHandling(PEAR_ERROR_PRINT); // Optional error handling $v_list[0]="dev/file.txt"; $v_list[1]="dev/data/"; (Optional '/' at the end) $v_list[2]="log/file.log"; $tar_object->createModify($v_list, "install", "dev"); // files are stored in the archive as : // install/file.txt // install/data // install/data/file1.txt // install/data/... all the files and sub-dirs of data/ // install/log/file.log How it works : Open the file in write mode (erasing the existing one if one), call the _addList() method for adding the files in an empty archive, add the tar footer (512 bytes block), close the tar file. Method : addModify($p_filelist, $p_add_dir, $p_remove_dir="") Description : This method add the files / directories listed in $p_filelist at the end of the existing archive. If the archive does not yet exists it is created. The $p_filelist parameter can be an array of string, each string representing a filename or a directory name with their path if needed. It can also be a single string with names separated by a single blank. The path indicated in $p_remove_dir will be removed from the memorized path of each file / directory listed when this path exists. By default nothing is removed (empty path "") The path indicated in $p_add_dir will be added at the beginning of the memorized path of each file / directory listed. However it can be set to empty "". The adding of a path is done after the removing of path. The path add/remove ability enables the user to prepare an archive for extraction in a different path than the origin files are. If a file/dir is already in the archive it will only be added at the end of the archive. There is no update of the existing archived file/dir. However while extracting the archive, the last file will replace the first one. This results in a none optimization of the archive size. If a file/dir does not exist the file/dir is ignored. However an error text is send to PEAR error. If a file/dir is not readable the file/dir is ignored. However an error text is send to PEAR error. If the resulting filename/dirname (after the add/remove option or not) string is greater than 99 char, the file/dir is ignored. However an error text is send to PEAR error. Arguments : $p_filelist : An array of filenames and directory names, or a single string with names separated by a single blank space. $p_add_dir : A string which contains a path to be added to the memorized path of each element in the list. $p_remove_dir : A string which contains a path to be removed from the memorized path of each element in the list, when relevant. Return value : true on success, false on error. Sample 1 : $tar_object = new Archive_Tar("tarname.tar"); [...] $v_list[0]="dev/file.txt"; $v_list[1]="dev/data/"; (Optional '/' at the end) $v_list[2]="log/file.log"; $tar_object->addModify($v_list, "install"); // files are stored in the archive as : // install/file.txt // install/data // install/data/file1.txt // install/data/... all the files and sub-dirs of data/ // install/file.log Sample 2 : $tar_object = new Archive_Tar("tarname.tar"); [...] $v_list[0]="dev/file.txt"; $v_list[1]="dev/data/"; (Optional '/' at the end) $v_list[2]="log/file.log"; $tar_object->addModify($v_list, "install", "dev"); // files are stored in the archive as : // install/file.txt // install/data // install/data/file1.txt // install/data/... all the files and sub-dirs of data/ // install/log/file.log How it works : If the archive does not exists it create it and add the files. If the archive does exists and is not compressed, it open it, jump before the last empty 512 bytes block (tar footer) and add the files at this point. If the archive does exists and is compressed, a temporary copy file is created. This temporary file is then 'gzip' read block by block until the last empty block. The new files are then added in the compressed file. The adding of files is done by going through the file/dir list, adding files per files, in a recursive way through the directory. Each time a path need to be added/removed it is done before writing the file header in the archive. Method : add($p_filelist) Description : This method add the files / directories listed in $p_filelist at the end of the existing archive. If the archive does not yet exists it is created. The $p_filelist parameter can be an array of string, each string representing a filename or a directory name with their path if needed. It can also be a single string with names separated by a single blank. See addModify() method for details and limitations. Arguments : $p_filelist : An array of filenames and directory names, or a single string with names separated by a single blank space. Return value : true on success, false on error. Sample 1 : $tar_object = new Archive_Tar("tarname.tar"); [...] $v_list[0]="dev/file.txt"; $v_list[1]="dev/data/"; (Optional '/' at the end) $v_list[2]="log/file.log"; $tar_object->add($v_list); Sample 2 : $tar_object = new Archive_Tar("tarname.tgz", true); [...] $v_list[0]="dev/file.txt"; $v_list[1]="dev/data/"; (Optional '/' at the end) $v_list[2]="log/file.log"; $tar_object->add($v_list); How it works : Simply call the addModify() method with the right parameters. Method : extract($p_path = "") Description : This method extract all the content of the archive in the directory indicated by $p_path.If $p_path is optional, if not set the archive is extracted in the current directory. While extracting a file, if the directory path does not exists it is created. See extractModify() for details and limitations. Arguments : $p_path : Optional path where the files/dir need to by extracted. Return value : true on success, false on error. Sample : $tar_object = new Archive_Tar("tarname.tar"); $tar_object->extract(); How it works : Simply call the extractModify() method with appropriate parameters. Method : extractModify($p_path, $p_remove_path) Description : This method extract all the content of the archive in the directory indicated by $p_path. When relevant the memorized path of the files/dir can be modified by removing the $p_remove_path path at the beginning of the file/dir path. While extracting a file, if the directory path does not exists it is created. While extracting a file, if the file already exists it is replaced without looking for last modification date. While extracting a file, if the file already exists and is write protected, the extraction is aborted. While extracting a file, if a directory with the same name already exists, the extraction is aborted. While extracting a directory, if a file with the same name already exists, the extraction is aborted. While extracting a file/directory if the destination directory exist and is write protected, or does not exist but can not be created, the extraction is aborted. If after extraction an extracted file does not show the correct stored file size, the extraction is aborted. When the extraction is aborted, a PEAR error text is set and false is returned. However the result can be a partial extraction that may need to be manually cleaned. Arguments : $p_path : The path of the directory where the files/dir need to by extracted. $p_remove_path : Part of the memorized path that can be removed if present at the beginning of the file/dir path. Return value : true on success, false on error. Sample : // Imagine tarname.tar with files : // dev/data/file.txt // dev/data/log.txt // readme.txt $tar_object = new Archive_Tar("tarname.tar"); $tar_object->extractModify("install", "dev"); // Files will be extracted there : // install/data/file.txt // install/data/log.txt // install/readme.txt How it works : Open the archive and call a more generic function that can extract only a part of the archive or all the archive. See extractList() method for more details. Method : listContent() Description : This method returns an array of arrays that describe each file/directory present in the archive. The array is not sorted, so it show the position of the file in the archive. The file informations are : $file[filename] : Name and path of the file/dir. $file[mode] : File permissions (result of fileperms()) $file[uid] : user id $file[gid] : group id $file[size] : filesize $file[mtime] : Last modification time (result of filemtime()) $file[typeflag] : "" for file, "5" for directory Arguments : Return value : An array of arrays or 0 on error. Sample : $tar_object = new Archive_Tar("tarname.tar"); if (($v_list = $tar_object->listContent()) != 0) for ($i=0; $i"; echo " .size :'".$v_list[$i][size]."'
"; echo " .mtime :'".$v_list[$i][mtime]."' (". date("l dS of F Y h:i:s A", $v_list[$i][mtime]).")
"; echo " .mode :'".$v_list[$i][mode]."'
"; echo " .uid :'".$v_list[$i][uid]."'
"; echo " .gid :'".$v_list[$i][gid]."'
"; echo " .typeflag :'".$v_list[$i][typeflag]."'
"; } How it works : Call the same function as an extract however with a flag to only go through the archive without extracting the files. Method : extractList($p_filelist, $p_path = "", $p_remove_path = "") Description : This method extract from the archive only the files indicated in the $p_filelist. These files are extracted in the current directory or in the directory indicated by the optional $p_path parameter. If indicated the $p_remove_path can be used in the same way as it is used in extractModify() method. Arguments : $p_filelist : An array of filenames and directory names, or a single string with names separated by a single blank space. $p_path : The path of the directory where the files/dir need to by extracted. $p_remove_path : Part of the memorized path that can be removed if present at the beginning of the file/dir path. Return value : true on success, false on error. Sample : // Imagine tarname.tar with files : // dev/data/file.txt // dev/data/log.txt // readme.txt $tar_object = new Archive_Tar("tarname.tar"); $tar_object->extractList("dev/data/file.txt readme.txt", "install", "dev"); // Files will be extracted there : // install/data/file.txt // install/readme.txt How it works : Go through the archive and extract only the files present in the list. php-pear-1.10.1+submodules+notgz/docs/rfc01_PEAR_pecl-binaries.txt000066400000000000000000000052071262614675700246550ustar00rootroot00000000000000Author: Tomas V.V.Cox Abstract: Open discussion on how to handle PECL binary packages pecl package name ----------------- The name of the extension would be: peclfoo-bin---3.1.2.tgz The os (Operating system) and arch (CPU type), would be the value returned by the OS_Guess class. package creation ---------------- pear package [-t ] -t The type of package you want to generate (pear, rpm, msi, src, etc) Without args it will package the extension as it does nowadays (the same as "-t src"). We have now native pear packages, rpm, msi is planned and others will surely come. Additionally of generating the native package description file, we could perhaps also call the tools for generating the whole package. An idea would be to create in addition a BUILDINFO.txt file with some data about the env where the extension was compiled at, like the php version, the php_uname(), the extra libs versions, os vendor version, pear version, etc. package.xml ----------- As a binary release shares the same release data with the source distrib, the same package.xml file could be used for all kind of distribs. Let's say something like: ... .. A package may contain many compiled extensions for different platforms, one single extension or the sources. Installation ------------ pear install -t bin peclfoo (download and install the binary distrib of peclfoo for your current OS-ARCH) pear install peclfoo (download, build and install peclfoo) All the files with role="ext" would be installed in "ext_dir" (pear cmd setting). The user can config it with "pear config-set ext_dir=XXX". If this var is not explicitly set, the following will be used for finding a default location: if (getenv('PHP_PEAR_EXTENSION_DIR')) { define('PEAR_CONFIG_DEFAULT_EXT_DIR', getenv('PHP_PEAR_EXTENSION_DIR')); } else { if (ini_get('extension_dir')) { define('PEAR_CONFIG_DEFAULT_EXT_DIR', ini_get('extension_dir')); } elseif (defined('PEAR_EXTENSION_DIR') && @is_dir(PEAR_EXTENSION_DIR)) { define('PEAR_CONFIG_DEFAULT_EXT_DIR', PEAR_EXTENSION_DIR); } elseif (defined('PHP_EXTENSION_DIR')) { define('PEAR_CONFIG_DEFAULT_EXT_DIR', PHP_EXTENSION_DIR); } else { define('PEAR_CONFIG_DEFAULT_EXT_DIR', '.'); } } Listing in the web ------------------ A new column "Type" should be added to the release listing under the package home page at pear.php.net, saying that the package is a binary distrib compiled for OS X and ARCH Y or sources. php-pear-1.10.1+submodules+notgz/docs/rfc01_PEAR_subpackages.txt000066400000000000000000000106721262614675700244320ustar00rootroot00000000000000RFC: subpackages Sept. 17, 2003 Greg Beaver The Problem: ------------ Many PEAR packages consist of a core and several ancillary self-contained program elements. Examples are: MDB/DB and database drivers Log and log classes Cache and Cache drivers phpDocumentor and Converters HTML_QuickForm and HTML_QuickForm_Controller In most cases, not all packages need be installed. The most common example of this is DB: how many people need to use every single database driver? Most of them just eat up disk space, except on multi-user installations. In addition, each ancillary program element may have a different stability level (sqlite driver may be beta quality, while the mysql driver is stable). Currently, this results in a contradiction: the core is stable, but one driver is not. What is the stability of the package? stable or beta? People who want to only install and use stable packages may be deceived by a package that is marked stable and contains an alpha-quality driver, for example. Plus, many PEAR packages are criticized for their bloat. The Solution: ------------- Subpackages will allow the solving of all of these problems. Note that subpackaging does not address other problems, such as bundling together related packages (PFC packages, for example, or packages needed for a framework that need not have any dependencies). Subpackages are a dependency relation. In other words, if Package Foo depends on Bar, Foo is not necessarily a subpackage of Bar, but might be. However, if Foo does not depend on Bar, Foo is definitively NOT a subpackage of Bar. In other words, subpackages by definition cannot function without the presence of the core package (DB drivers are pretty pointless without DB). Note that with the presence of subpackages, a subpackages can be released with a new version number without need to release a new version of the core, allowing rapid development on unstable subpackages, and slower development on stable components. How to differentiate a subpackage from a normal dependency: ----------------------------------------------------------- An addition should be made to the package.dtd file for package.xml files. A new dependency type, "spkg" should be used to define a subpackage dependency. This dependency type should be used by subpackages to definitively link to a parent package as a subpackage. example package Foo_Bar's package.xml dependency: Foo -or- Foo All rel values would be available including "not" if a particular version of the parent package must not be installed due to a bug affecting this particular subpackage (rare case). package Foo's package.xml dependencies may contain an optional dependency on the subpackage: Foo_Bar standard subpackages must be listed as optional dependencies in package.xml to allow easy installation with the --alldeps switch, but third party subpackages need not be listed as optional dependencies (if someone releases a custom DB driver or specialized phpDocumentor converter, for example, on their own website) Note that a required subpackage must be bundled as part of the core, and is not a subpackage - a subpackage MUST be an optional dependency. Naming/Path Conventions: ------------------------ Subpackages must reside in a subdirectory of the parent package, just as they would under normal circumstances as part of the package. Foo's subpackage Bar must be named Foo_Bar, and reside in Foo/Bar.php as per PEAR conventions. pear.php.net changes: --------------------- Subpackages would not be listed globally, but instead on the package page as optional components. Documentation for subpackages will reside as part of the main package's documentation. PEAR Installer changes: ----------------------- pear info/remote-info would list available subpackages (remote-info only) and installed subpackages (info only) pear list would list top-level packages, with some indication of packages that have subpackages (an asterisk or something). pear list PackageWithSubpackages would list subpackages as well pear uninstall PackageWithSubpackages would automatically uninstall any subpackages without requiring --force or other switches, as if they were simply a part of the main application. This is due to the fact that they would be simply a part of the package if PEAR didn't support subpackages. php-pear-1.10.1+submodules+notgz/go-pear-list.php000077500000000000000000000010071262614675700216560ustar00rootroot00000000000000 "1.4.10", "Console_Getopt" => "1.2.3", "Archive_Tar" => "1.3.7", // required packages for the web frontend "PEAR_Frontend_Web" => "0.5.1", "HTML_Template_IT" => "1.1.4", "Net_UserAgent_Detect" => "2.0.1", ); ?> php-pear-1.10.1+submodules+notgz/go-pear-phar.php000066400000000000000000000001671262614675700216400ustar00rootroot00000000000000run(); ?>php-pear-1.10.1+submodules+notgz/install-pear.php000066400000000000000000000243751262614675700217600ustar00rootroot00000000000000getLayers(); foreach ($config_layers as $layer) { if ($layer == 'default') continue; $config->removeLayer($layer); } $keys = $config->getKeys(); if ($debug) { $config->set('verbose', 5, 'default'); } else { $config->set('verbose', 0, 'default'); } // PEAR executables if (!empty($bin_dir)) { $config->set('bin_dir', $bin_dir, 'default'); } // Cache files if (!empty($cache_dir)) { $config->set('cache_dir', $cache_dir, 'default'); } // Config files if (!empty($cfg_dir)) { $config->set('cfg_dir', $cfg_dir, 'default'); } // Web files if (!empty($www_dir)) { $config->set('www_dir', $www_dir, 'default'); } // Manual pages if (!empty($man_dir)) { $config->set('man_dir', $man_dir, 'default'); } // Downloaded files if (!empty($download_dir)) { $config->set('download_dir', $download_dir, 'default'); } // Temporary files if (!empty($temp_dir)) { $config->set('temp_dir', $temp_dir, 'default'); } // Documentation files if (!empty($doc_dir)) { $config->set('doc_dir', $doc_dir, 'default'); } // Data files if (!empty($data_dir)) { $config->set('data_dir', $data_dir, 'default'); } // Unit tests if (!empty($test_dir)) { $config->set('test_dir', $test_dir, 'default'); } // User supplied a dir prefix if (!empty($with_dir)) { $ds = DIRECTORY_SEPARATOR; $config->set('php_dir', $with_dir, 'default'); // Metadata if (!empty($metadata_dir)) { $config->set('metadata_dir', $metadata_dir, 'default'); } if (empty($doc_dir)) { $config->set('doc_dir', $with_dir . $ds . 'doc', 'default'); } if (empty($data_dir)) { $config->set('data_dir', $with_dir . $ds . 'data', 'default'); } if (empty($test_dir)) { $config->set('test_dir', $with_dir . $ds . 'test', 'default'); } if (empty($www_dir)) { $config->set('www_dir', $with_dir . $ds . 'htdocs', 'default'); } if (empty($cfg_dir)) { $config->set('cfg_dir', $with_dir . $ds . 'cfg', 'default'); } if (empty($man_dir)) { $config->set('man_dir', $with_dir . $ds . 'local' . $ds . 'man', 'default'); } if (!is_writable($config->get('cache_dir'))) { include_once 'System.php'; $cdir = System::mktemp(array('-d', 'pear')); if (PEAR::isError($cdir)) { $ui->outputData("[PEAR] cannot make new temporary directory: " . $cdir); die(1); } $oldcachedir = $config->get('cache_dir'); $config->set('cache_dir', $cdir); } } // PHP executable if (!empty($php_bin)) { $config->set('php_bin', $php_bin); } // PHP prefix if (isset($prefix)) { if ($prefix != 'a') { if ($prefix[0] == 'a') { $prefix = substr($prefix, 1); } $config->set('php_prefix', $prefix, 'system'); } } // PHP suffix if (isset($suffix)) { if ($suffix != 'a') { if ($suffix[0] == 'a') { $suffix = substr($suffix, 1); } $config->set('php_suffix', $suffix, 'system'); } } /* Print PEAR Conf (useful for debugging do NOT REMOVE) */ if ($debug) { sort($keys); foreach ($keys as $key) { echo $key . ' ' . $config->getPrompt($key) . ": " . $config->get($key, null, 'default') . "\n"; } if ($debug == 2) { // extreme debugging exit; } } // end print $php_dir = $config->get('php_dir'); $options = array(); $options['upgrade'] = true; $install_root = getenv('INSTALL_ROOT'); if (!empty($install_root)) { $options['packagingroot'] = $install_root; $reg = new PEAR_Registry($options['packagingroot'], false, false, $metadata_dir); } else { $reg = $config->getRegistry('default'); } $ui = PEAR_Frontend::singleton('PEAR_Frontend_CLI'); if (PEAR::isError($ui)) { die($ui->getMessage()); } $installer = new PEAR_Installer($ui); $pkg = new PEAR_PackageFile($config, $debug); foreach ($install_files as $package => $instfile) { $info = $pkg->fromAnyFile($instfile, PEAR_VALIDATE_INSTALLING); if (PEAR::isError($info)) { if (is_array($info->getUserInfo())) { foreach ($info->getUserInfo() as $err) { $ui->outputData(sprintf("[PEAR] %s: %s", $package, $err['message'])); } } $ui->outputData(sprintf("[PEAR] %s: %s", $package, $info->getMessage())); continue; } $new_ver = $info->getVersion(); $downloaderpackage = new PEAR_Downloader_Package($installer); $err = $downloaderpackage->initialize($instfile); if (PEAR::isError($err)) { $ui->outputData(sprintf("[PEAR] %s: %s", $package, $err->getMessage())); continue; } if ($reg->packageExists($package)) { $old_ver = $reg->packageInfo($package, 'version'); if (version_compare($new_ver, $old_ver, 'gt')) { $installer->setOptions($options); $dp = array($downloaderpackage); $installer->setDownloadedPackages($dp); $err = $installer->install($downloaderpackage, $options); if (PEAR::isError($err)) { $ui->outputData(sprintf("[PEAR] %s: %s", $package, $err->getMessage())); continue; } $ui->outputData(sprintf("[PEAR] %-15s- upgraded: %s", $package, $new_ver)); } else { if ($force) { $options['force'] = true; $installer->setOptions($options); $dp = array($downloaderpackage); $installer->setDownloadedPackages($dp); $err = $installer->install($downloaderpackage, $options); if (PEAR::isError($err)) { $ui->outputData(sprintf("[PEAR] %s: %s", $package, $err->getMessage())); continue; } $ui->outputData(sprintf("[PEAR] %-15s- installed: %s", $package, $new_ver)); } else { $ui->outputData(sprintf("[PEAR] %-15s- already installed: %s", $package, $old_ver)); } } } else { $options['nodeps'] = true; $installer->setOptions($options); $dp = array($downloaderpackage); $installer->setDownloadedPackages($dp); $err = $installer->install($downloaderpackage, $options); if (PEAR::isError($err)) { $ui->outputData(sprintf("[PEAR] %s: %s", $package, $err->getMessage())); continue; } $ui->outputData(sprintf("[PEAR] %-15s- installed: %s", $package, $new_ver)); } if ($package == 'PEAR') { if (is_file($ufile = $config->getConfFile('user'))) { $ui->outputData('Warning! a PEAR user config file already exists from ' . 'a previous PEAR installation at ' . "'$ufile'. You may probably want to remove it."); } $config->set('verbose', 1, 'default'); if (isset($oldcachedir)) { $config->set('cache_dir', $oldcachedir); } $data = array(); foreach ($config->getKeys() as $key) { $data[$key] = $config->get($key); } $cnf_file = $config->getConfFile('system'); if (!empty($install_root)) { $cnf_file = $install_root . DIRECTORY_SEPARATOR . $cnf_file; } $config->writeConfigFile($cnf_file, 'system', $data); $ui->outputData('Wrote PEAR system config file at: ' . $cnf_file); $ui->outputData('You may want to add: ' . $config->get('php_dir') . ' to your php.ini include_path'); } } ?> php-pear-1.10.1+submodules+notgz/install-pear.txt000066400000000000000000000014431262614675700217770ustar00rootroot00000000000000+----------------------------------------------------------------------+ | The installation process is incomplete. The following resources were | | not installed: | | | | Self-contained Extension Support | | PEAR: PHP Extension and Application Repository | | | | To install these components, become the superuser and execute: | | | | # make install-su | +----------------------------------------------------------------------+ php-pear-1.10.1+submodules+notgz/make-command-xml.php000077500000000000000000000050121262614675700225020ustar00rootroot00000000000000.xml file from its php file * Outputs the XML to stdout. */ echo "Starting the XML generation process\n\n"; // Name of the command, eg 'Remote' for Remote.php's XML output $dir = 'PEAR/Command/'; foreach (scandir($dir) as $file) { $file = explode('.', $file); if (isset($file[1]) && $file[1] === 'php' && $file[0] != 'Common') { echo "Generating XML for " . $file[0] . " \n"; generateXML($file[0]); } } echo "\nDone.\n"; function generateXML($name) { $file = 'PEAR/Command/' . $name . '.php'; if (!file_exists($file)) { die('File '.$file.' doesn\'t exist, perhaps '.$name.' is not a valid command name.'); } require_once $file; $cmd_name = 'PEAR_Command_' . $name; $a = 't'; $cmd = new $cmd_name($a, $a); $xml = ''."\n"; foreach ($cmd->commands as $command => $docs) { $command = htmlentities($command, ENT_QUOTES, 'UTF-8'); $xml .= ' <'.$command.'>'."\n"; $xml .= ' '.htmlentities($docs['summary'], ENT_QUOTES, 'UTF-8', false)."\n"; $xml .= ' '.htmlentities($docs['function'], ENT_QUOTES, 'UTF-8', false)."\n"; $xml .= ' '.htmlentities($docs['shortcut'], ENT_QUOTES, 'UTF-8', false)."\n"; if (count($docs['options']) === 0) { $xml .= " \n"; } else { $xml .= " \n"; foreach($docs['options'] as $option => $opt_docs) { $option = htmlentities($option, ENT_QUOTES, 'UTF-8', false); $xml .= ' <'.$option.'>'."\n"; $xml .= ' '; if (isset($opt_docs['shortopt'])) { $xml .= htmlentities($opt_docs['shortopt'], ENT_QUOTES, 'UTF-8', false); } $xml .= "\n"; $xml .= ' '.htmlentities($opt_docs['doc'], ENT_QUOTES, 'UTF-8', false)."\n"; if (isset($opt_docs['arg']) && $opt_docs['arg'] != '') { $xml .= ' '.htmlentities($opt_docs['arg'], ENT_QUOTES, 'UTF-8', false)."\n"; } $xml .= ' '."\n"; } $xml .= " \n"; } $xml .= ' '.htmlentities($docs['doc'], ENT_QUOTES, 'UTF-8', false)."\n"; $xml .= ' '."\n"; } $xml .= ''; file_put_contents('PEAR/Command/' . $name . '.xml', $xml); } php-pear-1.10.1+submodules+notgz/make-gopear-phar.php000066400000000000000000000162301262614675700224740ustar00rootroot00000000000000 * $ pear download -Z PEAR Archive_Tar Console_Getopt Structures_Graph XML_Util * $ mkdir src && cd src * $ for i in ../*.tar; do tar xvf $i; done * $ mv *\/* . * * * finally, run this script using PHP 5.1's cli php in the main directory * * @category pear * @package PEAR * @author Greg Beaver * @copyright 2005-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License */ error_reporting(error_reporting() & ~E_STRICT & ~E_DEPRECATED); function replaceVersion($contents, $path) { return str_replace(array('@PEAR-VER@', '@package_version@'), $GLOBALS['pearver'], $contents); } $peardir = dirname(__FILE__); $srcdir = dirname(__FILE__) . '/go-pear-tarballs/src/'; $outputFile = 'go-pear.phar'; $dp = @scandir($peardir . '/go-pear-tarballs'); if ($dp === false) { die("while locating packages to install: opendir('" . $peardir . "/go-pear-tarballs') failed\n"); } $packages = array(); foreach ($dp as $entry) { if ($entry{0} == '.' || !in_array(substr($entry, -4), array('.tar'))) { continue; } $packages[] = $entry; } $y = array(); foreach (explode(PATH_SEPARATOR, get_include_path()) as $path) { if ($path == '.') { continue; } $y[] = $path; } // remove current dir, we will otherwise include SVN files, which is not good set_include_path(implode(PATH_SEPARATOR, $y)); require_once 'PEAR/PackageFile.php'; require_once 'PEAR/Config.php'; require_once 'PHP/Archive/Creator.php'; $config = &PEAR_Config::singleton(); chdir($peardir); $pkg = new PEAR_PackageFile($config); $pf = $pkg->fromPackageFile($peardir . DIRECTORY_SEPARATOR . 'package2.xml', PEAR_VALIDATE_NORMAL); if (PEAR::isError($pf)) { foreach ($pf->getUserInfo() as $warn) { echo $warn['message'] . "\n"; } die($pf->getMessage()); } $pearver = $pf->getVersion(); $creator = new PHP_Archive_Creator('index.php', $outputFile); // no compression $creator->useDefaultFrontController('PEAR.php'); $creator->useSHA1Signature(); foreach ($packages as $package) { echo "adding PEAR/go-pear-tarballs/$package\n"; $creator->addFile("go-pear-tarballs/$package", "PEAR/go-pear-tarballs/$package"); } $commandcontents = file_get_contents(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'go-pear-phar.php'); $commandcontents = str_replace('require_once \'', 'require_once \'phar://' . $outputFile . '/', $commandcontents); $creator->addString($commandcontents, 'index.php'); $commandcontents = file_get_contents(dirname(__FILE__) . DIRECTORY_SEPARATOR . '/PEAR/Frontend.php'); $commandcontents = str_replace( array( "\$file = str_replace('_', '/', \$uiclass) . '.php';" ), array( "\$file = 'phar://" . $outputFile . "/' . str_replace('_', '/', \$uiclass) . '.php';" ), $commandcontents); $commandcontents = replaceVersion($commandcontents, ''); $creator->addString($commandcontents, 'PEAR/Frontend.php'); $commandcontents = file_get_contents(dirname(__FILE__) . DIRECTORY_SEPARATOR . '/PEAR/PackageFile/v2.php'); $commandcontents = str_replace( array( '$fp = @fopen("PEAR/Task/$taskfile.php", \'r\', true);', ), array( '$fp = @fopen("phar://' . $outputFile . '/PEAR/Task/$taskfile.php", \'r\', true);' ), $commandcontents); $commandcontents = replaceVersion($commandcontents, ''); $commandcontents = $creator->tokenMagicRequire($commandcontents, 'a.php'); $creator->addString($commandcontents, 'PEAR/PackageFile/v2.php'); $creator->addMagicRequireCallback(array($creator, 'limitedSmartMagicRequire')); $creator->addMagicRequireCallback('replaceVersion'); $creator->addFile($peardir . '/PEAR/Command.php', 'PEAR/Command.php'); $creator->clearMagicRequire(); $creator->addMagicRequireCallback(array($creator, 'tokenMagicRequire')); $creator->addMagicRequireCallback('replaceVersion'); $creator->addDir($peardir . DIRECTORY_SEPARATOR . 'PEAR', array(), array( '*PEAR/Dependency2.php', '*PEAR/PackageFile/Generator/v1.php', '*PEAR/PackageFile/Generator/v2.php', '*PEAR/PackageFile/v2/Validator.php', '*PEAR/Downloader/Package.php', '*PEAR/Installer/Role.php', '*PEAR/ChannelFile/Parser.php', '*PEAR/Command/Install.xml', '*PEAR/Command/Install.php', '*PEAR/Downloader/Package.php', '*PEAR/Frontend/CLI.php', '*PEAR/Installer/Role/Common.php', '*PEAR/Installer/Role/Data.php', '*PEAR/Installer/Role/Doc.php', '*PEAR/Installer/Role/Php.php', '*PEAR/Installer/Role/Script.php', '*PEAR/Installer/Role/Test.php', '*PEAR/Installer/Role/Data.xml', '*PEAR/Installer/Role/Doc.xml', '*PEAR/Installer/Role/Php.xml', '*PEAR/Installer/Role/Script.xml', '*PEAR/Installer/Role/Test.xml', '*PEAR/PackageFile.php', '*PEAR/PackageFile/v1.php', '*PEAR/PackageFile/Parser/v1.php', '*PEAR/PackageFile/Parser/v2.php', '*PEAR/PackageFile/Generator/v1.php', '*PEAR/REST.php', '*PEAR/REST/10.php', '*PEAR/Task/Common.php', '*PEAR/Task/Postinstallscript.php', '*PEAR/Task/Postinstallscript/rw.php', '*PEAR/Task/Replace.php', '*PEAR/Task/Replace/rw.php', '*PEAR/Task/Windowseol.php', '*PEAR/Task/Windowseol/rw.php', '*PEAR/Task/Unixeol.php', '*PEAR/Task/Unixeol/rw.php', '*PEAR/Validator/PECL.php', '*PEAR/ChannelFile.php', '*PEAR/Command/Common.php', '*PEAR/Common.php', '*PEAR/Config.php', '*PEAR/Dependency2.php', '*PEAR/DependencyDB.php', '*PEAR/Downloader.php', '*PEAR/ErrorStack.php', '*PEAR/Installer.php', '*PEAR/Registry.php', '*PEAR/Remote.php', '*PEAR/Start.php', '*PEAR/Start/CLI.php', '*PEAR/Validate.php', '*PEAR/XMLParser.php', ), false, $peardir); $creator->addFile($peardir . DIRECTORY_SEPARATOR . 'PEAR.php', 'PEAR.php'); $creator->addFile($peardir . DIRECTORY_SEPARATOR . 'System.php', 'System.php'); $creator->addFile($peardir . DIRECTORY_SEPARATOR . 'OS/Guess.php', 'OS/Guess.php'); $creator->addFile($srcdir . DIRECTORY_SEPARATOR . 'Archive/Tar.php', 'Archive/Tar.php'); $creator->addFile($srcdir . DIRECTORY_SEPARATOR . 'XML/Util.php', 'XML/Util.php'); $creator->addFile($srcdir . DIRECTORY_SEPARATOR . 'Console/Getopt.php', 'Console/Getopt.php'); $creator->addFile($srcdir . DIRECTORY_SEPARATOR . 'Structures/Graph.php', 'Structures/Graph.php'); $creator->addFile($srcdir . DIRECTORY_SEPARATOR . 'Structures/Graph/Node.php', 'Structures/Graph/Node.php'); $creator->addFile($srcdir . DIRECTORY_SEPARATOR . 'Structures/Graph/Manipulator/AcyclicTest.php', 'Structures/Graph/Manipulator/AcyclicTest.php'); $creator->addFile($srcdir . DIRECTORY_SEPARATOR . 'Structures/Graph/Manipulator/TopologicalSorter.php', 'Structures/Graph/Manipulator/TopologicalSorter.php'); $creator->useSHA1Signature(); $creator->savePhar(dirname(__FILE__) . DIRECTORY_SEPARATOR . $outputFile); php-pear-1.10.1+submodules+notgz/make-installpear-nozlib-phar.php000066400000000000000000000172021262614675700250300ustar00rootroot00000000000000 * $ pear download -Z PEAR Archive_Tar Console_Getopt Structures_Graph XML_Util * $ mkdir src && cd src * $ for i in ../*.tar; do tar xvf $i; done * $ mv *\/* . * * * finally, run this script using PHP 5.1's cli php in the main directory * * @category pear * @package PEAR * @author Greg Beaver * @copyright 2005-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License */ error_reporting(error_reporting() & ~E_STRICT & ~E_DEPRECATED); function replaceVersion($contents, $path) { return str_replace(array('@PEAR-VER@', '@package_version@'), $GLOBALS['pearver'], $contents); } $peardir = dirname(__FILE__); $srcdir = dirname(__FILE__) . '/go-pear-tarballs/src/'; $outputFile = 'install-pear-nozlib.phar'; $dp = @scandir($peardir . '/go-pear-tarballs'); if ($dp === false) { die("while locating packages to install: opendir('" . $peardir . "/go-pear-tarballs') failed\n"); } $packages = array(); foreach ($dp as $entry) { if ($entry{0} == '.' || !in_array(substr($entry, -4), array('.tar'))) { continue; } preg_match('/([A-Za-z0-9_:]+)-.*?\.tar$/', $entry, $matches); if ($matches[1] == 'PEAR') { $pearentry = $entry; continue; } $packages[$matches[1]] = $entry; } $packages['PEAR'] = $pearentry; $y = array(); foreach (explode(PATH_SEPARATOR, get_include_path()) as $path) { if ($path == '.') { continue; } $y[] = $path; } // remove current dir, we will otherwise include SVN files, which is not good set_include_path(implode(PATH_SEPARATOR, $y)); require_once 'PEAR/PackageFile.php'; require_once 'PEAR/Config.php'; require_once 'PHP/Archive/Creator.php'; $config = &PEAR_Config::singleton(); chdir($peardir); $pkg = new PEAR_PackageFile($config); $pf = $pkg->fromPackageFile($peardir . DIRECTORY_SEPARATOR . 'package2.xml', PEAR_VALIDATE_NORMAL); if (PEAR::isError($pf)) { foreach ($pf->getUserInfo() as $warn) { echo $warn['message'] . "\n"; } die($pf->getMessage()); } $pearver = $pf->getVersion(); $creator = new PHP_Archive_Creator('index.php', $outputFile); // no compression $creator->useDefaultFrontController('PEAR.php'); $creator->useSHA1Signature(); $install_files = '$install_files = array('; foreach ($packages as $name => $package) { echo "$name => $package\n"; $install_files .= "'$name' => 'phar://" . $outputFile . "/$package'," . "\n"; $creator->addFile("go-pear-tarballs/$package", "$package"); } $install_files .= ');'; echo "install_files is $install_files"; $commandcontents = file_get_contents(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'install-pear.php'); $commandcontents = str_replace( array( 'include_once \'', '$install_files = array();' ), array( 'include_once \'phar://' . $outputFile . '/', $install_files ), $commandcontents); $creator->addString($commandcontents, 'index.php'); $commandcontents = file_get_contents(dirname(__FILE__) . DIRECTORY_SEPARATOR . '/PEAR/Frontend.php'); $commandcontents = str_replace( array( "\$file = str_replace('_', '/', \$uiclass) . '.php';" ), array( "\$file = 'phar://" . $outputFile . "/' . str_replace('_', '/', \$uiclass) . '.php';" ), $commandcontents); $commandcontents = replaceVersion($commandcontents, ''); $creator->addString($commandcontents, 'PEAR/Frontend.php'); $commandcontents = file_get_contents(dirname(__FILE__) . DIRECTORY_SEPARATOR . '/PEAR/PackageFile/v2.php'); $commandcontents = str_replace( array( '$fp = @fopen("PEAR/Task/$taskfile.php", \'r\', true);', ), array( '$fp = @fopen("phar://' . $outputFile . '/PEAR/Task/$taskfile.php", \'r\', true);' ), $commandcontents); $commandcontents = replaceVersion($commandcontents, ''); $commandcontents = $creator->tokenMagicRequire($commandcontents, 'a.php'); $creator->addString($commandcontents, 'PEAR/PackageFile/v2.php'); $creator->addMagicRequireCallback(array($creator, 'limitedSmartMagicRequire')); $creator->addMagicRequireCallback('replaceVersion'); $creator->addFile($peardir . '/PEAR/Command.php', 'PEAR/Command.php'); $creator->clearMagicRequire(); $creator->addMagicRequireCallback(array($creator, 'tokenMagicRequire')); $creator->addMagicRequireCallback('replaceVersion'); $creator->addDir($peardir . DIRECTORY_SEPARATOR . 'PEAR', array(), array( '*PEAR/Dependency2.php', '*PEAR/PackageFile/Generator/v1.php', '*PEAR/PackageFile/Generator/v2.php', '*PEAR/PackageFile/v2/Validator.php', '*PEAR/Downloader/Package.php', '*PEAR/Installer/Role.php', '*PEAR/ChannelFile/Parser.php', '*PEAR/Command/Install.xml', '*PEAR/Command/Install.php', '*PEAR/Downloader/Package.php', '*PEAR/Frontend/CLI.php', '*PEAR/Installer/Role/Common.php', '*PEAR/Installer/Role/Data.php', '*PEAR/Installer/Role/Doc.php', '*PEAR/Installer/Role/Php.php', '*PEAR/Installer/Role/Script.php', '*PEAR/Installer/Role/Test.php', '*PEAR/Installer/Role/Data.xml', '*PEAR/Installer/Role/Doc.xml', '*PEAR/Installer/Role/Php.xml', '*PEAR/Installer/Role/Script.xml', '*PEAR/Installer/Role/Test.xml', '*PEAR/PackageFile.php', '*PEAR/PackageFile/v1.php', '*PEAR/PackageFile/Parser/v1.php', '*PEAR/PackageFile/Parser/v2.php', '*PEAR/PackageFile/Generator/v1.php', '*PEAR/REST.php', '*PEAR/REST/10.php', '*PEAR/Task/Common.php', '*PEAR/Task/Postinstallscript.php', '*PEAR/Task/Postinstallscript/rw.php', '*PEAR/Task/Replace.php', '*PEAR/Task/Replace/rw.php', '*PEAR/Task/Windowseol.php', '*PEAR/Task/Windowseol/rw.php', '*PEAR/Task/Unixeol.php', '*PEAR/Task/Unixeol/rw.php', '*PEAR/Validator/PECL.php', '*PEAR/ChannelFile.php', '*PEAR/Command/Common.php', '*PEAR/Common.php', '*PEAR/Config.php', '*PEAR/Dependency2.php', '*PEAR/DependencyDB.php', '*PEAR/Downloader.php', '*PEAR/ErrorStack.php', '*PEAR/Installer.php', '*PEAR/Registry.php', '*PEAR/Remote.php', '*PEAR/Start.php', '*PEAR/Start/CLI.php', '*PEAR/Validate.php', '*PEAR/XMLParser.php', ), false, $peardir); $creator->addFile($peardir . DIRECTORY_SEPARATOR . 'PEAR.php', 'PEAR.php'); $creator->addFile($peardir . DIRECTORY_SEPARATOR . 'System.php', 'System.php'); $creator->addFile($peardir . DIRECTORY_SEPARATOR . 'OS/Guess.php', 'OS/Guess.php'); $creator->addFile($srcdir . DIRECTORY_SEPARATOR . 'Archive/Tar.php', 'Archive/Tar.php'); $creator->addFile($srcdir . DIRECTORY_SEPARATOR . 'XML/Util.php', 'XML/Util.php'); $creator->addFile($srcdir . DIRECTORY_SEPARATOR . 'Console/Getopt.php', 'Console/Getopt.php'); $creator->addFile($srcdir . DIRECTORY_SEPARATOR . 'Structures/Graph.php', 'Structures/Graph.php'); $creator->addFile($srcdir . DIRECTORY_SEPARATOR . 'Structures/Graph/Node.php', 'Structures/Graph/Node.php'); $creator->addFile($srcdir . DIRECTORY_SEPARATOR . 'Structures/Graph/Manipulator/AcyclicTest.php', 'Structures/Graph/Manipulator/AcyclicTest.php'); $creator->addFile($srcdir . DIRECTORY_SEPARATOR . 'Structures/Graph/Manipulator/TopologicalSorter.php', 'Structures/Graph/Manipulator/TopologicalSorter.php'); $creator->useSHA1Signature(); $creator->savePhar(dirname(__FILE__) . DIRECTORY_SEPARATOR . $outputFile); php-pear-1.10.1+submodules+notgz/make-pear-bundle.php000066400000000000000000000102021262614675700224560ustar00rootroot00000000000000#!/usr/bin/php "1.5.1", "Console_Getopt" => "1.2.1", "Archive_Tar" => "1.3.2", "Structures_Graph" => "1.0.2", // required packages for the web frontend "PEAR_Frontend_Web" => "0.5.1", "HTML_Template_IT" => "1.1.4", "Net_UserAgent_Detect" => "2.0.1", ); /* download the packages into the destination */ echo "Fetching packages\n"; foreach ($packages as $name => $version) { $filename = "$name-$version.tgz"; $destfilename = "$dist_dir/PEAR/go-pear-bundle/$filename"; if (file_exists($destfilename)) continue; $url = "http://pear.php.net/get/$filename"; echo "Downloading $name from $url\n"; flush(); copy($url, $destfilename); } echo "Download complete. Extracting bootstrap files\n"; /* Now, we want PEAR.php, Getopt.php (Console_Getopt) and Tar.php (Archive_Tar) * broken out of the tarballs */ extract_file_from_tarball('PEAR', 'PEAR.php', "$dist_dir/PEAR/go-pear-bundle"); extract_file_from_tarball('Archive_Tar', 'Archive/Tar.php', "$dist_dir/PEAR/go-pear-bundle"); extract_file_from_tarball('Console_Getopt', 'Console/Getopt.php', "$dist_dir/PEAR/go-pear-bundle"); extract_file_from_tarball('Structures_Graph', 'Structures/Graph.php', "$dist_dir/PEAR/go-pear-bundle"); extract_file_from_tarball('Structures_Graph', 'Structures/Graph/Node.php', "$dist_dir/PEAR/go-pear-bundle"); extract_file_from_tarball('Structures_Graph', 'Structures/Graph/Manipulator/AcyclicTest.php', "$dist_dir/PEAR/go-pear-bundle"); extract_file_from_tarball('Structures_Graph', 'Structures/Graph/Manipulator/TopologicalSorter.php', "$dist_dir/PEAR/go-pear-bundle"); ?>php-pear-1.10.1+submodules+notgz/man1/000077500000000000000000000000001262614675700174755ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/man1/pear.1000066400000000000000000000115611262614675700205120ustar00rootroot00000000000000.TH PEAR 1 "2013" "The PEAR Group" "User commands" .SH NAME pear, pecl, peardev \- PEAR installer .SH SYNOPSIS .B pear [ options ] command [command-options] .LP .B pecl [ options ] command [command-options] .LP .B peardev [ options ] command [command-options] .LP .SH DESCRIPTION \fBPEAR\fP is the PHP Extension and Application Repository, found at .B http://pear.php.net. .P .P The \fBpear\fP command is used to install PEAR extensions. .P The \fBpecl\fP command is used to install PECL extensions. .P The \fBpeardev\fP command is a wrapper for the \fBpear\fP command which removes the normal configured memory limit. .SH OPTIONS .TP 15 .B \-v increase verbosity level (default 1) .TP .B \-q be quiet, decrease verbosity level .TP .B \-c \fIfile\fP find user configuration in \fBfile\fP .TP .B \-C \fIfile\fP find system configuration in \fBfile\fP .TP .B \-d \fIfoo=bar\fP set user config variable \fBfoo\fP to \fBbar\fP .TP .B \-D \fIfoo=bar\fP set system config variable \fBfoo\fP to \fBbar\fP .TP .B \-G start in graphical (Gtk) mode .TP .B \-S store system configuration .TP .B \-s store user configuration .TP .B \-y \fIfoo\fP unset .B foo in the user configuration .TP .B \-V version information .TP .PD 0 .B \-h .TP .PD 1 .B \-? display help/usage .SH COMMANDS .TP 15 .B build Build an Extension From C Source .TP .B bundle Unpacks a Pecl Package .TP .B channel-add Add a Channel .TP .B channel-alias Specify an alias to a channel name .TP .B channel-delete Remove a Channel From the List .TP .B channel-discover Initialize a Channel from its server .TP .B channel-info Retrieve Information on a Channel .TP .TP .B channel-login Connects and authenticates to remote channel server .TP .B channel-logout Logs out from the remote channel server .TP .B channel-update Update an Existing Channel .TP .B clear-cache Clear Web Services Cache .TP .B config-create Create a Default configuration file .TP .B config-get Show One Setting .TP .B config-help Show Information About Setting .TP .B config-set Change Setting .TP .B config-show Show All Settings .TP .B convert Convert a package.xml 1.0 to package.xml 2.0 format .TP .B cvsdiff Run a "cvs diff" for all files in a package .TP .B cvstag Set CVS Release Tag .TP .B download Download Package .TP .B download-all Downloads each available package from the default channel .TP .B info Display information about a package .TP .B install Install Package .TP .B list List Installed Packages In The Default Channel .TP .B list-all List All Packages .TP .B list-channels List Available Channels .TP .B list-files List Files In Installed Package .TP .B list-upgrades List Available Upgrades .TP .B login Connects and authenticates to remote server [Deprecated in favor of channel-login] .TP .B logout Logs out from the remote server [Deprecated in favor of channel-logout] .TP .B make-rpm-spec Builds an RPM spec file from a PEAR package .TP .B makerpm Builds an RPM spec file from a PEAR package .TP .B package Build Package .TP .B package-dependencies Show package dependencies .TP .B package-validate Validate Package Consistency .TP .B pickle Build PECL Package .TP .B remote-info Information About Remote Packages .TP .B remote-list List Remote Packages .TP .B run-scripts Run Post-Install Scripts bundled with a package .TP .B run-tests Run Regression Tests .TP .B search Search remote package database .TP .B shell-test Shell Script Test .TP .B sign Sign a package distribution file .TP .B svntag Set SVN Release Tag .TP .B uninstall Un-install Package .TP .B update-channels Update the Channel List .TP .B upgrade Upgrade Package .TP .B upgrade-all Upgrade All Packages [Deprecated in favor of calling upgrade with no parameters] .SH FILES .TP 15 .B /etc/pear.conf The system configuration file. .TP .B $HOME/.pearrc The user configuration. .SH SEE ALSO .TP To list all options, use .PS pear help options .TP To list all command shortcuts, use .PS pear help shortcuts .TP to get the help for the specified command, use .PS pear help \fIcommand\fP .TP Documentation for PEAR can be found at .PD 0 .P .B http://pear.php.net/manual/ .SH VERSION INFORMATION This manpage describes \fBPEAR\fP, version @package_version@. .SH COPYRIGHT Copyright \(co 1997\-2009 Stig Bakken, Gregory Beaver, Helgi Þormar Þorbjörnsson, Tomas V.V.Cox, Martin Jansen. .P All rights reserved. .P Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: .P * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. .P * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. .SH BUGS You can view the list of known bugs or report any new bug you found at: .PD 0 .P .B http://pear.php.net/bugs/ php-pear-1.10.1+submodules+notgz/man1/peardev.1000066400000000000000000000000211262614675700211760ustar00rootroot00000000000000.so man1/pear.1 php-pear-1.10.1+submodules+notgz/man1/pecl.1000066400000000000000000000000211262614675700204730ustar00rootroot00000000000000.so man1/pear.1 php-pear-1.10.1+submodules+notgz/man5/000077500000000000000000000000001262614675700175015ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/man5/pear.conf.5000066400000000000000000000024211262614675700214410ustar00rootroot00000000000000.TH PEAR.CONF 5 "2013" "File Formats" .SH NAME .B pear.conf \- configuration file for \fBPEAR\fR applications. .SH DESCRIPTION The \fBpear.conf\fP is used by \fBPEAR\fR applications to store their configuration. This file should not be edited. .P The \fBpear\fR command provides the \fBconfig-show\fR, \fBconfig-get\fR and \fBconfig-set\fR sub-commands needed to change the configuration. .SH FILES .TP 15 .B /etc/pear.conf The system configuration file. .TP .B $HOME/.pearrc The user configuration file. .SH SEE ALSO .B pear(1) .SH COPYRIGHT .PD 0 Copyright \(co 1997\-2009 Stig Bakken, Gregory Beaver, Helgi Þormar Þorbjörnsson, Tomas V.V.Cox, Martin Jansen. .P All rights reserved. .P Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: .P * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. .P * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. .SH BUGS You can view the list of known bugs or report any new bug you found at: .PD 0 .P .B http://pear.php.net/bugs/ php-pear-1.10.1+submodules+notgz/package-ErrorStack.xml000066400000000000000000000033701262614675700230360ustar00rootroot00000000000000 PEAR_ErrorStack pear.php.net Stack-based error handling/raising Advanced Error Handling Greg Beaver cellog cellog@php.net yes 2005-08-20 0.8.0 0.8.0 beta beta PHP License Initial release separate from PEAR base package * fix Bug #5018: Notice due api changes in php5.1/php4.4 5.4.0 1.4.0a12 0.8.0 0.8.0 beta beta 2005-05-11 PHP License initial release separate from PEAR base package php-pear-1.10.1+submodules+notgz/package-manpages.xml000066400000000000000000000057771262614675700225670ustar00rootroot00000000000000 PEAR_Manpages pear.php.net PEAR man pages Unix man pages for pear, pecl and peardev commands, and for pear.conf file. Remi Collet remicollet fedora@famillecollet.com no Christian Weiske cweiske cweiske@php.net yes 2015-10-07 1.10.0 1.10.0 stable stable New BSD License No changes to 1.10.0dev2. 5.4.0 1.10.0dev2 windows 2015-07-28 1.10.0dev2 1.10.0 devel devel New BSD License Initial release 2015-10-07 1.10.0 1.10.0 stable stable New BSD License No changes to 1.10.0dev2. php-pear-1.10.1+submodules+notgz/package.dtd000066400000000000000000000064771262614675700207470ustar00rootroot00000000000000 php-pear-1.10.1+submodules+notgz/package2.xml000066400000000000000000001372541262614675700210540ustar00rootroot00000000000000 PEAR pear.php.net PEAR Base System The PEAR package contains: * the PEAR installer, for creating, distributing and installing packages * the PEAR_Exception PHP5 error handling mechanism * the 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 of common operations with files and directories * the PEAR base class Features in a nutshell: * full support for channels * pre-download dependency validation * new package.xml 2.0 format allows tremendous flexibility while maintaining BC * support for optional dependency groups and limited support for sub-packaging * robust dependency support * full dependency validation on uninstall * remote install for hosts with only ftp access - no more problems with restricted host installation * full support for mirroring * support for bundling several packages into a single tarball * support for static dependencies on a url-based package * support for custom file roles and installation tasks Greg Beaver cellog cellog@php.net no Pierre-Alain Joye pajoye pierre@php.net no Stig Bakken ssb stig@php.net no Tomas V.V.Cox cox cox@idecnet.com no Helgi Thormar dufuz dufuz@php.net no Christian Weiske cweiske cweiske@php.net yes Tias Guns tias tias@php.net no Tim Jackson timj timj@php.net no Bertrand Gugger toggg toggg@php.net no Martin Jansen mj mj@php.net no 2015-10-17 1.10.1 1.10.1 stable stable New BSD License * Fix bug #20959: Crash on channel discovery with channel.xml redirect [cweiske] * Fix bug #20968: Incorrect call to __construct() from PEAR() [edlman] * Add legacy constructor for PEAR_Error for backwards compatibility [cweiske] 5.4.0 1.9.0 Archive_Tar pear.php.net 1.4.0 Structures_Graph pear.php.net 1.1.0 1.1.1 Console_Getopt pear.php.net 1.4.1 1.4.1 XML_Util pear.php.net 1.3.0 1.3.0 PEAR_Frontend_Web pear.php.net 0.4 PEAR_Frontend_Gtk pear.php.net 0.4.0 0.4.0 xml pcre PEAR_Frontend_Web pear.php.net 0.5.1 PEAR_Frontend_Gtk pear.php.net 0.4.0 PEAR_Frontend_Gtk2 pear.php.net windows 1.8.0alpha1 1.8.0 alpha stable 2009-03-09 New BSD License * Implement Request #10373: if pref_state=stable and installed package=beta, allow up to latest beta version [dufuz] * Implement Request #10581: login / logout should map to channel-login / channel-logout [dufuz] * Implement Request #10825: Only display the "invalid or missing package file"-error if it makes sense [dufuz] * Implement Request #11170: script to generate Command/[command].xml [dufuz] * Implement Request #11176: improve channel ... has updated its protocols message [dufuz] * Implement Request #12706: pear list -a hard to read [dufuz] * Implement Request #11353: upgrade-all and upgrade commands to upgrade within the same stability level [dufuz] * Implement Request #13015: Add https discovery for channel.xml [dufuz / initial patch by Martin Roos] * Implement Request #13927: install-pear.php should have option to set www_dir [timj] * Implement Request #14324: Make the pear install command behave similar to apt-get [dufuz] * Implement Request #14325: make pear upgrade with no params behave like pear upgrade-all [dufuz] - upgrade-all can be considered deprecated in favor of calling upgrade with no parameters to replicate better what other package managers are doing. upgrade-all will still work as intended. * Implement Request #14504: add a channel parameter support to the upgrade function [dufuz] - Options -c ezc and --channel=ezc got added to upgrade and upgrade-all to allow for channel specific upgrades * Implement Request #14556: install-pear-nozlib.phar should get download_dir config and other options [cweiske] * Implement Request #15566: Add doc.php.net as a default channel [dufuz / saltybeagle] * Fix PHP Bug #43857: --program-suffix not always reflected everywhere [cellog] * Fix PHP Bug #47323: strotime warnings in make install [dufuz] * Fix Bug #13908: pear info command and maintainers inactive not mentioned [dufuz] * Fix Bug #13926: install-pear.php does not set cfg_dir if -d option set with no -c option [timj] * Fix Bug #13943: tests fail when php.exe path contains spaces [dufuz / jorrit] * Fix Bug #13953: config-set/config-show with channel alias fail [cellog] * Fix Bug #13958: When a phpt tests exit() or die() xdebug coverage is not generated, patch by izi (David Jean Louis) [izi / dufuz] * Fix Bug #14041: Unpredictable unit test processing sequence [dufuz] * Fix Bug #14140: Strict warning not suppressed in the shutdown function [dufuz] * Fix Bug #14210: pear list -ia brings warnings [dufuz] * Fix Bug #14274: PEAR packager mangles package.xml encoding, then complains about it [dufuz] * Fix Bug #14287: cannot upgrade from stable to beta via -beta when config is set to stable [dufuz] * Fix Bug #14300: Package files themselves can not be served over https [dufuz / initial patch by Martin Roos] * Fix Bug #14437: openbasedir warning when loading config [dufuz] * Fix Bug #14558: PackageFile.php creates tmp directory outside configured temp_dir [cweiske] * Fix Bug #14947: downloadHttp() is missing Host part of the HTTP Request when using Proxy [ifeghali] * Fix Bug #14977: PEAR/Frontend.php doesn't require_once PEAR.php [dufuz] * Fix Bug #15750: Unreachable code in PEAR_Downloader [dufuz] * Fix Bug #15979: Package files incorrectly removed when splitting a package into multiple pkgs [dufuz] * Fix Bug #15914: pear upgrade installs different version if desired version not found [dufuz] NOTE! Functions that have been deprecated for 3+ years in PEAR_Common, please take a moment to migrate over to one of the alternatives that have ben provided: * PEAR_Common->downloadHttp (use PEAR_Downloader->downloadHttp instead) * PEAR_Common->infoFromTgzFile (use PEAR_PackageFile->fromTgzFile instead) * PEAR_Common->infoFromDescriptionFile (use PEAR_PackageFile->fromPackageFile instead) * PEAR_Common->infoFromString (use PEAR_PackageFile->fromXmlstring instead) * PEAR_Common->infoFromArray (use PEAR_PackageFile->fromAnyFile instead) * PEAR_Common->xmlFromInfo (use a PEAR_PackageFile_v* object's generator instead) * PEAR_Common->validatePackageInfo (use the validation of PEAR_PackageFile objects) * PEAR_Common->analyzeSourceCode (use a PEAR_PackageFile_v* object instead) * PEAR_Common->detectDependencies (use PEAR_Downloader_Package->detectDependencies instead) * PEAR_Common->buildProvidesArray (use PEAR_PackageFile_v1->_buildProvidesArray or PEAR_PackageFile_v2_Validator->_buildProvidesArray) PHP 4.4 and 5.1.6 are now the minimum PHP requirements, for brave souls pear upgrade -f PEAR will allow people with lower versions to upgrade to this release but no guarantees will be made that it will work properly. Support for XML RPC channels has been dropped - The only ones that used it (pear.php.net and pecl.php.net) have used the REST interface for years now. SOAP support also removed as it was only proof of concept. Move codebase from the PHP License to New BSD 2 clause license 2009-03-27 1.8.0RC1 1.8.0 beta stable New BSD License * Fix Bug #14331: pear cvstag only works from inside the package directory [dufuz] * Fix Bug #16045: E_Notice: Undefined index: channel in PEAR/DependencyDB.php [dufuz] * Implemented Request #11230: better error message when mirror not in channel.xml file [dufuz] * Implemented Request #13150: Add support for following HTTP 302 redirects [dufuz] 2009-04-10 1.8.0 1.8.0 stable stable New BSD License Changes since RC1: * Fix Bug #14792: Bad md5sum for files with replaced content [dufuz] * Fix Bug #16057:-r is limited to 4 directories in depth [dufuz] * Fix Bug #16077: PEAR5::getStaticProperty does not return a reference to the property [dufuz] Remove custom XML_Util class in favor of using upstream XML_Util package as dependency RC1 Release Notes: * Fix Bug #14331: pear cvstag only works from inside the package directory [dufuz] * Fix Bug #16045: E_Notice: Undefined index: channel in PEAR/DependencyDB.php [dufuz] * Implemented Request #11230: better error message when mirror not in channel.xml file [dufuz] * Implemented Request #13150: Add support for following HTTP 302 redirects [dufuz] Alpha1 Release Notes: * Implement Request #10373: if pref_state=stable and installed package=beta, allow up to latest beta version [dufuz] * Implement Request #10581: login / logout should map to channel-login / channel-logout [dufuz] * Implement Request #10825: Only display the "invalid or missing package file"-error if it makes sense [dufuz] * Implement Request #11170: script to generate Command/[command].xml [dufuz] * Implement Request #11176: improve channel ... has updated its protocols message [dufuz] * Implement Request #12706: pear list -a hard to read [dufuz] * Implement Request #11353: upgrade-all and upgrade commands to upgrade within the same stability level [dufuz] * Implement Request #13015: Add https discovery for channel.xml [dufuz / initial patch by Martin Roos] * Implement Request #13927: install-pear.php should have option to set www_dir [timj] * Implement Request #14324: Make the pear install command behave similar to apt-get [dufuz] * Implement Request #14325: make pear upgrade with no params behave like pear upgrade-all [dufuz] - upgrade-all can be considered deprecated in favor of calling upgrade with no parameters to replicate better what other package managers are doing. upgrade-all will still work as intended. * Implement Request #14504: add a channel parameter support to the upgrade function [dufuz] - Options -c ezc and --channel=ezc got added to upgrade and upgrade-all to allow for channel specific upgrades * Implement Request #14556: install-pear-nozlib.phar should get download_dir config and other options [cweiske] * Implement Request #15566: Add doc.php.net as a default channel [dufuz / saltybeagle] * Fix PHP Bug #43857: --program-suffix not always reflected everywhere [cellog] * Fix PHP Bug #47323: strotime warnings in make install [dufuz] * Fix Bug #13908: pear info command and maintainers inactive not mentioned [dufuz] * Fix Bug #13926: install-pear.php does not set cfg_dir if -d option set with no -c option [timj] * Fix Bug #13943: tests fail when php.exe path contains spaces [dufuz / jorrit] * Fix Bug #13953: config-set/config-show with channel alias fail [cellog] * Fix Bug #13958: When a phpt tests exit() or die() xdebug coverage is not generated, patch by izi (David Jean Louis) [izi / dufuz] * Fix Bug #14041: Unpredictable unit test processing sequence [dufuz] * Fix Bug #14140: Strict warning not suppressed in the shutdown function [dufuz] * Fix Bug #14210: pear list -ia brings warnings [dufuz] * Fix Bug #14274: PEAR packager mangles package.xml encoding, then complains about it [dufuz] * Fix Bug #14287: cannot upgrade from stable to beta via -beta when config is set to stable [dufuz] * Fix Bug #14300: Package files themselves can not be served over https [dufuz / initial patch by Martin Roos] * Fix Bug #14437: openbasedir warning when loading config [dufuz] * Fix Bug #14558: PackageFile.php creates tmp directory outside configured temp_dir [cweiske] * Fix Bug #14947: downloadHttp() is missing Host part of the HTTP Request when using Proxy [ifeghali] * Fix Bug #14977: PEAR/Frontend.php doesn't require_once PEAR.php [dufuz] * Fix Bug #15750: Unreachable code in PEAR_Downloader [dufuz] * Fix Bug #15979: Package files incorrectly removed when splitting a package into multiple pkgs [dufuz] * Fix Bug #15914: pear upgrade installs different version if desired version not found [dufuz] NOTE! Functions that have been deprecated for 3+ years in PEAR_Common, please take a moment to migrate over to one of the alternatives that have ben provided: * PEAR_Common->downloadHttp (use PEAR_Downloader->downloadHttp instead) * PEAR_Common->infoFromTgzFile (use PEAR_PackageFile->fromTgzFile instead) * PEAR_Common->infoFromDescriptionFile (use PEAR_PackageFile->fromPackageFile instead) * PEAR_Common->infoFromString (use PEAR_PackageFile->fromXmlstring instead) * PEAR_Common->infoFromArray (use PEAR_PackageFile->fromAnyFile instead) * PEAR_Common->xmlFromInfo (use a PEAR_PackageFile_v* object's generator instead) * PEAR_Common->validatePackageInfo (use the validation of PEAR_PackageFile objects) * PEAR_Common->analyzeSourceCode (use a PEAR_PackageFile_v* object instead) * PEAR_Common->detectDependencies (use PEAR_Downloader_Package->detectDependencies instead) * PEAR_Common->buildProvidesArray (use PEAR_PackageFile_v1->_buildProvidesArray or PEAR_PackageFile_v2_Validator->_buildProvidesArray) PHP 4.4 and 5.1.6 are now the minimum PHP requirements, for brave souls pear upgrade -f PEAR will allow people with lower versions to upgrade to this release but no guarantees will be made that it will work properly. Support for XML RPC channels has been dropped - The only ones that used it (pear.php.net and pecl.php.net) have used the REST interface for years now. SOAP support also removed as it was only proof of concept. Move codebase from the PHP License to New BSD 2 clause license 2009-04-15 1.8.1 1.8.1 stable stable New BSD License * Fix Bug #16099 PEAR crash on PHP4 (parse error) [dufuz] 2009-08-18 1.9.0RC1 1.9.0RC1 beta stable New BSD License * Implement Request #16213: add alias to list-channels output [dufuz] * Implement Request #16378: pear svntag [dufuz] * Implement Request #16386: PEAR_Config::remove() does not support specifying a channel [timj] * Implement Request #16396: package-dependencies should allow package names [dufuz] * Fix Bug #11181: pear requests channel.xml from main server instead from mirror [dufuz] * Fix Bug #14493: pear install --offline doesn't print out errors [dufuz] * Fix Bug #11348: pear package-dependencies isn't well explained [dufuz] * Fix Bug #16108: PEAR_PackageFile_Generator_v2 PHP4 parse error when running upgrade-all [dufuz] * Fix Bug #16113: Installing certain packages fails due incorrect encoding handling [dufuz] * Fix Bug #16122: PEAR RunTest failed to run as expected [dufuz] * Fix Bug #16366: compiling 5.2.10 leads to non-functioning pear [dufuz] * Fix Bug #16387: channel-logout does not support logging out from a non-default channel [timj] * Fix Bug #16444: Setting preferred mirror fails [dufuz] * Fix the shutdown functions where a index might not exist and thus raise a notice [derick] 2009-08-20 1.9.0RC2 1.9.0RC2 beta stable New BSD License * REST 1.4 file was occasionally being included but REST 1.4 is not intended for this release cycle [dufuz] 2009-08-21 1.9.0RC3 1.9.0RC3 beta stable New BSD License * Improved svntag support to handle packages like PEAR it self [dufuz] 2009-08-23 1.9.0RC4 1.9.0RC4 beta stable New BSD License * Fixed a problem where the original channel could not be set as a preferred_mirror again [dufuz] * Make sure channel aliases can't be made to start with - [dufuz] * Output issues with pear search [dufuz] * Fixed couple of stray notices [dufuz] 2009-09-03 1.9.0 1.9.0 stable stable New BSD License * Fix Bug #16547: The phar for PEAR installer uses ereg() which is deprecated [dufuz] 2010-05-26 1.9.1 1.9.1 stable stable New BSD License * svntag improvements, tag package files passed into the command and better directory checks [dufuz] * rely on Structures_Graph minimum version instead of recommended version [saltybeagle] * Fix Bug #12613: running go-pear.phar from C:\ fails [dufuz] * Fix Bug #14841: Installing pear into directory with space fails [dufuz] * Fix Bug #16644: pear.bat returns syntax error when parenthesis are in install path. [dufuz] [patch by bwaters (Bryan Waters)] * Fix Bug #16767: Use of Depreciated HTML Attributes in the Exception class [dufuz] [patch by fuhrysteve (Stephen J. Fuhry)] * Fix Bug #16864: "pear list-upgrades -i" issues E_WARNINGS [dufuz] [patch by rquadling (Richard Quadling)] * Fix Bug #17220: command `pear help` outputs to stderr instead of stdout [dufuz] * Fix Bug #17234: channel-discover adds port to HTTP Host header [dufuz] * Fix Bug #17292: Code Coverage in PEAR_RunTest does not work with namespaces [sebastian] * Fix Bug #17359: loadExtension() fails over missing dl() when used in multithread env [dufuz] * Fix Bug #17378: pear info $package fails if directory with that name exists [dufuz] 2011-02-28 1.9.2 1.9.2 stable stable New BSD License Important! This is a security fix release. The advisory can be found at http://pear.php.net/advisory-20110228.txt Bugs: * Fixed Bug #17463: Regression: On Windows, svntag [patch by doconnor] * Fixed Bug #17641: pecl-list doesn't sort packages by name [dufuz] * Fixed Bug #17781: invalid argument warning on foreach due to an empty optional dependencie [dufuz] * Fixed Bug #17801: PEAR run-tests wrongly detects php-cgi [patch by David Jean Louis (izi)] * Fixed Bug #17839: pear svntag does not tag package.xml file [dufuz] * Fixed Bug #17986: PEAR Installer cannot handle files moved between packages [dufuz] * Fixed Bug #17997: Strange output if directories are not writeable [dufuz] * Fixed Bug #18001: PEAR/RunTest coverage fails [dufuz] * Fixed Bug #18056 [SECURITY]: Symlink attack in PEAR install [dufuz] * Fixed Bug #18218: "pear package" does not allow the use of late static binding [dufuz and Christer Edvartsen] * Fixed Bug #18238: Wrong return code from "pear help" [till] * Fixed Bug #18308: Broken error message about missing channel validator [yunosh] This feature is implemented as a result of #18056 * Implemented Request #16648: Use TMPDIR for builds instead of /var/tmp [dufuz] 2011-06-04 1.9.3 1.9.2 stable stable New BSD License * Fixed Bug #17744: Empty changelog causes fatal error in setChangelogentry [dufuz] * Fixed Bug #18340: raiseErro typo [doconnor] * Fixed Bug #18349: package.xml version not recognized when single quoted [dufuz] * Fixed Bug #18364: date.timezone errors for sh/bat files when TZ is not set in php.ini [dufuz] * Fixed Bug #18388: Parentheses error in REST.php line 232 [dufuz] * Fixed Bug #18428: invalid preg_match patterns [glen] * Fixed Bug #18486: REST/10.php does not check error condition [dufuz] * Fixed a problem in RunTest and code coverage. Correctly register the code coverage shutdown function in case we are inside a namespace. [sebastian] * Fixed a bug with extensions not providing their config.m4 and co in the root directory of their pecl package but rather in a sub directory, such as xhprof. [dufuz] 2011-07-06 1.9.4 1.9.4 stable stable New BSD License Bug Fixes: * Bug #17350: "pear install --force" doesn't uninstall files from previous pkg versions [dufuz] * Bug #18362: A whitespace TEMP_DIR path breaks install/upgrade functionality [dufuz] * Bug #18440: bad tmp folder path on install : Unable to create path for C:/Program/tmp [dufuz] * Bug #18581: "config-get -c" not returning channel's configuration when using alias [dufuz] * Bug #18639: regression: installing xdebug fails most likely due to another fix [dufuz] Features * All System (the class) functions can now take in spaced paths as long as they are surrounded in quotes. Prior to this it was possible to do that by passing all values in as an array (by product of #18362, #18440) [dufuz] 2014-06-27 1.9.5dev1 1.9.5 devel devel New BSD License Bug fixes: * Fix bug #18343: Entities in file names decoded during packaging [cweiske] * Fix bug #18665: pecl extensions not enabled in empty php.ini files [Louis Opter] * Fix bug #18834: Do not truncate cache file if it is a symlink [avb] * Fix bug #18892: Parse error in Installer.php [ashnazg] * Fix bug #19482: fix pearcmd for include paths with trailing backslash [cweiske] * Fix bug #19793: PHP Notice about ob_end_clean() [cweiske] * Fix bug #20086: Invalid regexp in PEAR_Builder::build() [avb] * Fix bug #20203: split content-type and get real mime type [Samu Voutilainen] * Fix bug #20283: use full path for "zend_extension=..." [cweiske] * Fix bug #20284: Reset interpreter before running --CLEAN-- section php-cgi run [Mats Lindh] * Fix bug #20285: fix spelling mistakes [Veres Lajos] * Fix bug #20286: Support access of static variables on objects in validator [cweiske] * Fix bug #20321: Correctly detect name of current user during installation [cweiske] * Fix bug: let pear run-tests fail when there are failed tests [cweiske] * Prepare a test for bug #18056 / bug #18834 [avb] 2014-07-12 1.9.5 1.9.5 stable stable New BSD License No changes since 1.9.5.dev1. Bug fixes in 1.9.5.dev1: * Fix bug #18343: Entities in file names decoded during packaging [cweiske] * Fix bug #18665: pecl extensions not enabled in empty php.ini files [Louis Opter] * Fix bug #18834: Do not truncate cache file if it is a symlink [avb] * Fix bug #18892: Parse error in Installer.php [ashnazg] * Fix bug #19482: fix pearcmd for include paths with trailing backslash [cweiske] * Fix bug #19793: PHP Notice about ob_end_clean() [cweiske] * Fix bug #20086: Invalid regexp in PEAR_Builder::build() [avb] * Fix bug #20203: split content-type and get real mime type [Samu Voutilainen] * Fix bug #20283: use full path for "zend_extension=..." [cweiske] * Fix bug #20284: Reset interpreter before running --CLEAN-- section php-cgi run [Mats Lindh] * Fix bug #20285: fix spelling mistakes [Veres Lajos] * Fix bug #20286: Support access of static variables on objects in validator [cweiske] * Fix bug #20321: Correctly detect name of current user during installation [cweiske] * Fix bug: let pear run-tests fail when there are failed tests [cweiske] * Prepare a test for bug #18056 / bug #18834 [avb] 2015-07-25 1.10.0dev1 1.10.0 devel devel New BSD License * Implement #20488: Add support for PHP 7 [cweiske] * Drop support for PHP 4 and 5.0 - 5.3 [cweiske] * Remove deprecated methods [cweiske] * Fix static warnings [cweiske] * Fix #17045: avoid overwriting include path [glen] * Fix #17399: "pear help" doesn't mention the "version" command [kguest] * Add --showdiff to "pear run-tests" to print diff for failed tests [tyrael] * Fix channel.xml downloading from https if it did not change [cweiske] 2015-07-31 1.10.0dev2 1.10.0 devel devel New BSD License * Fix #18638 and #18405: Make PEAR::loadExtension static [cweiske] * Fix #20319: allow pear to work when cache_dir is not writable [remicollet] * Implement #20333: New role=man for man pages [bjori] * Implement #20334: add "metadata_dir" configuration option [remicollet] * Add long option names to install-pear.php [remicollet] 2015-09-28 1.10.0dev3 1.10.0 devel devel New BSD License * Fix #20507: pear list-upgrades does not take PHP version into account [cweiske] * Fix #20927: Use correct php-config [cweiske] * Fix #20946: PEAR_Builder::log() declaration [remicollet] * Remove PEAR/ErrorStack5.php [cweiske] 2015-10-07 1.10.0 1.10.0 stable stable New BSD License No changes since version 1.10.0dev3. Changes since version 1.9.5: * Implement #20488: Add support for PHP 7 [cweiske] * Drop support for PHP 4 and 5.0 - 5.3 [cweiske] * Remove deprecated methods [cweiske] * Add --showdiff to "pear run-tests" to print diff for failed tests [tyrael] * Implement #20333: New role=man for man pages [bjori] * Implement #20334: add "metadata_dir" configuration option [remicollet] * Add long option names to install-pear.php [remicollet] * Remove PEAR/ErrorStack5.php [cweiske] * Fix #17045: avoid overwriting include path [glen] * Fix #17399: "pear help" doesn't mention the "version" command [kguest] * Fix #18638 and #18405: Make PEAR::loadExtension static [cweiske] * Fix #20319: allow pear to work when cache_dir is not writable [remicollet] * Fix #20507: pear list-upgrades does not take PHP version into account [cweiske] * Fix #20927: Use correct php-config [cweiske] * Fix #20946: PEAR_Builder::log() declaration [remicollet] * Fix channel.xml downloading from https if it did not change [cweiske] * Fix static warnings [cweiske] 2015-10-17 1.10.1 1.10.1 stable stable New BSD License * Fix bug #20959: Crash on channel discovery with channel.xml redirect [cweiske] * Fix bug #20968: Incorrect call to __construct() from PEAR() [edlman] * Add legacy constructor for PEAR_Error for backwards compatibility [cweiske] php-pear-1.10.1+submodules+notgz/packages/000077500000000000000000000000001262614675700204175ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/packages/XML_RPC-1.1.0.tar000066400000000000000000001460001262614675700227270ustar00rootroot00000000000000package.xml100664 764 764 4423 10025356566 6402 XML_RPC PHP implementation of the XML-RPC protocol This is a PEAR-ified version of Useful inc's XML-RPC for PHP. It has support for HTTP transport, proxies and authentication. ssb Stig Sther Bakken stig@php.net lead 1.1.0 2003-03-15 PHP License stable - Added support for sequential arrays to XML_RPC_encode() (mroch) - Cleaned up new XML_RPC_encode() changes a bit (mroch, pierre) - Remove "require_once 'PEAR.php'", include only when needed to raise an error - Replace echo and error_log() with raiseError() (mroch) - Make all classes extend XML_RPC_Base, which will handle common functions (mroch) - be tolerant of junk after methodResponse (Luca Mariano, mroch) - Silent notice even in the error log (pierre) - fix include of shared xml extension on win32 (pierre) 1.0.4 2002-10-02 stable * added HTTP proxy authorization support (thanks to Arnaud Limbourg) 1.0.3 2002-05-19 stable * fix bug when parsing responses with boolean types 1.0.2 2002-04-16 stable * E_ALL fixes * fix HTTP response header parsing 1.0.1 2001-09-25 stable This is a PEAR-ified version of Useful Inc's 1.0.1 release. Includes an urgent security fix identified by Dan Libby <dan@libby.com>. XML_RPC-1.1.0/RPC.php100664 764 764 104260 10025332360 7243 // $Id: RPC.php,v 1.21 2004/03/15 13:51:44 pajoye Exp $ // License is granted to use or modify this software ("XML-RPC for PHP") // for commercial or non-commercial use provided the copyright of the author // is preserved in any distributed or derivative work. // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESSED OR // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. // IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT // NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // Adapted to PEAR standards by Stig S�her Bakken and // Martin Jansen // /* $id$ */ if (!function_exists('xml_parser_create')) { // Win 32 fix. From: "Leo West" if ($WINDIR) { dl("php_xml.dll"); } else { dl("xml.so"); } } define('XML_RPC_ERROR_INVALID_TYPE', 101); define('XML_RPC_ERROR_NON_NUMERIC_FOUND', 102); define('XML_RPC_ERROR_CONNECTION_FAILED', 103); define('XML_RPC_ERROR_ALREADY_INITIALIZED', 104); $GLOBALS['XML_RPC_I4'] = "i4"; $GLOBALS['XML_RPC_Int'] = "int"; $GLOBALS['XML_RPC_Boolean'] = "boolean"; $GLOBALS['XML_RPC_Double'] = "double"; $GLOBALS['XML_RPC_String'] = "string"; $GLOBALS['XML_RPC_DateTime'] = "dateTime.iso8601"; $GLOBALS['XML_RPC_Base64'] = "base64"; $GLOBALS['XML_RPC_Array'] = "array"; $GLOBALS['XML_RPC_Struct'] = "struct"; $GLOBALS['XML_RPC_Types'] = array($GLOBALS['XML_RPC_I4'] => 1, $GLOBALS['XML_RPC_Int'] => 1, $GLOBALS['XML_RPC_Boolean'] => 1, $GLOBALS['XML_RPC_String'] => 1, $GLOBALS['XML_RPC_Double'] => 1, $GLOBALS['XML_RPC_DateTime'] => 1, $GLOBALS['XML_RPC_Base64'] => 1, $GLOBALS['XML_RPC_Array'] => 2, $GLOBALS['XML_RPC_Struct'] => 3); $GLOBALS['XML_RPC_entities'] = array("quot" => '"', "amp" => "&", "lt" => "<", "gt" => ">", "apos" => "'"); $GLOBALS['XML_RPC_err']["unknown_method"] = 1; $GLOBALS['XML_RPC_str']["unknown_method"] = "Unknown method"; $GLOBALS['XML_RPC_err']["invalid_return"] = 2; $GLOBALS['XML_RPC_str']["invalid_return"] = "Invalid return payload: enabling debugging to examine incoming payload"; $GLOBALS['XML_RPC_err']["incorrect_params"] = 3; $GLOBALS['XML_RPC_str']["incorrect_params"] = "Incorrect parameters passed to method"; $GLOBALS['XML_RPC_err']["introspect_unknown"] = 4; $GLOBALS['XML_RPC_str']["introspect_unknown"] = "Can't introspect: method unknown"; $GLOBALS['XML_RPC_err']["http_error"] = 5; $GLOBALS['XML_RPC_str']["http_error"] = "Didn't receive 200 OK from remote server."; $GLOBALS['XML_RPC_defencoding'] = "UTF-8"; // let user errors start at 800 $GLOBALS['XML_RPC_erruser'] = 800; // let XML parse errors start at 100 $GLOBALS['XML_RPC_errxml'] = 100; // formulate backslashes for escaping regexp $GLOBALS['XML_RPC_backslash'] = chr(92) . chr(92); $GLOBALS['XML_RPC_twoslash'] = $GLOBALS['XML_RPC_backslash'] . $GLOBALS['XML_RPC_backslash']; $GLOBALS['XML_RPC_twoslash'] = "2SLS"; // used to store state during parsing // quick explanation of components: // st - used to build up a string for evaluation // ac - used to accumulate values // qt - used to decide if quotes are needed for evaluation // cm - used to denote struct or array (comma needed) // isf - used to indicate a fault // lv - used to indicate "looking for a value": implements // the logic to allow values with no types to be strings // params - used to store parameters in method calls // method - used to store method name $GLOBALS['XML_RPC_xh'] = array(); function XML_RPC_entity_decode($string) { $top = split("&", $string); $op = ""; $i = 0; while($i < sizeof($top)) { if (ereg("^([#a-zA-Z0-9]+);", $top[$i], $regs)) { $op .= ereg_replace("^[#a-zA-Z0-9]+;", XML_RPC_lookup_entity($regs[1]), $top[$i]); } else { if ($i == 0) { $op = $top[$i]; } else { $op .= "&" . $top[$i]; } } $i++; } return $op; } function XML_RPC_lookup_entity($ent) { global $XML_RPC_entities; if ($XML_RPC_entities[strtolower($ent)]) { return $XML_RPC_entities[strtolower($ent)]; } if (ereg("^#([0-9]+)$", $ent, $regs)) { return chr($regs[1]); } return "?"; } function XML_RPC_se($parser, $name, $attrs) { global $XML_RPC_xh, $XML_RPC_DateTime, $XML_RPC_String; switch ($name) { case "STRUCT": case "ARRAY": $XML_RPC_xh[$parser]['st'] .= "array("; $XML_RPC_xh[$parser]['cm']++; // this last line turns quoting off // this means if we get an empty array we'll // simply get a bit of whitespace in the eval $XML_RPC_xh[$parser]['qt'] = 0; break; case "NAME": $XML_RPC_xh[$parser]['st'] .= "'"; $XML_RPC_xh[$parser]['ac'] = ""; break; case "FAULT": $XML_RPC_xh[$parser]['isf'] = 1; break; case "PARAM": $XML_RPC_xh[$parser]['st'] = ""; break; case "VALUE": $XML_RPC_xh[$parser]['st'] .= "new XML_RPC_Value("; $XML_RPC_xh[$parser]['lv'] = 1; $XML_RPC_xh[$parser]['vt'] = $XML_RPC_String; $XML_RPC_xh[$parser]['ac'] = ""; $XML_RPC_xh[$parser]['qt'] = 0; // look for a value: if this is still 1 by the // time we reach the first data segment then the type is string // by implication and we need to add in a quote break; case "I4": case "INT": case "STRING": case "BOOLEAN": case "DOUBLE": case "DATETIME.ISO8601": case "BASE64": $XML_RPC_xh[$parser]['ac'] = ""; // reset the accumulator if ($name == "DATETIME.ISO8601" || $name == "STRING") { $XML_RPC_xh[$parser]['qt'] = 1; if ($name == "DATETIME.ISO8601") { $XML_RPC_xh[$parser]['vt'] = $XML_RPC_DateTime; } } elseif ($name == "BASE64") { $XML_RPC_xh[$parser]['qt'] = 2; } else { // No quoting is required here -- but // at the end of the element we must check // for data format errors. $XML_RPC_xh[$parser]['qt'] = 0; } break; case "MEMBER": $XML_RPC_xh[$parser]['ac'] = ""; break; default: break; } if ($name!="VALUE") { $XML_RPC_xh[$parser]['lv'] = 0; } } function XML_RPC_ee($parser, $name) { global $XML_RPC_xh,$XML_RPC_Types,$XML_RPC_String; switch ($name) { case "STRUCT": case "ARRAY": if ($XML_RPC_xh[$parser]['cm'] && substr($XML_RPC_xh[$parser]['st'], -1) == ',') { $XML_RPC_xh[$parser]['st'] = substr($XML_RPC_xh[$parser]['st'],0,-1); } $XML_RPC_xh[$parser]['st'] .= ")"; $XML_RPC_xh[$parser]['vt'] = strtolower($name); $XML_RPC_xh[$parser]['cm']--; break; case "NAME": $XML_RPC_xh[$parser]['st'] .= $XML_RPC_xh[$parser]['ac'] . "' => "; break; case "BOOLEAN": // special case here: we translate boolean 1 or 0 into PHP // constants true or false if ($XML_RPC_xh[$parser]['ac'] == '1') { $XML_RPC_xh[$parser]['ac'] = "true"; } else { $XML_RPC_xh[$parser]['ac'] = "false"; } $XML_RPC_xh[$parser]['vt'] = strtolower($name); // Drop through intentionally. case "I4": case "INT": case "STRING": case "DOUBLE": case "DATETIME.ISO8601": case "BASE64": if ($XML_RPC_xh[$parser]['qt'] == 1) { // we use double quotes rather than single so backslashification works OK $XML_RPC_xh[$parser]['st'] .= "\"" . $XML_RPC_xh[$parser]['ac'] . "\""; } elseif ($XML_RPC_xh[$parser]['qt'] == 2) { $XML_RPC_xh[$parser]['st'] .= "base64_decode('" . $XML_RPC_xh[$parser]['ac'] . "')"; } elseif ($name=="BOOLEAN") { $XML_RPC_xh[$parser]['st'] .= $XML_RPC_xh[$parser]['ac']; } else { // we have an I4, INT or a DOUBLE // we must check that only 0123456789-. are characters here if (!ereg("^\-?[0123456789 \t\.]+$", $XML_RPC_xh[$parser]['ac'])) { $this->raiseError("Non-numeric value recieved in INT or DOUBLE", XML_RPC_ERROR_NON_NUMERIC_FOUND); $XML_RPC_xh[$parser]['st'] .= "ERROR_NON_NUMERIC_FOUND"; } else { // it's ok, add it on $XML_RPC_xh[$parser]['st'] .= $XML_RPC_xh[$parser]['ac']; } } $XML_RPC_xh[$parser]['ac'] = ""; $XML_RPC_xh[$parser]['qt'] = 0; $XML_RPC_xh[$parser]['lv'] = 3; // indicate we've found a value break; case "VALUE": // deal with a string value if (strlen($XML_RPC_xh[$parser]['ac']) > 0 && $XML_RPC_xh[$parser]['vt'] == $XML_RPC_String) { $XML_RPC_xh[$parser]['st'] .= "\"" . $XML_RPC_xh[$parser]['ac'] . "\""; } // This if () detects if no scalar was inside // and pads an empty "". if ($XML_RPC_xh[$parser]['st'][strlen($XML_RPC_xh[$parser]['st'])-1] == '(') { $XML_RPC_xh[$parser]['st'] .= '""'; } $XML_RPC_xh[$parser]['st'] .= ", '" . $XML_RPC_xh[$parser]['vt'] . "')"; if ($XML_RPC_xh[$parser]['cm']) { $XML_RPC_xh[$parser]['st'] .= ","; } break; case "MEMBER": $XML_RPC_xh[$parser]['ac'] = ""; $XML_RPC_xh[$parser]['qt'] = 0; break; case "DATA": $XML_RPC_xh[$parser]['ac'] = ""; $XML_RPC_xh[$parser]['qt'] = 0; break; case "PARAM": $XML_RPC_xh[$parser]['params'][] = $XML_RPC_xh[$parser]['st']; break; case "METHODNAME": $XML_RPC_xh[$parser]['method'] = ereg_replace("^[\n\r\t ]+", "", $XML_RPC_xh[$parser]['ac']); break; case "BOOLEAN": // special case here: we translate boolean 1 or 0 into PHP // constants true or false if ($XML_RPC_xh[$parser]['ac'] == '1') { $XML_RPC_xh[$parser]['ac'] = "true"; } else { $XML_RPC_xh[$parser]['ac'] = "false"; } $XML_RPC_xh[$parser]['vt'] = strtolower($name); break; default: break; } // if it's a valid type name, set the type if (isset($XML_RPC_Types[strtolower($name)])) { $XML_RPC_xh[$parser]['vt'] = strtolower($name); } } function XML_RPC_cd($parser, $data) { global $XML_RPC_xh, $XML_RPC_backslash; if ($XML_RPC_xh[$parser]['lv'] != 3) { // "lookforvalue==3" means that we've found an entire value // and should discard any further character data if ($XML_RPC_xh[$parser]['lv'] == 1) { // if we've found text and we're just in a then // turn quoting on, as this will be a string $XML_RPC_xh[$parser]['qt'] = 1; // and say we've found a value $XML_RPC_xh[$parser]['lv'] = 2; } // replace characters that eval would // do special things with if (isset($XML_RPC_xh[$parser]['ac'])) { $XML_RPC_xh[$parser]['ac'] .= str_replace('$', '\$', str_replace('"', '\"', str_replace(chr(92), $XML_RPC_backslash, $data))); } else { $XML_RPC_xh[$parser]['ac'] = ''; } } } function XML_RPC_dh($parser, $data) { global $XML_RPC_xh; if (substr($data, 0, 1) == "&" && substr($data, -1, 1) == ";") { if ($XML_RPC_xh[$parser]['lv'] == 1) { $XML_RPC_xh[$parser]['qt'] = 1; $XML_RPC_xh[$parser]['lv'] = 2; } $XML_RPC_xh[$parser]['ac'] .= str_replace('$', '\$', str_replace('"', '\"', str_replace(chr(92), $XML_RPC_backslash, $data))); } } /** * Base class * * This class provides common functions for all of the XML_RPC classes. */ class XML_RPC_Base { function raiseError($msg, $code) { include_once 'PEAR.php'; PEAR::raiseError(get_class($this) . ": " . $msg, $code); } } class XML_RPC_Client extends XML_RPC_Base { var $path; var $server; var $port; var $errno; var $errstring; var $debug = 0; var $username = ""; var $password = ""; function XML_RPC_Client($path, $server, $port = 80, $proxy = '', $proxy_port = 8080, $proxy_user = '', $proxy_pass = '') { $this->port = $port; $this->server = $server; $this->path = $path; $this->proxy = $proxy; $this->proxy_port = $proxy_port; $this->proxy_user = $proxy_user; $this->proxy_pass = $proxy_pass; } function setDebug($in) { if ($in) { $this->debug = 1; } else { $this->debug = 0; } } function setCredentials($u, $p) { $this->username = $u; $this->password = $p; } function send($msg, $timeout = 0) { // where msg is an xmlrpcmsg $msg->debug = $this->debug; return $this->sendPayloadHTTP10($msg, $this->server, $this->port, $timeout, $this->username, $this->password); } function sendPayloadHTTP10($msg, $server, $port, $timeout=0, $username = "", $password = "") { // If we're using a proxy open a socket to the proxy server instead to the xml-rpc server if ($this->proxy){ if ($timeout > 0) { $fp = fsockopen($this->proxy, $this->proxy_port, $this->errno, $this->errstr, $timeout); } else { $fp = fsockopen($this->proxy, $this->proxy_port, $this->errno, $this->errstr); } } else { if ($timeout > 0) { $fp = fsockopen($server, $port, $this->errno, $this->errstr, $timeout); } else { $fp = fsockopen($server, $port, $this->errno, $this->errstr); } } if (!$fp && $this->proxy) { $this->raiseError( "Connection to proxy server " . $this->proxy . ":" . $this->proxy_port . " failed", XML_RPC_ERROR_CONNECTION_FAILED); } elseif (!$fp) { $this->raiseError( "Connection to RPC server " . $this->server . " failed", XML_RPC_ERROR_CONNECTION_FAILED); } // Only create the payload if it was not created previously if (empty($msg->payload)) { $msg->createPayload(); } // thanks to Grant Rauscher for this $credentials = ""; if ($username != "") { $credentials = "Authorization: Basic " . base64_encode($username . ":" . $password) . "\r\n"; } if ($this->proxy) { $op = "POST http://" . $this->server; if ($this->proxy_port) { $op .= ":" . $this->port; } } else { $op = "POST "; } $op .= $this->path. " HTTP/1.0\r\n" . "User-Agent: PEAR XML_RPC\r\n" . "Host: " . $this->server . "\r\n"; if ($this->proxy && $this->proxy_user != '') { $op .= 'Proxy-Authorization: Basic ' . base64_encode($this->proxy_user . ':' . $this->proxy_pass) . "\r\n"; } $op .= $credentials . "Content-Type: text/xml\r\n" . "Content-Length: " . strlen($msg->payload) . "\r\n\r\n" . $msg->payload; if (!fputs($fp, $op, strlen($op))) { $this->errstr = "Write error"; return 0; } $resp = $msg->parseResponseFile($fp); fclose($fp); return $resp; } } class XML_RPC_Response extends XML_RPC_Base { var $xv; var $fn; var $fs; var $hdrs; function XML_RPC_Response($val, $fcode = 0, $fstr = "") { if ($fcode != 0) { $this->fn = $fcode; $this->fs = htmlspecialchars($fstr); } else { $this->xv = $val; } } function faultCode() { if (isset($this->fn)) { return $this->fn; } else { return 0; } } function faultString() { return $this->fs; } function value() { return $this->xv; } function serialize() { $rs = "\n"; if ($this->fn) { $rs .= " faultCode " . $this->fn . " faultString " . $this->fs . " "; } else { $rs .= "\n\n" . $this->xv->serialize() . "\n"; } $rs .= "\n"; return $rs; } } class XML_RPC_Message extends XML_RPC_Base { var $payload; var $methodname; var $params = array(); var $debug = 0; function XML_RPC_Message($meth, $pars = 0) { $this->methodname = $meth; if (is_array($pars) && sizeof($pars)>0) { for($i = 0; $i < sizeof($pars); $i++) { $this->addParam($pars[$i]); } } } function xml_header() { return "\n\n"; } function xml_footer() { return "\n"; } function createPayload() { $this->payload = $this->xml_header(); $this->payload .= "" . $this->methodname . "\n"; $this->payload .= "\n"; for($i = 0; $i < sizeof($this->params); $i++) { $p = $this->params[$i]; $this->payload .= "\n" . $p->serialize() . "\n"; } $this->payload .= "\n"; $this->payload .= $this->xml_footer(); $this->payload = str_replace("\n", "\r\n", $this->payload); } function method($meth = "") { if ($meth != "") { $this->methodname = $meth; } return $this->methodname; } function serialize() { $this->createPayload(); return $this->payload; } function addParam($par) { $this->params[] = $par; } function getParam($i) { return $this->params[$i]; } function getNumParams() { return sizeof($this->params); } function parseResponseFile($fp) { $ipd = ""; while($data = fread($fp, 32768)) { $ipd .= $data; } return $this->parseResponse($ipd); } function parseResponse($data = "") { global $XML_RPC_xh,$XML_RPC_err,$XML_RPC_str; global $XML_RPC_defencoding; $parser = xml_parser_create($XML_RPC_defencoding); $XML_RPC_xh[$parser] = array(); $XML_RPC_xh[$parser]['st'] = ""; $XML_RPC_xh[$parser]['cm'] = 0; $XML_RPC_xh[$parser]['isf'] = 0; $XML_RPC_xh[$parser]['ac'] = ""; $XML_RPC_xh[$parser]['qt'] = ""; xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, true); xml_set_element_handler($parser, "XML_RPC_se", "XML_RPC_ee"); xml_set_character_data_handler($parser, "XML_RPC_cd"); xml_set_default_handler($parser, "XML_RPC_dh"); $xmlrpc_value = new XML_RPC_Value; $hdrfnd = 0; if ($this->debug) { print "
---GOT---\n";
            print isset($_SERVER['SERVER_PROTOCOL']) ? htmlspecialchars($data) : $data;
            print "\n---END---\n
"; } // see if we got an HTTP 200 OK, else bomb // but only do this if we're using the HTTP protocol. if (ereg("^HTTP",$data) && !ereg("^HTTP/[0-9\.]+ 200 ", $data)) { $errstr = substr($data, 0, strpos($data, "\n")-1); error_log("HTTP error, got response: " . $errstr); $r = new XML_RPC_Response(0, $XML_RPC_err["http_error"], $XML_RPC_str["http_error"] . " (" . $errstr . ")"); xml_parser_free($parser); return $r; } // gotta get rid of headers here if ((!$hdrfnd) && ($brpos = strpos($data,"\r\n\r\n"))) { $XML_RPC_xh[$parser]['ha'] = substr($data, 0, $brpos); $data = substr($data, $brpos + 4); $hdrfnd = 1; } // be tolerant of junk after methodResponse (e.g. javascript automatically inserted by free hosts) // thanks to Luca Mariano $data = substr($data, 0, strpos($data, "") + 17); if (!xml_parse($parser, $data, sizeof($data))) { // thanks to Peter Kocks if ((xml_get_current_line_number($parser)) == 1) { $errstr = "XML error at line 1, check URL"; } else { $errstr = sprintf("XML error: %s at line %d", xml_error_string(xml_get_error_code($parser)), xml_get_current_line_number($parser)); } error_log($errstr); $r = new XML_RPC_Response(0, $XML_RPC_err["invalid_return"], $XML_RPC_str["invalid_return"]); xml_parser_free($parser); return $r; } xml_parser_free($parser); if ($this->debug) { print "
---EVALING---[" .
            strlen($XML_RPC_xh[$parser]['st']) . " chars]---\n" .
            htmlspecialchars($XML_RPC_xh[$parser]['st']) . ";\n---END---
"; } if (strlen($XML_RPC_xh[$parser]['st']) == 0) { // then something odd has happened // and it's time to generate a client side error // indicating something odd went on $r = new XML_RPC_Response(0, $XML_RPC_err["invalid_return"], $XML_RPC_str["invalid_return"]); } else { eval('$v=' . $XML_RPC_xh[$parser]['st'] . '; $allOK=1;'); if ($XML_RPC_xh[$parser]['isf']) { $f = $v->structmem("faultCode"); $fs = $v->structmem("faultString"); $r = new XML_RPC_Response($v, $f->scalarval(), $fs->scalarval()); } else { $r = new XML_RPC_Response($v); } } $r->hdrs = split("\r?\n", $XML_RPC_xh[$parser]['ha'][1]); return $r; } } class XML_RPC_Value extends XML_RPC_Base { var $me = array(); var $mytype = 0; function XML_RPC_Value($val = -1, $type = "") { global $XML_RPC_Types; $this->me = array(); $this->mytype = 0; if ($val != -1 || $type != "") { if ($type == "") { $type="string"; } if ($XML_RPC_Types[$type] == 1) { $this->addScalar($val,$type); } elseif ($XML_RPC_Types[$type] == 2) { $this->addArray($val); } elseif ($XML_RPC_Types[$type] == 3) { $this->addStruct($val); } } } function addScalar($val, $type = "string") { global $XML_RPC_Types, $XML_RPC_Boolean; if ($this->mytype == 1) { $this->raiseError("Scalar can have only one value", XML_RPC_ERROR_INVALID_TYPE); return 0; } $typeof = $XML_RPC_Types[$type]; if ($typeof != 1) { $this->raiseError("Not a scalar type (${typeof})", XML_RPC_ERROR_INVALID_TYPE); return 0; } if ($type == $XML_RPC_Boolean) { if (strcasecmp($val,"true") == 0 || $val == 1 || ($val == true && strcasecmp($val,"false"))) { $val = 1; } else { $val = 0; } } if ($this->mytype == 2) { // we're adding to an array here $ar = $this->me["array"]; $ar[] = new XML_RPC_Value($val, $type); $this->me["array"] = $ar; } else { // a scalar, so set the value and remember we're scalar $this->me[$type] = $val; $this->mytype = $typeof; } return 1; } function addArray($vals) { global $XML_RPC_Types; if ($this->mytype != 0) { $this->raiseError( "Already initialized as a [" . $this->kindOf() . "]", XML_RPC_ERROR_ALREADY_INITIALIZED); return 0; } $this->mytype = $XML_RPC_Types["array"]; $this->me["array"] = $vals; return 1; } function addStruct($vals) { global $XML_RPC_Types; if ($this->mytype != 0) { $this->raiseError( "Already initialized as a [" . $this->kindOf() . "]", XML_RPC_ERROR_ALREADY_INITIALIZED); return 0; } $this->mytype = $XML_RPC_Types["struct"]; $this->me["struct"] = $vals; return 1; } function dump($ar) { reset($ar); while (list( $key, $val ) = each($ar)) { echo "$key => $val
"; if ($key == 'array') { while ( list( $key2, $val2 ) = each( $val ) ) { echo "-- $key2 => $val2
"; } } } } function kindOf() { switch ($this->mytype) { case 3: return "struct"; break; case 2: return "array"; break; case 1: return "scalar"; break; default: return "undef"; } } function serializedata($typ, $val) { $rs = ""; global $XML_RPC_Types, $XML_RPC_Base64, $XML_RPC_String, $XML_RPC_Boolean; switch ($XML_RPC_Types[$typ]) { case 3: // struct $rs .= "\n"; reset($val); while(list($key2, $val2) = each($val)) { $rs .= "${key2}\n"; $rs .= $this->serializeval($val2); $rs .= "\n"; } $rs .= ""; break; case 2: // array $rs .= "\n\n"; for($i = 0; $i < sizeof($val); $i++) { $rs .= $this->serializeval($val[$i]); } $rs .= "\n"; break; case 1: switch ($typ) { case $XML_RPC_Base64: $rs .= "<${typ}>" . base64_encode($val) . ""; break; case $XML_RPC_Boolean: $rs .= "<${typ}>" . ($val ? "1" : "0") . ""; break; case $XML_RPC_String: $rs .= "<${typ}>" . htmlspecialchars($val). ""; break; default: $rs .= "<${typ}>${val}"; } break; default: break; } return $rs; } function serialize() { return $this->serializeval($this); } function serializeval($o) { $rs = ""; $ar = $o->me; reset($ar); list($typ, $val) = each($ar); $rs .= ""; $rs .= $this->serializedata($typ, $val); $rs .= "\n"; return $rs; } function structmem($m) { $nv = $this->me["struct"][$m]; return $nv; } function structreset() { reset($this->me["struct"]); } function structeach() { return each($this->me["struct"]); } function getval() { // UNSTABLE global $XML_RPC_BOOLEAN, $XML_RPC_Base64; reset($this->me); list($a,$b) = each($this->me); // contributed by I Sofer, 2001-03-24 // add support for nested arrays to scalarval // i've created a new method here, so as to // preserve back compatibility if (is_array($b)) { foreach ($b as $id => $cont) { $b[$id] = $cont->scalarval(); } } // add support for structures directly encoding php objects if (is_object($b)) { $t = get_object_vars($b); foreach ($t as $id => $cont) { $t[$id] = $cont->scalarval(); } foreach ($t as $id => $cont) { eval('$b->'.$id.' = $cont;'); } } // end contrib return $b; } function scalarval() { global $XML_RPC_Boolean, $XML_RPC_Base64; reset($this->me); list($a,$b) = each($this->me); return $b; } function scalartyp() { global $XML_RPC_I4, $XML_RPC_Int; reset($this->me); list($a,$b) = each($this->me); if ($a == $XML_RPC_I4) { $a = $XML_RPC_Int; } return $a; } function arraymem($m) { $nv = $this->me["array"][$m]; return $nv; } function arraysize() { reset($this->me); list($a,$b) = each($this->me); return sizeof($b); } } /** * date helpers */ function XML_RPC_iso8601_encode($timet, $utc = 0) { // return an ISO8601 encoded string // really, timezones ought to be supported // but the XML-RPC spec says: // // "Don't assume a timezone. It should be specified by the server in its // documentation what assumptions it makes about timezones." // // these routines always assume localtime unless // $utc is set to 1, in which case UTC is assumed // and an adjustment for locale is made when encoding if (!$utc) { $t = strftime("%Y%m%dT%H:%M:%S", $timet); } else { if (function_exists("gmstrftime")) { // gmstrftime doesn't exist in some versions // of PHP $t = gmstrftime("%Y%m%dT%H:%M:%S", $timet); } else { $t = strftime("%Y%m%dT%H:%M:%S", $timet - date("Z")); } } return $t; } function XML_RPC_iso8601_decode($idate, $utc = 0) { // return a timet in the localtime, or UTC $t = 0; if (ereg("([0-9]{4})([0-9]{2})([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})", $idate, $regs)) { if ($utc) { $t = gmmktime($regs[4], $regs[5], $regs[6], $regs[2], $regs[3], $regs[1]); } else { $t = mktime($regs[4], $regs[5], $regs[6], $regs[2], $regs[3], $regs[1]); } } return $t; } /** * Takes a message in PHP XML_RPC object format and translates it into native PHP types. * * @author Dan Libby **/ function XML_RPC_decode($XML_RPC_val) { $kind = $XML_RPC_val->kindOf(); if ($kind == "scalar") { return $XML_RPC_val->scalarval(); } elseif ($kind == "array") { $size = $XML_RPC_val->arraysize(); $arr = array(); for($i = 0; $i < $size; $i++) { $arr[] = XML_RPC_decode($XML_RPC_val->arraymem($i)); } return $arr; } elseif ($kind == "struct") { $XML_RPC_val->structreset(); $arr = array(); while(list($key,$value) = $XML_RPC_val->structeach()) { $arr[$key] = XML_RPC_decode($value); } return $arr; } } /** * Takes native php types and encodes them into XML_RPC PHP object format. * * Feature creep -- could support more types via optional type argument. * * @author Dan Libby **/ function XML_RPC_encode($php_val) { global $XML_RPC_Boolean; global $XML_RPC_Int; global $XML_RPC_Double; global $XML_RPC_String; global $XML_RPC_Array; global $XML_RPC_Struct; $type = gettype($php_val); $XML_RPC_val = new XML_RPC_Value; switch ($type) { case "array": $keys = array_keys($php_val); $count = count($php_val); $firstkey = $keys[0]; $lastkey = $keys[$count - 1]; if ($firstkey === 0 && is_int($lastkey) && ($lastkey + 1) == $count) { $is_continuous = true; $expected = 0; foreach ($keys as $actual) { if ($actual != $expected) { $is_continuous = false; break; } $expected++; } if ($is_continuous) { $arr = array(); foreach ($php_val as $k => $v) { $arr[$k] = XML_RPC_encode($v); } $XML_RPC_val->addArray($arr); break; } } // fall though if not numerical and continuous case "object": $arr = array(); foreach ($php_val as $k => $v) { $arr[$k] = XML_RPC_encode($v); } $XML_RPC_val->addStruct($arr); break; case "integer": $XML_RPC_val->addScalar($php_val, $XML_RPC_Int); break; case "double": $XML_RPC_val->addScalar($php_val, $XML_RPC_Double); break; case "string": case "NULL": $XML_RPC_val->addScalar($php_val, $XML_RPC_String); break; // // Add support for encoding/decoding of booleans, since they are supported in PHP case "boolean": $XML_RPC_val->addScalar($php_val, $XML_RPC_Boolean); break; // case "unknown type": default: $XML_RPC_val = false; break; } return $XML_RPC_val; } ?> XML_RPC-1.1.0/Server.php100664 764 764 27071 10025333217 10053 // License is granted to use or modify this software ("XML-RPC for PHP") // for commercial or non-commercial use provided the copyright of the author // is preserved in any distributed or derivative work. // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESSED OR // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. // IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT // NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // Adapted to PEAR standards by Stig S�her Bakken // /* $Id: Server.php,v 1.6 2004/03/15 13:58:39 pajoye Exp $ */ require_once "XML/RPC.php"; // listMethods: either a string, or nothing $GLOBALS['XML_RPC_Server_listMethods_sig'] = array(array($GLOBALS['XML_RPC_Array'], $GLOBALS['XML_RPC_String']), array($GLOBALS['XML_RPC_Array'])); $GLOBALS['XML_RPC_Server_listMethods_doc'] = 'This method lists all the methods that the XML-RPC server knows how to dispatch'; function XML_RPC_Server_listMethods($server, $m) { global $XML_RPC_err, $XML_RPC_str, $XML_RPC_Server_dmap; $v = new XML_RPC_Value(); $dmap = $server->dmap; $outAr = array(); for (reset($dmap); list($key, $val) = each($dmap); ) { $outAr[] = new XML_RPC_Value($key, "string"); } $dmap = $XML_RPC_Server_dmap; for (reset($dmap); list($key, $val) = each($dmap); ) { $outAr[] = new XML_RPC_Value($key, "string"); } $v->addArray($outAr); return new XML_RPC_Response($v); } $GLOBALS['XML_RPC_Server_methodSignature_sig'] = array(array($GLOBALS['XML_RPC_Array'], $GLOBALS['XML_RPC_String'])); $GLOBALS['XML_RPC_Server_methodSignature_doc'] = 'Returns an array of known signatures (an array of arrays) for the method name passed. If no signatures are known, returns a none-array (test for type != array to detect missing signature)'; function XML_RPC_Server_methodSignature($server, $m) { global $XML_RPC_err, $XML_RPC_str, $XML_RPC_Server_dmap; $methName = $m->getParam(0); $methName = $methName->scalarval(); if (ereg("^system\.", $methName)) { $dmap = $XML_RPC_Server_dmap; $sysCall = 1; } else { $dmap = $server->dmap; $sysCall = 0; } // print "\n"; if (isset($dmap[$methName])) { if ($dmap[$methName]["signature"]) { $sigs = array(); $thesigs = $dmap[$methName]["signature"]; for ($i = 0; $i < sizeof($thesigs); $i++) { $cursig = array(); $inSig = $thesigs[$i]; for ($j = 0; $j < sizeof($inSig); $j++) { $cursig[] = new XML_RPC_Value($inSig[$j], "string"); } $sigs[] = new XML_RPC_Value($cursig, "array"); } $r = new XML_RPC_Response(new XML_RPC_Value($sigs, "array")); } else { $r = new XML_RPC_Response(new XML_RPC_Value("undef", "string")); } } else { $r = new XML_RPC_Response(0, $XML_RPC_err["introspect_unknown"], $XML_RPC_str["introspect_unknown"]); } return $r; } $GLOBALS['XML_RPC_Server_methodHelp_sig'] = array(array($GLOBALS['XML_RPC_String'], $GLOBALS['XML_RPC_String'])); $GLOBALS['XML_RPC_Server_methodHelp_doc'] = 'Returns help text if defined for the method passed, otherwise returns an empty string'; function XML_RPC_Server_methodHelp($server, $m) { global $XML_RPC_err, $XML_RPC_str, $XML_RPC_Server_dmap; $methName = $m->getParam(0); $methName = $methName->scalarval(); if (ereg("^system\.", $methName)) { $dmap = $XML_RPC_Server_dmap; $sysCall = 1; } else { $dmap = $server->dmap; $sysCall = 0; } // print "\n"; if (isset($dmap[$methName])) { if ($dmap[$methName]["docstring"]) { $r = new XML_RPC_Response(new XML_RPC_Value($dmap[$methName]["docstring"]), "string"); } else { $r = new XML_RPC_Response(new XML_RPC_Value("", "string")); } } else { $r = new XML_RPC_Response(0, $XML_RPC_err["introspect_unknown"], $XML_RPC_str["introspect_unknown"]); } return $r; } $GLOBALS['XML_RPC_Server_dmap'] = array( "system.listMethods" => array("function" => "XML_RPC_Server_listMethods", "signature" => $GLOBALS['XML_RPC_Server_listMethods_sig'], "docstring" => $GLOBALS['XML_RPC_Server_listMethods_doc']), "system.methodHelp" => array("function" => "XML_RPC_Server_methodHelp", "signature" => $GLOBALS['XML_RPC_Server_methodHelp_sig'], "docstring" => $GLOBALS['XML_RPC_Server_methodHelp_doc']), "system.methodSignature" => array("function" => "XML_RPC_Server_methodSignature", "signature" => $GLOBALS['XML_RPC_Server_methodSignature_sig'], "docstring" => $GLOBALS['XML_RPC_Server_methodSignature_doc']) ); $GLOBALS['XML_RPC_Server_debuginfo'] = ""; function XML_RPC_Server_debugmsg($m) { global $XML_RPC_Server_debuginfo; $XML_RPC_Server_debuginfo = $XML_RPC_Server_debuginfo . $m . "\n"; } class XML_RPC_Server { var $dmap = array(); function XML_RPC_Server($dispMap, $serviceNow = 1) { global $HTTP_RAW_POST_DATA; // dispMap is a despatch array of methods // mapped to function names and signatures // if a method // doesn't appear in the map then an unknown // method error is generated $this->dmap = $dispMap; if ($serviceNow) { $this->service(); } } function serializeDebug() { global $XML_RPC_Server_debuginfo; if ($XML_RPC_Server_debuginfo != "") return "\n"; else return ""; } function service() { $r = $this->parseRequest(); $payload = "\n" . $this->serializeDebug() . $r->serialize(); header('Content-Length: ' . strlen($payload)); header('Content-Type: text/xml'); print $payload; } function verifySignature($in, $sig) { for ($i = 0; $i < sizeof($sig); $i++) { // check each possible signature in turn $cursig = $sig[$i]; if (sizeof($cursig) == $in->getNumParams() + 1) { $itsOK = 1; for ($n = 0; $n < $in->getNumParams(); $n++) { $p = $in->getParam($n); // print "\n"; if ($p->kindOf() == "scalar") { $pt = $p->scalartyp(); } else { $pt = $p->kindOf(); } // $n+1 as first type of sig is return type if ($pt != $cursig[$n+1]) { $itsOK = 0; $pno = $n+1; $wanted = $cursig[$n+1]; $got = $pt; break; } } if ($itsOK) return array(1); } } return array(0, "Wanted ${wanted}, got ${got} at param ${pno})"); } function parseRequest($data = "") { global $XML_RPC_xh,$HTTP_RAW_POST_DATA; global $XML_RPC_err, $XML_RPC_str, $XML_RPC_errxml, $XML_RPC_defencoding, $XML_RPC_Server_dmap; if ($data == "") { $data = $HTTP_RAW_POST_DATA; } $parser = xml_parser_create($XML_RPC_defencoding); $XML_RPC_xh[$parser] = array(); $XML_RPC_xh[$parser]['st'] = ""; $XML_RPC_xh[$parser]['cm'] = 0; $XML_RPC_xh[$parser]['isf'] = 0; $XML_RPC_xh[$parser]['params'] = array(); $XML_RPC_xh[$parser]['method'] = ""; $plist = ''; // decompose incoming XML into request structure xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, true); xml_set_element_handler($parser, "XML_RPC_se", "XML_RPC_ee"); xml_set_character_data_handler($parser, "XML_RPC_cd"); xml_set_default_handler($parser, "XML_RPC_dh"); if (!xml_parse($parser, $data, 1)) { // return XML error as a faultCode $r = new XML_RPC_Response(0, $XML_RPC_errxml+xml_get_error_code($parser), sprintf("XML error: %s at line %d", xml_error_string(xml_get_error_code($parser)), xml_get_current_line_number($parser))); xml_parser_free($parser); } else { xml_parser_free($parser); $m = new XML_RPC_Message($XML_RPC_xh[$parser]['method']); // now add parameters in for ($i = 0; $i < sizeof($XML_RPC_xh[$parser]['params']); $i++) { // print "\n"; $plist .= "$i - " . $XML_RPC_xh[$parser]['params'][$i] . " \n"; eval('$m->addParam(' . $XML_RPC_xh[$parser]['params'][$i] . ");"); } XML_RPC_Server_debugmsg($plist); // now to deal with the method $methName = $XML_RPC_xh[$parser]['method']; if (ereg("^system\.", $methName)) { $dmap = $XML_RPC_Server_dmap; $sysCall = 1; } else { $dmap = $this->dmap; $sysCall = 0; } if (isset($dmap[$methName]['function'])) { // dispatch if exists if (isset($dmap[$methName]['signature'])) { $sr = $this->verifySignature($m, $dmap[$methName]['signature'] ); } if ( (!isset($dmap[$methName]['signature'])) || $sr[0]) { // if no signature or correct signature if ($sysCall) { eval('$r=' . $dmap[$methName]['function'] . '($this, $m);'); } else { eval('$r=' . $dmap[$methName]['function'] . '($m);'); } } else { $r = new XML_RPC_Response(0, $XML_RPC_err["incorrect_params"], $XML_RPC_str["incorrect_params"] . ": " . $sr[1]); } } else { // else prepare error response $r = new XML_RPC_Response(0, $XML_RPC_err["unknown_method"], $XML_RPC_str["unknown_method"]); } } return $r; } function echoInput() { global $HTTP_RAW_POST_DATA; // a debugging routine: just echos back the input // packet as a string value $r = new XML_RPC_Response; $r->xv = new XML_RPC_Value("'Aha said I: '" . $HTTP_RAW_POST_DATA, "string"); print $r->serialize(); } } ?> php-pear-1.10.1+submodules+notgz/scripts/000077500000000000000000000000001262614675700203305ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/scripts/go-pear.bat000066400000000000000000000001331262614675700223470ustar00rootroot00000000000000@ECHO OFF set PHP_BIN=cli\php.exe %PHP_BIN% -d output_buffering=0 PEAR\go-pear.php %1 pausephp-pear-1.10.1+submodules+notgz/scripts/pear.bat000077500000000000000000000103611262614675700217530ustar00rootroot00000000000000@ECHO OFF REM ---------------------------------------------------------------------- REM PHP version 5 REM ---------------------------------------------------------------------- REM Copyright (c) 1997-2010 The Authors REM ---------------------------------------------------------------------- REM http://opensource.org/licenses/bsd-license.php New BSD License REM ---------------------------------------------------------------------- REM Authors: Alexander Merz (alexmerz@php.net) REM ---------------------------------------------------------------------- REM REM Last updated 12/29/2004 ($Id$ is not replaced if the file is binary) REM change this lines to match the paths of your system REM ------------------- REM Test to see if this is a raw pear.bat (uninstalled version) SET TMPTMPTMPTMPT=@includ SET PMTPMTPMT=%TMPTMPTMPTMPT%e_path@ FOR %%x IN ("@include_path@") DO (if %%x=="%PMTPMTPMT%" GOTO :NOTINSTALLED) REM Check PEAR global ENV, set them if they do not exist IF "%PHP_PEAR_INSTALL_DIR%"=="" SET "PHP_PEAR_INSTALL_DIR=@include_path@" IF "%PHP_PEAR_BIN_DIR%"=="" SET "PHP_PEAR_BIN_DIR=@bin_dir@" IF "%PHP_PEAR_PHP_BIN%"=="" SET "PHP_PEAR_PHP_BIN=@php_bin@" GOTO :INSTALLED :NOTINSTALLED ECHO WARNING: This is a raw, uninstalled pear.bat REM Check to see if we can grab the directory of this file (Windows NT+) IF %~n0 == pear ( FOR %%x IN (cli\php.exe php.exe) DO (if "%%~$PATH:x" NEQ "" ( SET "PHP_PEAR_PHP_BIN=%%~$PATH:x" echo Using PHP Executable "%PHP_PEAR_PHP_BIN%" "%PHP_PEAR_PHP_BIN%" -v GOTO :NEXTTEST )) GOTO :FAILAUTODETECT :NEXTTEST IF "%PHP_PEAR_PHP_BIN%" NEQ "" ( REM We can use this PHP to run a temporary php file to get the dirname of pear echo ^ > ~~getloc.php "%PHP_PEAR_PHP_BIN%" ~~getloc.php set /p PHP_PEAR_BIN_DIR=fakeprompt < ~a.a DEL ~a.a DEL ~~getloc.php set "PHP_PEAR_INSTALL_DIR=%PHP_PEAR_BIN_DIR%pear" REM Make sure there is a pearcmd.php at our disposal IF NOT EXIST %PHP_PEAR_INSTALL_DIR%\pearcmd.php ( IF EXIST %PHP_PEAR_INSTALL_DIR%\scripts\pearcmd.php COPY %PHP_PEAR_INSTALL_DIR%\scripts\pearcmd.php %PHP_PEAR_INSTALL_DIR%\pearcmd.php IF EXIST pearcmd.php COPY pearcmd.php %PHP_PEAR_INSTALL_DIR%\pearcmd.php IF EXIST %~dp0\scripts\pearcmd.php COPY %~dp0\scripts\pearcmd.php %PHP_PEAR_INSTALL_DIR%\pearcmd.php ) ) GOTO :INSTALLED ) ELSE ( REM Windows Me/98 cannot succeed, so allow the batch to fail ) :FAILAUTODETECT echo WARNING: failed to auto-detect pear information :INSTALLED REM Check Folders and files IF NOT EXIST "%PHP_PEAR_INSTALL_DIR%" GOTO PEAR_INSTALL_ERROR IF NOT EXIST "%PHP_PEAR_INSTALL_DIR%\pearcmd.php" GOTO PEAR_INSTALL_ERROR2 IF NOT EXIST "%PHP_PEAR_BIN_DIR%" GOTO PEAR_BIN_ERROR IF NOT EXIST "%PHP_PEAR_PHP_BIN%" GOTO PEAR_PHPBIN_ERROR REM launch pearcmd GOTO RUN :PEAR_INSTALL_ERROR ECHO PHP_PEAR_INSTALL_DIR is not set correctly. ECHO Please fix it using your environment variable or modify ECHO the default value in pear.bat ECHO The current value is: ECHO %PHP_PEAR_INSTALL_DIR% GOTO END :PEAR_INSTALL_ERROR2 ECHO PHP_PEAR_INSTALL_DIR is not set correctly. ECHO pearcmd.php could not be found there. ECHO Please fix it using your environment variable or modify ECHO the default value in pear.bat ECHO The current value is: ECHO %PHP_PEAR_INSTALL_DIR% GOTO END :PEAR_BIN_ERROR ECHO PHP_PEAR_BIN_DIR is not set correctly. ECHO Please fix it using your environment variable or modify ECHO the default value in pear.bat ECHO The current value is: ECHO %PHP_PEAR_BIN_DIR% GOTO END :PEAR_PHPBIN_ERROR ECHO PHP_PEAR_PHP_BIN is not set correctly. ECHO Please fix it using your environment variable or modify ECHO the default value in pear.bat ECHO The current value is: ECHO %PHP_PEAR_PHP_BIN% GOTO END :RUN "%PHP_PEAR_PHP_BIN%" -C -d date.timezone=UTC -d output_buffering=1 -d safe_mode=0 -d open_basedir="" -d auto_prepend_file="" -d auto_append_file="" -d variables_order=EGPCS -d register_argc_argv="On" -d "include_path='%PHP_PEAR_INSTALL_DIR%'" -f "%PHP_PEAR_INSTALL_DIR%\pearcmd.php" -- %1 %2 %3 %4 %5 %6 %7 %8 %9 :END @ECHO ONphp-pear-1.10.1+submodules+notgz/scripts/pear.sh000077500000000000000000000014041262614675700216150ustar00rootroot00000000000000#!/bin/sh # first find which PHP binary to use if test "x$PHP_PEAR_PHP_BIN" != "x"; then PHP="$PHP_PEAR_PHP_BIN" else if test "@php_bin@" = '@'php_bin'@'; then PHP=php else PHP="@php_bin@" fi fi # then look for the right pear include dir if test "x$PHP_PEAR_INSTALL_DIR" != "x"; then INCDIR=$PHP_PEAR_INSTALL_DIR INCARG="-d include_path=$PHP_PEAR_INSTALL_DIR" else if test "@php_dir@" = '@'php_dir'@'; then INCDIR=`dirname $0` INCARG="" else INCDIR="@php_dir@" INCARG="-d include_path=@php_dir@" fi fi exec $PHP -C -q $INCARG -d date.timezone=UTC -d output_buffering=1 -d variables_order=EGPCS -d open_basedir="" -d safe_mode=0 -d register_argc_argv="On" -d auto_prepend_file="" -d auto_append_file="" $INCDIR/pearcmd.php "$@" php-pear-1.10.1+submodules+notgz/scripts/pearcmd.php000066400000000000000000000355101262614675700224600ustar00rootroot00000000000000 * @author Tomas V.V.Cox * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @link http://pear.php.net/package/PEAR */ @ob_end_clean(); if (!defined('PEAR_RUNTYPE')) { // this is defined in peclcmd.php as 'pecl' define('PEAR_RUNTYPE', 'pear'); } define('PEAR_IGNORE_BACKTRACE', 1); /** * @nodep Gtk */ //the space is needed for windows include paths with trailing backslash // http://pear.php.net/bugs/bug.php?id=19482 if ('@include_path@ ' != '@'.'include_path'.'@ ') { ini_set('include_path', trim('@include_path@ '). PATH_SEPARATOR . get_include_path()); $raw = false; } else { // this is a raw, uninstalled pear, either a cvs checkout, or php distro $raw = true; } @ini_set('allow_url_fopen', true); @set_time_limit(0); ob_implicit_flush(true); @ini_set('track_errors', true); @ini_set('html_errors', false); $_PEAR_PHPDIR = '#$%^&*'; set_error_handler('error_handler'); $pear_package_version = "@pear_version@"; require_once 'PEAR.php'; require_once 'PEAR/Frontend.php'; require_once 'PEAR/Config.php'; require_once 'PEAR/Command.php'; require_once 'Console/Getopt.php'; PEAR_Command::setFrontendType('CLI'); $all_commands = PEAR_Command::getCommands(); // remove this next part when we stop supporting that crap-ass PHP 4.2 if (!isset($_SERVER['argv']) && !isset($argv) && !isset($HTTP_SERVER_VARS['argv'])) { echo 'ERROR: either use the CLI php executable, ' . 'or set register_argc_argv=On in php.ini'; exit(1); } $argv = Console_Getopt::readPHPArgv(); // fix CGI sapi oddity - the -- in pear.bat/pear is not removed if (php_sapi_name() != 'cli' && isset($argv[1]) && $argv[1] == '--') { unset($argv[1]); $argv = array_values($argv); } $progname = PEAR_RUNTYPE; array_shift($argv); $options = Console_Getopt::getopt2($argv, "c:C:d:D:Gh?sSqu:vV"); if (PEAR::isError($options)) { usage($options); } $opts = $options[0]; $fetype = 'CLI'; if ($progname == 'gpear' || $progname == 'pear-gtk') { $fetype = 'Gtk2'; } else { foreach ($opts as $opt) { if ($opt[0] == 'G') { $fetype = 'Gtk2'; } } } $pear_user_config = ''; $pear_system_config = ''; $store_user_config = false; $store_system_config = false; $verbose = 1; foreach ($opts as $opt) { switch ($opt[0]) { case 'c': $pear_user_config = $opt[1]; break; case 'C': $pear_system_config = $opt[1]; break; } } PEAR_Command::setFrontendType($fetype); $ui = &PEAR_Command::getFrontendObject(); $config = &PEAR_Config::singleton($pear_user_config, $pear_system_config); if (PEAR::isError($config)) { $_file = ''; if ($pear_user_config !== false) { $_file .= $pear_user_config; } if ($pear_system_config !== false) { $_file .= '/' . $pear_system_config; } if ($_file == '/') { $_file = 'The default config file'; } $config->getMessage(); $ui->outputData("ERROR: $_file is not a valid config file or is corrupted."); // We stop, we have no idea where we are :) exit(1); } // this is used in the error handler to retrieve a relative path $_PEAR_PHPDIR = $config->get('php_dir'); $ui->setConfig($config); PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array($ui, "displayFatalError")); $verbose = $config->get("verbose"); $cmdopts = array(); if ($raw) { if (!$config->isDefinedLayer('user') && !$config->isDefinedLayer('system')) { $found = false; foreach ($opts as $opt) { if ($opt[0] == 'd' || $opt[0] == 'D') { // the user knows what they are doing, and are setting config values $found = true; } } if (!$found) { // no prior runs, try to install PEAR $parent = dirname(__FILE__); if (strpos($parent, 'scripts')) { $grandparent = dirname($parent); $packagexml = $grandparent . DIRECTORY_SEPARATOR . 'package2.xml'; $pearbase = $grandparent; } else { $packagexml = $parent . DIRECTORY_SEPARATOR . 'package2.xml'; $pearbase = $parent; } if (file_exists($packagexml)) { $options[1] = array( 'install', $packagexml ); $config->set('php_dir', $pearbase . DIRECTORY_SEPARATOR . 'php'); $config->set('data_dir', $pearbase . DIRECTORY_SEPARATOR . 'data'); $config->set('doc_dir', $pearbase . DIRECTORY_SEPARATOR . 'docs'); $config->set('test_dir', $pearbase . DIRECTORY_SEPARATOR . 'tests'); $config->set( 'ext_dir', $pearbase . DIRECTORY_SEPARATOR . 'extensions' ); $config->set('bin_dir', $pearbase); $config->mergeConfigFile($pearbase . 'pear.ini', false); $config->store(); $config->set('auto_discover', 1); } } } } foreach ($opts as $opt) { $param = !empty($opt[1]) ? $opt[1] : true; switch ($opt[0]) { case 'd': if ($param === true) { die( 'Invalid usage of "-d" option, expected -d config_value=value, ' . 'received "-d"' . "\n" ); } $possible = explode('=', $param); if (count($possible) != 2) { die( 'Invalid usage of "-d" option, expected ' . '-d config_value=value, received "' . $param . '"' . "\n" ); } list($key, $value) = explode('=', $param); $config->set($key, $value, 'user'); break; case 'D': if ($param === true) { die( 'Invalid usage of "-d" option, expected ' . '-d config_value=value, received "-d"' . "\n" ); } $possible = explode('=', $param); if (count($possible) != 2) { die( 'Invalid usage of "-d" option, expected ' . '-d config_value=value, received "' . $param . '"' . "\n" ); } list($key, $value) = explode('=', $param); $config->set($key, $value, 'system'); break; case 's': $store_user_config = true; break; case 'S': $store_system_config = true; break; case 'u': $config->remove($param, 'user'); break; case 'v': $config->set('verbose', $config->get('verbose') + 1); break; case 'q': $config->set('verbose', $config->get('verbose') - 1); break; case 'V': usage(null, 'version'); case 'c': case 'C': break; default: // all non pear params goes to the command $cmdopts[$opt[0]] = $param; break; } } if ($store_system_config) { $config->store('system'); } if ($store_user_config) { $config->store('user'); } $command = (isset($options[1][0])) ? $options[1][0] : null; if (empty($command) && ($store_user_config || $store_system_config)) { exit; } if ($fetype == 'Gtk2') { if (!$config->validConfiguration()) { PEAR::raiseError( "CRITICAL ERROR: no existing valid configuration files found in " . "files '$pear_user_config' or '$pear_system_config', " . "please copy an existing configuration file to one of these " . "locations, or use the -c and -s options to create one" ); } Gtk::main(); } else { do { if ($command == 'help') { usage(null, isset($options[1][1]) ? $options[1][1] : null); } if (!$config->validConfiguration()) { PEAR::raiseError( "CRITICAL ERROR: no existing valid configuration files found " . "in files '$pear_user_config' or '$pear_system_config', " . "please copy an existing configuration file to one of " . "these locations, or use the -c and -s options to create one" ); } PEAR::pushErrorHandling(PEAR_ERROR_RETURN); $cmd = PEAR_Command::factory($command, $config); PEAR::popErrorHandling(); if (PEAR::isError($cmd)) { usage(null, isset($options[1][0]) ? $options[1][0] : null); } $short_args = $long_args = null; PEAR_Command::getGetoptArgs($command, $short_args, $long_args); array_shift($options[1]); $tmp = Console_Getopt::getopt2($options[1], $short_args, $long_args); if (PEAR::isError($tmp)) { break; } list($tmpopt, $params) = $tmp; $opts = array(); foreach ($tmpopt as $foo => $tmp2) { list($opt, $value) = $tmp2; if ($value === null) { $value = true; // options without args } if (strlen($opt) == 1) { $cmdoptions = $cmd->getOptions($command); foreach ($cmdoptions as $o => $d) { if (isset($d['shortopt']) && $d['shortopt'] == $opt) { $opts[$o] = $value; } } } else { if (substr($opt, 0, 2) == '--') { $opts[substr($opt, 2)] = $value; } } } $ok = $cmd->run($command, $opts, $params); if ($ok === false) { PEAR::raiseError("unknown command `$command'"); } if (PEAR::isError($ok)) { PEAR::setErrorHandling( PEAR_ERROR_CALLBACK, array($ui, "displayFatalError") ); PEAR::raiseError($ok); } } while (false); } // {{{ usage() /** * Display usage information * * @param mixed $error Optional error message * @param mixed $helpsubject Optional subject/command to display help for * * @return void */ function usage($error = null, $helpsubject = null) { global $progname, $all_commands; $stdout = fopen('php://stdout', 'w'); if (PEAR::isError($error)) { fputs($stdout, $error->getMessage() . "\n"); } elseif ($error !== null) { fputs($stdout, "$error\n"); } if ($helpsubject != null) { $put = cmdHelp($helpsubject); } else { $put = "Commands:\n"; $maxlen = max(array_map("strlen", $all_commands)); $formatstr = "%-{$maxlen}s %s\n"; ksort($all_commands); foreach ($all_commands as $cmd => $class) { $put .= sprintf($formatstr, $cmd, PEAR_Command::getDescription($cmd)); } $put .= "Usage: $progname [options] command [command-options] \n". "Type \"$progname help options\" to list all options.\n". "Type \"$progname help shortcuts\" to list all command shortcuts.\n". "Type \"$progname help version\" or ". "\"$progname version\" to list version information.\n". "Type \"$progname help \" to get the help ". "for the specified command."; } fputs($stdout, "$put\n"); fclose($stdout); if ($error === null) { exit(0); } exit(1); } /** * Return help string for specified command * * @param string $command Command to return help for * * @return void */ function cmdHelp($command) { global $progname, $all_commands, $config; if ($command == "options") { return "Options:\n". " -v increase verbosity level (default 1)\n". " -q be quiet, decrease verbosity level\n". " -c file find user configuration in `file'\n". " -C file find system configuration in `file'\n". " -d foo=bar set user config variable `foo' to `bar'\n". " -D foo=bar set system config variable `foo' to `bar'\n". " -G start in graphical (Gtk) mode\n". " -s store user configuration\n". " -S store system configuration\n". " -u foo unset `foo' in the user configuration\n". " -h, -? display help/usage (this message)\n". " -V version information\n"; } elseif ($command == "shortcuts") { $sc = PEAR_Command::getShortcuts(); $ret = "Shortcuts:\n"; foreach ($sc as $s => $c) { $ret .= sprintf(" %-8s %s\n", $s, $c); } return $ret; } elseif ($command == "version") { return "PEAR Version: ".$GLOBALS['pear_package_version']. "\nPHP Version: ".phpversion(). "\nZend Engine Version: ".zend_version(). "\nRunning on: ".php_uname(); } elseif ($help = PEAR_Command::getHelp($command)) { if (is_string($help)) { return "$progname $command [options] $help\n"; } if ($help[1] === null) { return "$progname $command $help[0]"; } return "$progname $command [options] $help[0]\n$help[1]"; } return "Command '$command' is not valid, try '$progname help'"; } // }}} /** * error_handler * * @param mixed $errno Error number * @param mixed $errmsg Message * @param mixed $file Filename * @param mixed $line Line number * @param mixed $vars Variables * * @access public * @return boolean */ function error_handler($errno, $errmsg, $file, $line, $vars) { if ($errno & E_STRICT || $errno & E_DEPRECATED || !error_reporting() ) { if ($errno & E_STRICT) { return; // E_STRICT } if ($errno & E_DEPRECATED) { return; // E_DEPRECATED } if (!error_reporting() && isset($GLOBALS['config']) && $GLOBALS['config']->get('verbose') < 4) { return false; // @silenced error, show all if debug is high enough } } $errortype = array ( E_DEPRECATED => 'Deprecated Warning', E_ERROR => "Error", E_WARNING => "Warning", E_PARSE => "Parsing Error", E_STRICT => 'Strict Warning', E_NOTICE => "Notice", E_CORE_ERROR => "Core Error", E_CORE_WARNING => "Core Warning", E_COMPILE_ERROR => "Compile Error", E_COMPILE_WARNING => "Compile Warning", E_USER_ERROR => "User Error", E_USER_WARNING => "User Warning", E_USER_NOTICE => "User Notice" ); $prefix = $errortype[$errno]; global $_PEAR_PHPDIR; if (stristr($file, $_PEAR_PHPDIR)) { $file = substr($file, strlen($_PEAR_PHPDIR) + 1); } else { $file = basename($file); } print "\n$prefix: $errmsg in $file on line $line\n"; return false; } /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * indent-tabs-mode: nil * mode: php * End: */ // vim600:syn=php php-pear-1.10.1+submodules+notgz/scripts/peardev.bat000066400000000000000000000111371262614675700224510ustar00rootroot00000000000000@ECHO OFF REM ---------------------------------------------------------------------- REM PHP version 5 REM ---------------------------------------------------------------------- REM Copyright (c) 1997-2004 The PHP Group REM ---------------------------------------------------------------------- REM This source file is subject to version 3.0 of the PHP license, REM that is bundled with this package in the file LICENSE, and is REM available at through the world-wide-web at REM http://www.php.net/license/3_0.txt. REM If you did not receive a copy of the PHP license and are unable to REM obtain it through the world-wide-web, please send a note to REM license@php.net so we can mail you a copy immediately. REM ---------------------------------------------------------------------- REM Authors: Alexander Merz (alexmerz@php.net) REM ---------------------------------------------------------------------- REM REM $Id: peardev.bat,v 1.6 2007-09-03 03:00:17 cellog Exp $ REM change this lines to match the paths of your system REM ------------------- REM Test to see if this is a raw pear.bat (uninstalled version) SET TMPTMPTMPTMPT=@includ SET PMTPMTPMT=%TMPTMPTMPTMPT%e_path@ FOR %%x IN ("@include_path@") DO (if %%x=="%PMTPMTPMT%" GOTO :NOTINSTALLED) REM Check PEAR global ENV, set them if they do not exist IF "%PHP_PEAR_INSTALL_DIR%"=="" SET "PHP_PEAR_INSTALL_DIR=@include_path@" IF "%PHP_PEAR_BIN_DIR%"=="" SET "PHP_PEAR_BIN_DIR=@bin_dir@" IF "%PHP_PEAR_PHP_BIN%"=="" SET "PHP_PEAR_PHP_BIN=@php_bin@" GOTO :INSTALLED :NOTINSTALLED ECHO WARNING: This is a raw, uninstalled pear.bat REM Check to see if we can grab the directory of this file (Windows NT+) IF %~n0 == pear ( FOR %%x IN (cli\php.exe php.exe) DO (if "%%~$PATH:x" NEQ "" ( SET "PHP_PEAR_PHP_BIN=%%~$PATH:x" echo Using PHP Executable "%PHP_PEAR_PHP_BIN%" "%PHP_PEAR_PHP_BIN%" -v GOTO :NEXTTEST )) GOTO :FAILAUTODETECT :NEXTTEST IF "%PHP_PEAR_PHP_BIN%" NEQ "" ( REM We can use this PHP to run a temporary php file to get the dirname of pear echo ^ > ~~getloc.php "%PHP_PEAR_PHP_BIN%" ~~getloc.php set /p PHP_PEAR_BIN_DIR=fakeprompt < ~a.a DEL ~a.a DEL ~~getloc.php set "PHP_PEAR_INSTALL_DIR=%PHP_PEAR_BIN_DIR%pear" REM Make sure there is a pearcmd.php at our disposal IF NOT EXIST %PHP_PEAR_INSTALL_DIR%\pearcmd.php ( IF EXIST %PHP_PEAR_INSTALL_DIR%\scripts\pearcmd.php COPY %PHP_PEAR_INSTALL_DIR%\scripts\pearcmd.php %PHP_PEAR_INSTALL_DIR%\pearcmd.php IF EXIST pearcmd.php COPY pearcmd.php %PHP_PEAR_INSTALL_DIR%\pearcmd.php IF EXIST %~dp0\scripts\pearcmd.php COPY %~dp0\scripts\pearcmd.php %PHP_PEAR_INSTALL_DIR%\pearcmd.php ) ) GOTO :INSTALLED ) ELSE ( REM Windows Me/98 cannot succeed, so allow the batch to fail ) :FAILAUTODETECT echo WARNING: failed to auto-detect pear information :INSTALLED REM Check Folders and files IF NOT EXIST "%PHP_PEAR_INSTALL_DIR%" GOTO PEAR_INSTALL_ERROR IF NOT EXIST "%PHP_PEAR_INSTALL_DIR%\pearcmd.php" GOTO PEAR_INSTALL_ERROR2 IF NOT EXIST "%PHP_PEAR_BIN_DIR%" GOTO PEAR_BIN_ERROR IF NOT EXIST "%PHP_PEAR_PHP_BIN%" GOTO PEAR_PHPBIN_ERROR REM launch pearcmd GOTO RUN :PEAR_INSTALL_ERROR ECHO PHP_PEAR_INSTALL_DIR is not set correctly. ECHO Please fix it using your environment variable or modify ECHO the default value in pear.bat ECHO The current value is: ECHO %PHP_PEAR_INSTALL_DIR% GOTO END :PEAR_INSTALL_ERROR2 ECHO PHP_PEAR_INSTALL_DIR is not set correctly. ECHO pearcmd.php could not be found there. ECHO Please fix it using your environment variable or modify ECHO the default value in pear.bat ECHO The current value is: ECHO %PHP_PEAR_INSTALL_DIR% GOTO END :PEAR_BIN_ERROR ECHO PHP_PEAR_BIN_DIR is not set correctly. ECHO Please fix it using your environment variable or modify ECHO the default value in pear.bat ECHO The current value is: ECHO %PHP_PEAR_BIN_DIR% GOTO END :PEAR_PHPBIN_ERROR ECHO PHP_PEAR_PHP_BIN is not set correctly. ECHO Please fix it using your environment variable or modify ECHO the default value in pear.bat ECHO The current value is: ECHO %PHP_PEAR_PHP_BIN% GOTO END :RUN "%PHP_PEAR_PHP_BIN%" -C -d date.timezone=UTC -d memory_limit="-1" -d safe_mode=0 -d register_argc_argv="On" -d auto_prepend_file="" -d auto_append_file="" -d variables_order=EGPCS -d open_basedir="" -d output_buffering=1 -d "include_path='%PHP_PEAR_INSTALL_DIR%'" -f "%PHP_PEAR_INSTALL_DIR%\pearcmd.php" -- %1 %2 %3 %4 %5 %6 %7 %8 %9 :END @ECHO ONphp-pear-1.10.1+submodules+notgz/scripts/peardev.sh000077500000000000000000000014311262614675700223140ustar00rootroot00000000000000#!/bin/sh # first find which PHP binary to use if test "x$PHP_PEAR_PHP_BIN" != "x"; then PHP="$PHP_PEAR_PHP_BIN" else if test "@php_bin@" = '@'php_bin'@'; then PHP=php else PHP="@php_bin@" fi fi # then look for the right pear include dir if test "x$PHP_PEAR_INSTALL_DIR" != "x"; then INCDIR=$PHP_PEAR_INSTALL_DIR INCARG="-d include_path=$PHP_PEAR_INSTALL_DIR" else if test "@php_dir@" = '@'php_dir'@'; then INCDIR=`dirname $0` INCARG="" else INCDIR="@php_dir@" INCARG="-d include_path=@php_dir@" fi fi exec $PHP -d date.timezone=UTC -d memory_limit="-1" -C -q $INCARG -d output_buffering=1 -d open_basedir="" -d safe_mode=0 -d register_argc_argv="On" -d auto_prepend_file="" -d variables_order=EGPCS -d auto_append_file="" $INCDIR/pearcmd.php "$@" php-pear-1.10.1+submodules+notgz/scripts/pecl.bat000066400000000000000000000110301262614675700217360ustar00rootroot00000000000000@ECHO OFF REM ---------------------------------------------------------------------- REM PHP version 5 REM ---------------------------------------------------------------------- REM Copyright (c) 1997-2004 The PHP Group REM ---------------------------------------------------------------------- REM This source file is subject to version 3.0 of the PHP license, REM that is bundled with this package in the file LICENSE, and is REM available at through the world-wide-web at REM http://www.php.net/license/3_0.txt. REM If you did not receive a copy of the PHP license and are unable to REM obtain it through the world-wide-web, please send a note to REM license@php.net so we can mail you a copy immediately. REM ---------------------------------------------------------------------- REM Authors: Alexander Merz (alexmerz@php.net) REM ---------------------------------------------------------------------- REM REM Last updated 02/08/2004 ($Id$ is not replaced if the file is binary) REM change this lines to match the paths of your system REM ------------------- REM Test to see if this is a raw pear.bat (uninstalled version) SET TMPTMPTMPTMPT=@includ SET PMTPMTPMT=%TMPTMPTMPTMPT%e_path@ FOR %%x IN ("@include_path@") DO (if %%x=="%PMTPMTPMT%" GOTO :NOTINSTALLED) REM Check PEAR global ENV, set them if they do not exist IF "%PHP_PEAR_INSTALL_DIR%"=="" SET "PHP_PEAR_INSTALL_DIR=@include_path@" IF "%PHP_PEAR_BIN_DIR%"=="" SET "PHP_PEAR_BIN_DIR=@bin_dir@" IF "%PHP_PEAR_PHP_BIN%"=="" SET "PHP_PEAR_PHP_BIN=@php_bin@" GOTO :INSTALLED :NOTINSTALLED ECHO WARNING: This is a raw, uninstalled pear.bat REM Check to see if we can grab the directory of this file (Windows NT+) IF %~n0 == pear ( FOR %%x IN (cli\php.exe php.exe) DO (if "%%~$PATH:x" NEQ "" ( SET "PHP_PEAR_PHP_BIN=%%~$PATH:x" echo Using PHP Executable "%PHP_PEAR_PHP_BIN%" "%PHP_PEAR_PHP_BIN%" -v GOTO :NEXTTEST )) GOTO :FAILAUTODETECT :NEXTTEST IF "%PHP_PEAR_PHP_BIN%" NEQ "" ( REM We can use this PHP to run a temporary php file to get the dirname of pear echo ^ > ~~getloc.php "%PHP_PEAR_PHP_BIN%" ~~getloc.php set /p PHP_PEAR_BIN_DIR=fakeprompt < ~a.a DEL ~a.a DEL ~~getloc.php set "PHP_PEAR_INSTALL_DIR=%PHP_PEAR_BIN_DIR%pear" REM Make sure there is a pearcmd.php at our disposal IF NOT EXIST %PHP_PEAR_INSTALL_DIR%\pearcmd.php ( IF EXIST %PHP_PEAR_INSTALL_DIR%\scripts\pearcmd.php COPY %PHP_PEAR_INSTALL_DIR%\scripts\pearcmd.php %PHP_PEAR_INSTALL_DIR%\pearcmd.php IF EXIST pearcmd.php COPY pearcmd.php %PHP_PEAR_INSTALL_DIR%\pearcmd.php IF EXIST %~dp0\scripts\pearcmd.php COPY %~dp0\scripts\pearcmd.php %PHP_PEAR_INSTALL_DIR%\pearcmd.php ) ) GOTO :INSTALLED ) ELSE ( REM Windows Me/98 cannot succeed, so allow the batch to fail ) :FAILAUTODETECT echo WARNING: failed to auto-detect pear information :INSTALLED REM Check Folders and files IF NOT EXIST "%PHP_PEAR_INSTALL_DIR%" GOTO PEAR_INSTALL_ERROR IF NOT EXIST "%PHP_PEAR_INSTALL_DIR%\pearcmd.php" GOTO PEAR_INSTALL_ERROR2 IF NOT EXIST "%PHP_PEAR_BIN_DIR%" GOTO PEAR_BIN_ERROR IF NOT EXIST "%PHP_PEAR_PHP_BIN%" GOTO PEAR_PHPBIN_ERROR REM launch pearcmd GOTO RUN :PEAR_INSTALL_ERROR ECHO PHP_PEAR_INSTALL_DIR is not set correctly. ECHO Please fix it using your environment variable or modify ECHO the default value in pear.bat ECHO The current value is: ECHO %PHP_PEAR_INSTALL_DIR% GOTO END :PEAR_INSTALL_ERROR2 ECHO PHP_PEAR_INSTALL_DIR is not set correctly. ECHO pearcmd.php could not be found there. ECHO Please fix it using your environment variable or modify ECHO the default value in pear.bat ECHO The current value is: ECHO %PHP_PEAR_INSTALL_DIR% GOTO END :PEAR_BIN_ERROR ECHO PHP_PEAR_BIN_DIR is not set correctly. ECHO Please fix it using your environment variable or modify ECHO the default value in pear.bat ECHO The current value is: ECHO %PHP_PEAR_BIN_DIR% GOTO END :PEAR_PHPBIN_ERROR ECHO PHP_PEAR_PHP_BIN is not set correctly. ECHO Please fix it using your environment variable or modify ECHO the default value in pear.bat ECHO The current value is: ECHO %PHP_PEAR_PHP_BIN% GOTO END :RUN "%PHP_PEAR_PHP_BIN%" -C -n -d date.timezone=UTC -d output_buffering=1 -d safe_mode=0 -d "include_path='%PHP_PEAR_INSTALL_DIR%'" -d register_argc_argv="On" -d variables_order=EGPCS -f "%PHP_PEAR_INSTALL_DIR%\peclcmd.php" -- %1 %2 %3 %4 %5 %6 %7 %8 %9 :END @ECHO ONphp-pear-1.10.1+submodules+notgz/scripts/pecl.sh000077500000000000000000000013051262614675700216110ustar00rootroot00000000000000#!/bin/sh # first find which PHP binary to use if test "x$PHP_PEAR_PHP_BIN" != "x"; then PHP="$PHP_PEAR_PHP_BIN" else if test "@php_bin@" = '@'php_bin'@'; then PHP=php else PHP="@php_bin@" fi fi # then look for the right pear include dir if test "x$PHP_PEAR_INSTALL_DIR" != "x"; then INCDIR=$PHP_PEAR_INSTALL_DIR INCARG="-d include_path=$PHP_PEAR_INSTALL_DIR" else if test "@php_dir@" = '@'php_dir'@'; then INCDIR=`dirname $0` INCARG="" else INCDIR="@php_dir@" INCARG="-d include_path=@php_dir@" fi fi exec $PHP -C -n -q $INCARG -d date.timezone=UTC -d output_buffering=1 -d variables_order=EGPCS -d safe_mode=0 -d register_argc_argv="On" $INCDIR/peclcmd.php "$@" php-pear-1.10.1+submodules+notgz/scripts/peclcmd.php000066400000000000000000000017711262614675700224560ustar00rootroot00000000000000 * @author Tomas V.V.Cox * @copyright 1997-2009 The Authors * @license http://opensource.org/licenses/bsd-license.php New BSD License * @link http://pear.php.net/package/PEAR */ /** * @nodep Gtk */ //the space is needed for windows include paths with trailing backslash // http://pear.php.net/bugs/bug.php?id=19482 if ('@include_path@ ' != '@'.'include_path'.'@ ') { ini_set('include_path', trim('@include_path@ '). PATH_SEPARATOR . get_include_path()); $raw = false; } else { // this is a raw, uninstalled pear, either a cvs checkout, or php distro $raw = true; } define('PEAR_RUNTYPE', 'pecl'); require_once 'pearcmd.php'; /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * indent-tabs-mode: nil * mode: php * End: */ // vim600:syn=php ?> php-pear-1.10.1+submodules+notgz/submodules/000077500000000000000000000000001262614675700210235ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/submodules/Archive_Tar/000077500000000000000000000000001262614675700232125ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/submodules/Console_Getopt/000077500000000000000000000000001262614675700237475ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/submodules/Structures_Graph/000077500000000000000000000000001262614675700243275ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/submodules/XML_Util/000077500000000000000000000000001262614675700224605ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/template.spec000066400000000000000000000037251262614675700213370ustar00rootroot00000000000000Summary: PEAR: @summary@ Name: @rpm_package@ Version: @version@ Release: 1 License: @release_license@ Group: Development/Libraries Source: http://@master_server@/get/@package@-%{version}.tgz BuildRoot: %{_tmppath}/%{name}-root URL: http://@master_server@/package/@package@ Prefix: %{_prefix} BuildArchitectures: @arch@ @extra_headers@ %description @description@ %prep rm -rf %{buildroot}/* %setup -c -T # XXX Source files location is missing here in pear cmd pear -v -c %{buildroot}/pearrc \ -d php_dir=%{_libdir}/php/pear \ -d doc_dir=/docs \ -d bin_dir=%{_bindir} \ -d data_dir=%{_libdir}/php/pear/data \ -d test_dir=%{_libdir}/php/pear/tests \ -d ext_dir=%{_libdir} \@extra_config@ -s %build echo BuildRoot=%{buildroot} %postun # if refcount = 0 then package has been removed (not upgraded) if [ "$1" -eq "0" ]; then pear uninstall --nodeps -r @possible_channel@@package@ rm @rpm_xml_dir@/@package@.xml fi %post # if refcount = 2 then package has been upgraded if [ "$1" -ge "2" ]; then pear upgrade --nodeps -r @rpm_xml_dir@/@package@.xml else pear install --nodeps -r @rpm_xml_dir@/@package@.xml fi %install 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 [ "@doc_files@" != "" ]; then mv %{buildroot}/docs/@package@/* . rm -rf %{buildroot}/docs fi mkdir -p %{buildroot}@rpm_xml_dir@ tar -xzf $RPM_SOURCE_DIR/@package@-%{version}.tgz package@package2xml@.xml cp -p package@package2xml@.xml %{buildroot}@rpm_xml_dir@/@package@.xml #rm -rf %{buildroot}/* #pear -q install -R %{buildroot} -n package@package2xml@.xml #mkdir -p %{buildroot}@rpm_xml_dir@ #cp -p package@package2xml@.xml %{buildroot}@rpm_xml_dir@/@package@.xml %files %defattr(-,root,root) %doc @doc_files@ / php-pear-1.10.1+submodules+notgz/test-modified.php000066400000000000000000000101041262614675700221030ustar00rootroot00000000000000getModifiedTests(); if (!$force && !count($modified)) { echo "No changes to coverage needed. Bye!\n"; exit; } if (!count($modified) && $force) { goto norunnie; } chdir($testpath); $e = error_reporting(); error_reporting(0); $test->doRunTests('run-tests', array('coverage' => true), $modified); error_reporting($e); chdir($olddir); if (!$force && file_exists($testpath . '/run-tests.log')) { // tests failed echo "Tests failed - not regenerating coverage data\n"; exit; } norunnie: $a = new Aggregator($testpath, $codepath, $testpath . '/pear2coverage.db'); if ($norender) { exit; } if (file_exists(__DIR__ . '/coverage')) { echo "Removing old coverage HTML..."; foreach (new \DirectoryIterator(__DIR__ . '/coverage') as $file) { if ($file->isDot()) continue; unlink($file->getPathName()); } echo "done\n"; } else { mkdir(__DIR__ . '/coverage'); } echo "Rendering\n"; $a->render(__DIR__ . '/coverage'); echo "Done rendering\n"; } ?> php-pear-1.10.1+submodules+notgz/tests/000077500000000000000000000000001262614675700200035ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR/000077500000000000000000000000001262614675700205325ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR/bug16077.phpt000066400000000000000000000004571262614675700226170ustar00rootroot00000000000000--TEST-- Bug #16077: PEAR5::getStaticProperty does not return a reference to the property --FILE-- --EXPECT-- bool(true) php-pear-1.10.1+submodules+notgz/tests/PEAR/pear1.phpt000066400000000000000000000040331262614675700224370ustar00rootroot00000000000000--TEST-- PEAR constructor/destructor test --SKIPIF-- --FILE-- _debug = true; $this->name = $name; parent::__construct(); } function _TestPEAR() { print "This is the TestPEAR($this->name) destructor\n"; $this->_PEAR(); } } class Test2 extends PEAR { function _Test2() { print "This is the Test2 destructor\n"; $this->_PEAR(); } } class Test3 extends Test2 { } // test for bug http://bugs.php.net/bug.php?id=14744 class Other extends Pear { var $a = 'default value'; function _Other() { // $a was modified but here misteriously returns to be // the original value. That makes the destructor useless // The correct value for $a in the destructor shoud be "new value" echo "#bug 14744# Other class destructor: other->a == '" . $this->a ."'\n"; } } print "testing plain destructors\n"; $o = new TestPEAR("test1"); $p = new TestPEAR("test2"); print "..\n"; print "testing inherited destructors\n"; $q = new Test3; echo "...\ntesting bug #14744\n"; $other = new Other; echo "#bug 14744# Other class constructor: other->a == '" . $other->a ."'\n"; // Modify $a $other->a = 'new value'; echo "#bug 14744# Other class modified: other->a == '" . $other->a ."'\n"; print "..\n"; print "script exiting...\n"; print "..\n"; ?> --EXPECT-- testing plain destructors PEAR constructor called, class=testpear PEAR constructor called, class=testpear .. testing inherited destructors ... testing bug #14744 #bug 14744# Other class constructor: other->a == 'default value' #bug 14744# Other class modified: other->a == 'new value' .. script exiting... .. This is the TestPEAR(test1) destructor PEAR destructor called, class=testpear This is the TestPEAR(test2) destructor PEAR destructor called, class=testpear This is the Test2 destructor #bug 14744# Other class destructor: other->a == 'new value' php-pear-1.10.1+submodules+notgz/tests/PEAR/pear2.phpt000066400000000000000000000677351262614675700224620ustar00rootroot00000000000000--TEST-- PEAR complete set/push/pop error-handling test --SKIPIF-- --FILE-- _default_error_mode', $this->_default_error_mode, '$this->_default_error_options', $this->_default_error_options); } function doSetErrorHandlingStatic() { print "testing in PEAR setErrorHandling array(obj, method)\n"; $obj = new testErrorHandlingPEAR; PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array(&$obj, 'fakeHandleError')); echoPEARVars('_PEAR_default_error_mode', $GLOBALS['_PEAR_default_error_mode'], '_PEAR_default_error_options', $GLOBALS['_PEAR_default_error_options']); echoPEARVars('$this->_default_error_mode', $this->_default_error_mode, '$this->_default_error_options', $this->_default_error_options); } function doSetErrorHandlingObject() { print "testing in PEAR setErrorHandling array(class, method)\n"; PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array('testErrorHandlingStatic', 'fakeHandleError')); echoPEARVars('_PEAR_default_error_mode', $GLOBALS['_PEAR_default_error_mode'], '_PEAR_default_error_options', $GLOBALS['_PEAR_default_error_options']); echoPEARVars('$this->_default_error_mode', $this->_default_error_mode, '$this->_default_error_options', $this->_default_error_options); } function doPushErrorHandlingFunction() { print "testing in PEAR pushErrorHandling\n"; PEAR::pushErrorHandling(PEAR_ERROR_CALLBACK, 'get_error_mode'); echoPEARStack('_PEAR_error_handler_stack', $GLOBALS['_PEAR_error_handler_stack']); } function doPushErrorHandlingObject() { print "testing in PEAR pushErrorHandling array(obj, method)\n"; $obj = new testErrorHandlingPEAR; PEAR::pushErrorHandling(PEAR_ERROR_CALLBACK, array(&$obj, 'fakeHandleError')); echoPEARStack('_PEAR_error_handler_stack', $GLOBALS['_PEAR_error_handler_stack']); } function doPushErrorHandlingStatic() { print "testing in PEAR pushErrorHandling array(class, method)\n"; PEAR::pushErrorHandling(PEAR_ERROR_CALLBACK, array('testErrorHandlingStatic', 'fakeHandleError')); echoPEARStack('_PEAR_error_handler_stack', $GLOBALS['_PEAR_error_handler_stack']); } function doPopErrorHandling() { print "testing in PEAR popErrorHandling\n"; PEAR::popErrorHandling(); echoPEARStack('_PEAR_error_handler_stack', $GLOBALS['_PEAR_error_handler_stack']); } } function echoPEARVars($name1, $mode, $name2, $options, $indent = '') { $levelMap = array( E_USER_NOTICE => 'E_USER_NOTICE', E_USER_WARNING => 'E_USER_WARNING', E_USER_ERROR => 'E_USER_ERROR', ); $pearLevelMap = array( PEAR_ERROR_RETURN =>'PEAR_ERROR_RETURN', PEAR_ERROR_PRINT =>'PEAR_ERROR_PRINT', PEAR_ERROR_TRIGGER =>'PEAR_ERROR_TRIGGER', PEAR_ERROR_DIE =>'PEAR_ERROR_DIE', PEAR_ERROR_CALLBACK =>'PEAR_ERROR_CALLBACK', PEAR_ERROR_EXCEPTION =>'PEAR_ERROR_EXCEPTION', ); print $indent . "echoing PEAR error-handling Variables:\n"; print "$indent--------------------------------------\n"; print $indent . "$name1:\n"; $levels = get_error_mode($mode); print $indent; foreach($levels as $level) { print $pearLevelMap[$level] . ','; } print "\n"; print $indent . "$name2:\n"; if (is_string($options)) { print $indent . 'Callback: ' . $options. "()\n"; } elseif (is_array($options)) { print $indent . 'Callback: '; if (is_string($options[0])) { print '(static) ' . $options[0] . '::'; } else { print strtolower(get_class($options[0])) . '->'; } print $options[1] . "()\n"; } else { print $indent . $levelMap[$options] . "\n"; } print "$indent--------------------------------------\n"; } function echoPEARStack($name, $stack) { print "stack $name:\n"; foreach ($stack as $i => $item) { print "Index $i:\n"; echoPEARVars('mode', $item[0], 'options', $item[1], ' '); } } function get_error_mode($err) { $ret = array(); $level = 0; while($level < 7) { $a = ($err >> $level++) & 1; if ($a) { $ret[] = 1 << ($level - 1); } } return $ret; } print "testing static error-handling global code\n"; echoPEARVars('_PEAR_default_error_mode', $GLOBALS['_PEAR_default_error_mode'], '_PEAR_default_error_options', $GLOBALS['_PEAR_default_error_options']); print "testing setErrorHandling\n"; PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'get_error_mode'); echoPEARVars('_PEAR_default_error_mode', $GLOBALS['_PEAR_default_error_mode'], '_PEAR_default_error_options', $GLOBALS['_PEAR_default_error_options']); print "testing setErrorHandling array(obj, method)\n"; $obj = new testErrorHandlingPEAR; PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array(&$obj, 'fakeHandleError')); echoPEARVars('_PEAR_default_error_mode', $GLOBALS['_PEAR_default_error_mode'], '_PEAR_default_error_options', $GLOBALS['_PEAR_default_error_options']); print "testing setErrorHandling array(class, method)\n"; PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array('testErrorHandlingStatic', 'fakeHandleError')); echoPEARVars('_PEAR_default_error_mode', $GLOBALS['_PEAR_default_error_mode'], '_PEAR_default_error_options', $GLOBALS['_PEAR_default_error_options']); print "testing pushErrorHandling\n"; PEAR::pushErrorHandling(PEAR_ERROR_CALLBACK, 'get_error_mode'); echoPEARStack('_PEAR_error_handler_stack', $GLOBALS['_PEAR_error_handler_stack']); print "testing pushErrorHandling array(obj, method)\n"; $obj = new testErrorHandlingPEAR; PEAR::pushErrorHandling(PEAR_ERROR_CALLBACK, array(&$obj, 'fakeHandleError')); echoPEARStack('_PEAR_error_handler_stack', $GLOBALS['_PEAR_error_handler_stack']); print "testing pushErrorHandling array(class, method)\n"; PEAR::pushErrorHandling(PEAR_ERROR_CALLBACK, array('testErrorHandlingStatic', 'fakeHandleError')); echoPEARStack('_PEAR_error_handler_stack', $GLOBALS['_PEAR_error_handler_stack']); print "testing popErrorHandling\n"; PEAR::popErrorHandling(); echoPEARStack('_PEAR_error_handler_stack', $GLOBALS['_PEAR_error_handler_stack']); print "testing popErrorHandling\n"; $obj = new testErrorHandlingPEAR; PEAR::popErrorHandling(); echoPEARStack('_PEAR_error_handler_stack', $GLOBALS['_PEAR_error_handler_stack']); print "testing popErrorHandling\n"; PEAR::popErrorHandling(); echoPEARStack('_PEAR_error_handler_stack', $GLOBALS['_PEAR_error_handler_stack']); print "*******************************************\n"; print "testing static error-handling in-class code\n"; print "*******************************************\n"; PEAR::setErrorHandling(PEAR_ERROR_RETURN, E_USER_NOTICE); $obj = new testErrorHandlingStatic; $obj->doSetErrorHandlingFunction(); $obj->doSetErrorHandlingStatic(); $obj->doSetErrorHandlingObject(); $obj->doPushErrorHandlingFunction(); $obj->doPushErrorHandlingStatic(); $obj->doPushErrorHandlingObject(); $obj->doPopErrorHandling(); $obj->doPopErrorHandling(); $obj->doPopErrorHandling(); print "*******************************************\n"; print "testing non-static error-handling in-class code\n"; print "*******************************************\n"; PEAR::setErrorHandling(PEAR_ERROR_RETURN, E_USER_NOTICE); $obj = new testErrorHandlingPEAR; $obj->doSetErrorHandlingFunction(); $obj->doSetErrorHandlingStatic(); $obj->doSetErrorHandlingObject(); $obj->doPushErrorHandlingFunction(); $obj->doPushErrorHandlingStatic(); $obj->doPushErrorHandlingObject(); $obj->doPopErrorHandling(); $obj->doPopErrorHandling(); $obj->doPopErrorHandling(); ?> --EXPECT-- testing static error-handling global code echoing PEAR error-handling Variables: -------------------------------------- _PEAR_default_error_mode: PEAR_ERROR_RETURN, _PEAR_default_error_options: E_USER_NOTICE -------------------------------------- testing setErrorHandling echoing PEAR error-handling Variables: -------------------------------------- _PEAR_default_error_mode: PEAR_ERROR_CALLBACK, _PEAR_default_error_options: Callback: get_error_mode() -------------------------------------- testing setErrorHandling array(obj, method) echoing PEAR error-handling Variables: -------------------------------------- _PEAR_default_error_mode: PEAR_ERROR_CALLBACK, _PEAR_default_error_options: Callback: testerrorhandlingpear->fakeHandleError() -------------------------------------- testing setErrorHandling array(class, method) echoing PEAR error-handling Variables: -------------------------------------- _PEAR_default_error_mode: PEAR_ERROR_CALLBACK, _PEAR_default_error_options: Callback: (static) testErrorHandlingStatic::fakeHandleError() -------------------------------------- testing pushErrorHandling stack _PEAR_error_handler_stack: Index 0: echoing PEAR error-handling Variables: -------------------------------------- mode: PEAR_ERROR_CALLBACK, options: Callback: (static) testErrorHandlingStatic::fakeHandleError() -------------------------------------- Index 1: echoing PEAR error-handling Variables: -------------------------------------- mode: PEAR_ERROR_CALLBACK, options: Callback: get_error_mode() -------------------------------------- testing pushErrorHandling array(obj, method) stack _PEAR_error_handler_stack: Index 0: echoing PEAR error-handling Variables: -------------------------------------- mode: PEAR_ERROR_CALLBACK, options: Callback: (static) testErrorHandlingStatic::fakeHandleError() -------------------------------------- Index 1: echoing PEAR error-handling Variables: -------------------------------------- mode: PEAR_ERROR_CALLBACK, options: Callback: get_error_mode() -------------------------------------- Index 2: echoing PEAR error-handling Variables: -------------------------------------- mode: PEAR_ERROR_CALLBACK, options: Callback: get_error_mode() -------------------------------------- Index 3: echoing PEAR error-handling Variables: -------------------------------------- mode: PEAR_ERROR_CALLBACK, options: Callback: testerrorhandlingpear->fakeHandleError() -------------------------------------- testing pushErrorHandling array(class, method) stack _PEAR_error_handler_stack: Index 0: echoing PEAR error-handling Variables: -------------------------------------- mode: PEAR_ERROR_CALLBACK, options: Callback: (static) testErrorHandlingStatic::fakeHandleError() -------------------------------------- Index 1: echoing PEAR error-handling Variables: -------------------------------------- mode: PEAR_ERROR_CALLBACK, options: Callback: get_error_mode() -------------------------------------- Index 2: echoing PEAR error-handling Variables: -------------------------------------- mode: PEAR_ERROR_CALLBACK, options: Callback: get_error_mode() -------------------------------------- Index 3: echoing PEAR error-handling Variables: -------------------------------------- mode: PEAR_ERROR_CALLBACK, options: Callback: testerrorhandlingpear->fakeHandleError() -------------------------------------- Index 4: echoing PEAR error-handling Variables: -------------------------------------- mode: PEAR_ERROR_CALLBACK, options: Callback: testerrorhandlingpear->fakeHandleError() -------------------------------------- Index 5: echoing PEAR error-handling Variables: -------------------------------------- mode: PEAR_ERROR_CALLBACK, options: Callback: (static) testErrorHandlingStatic::fakeHandleError() -------------------------------------- testing popErrorHandling stack _PEAR_error_handler_stack: Index 0: echoing PEAR error-handling Variables: -------------------------------------- mode: PEAR_ERROR_CALLBACK, options: Callback: (static) testErrorHandlingStatic::fakeHandleError() -------------------------------------- Index 1: echoing PEAR error-handling Variables: -------------------------------------- mode: PEAR_ERROR_CALLBACK, options: Callback: get_error_mode() -------------------------------------- Index 2: echoing PEAR error-handling Variables: -------------------------------------- mode: PEAR_ERROR_CALLBACK, options: Callback: get_error_mode() -------------------------------------- Index 3: echoing PEAR error-handling Variables: -------------------------------------- mode: PEAR_ERROR_CALLBACK, options: Callback: testerrorhandlingpear->fakeHandleError() -------------------------------------- testing popErrorHandling stack _PEAR_error_handler_stack: Index 0: echoing PEAR error-handling Variables: -------------------------------------- mode: PEAR_ERROR_CALLBACK, options: Callback: (static) testErrorHandlingStatic::fakeHandleError() -------------------------------------- Index 1: echoing PEAR error-handling Variables: -------------------------------------- mode: PEAR_ERROR_CALLBACK, options: Callback: get_error_mode() -------------------------------------- testing popErrorHandling stack _PEAR_error_handler_stack: ******************************************* testing static error-handling in-class code ******************************************* testing in class setErrorHandling echoing PEAR error-handling Variables: -------------------------------------- _PEAR_default_error_mode: PEAR_ERROR_CALLBACK, _PEAR_default_error_options: Callback: get_error_mode() -------------------------------------- testing in class setErrorHandling array(obj, method) echoing PEAR error-handling Variables: -------------------------------------- _PEAR_default_error_mode: PEAR_ERROR_CALLBACK, _PEAR_default_error_options: Callback: testerrorhandlingpear->fakeHandleError() -------------------------------------- testing in class setErrorHandling array(class, method) echoing PEAR error-handling Variables: -------------------------------------- _PEAR_default_error_mode: PEAR_ERROR_CALLBACK, _PEAR_default_error_options: Callback: (static) testErrorHandlingStatic::fakeHandleError() -------------------------------------- testing in class pushErrorHandling stack _PEAR_error_handler_stack: Index 0: echoing PEAR error-handling Variables: -------------------------------------- mode: PEAR_ERROR_CALLBACK, options: Callback: (static) testErrorHandlingStatic::fakeHandleError() -------------------------------------- Index 1: echoing PEAR error-handling Variables: -------------------------------------- mode: PEAR_ERROR_CALLBACK, options: Callback: get_error_mode() -------------------------------------- testing in class pushErrorHandling array(class, method) stack _PEAR_error_handler_stack: Index 0: echoing PEAR error-handling Variables: -------------------------------------- mode: PEAR_ERROR_CALLBACK, options: Callback: (static) testErrorHandlingStatic::fakeHandleError() -------------------------------------- Index 1: echoing PEAR error-handling Variables: -------------------------------------- mode: PEAR_ERROR_CALLBACK, options: Callback: get_error_mode() -------------------------------------- Index 2: echoing PEAR error-handling Variables: -------------------------------------- mode: PEAR_ERROR_CALLBACK, options: Callback: get_error_mode() -------------------------------------- Index 3: echoing PEAR error-handling Variables: -------------------------------------- mode: PEAR_ERROR_CALLBACK, options: Callback: (static) testErrorHandlingStatic::fakeHandleError() -------------------------------------- testing in class pushErrorHandling array(obj, method) stack _PEAR_error_handler_stack: Index 0: echoing PEAR error-handling Variables: -------------------------------------- mode: PEAR_ERROR_CALLBACK, options: Callback: (static) testErrorHandlingStatic::fakeHandleError() -------------------------------------- Index 1: echoing PEAR error-handling Variables: -------------------------------------- mode: PEAR_ERROR_CALLBACK, options: Callback: get_error_mode() -------------------------------------- Index 2: echoing PEAR error-handling Variables: -------------------------------------- mode: PEAR_ERROR_CALLBACK, options: Callback: get_error_mode() -------------------------------------- Index 3: echoing PEAR error-handling Variables: -------------------------------------- mode: PEAR_ERROR_CALLBACK, options: Callback: (static) testErrorHandlingStatic::fakeHandleError() -------------------------------------- Index 4: echoing PEAR error-handling Variables: -------------------------------------- mode: PEAR_ERROR_CALLBACK, options: Callback: (static) testErrorHandlingStatic::fakeHandleError() -------------------------------------- Index 5: echoing PEAR error-handling Variables: -------------------------------------- mode: PEAR_ERROR_CALLBACK, options: Callback: testerrorhandlingpear->fakeHandleError() -------------------------------------- testing in class popErrorHandling stack _PEAR_error_handler_stack: Index 0: echoing PEAR error-handling Variables: -------------------------------------- mode: PEAR_ERROR_CALLBACK, options: Callback: (static) testErrorHandlingStatic::fakeHandleError() -------------------------------------- Index 1: echoing PEAR error-handling Variables: -------------------------------------- mode: PEAR_ERROR_CALLBACK, options: Callback: get_error_mode() -------------------------------------- Index 2: echoing PEAR error-handling Variables: -------------------------------------- mode: PEAR_ERROR_CALLBACK, options: Callback: get_error_mode() -------------------------------------- Index 3: echoing PEAR error-handling Variables: -------------------------------------- mode: PEAR_ERROR_CALLBACK, options: Callback: (static) testErrorHandlingStatic::fakeHandleError() -------------------------------------- testing in class popErrorHandling stack _PEAR_error_handler_stack: Index 0: echoing PEAR error-handling Variables: -------------------------------------- mode: PEAR_ERROR_CALLBACK, options: Callback: (static) testErrorHandlingStatic::fakeHandleError() -------------------------------------- Index 1: echoing PEAR error-handling Variables: -------------------------------------- mode: PEAR_ERROR_CALLBACK, options: Callback: get_error_mode() -------------------------------------- testing in class popErrorHandling stack _PEAR_error_handler_stack: ******************************************* testing non-static error-handling in-class code ******************************************* testing in PEAR setErrorHandling echoing PEAR error-handling Variables: -------------------------------------- _PEAR_default_error_mode: PEAR_ERROR_RETURN, _PEAR_default_error_options: E_USER_NOTICE -------------------------------------- echoing PEAR error-handling Variables: -------------------------------------- $this->_default_error_mode: PEAR_ERROR_CALLBACK, $this->_default_error_options: Callback: get_error_mode() -------------------------------------- testing in PEAR setErrorHandling array(obj, method) echoing PEAR error-handling Variables: -------------------------------------- _PEAR_default_error_mode: PEAR_ERROR_RETURN, _PEAR_default_error_options: E_USER_NOTICE -------------------------------------- echoing PEAR error-handling Variables: -------------------------------------- $this->_default_error_mode: PEAR_ERROR_CALLBACK, $this->_default_error_options: Callback: testerrorhandlingpear->fakeHandleError() -------------------------------------- testing in PEAR setErrorHandling array(class, method) echoing PEAR error-handling Variables: -------------------------------------- _PEAR_default_error_mode: PEAR_ERROR_RETURN, _PEAR_default_error_options: E_USER_NOTICE -------------------------------------- echoing PEAR error-handling Variables: -------------------------------------- $this->_default_error_mode: PEAR_ERROR_CALLBACK, $this->_default_error_options: Callback: (static) testErrorHandlingStatic::fakeHandleError() -------------------------------------- testing in PEAR pushErrorHandling stack _PEAR_error_handler_stack: Index 0: echoing PEAR error-handling Variables: -------------------------------------- mode: PEAR_ERROR_CALLBACK, options: Callback: (static) testErrorHandlingStatic::fakeHandleError() -------------------------------------- Index 1: echoing PEAR error-handling Variables: -------------------------------------- mode: PEAR_ERROR_CALLBACK, options: Callback: get_error_mode() -------------------------------------- testing in PEAR pushErrorHandling array(class, method) stack _PEAR_error_handler_stack: Index 0: echoing PEAR error-handling Variables: -------------------------------------- mode: PEAR_ERROR_CALLBACK, options: Callback: (static) testErrorHandlingStatic::fakeHandleError() -------------------------------------- Index 1: echoing PEAR error-handling Variables: -------------------------------------- mode: PEAR_ERROR_CALLBACK, options: Callback: get_error_mode() -------------------------------------- Index 2: echoing PEAR error-handling Variables: -------------------------------------- mode: PEAR_ERROR_CALLBACK, options: Callback: get_error_mode() -------------------------------------- Index 3: echoing PEAR error-handling Variables: -------------------------------------- mode: PEAR_ERROR_CALLBACK, options: Callback: (static) testErrorHandlingStatic::fakeHandleError() -------------------------------------- testing in PEAR pushErrorHandling array(obj, method) stack _PEAR_error_handler_stack: Index 0: echoing PEAR error-handling Variables: -------------------------------------- mode: PEAR_ERROR_CALLBACK, options: Callback: (static) testErrorHandlingStatic::fakeHandleError() -------------------------------------- Index 1: echoing PEAR error-handling Variables: -------------------------------------- mode: PEAR_ERROR_CALLBACK, options: Callback: get_error_mode() -------------------------------------- Index 2: echoing PEAR error-handling Variables: -------------------------------------- mode: PEAR_ERROR_CALLBACK, options: Callback: get_error_mode() -------------------------------------- Index 3: echoing PEAR error-handling Variables: -------------------------------------- mode: PEAR_ERROR_CALLBACK, options: Callback: (static) testErrorHandlingStatic::fakeHandleError() -------------------------------------- Index 4: echoing PEAR error-handling Variables: -------------------------------------- mode: PEAR_ERROR_CALLBACK, options: Callback: (static) testErrorHandlingStatic::fakeHandleError() -------------------------------------- Index 5: echoing PEAR error-handling Variables: -------------------------------------- mode: PEAR_ERROR_CALLBACK, options: Callback: testerrorhandlingpear->fakeHandleError() -------------------------------------- testing in PEAR popErrorHandling stack _PEAR_error_handler_stack: Index 0: echoing PEAR error-handling Variables: -------------------------------------- mode: PEAR_ERROR_CALLBACK, options: Callback: (static) testErrorHandlingStatic::fakeHandleError() -------------------------------------- Index 1: echoing PEAR error-handling Variables: -------------------------------------- mode: PEAR_ERROR_CALLBACK, options: Callback: get_error_mode() -------------------------------------- Index 2: echoing PEAR error-handling Variables: -------------------------------------- mode: PEAR_ERROR_CALLBACK, options: Callback: get_error_mode() -------------------------------------- Index 3: echoing PEAR error-handling Variables: -------------------------------------- mode: PEAR_ERROR_CALLBACK, options: Callback: (static) testErrorHandlingStatic::fakeHandleError() -------------------------------------- testing in PEAR popErrorHandling stack _PEAR_error_handler_stack: Index 0: echoing PEAR error-handling Variables: -------------------------------------- mode: PEAR_ERROR_CALLBACK, options: Callback: (static) testErrorHandlingStatic::fakeHandleError() -------------------------------------- Index 1: echoing PEAR error-handling Variables: -------------------------------------- mode: PEAR_ERROR_CALLBACK, options: Callback: get_error_mode() -------------------------------------- testing in PEAR popErrorHandling stack _PEAR_error_handler_stack: php-pear-1.10.1+submodules+notgz/tests/PEAR_Channelfile/000077500000000000000000000000001262614675700230225ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Channelfile/setup.php.inc000066400000000000000000000005361262614675700254470ustar00rootroot00000000000000 php-pear-1.10.1+submodules+notgz/tests/PEAR_Channelfile/test_addfunction_basic.phpt000066400000000000000000000210121262614675700304110ustar00rootroot00000000000000--TEST-- PEAR_Channelfile->addFunction() (basic) --SKIPIF-- --FILE-- fromXmlString($first = ' pear.php.net pear PHP Extension and Application Repository PEAR_Validate logintest package.listLatestReleases package.listAll package.info package.getDownloadURL channel.listAll channel.update '); $res = $chf->validate(); $phpt->assertTrue($res, 'basic validation failed'); $phpt->assertEquals(array ( 'attribs' => array ( 'version' => '1.0', 'xmlns' => 'http://pear.php.net/channel-1.0', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation' => 'http://pear.php.net/dtd/channel-1.0.xsd', ), 'name' => 'pear.php.net', 'suggestedalias' => 'pear', 'summary' => 'PHP Extension and Application Repository', 'validatepackage' => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'PEAR_Validate', ), 'servers' => array ( 'primary' => array ( 'xmlrpc' => array ( 'function' => array ( 0 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'logintest', ), 1 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'package.listLatestReleases', ), 2 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'package.listAll', ), 3 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'package.info', ), 4 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'package.getDownloadURL', ), 5 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'channel.listAll', ), 6 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'channel.update', ), ), ), ), ), ), $chf->toArray(), 'Parsed array of default is not correct'); $chf->addFunction('xmlrpc', '2.0', 'foobar'); $chf->addFunction('soap', '1.0', 'foobar'); $phpt->assertTrue($chf->validate(), 'after add validation failed'); $phpt->assertEquals(array ( 'attribs' => array ( 'version' => '1.0', 'xmlns' => 'http://pear.php.net/channel-1.0', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation' => 'http://pear.php.net/dtd/channel-1.0.xsd', ), 'name' => 'pear.php.net', 'suggestedalias' => 'pear', 'summary' => 'PHP Extension and Application Repository', 'validatepackage' => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'PEAR_Validate', ), 'servers' => array ( 'primary' => array ( 'xmlrpc' => array ( 'function' => array ( 0 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'logintest', ), 1 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'package.listLatestReleases', ), 2 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'package.listAll', ), 3 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'package.info', ), 4 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'package.getDownloadURL', ), 5 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'channel.listAll', ), 6 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'channel.update', ), 7 => array ( 'attribs' => array ( 'version' => '2.0', ), '_content' => 'foobar', ), ), ), 'soap' => array ( 'function' => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'foobar', ), ), ), ), ), $chf->toArray(), 'addFunction() did not work as expected'); $chf->addFunction('soap', '1.0', 'gronfk'); $phpt->assertTrue($chf->validate(), 'after add validation failed'); $phpt->assertEquals(array ( 'attribs' => array ( 'version' => '1.0', 'xmlns' => 'http://pear.php.net/channel-1.0', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation' => 'http://pear.php.net/dtd/channel-1.0.xsd', ), 'name' => 'pear.php.net', 'suggestedalias' => 'pear', 'summary' => 'PHP Extension and Application Repository', 'validatepackage' => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'PEAR_Validate', ), 'servers' => array ( 'primary' => array ( 'xmlrpc' => array ( 'function' => array ( 0 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'logintest', ), 1 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'package.listLatestReleases', ), 2 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'package.listAll', ), 3 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'package.info', ), 4 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'package.getDownloadURL', ), 5 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'channel.listAll', ), 6 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'channel.update', ), 7 => array ( 'attribs' => array ( 'version' => '2.0', ), '_content' => 'foobar', ), ), ), 'soap' => array ( 'function' => array ( 0 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'foobar', ), 1 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'gronfk', ), ), ), ), ), ), $chf->toArray(), 'second add failed'); echo 'tests done'; ?> --EXPECT-- tests done php-pear-1.10.1+submodules+notgz/tests/PEAR_Channelfile/test_addfunction_mirror.phpt000066400000000000000000000137421262614675700306550ustar00rootroot00000000000000--TEST-- PEAR_Channelfile->addFunction() (mirror) --SKIPIF-- --FILE-- fromXmlString($first = ' pear.php.net pear PHP Extension and Application Repository PEAR_Validate logintest package.listLatestReleases package.listAll package.info package.getDownloadURL channel.listAll channel.update '); $phpt->assertTrue($chf->validate(), 'initial'); $phpt->assertEquals(array ( 'attribs' => array ( 'version' => '1.0', 'xmlns' => 'http://pear.php.net/channel-1.0', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation' => 'http://pear.php.net/dtd/channel-1.0.xsd', ), 'name' => 'pear.php.net', 'suggestedalias' => 'pear', 'summary' => 'PHP Extension and Application Repository', 'validatepackage' => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'PEAR_Validate', ), 'servers' => array ( 'primary' => array ( 'xmlrpc' => array ( 'function' => array ( 0 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'logintest', ), 1 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'package.listLatestReleases', ), 2 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'package.listAll', ), 3 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'package.info', ), 4 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'package.getDownloadURL', ), 5 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'channel.listAll', ), 6 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'channel.update', ), ), ), ), ), ), $chf->toArray(), 'Parsed array of default is not correct'); $chf->addMirror('mirror.php.net'); $chf->addFunction('xmlrpc', '2.0', 'foobar', 'mirror.php.net'); $chf->addFunction('soap', '1.0', 'foobar', 'mirror.php.net'); $phpt->assertTrue($chf->validate(), 'after mirror add'); $phpt->assertEquals(array ( 'attribs' => array ( 'version' => '1.0', 'xmlns' => 'http://pear.php.net/channel-1.0', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation' => 'http://pear.php.net/dtd/channel-1.0.xsd', ), 'name' => 'pear.php.net', 'suggestedalias' => 'pear', 'summary' => 'PHP Extension and Application Repository', 'validatepackage' => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'PEAR_Validate', ), 'servers' => array ( 'primary' => array ( 'xmlrpc' => array ( 'function' => array ( 0 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'logintest', ), 1 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'package.listLatestReleases', ), 2 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'package.listAll', ), 3 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'package.info', ), 4 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'package.getDownloadURL', ), 5 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'channel.listAll', ), 6 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'channel.update', ), ), ), ), 'mirror' => array ( 'attribs' => array ( 'host' => 'mirror.php.net', ), 'xmlrpc' => array ( 'function' => array ( 'attribs' => array ( 'version' => '2.0', ), '_content' => 'foobar', ), ), 'soap' => array ( 'function' => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'foobar', ), ), ), ), ), $chf->toArray(), 'addMirror() did not work as expected'); echo 'tests done'; ?> --EXPECT-- tests done php-pear-1.10.1+submodules+notgz/tests/PEAR_Channelfile/test_addmirror.phpt000066400000000000000000000175021262614675700267460ustar00rootroot00000000000000--TEST-- PEAR_Channelfile->addMirror() --SKIPIF-- --FILE-- fromXmlString($first = ' pear.php.net pear PHP Extension and Application Repository PEAR_Validate logintest package.listLatestReleases package.listAll package.info package.getDownloadURL channel.listAll channel.update '); $phpt->assertTrue($chf->validate(), 'initial setup'); $phpt->assertEquals(array ( 'attribs' => array ( 'version' => '1.0', 'xmlns' => 'http://pear.php.net/channel-1.0', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation' => 'http://pear.php.net/dtd/channel-1.0.xsd', ), 'name' => 'pear.php.net', 'suggestedalias' => 'pear', 'summary' => 'PHP Extension and Application Repository', 'validatepackage' => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'PEAR_Validate', ), 'servers' => array ( 'primary' => array ( 'xmlrpc' => array ( 'function' => array ( 0 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'logintest', ), 1 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'package.listLatestReleases', ), 2 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'package.listAll', ), 3 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'package.info', ), 4 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'package.getDownloadURL', ), 5 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'channel.listAll', ), 6 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'channel.update', ), ), ), ), ), ), $chf->toArray(), 'Parsed array of default is not correct'); $chf->addMirror('mirror.php.net'); $phpt->assertTrue($chf->validate(), 'after add mirror'); $phpt->assertEquals(array ( 'attribs' => array ( 'version' => '1.0', 'xmlns' => 'http://pear.php.net/channel-1.0', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation' => 'http://pear.php.net/dtd/channel-1.0.xsd', ), 'name' => 'pear.php.net', 'suggestedalias' => 'pear', 'summary' => 'PHP Extension and Application Repository', 'validatepackage' => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'PEAR_Validate', ), 'servers' => array ( 'primary' => array ( 'xmlrpc' => array ( 'function' => array ( 0 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'logintest', ), 1 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'package.listLatestReleases', ), 2 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'package.listAll', ), 3 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'package.info', ), 4 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'package.getDownloadURL', ), 5 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'channel.listAll', ), 6 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'channel.update', ), ), ), ), 'mirror' => array ( 'attribs' => array ( 'host' => 'mirror.php.net', ), ), ), ), $chf->toArray(), 'addMirror() did not work as expected'); $chf->addMirror('mirror.php2.net', 7900); $phpt->assertTrue($chf->validate(), 'after add mirror 2'); $phpt->assertEquals(array ( 'attribs' => array ( 'version' => '1.0', 'xmlns' => 'http://pear.php.net/channel-1.0', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation' => 'http://pear.php.net/dtd/channel-1.0.xsd', ), 'name' => 'pear.php.net', 'suggestedalias' => 'pear', 'summary' => 'PHP Extension and Application Repository', 'validatepackage' => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'PEAR_Validate', ), 'servers' => array ( 'primary' => array ( 'xmlrpc' => array ( 'function' => array ( 0 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'logintest', ), 1 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'package.listLatestReleases', ), 2 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'package.listAll', ), 3 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'package.info', ), 4 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'package.getDownloadURL', ), 5 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'channel.listAll', ), 6 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'channel.update', ), ), ), ), 'mirror' => array ( 0 => array ( 'attribs' => array ( 'host' => 'mirror.php.net', ), ), 1 => array ( 'attribs' => array ( 'host' => 'mirror.php2.net', 'port' => 7900, ), ), ), ), ), $chf->toArray(), 'addmirror 2'); echo 'tests done'; ?> --EXPECT-- tests done php-pear-1.10.1+submodules+notgz/tests/PEAR_Channelfile/test_getport.phpt000066400000000000000000000112701262614675700264430ustar00rootroot00000000000000--TEST-- PEAR_Channelfile->getPort() --SKIPIF-- --FILE-- fromXmlString($first = ' pear.php.net pear PHP Extension and Application Repository logintest package.listLatestReleases package.listAll package.info package.getDownloadURL channel.listAll channel.update logintest package.listLatestReleases package.listAll package.info package.getDownloadURL channel.listAll channel.update '); $phpt->assertTrue($chf->validate(), 'default parse'); $phpt->assertEquals(80, $chf->getPort(), '80 (default)'); $phpt->assertEquals(80, $chf->getPort('blah'), '80 mirror (default)'); $chf->fromXmlString($first = ' pear.php.net pear PHP Extension and Application Repository logintest package.listLatestReleases package.listAll package.info package.getDownloadURL channel.listAll channel.update logintest package.listLatestReleases package.listAll package.info package.getDownloadURL channel.listAll channel.update '); $phpt->assertTrue($chf->validate(), 'ssl default parse'); $phpt->assertEquals(443, $chf->getPort(), '443 (default ssl)'); $phpt->assertEquals(443, $chf->getPort('blah'), '443 mirror (default ssl)'); $chf->fromXmlString($first = ' pear.php.net pear PHP Extension and Application Repository logintest package.listLatestReleases package.listAll package.info package.getDownloadURL channel.listAll channel.update logintest package.listLatestReleases package.listAll package.info package.getDownloadURL channel.listAll channel.update '); $phpt->assertTrue($chf->validate(), 'second parse'); $phpt->assertEquals('2525', $chf->getPort(), '2525'); $phpt->assertEquals('2524', $chf->getPort('blah'), '2524'); echo 'tests done'; ?> --EXPECT-- tests done php-pear-1.10.1+submodules+notgz/tests/PEAR_Channelfile/test_getssl.phpt000066400000000000000000000062001262614675700262550ustar00rootroot00000000000000--TEST-- PEAR_Channelfile->getSsl() --SKIPIF-- --FILE-- fromXmlString($first = ' pear.php.net pear PHP Extension and Application Repository logintest package.listLatestReleases package.listAll package.info package.getDownloadURL channel.listAll channel.update logintest package.listLatestReleases package.listAll package.info package.getDownloadURL channel.listAll channel.update '); $phpt->assertTrue($chf->validate(), 'default parse'); $phpt->assertFalse($chf->getSsl(), 'main 1'); $phpt->assertFalse($chf->getSsl('blah'), 'mirror 1'); $chf->fromXmlString($first = ' pear.php.net pear PHP Extension and Application Repository logintest package.listLatestReleases package.listAll package.info package.getDownloadURL channel.listAll channel.update logintest package.listLatestReleases package.listAll package.info package.getDownloadURL channel.listAll channel.update '); $phpt->assertTrue($chf->validate(), '2 parse'); $phpt->assertTrue($chf->getSsl(), 'main 2'); $phpt->assertTrue($chf->getSsl('blah'), 'mirror 2'); echo 'tests done'; ?> --EXPECT-- tests done php-pear-1.10.1+submodules+notgz/tests/PEAR_Channelfile/test_parse_basic.phpt000066400000000000000000000075321262614675700272400ustar00rootroot00000000000000--TEST-- PEAR_Channelfile basic parsing --SKIPIF-- --FILE-- fromXmlString($first = ' pear.php.net pear PHP Extension and Application Repository http://pear.php.net/rest/ http://pear.php.net/rest/ http://pear.php.net/rest/ http://pear.php.net/rest/ '); $phpt->assertTrue($chf->validate(), 'initial parse'); $phpt->assertEquals(array ( 'attribs' => array ( 'version' => '1.0', 'xmlns' => 'http://pear.php.net/channel-1.0', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation' => 'http://pear.php.net/dtd/channel-1.0.xsd', ), 'name' => 'pear.php.net', 'suggestedalias' => 'pear', 'summary' => 'PHP Extension and Application Repository', 'servers' => array ( 'primary' => array ( 'rest' => array ( 'baseurl' => array ( 0 => array ( 'attribs' => array ( 'type' => 'REST1.0', ), '_content' => 'http://pear.php.net/rest/', ), 1 => array ( 'attribs' => array ( 'type' => 'REST1.1', ), '_content' => 'http://pear.php.net/rest/', ), 2 => array ( 'attribs' => array ( 'type' => 'REST1.2', ), '_content' => 'http://pear.php.net/rest/', ), 3 => array ( 'attribs' => array ( 'type' => 'REST1.3', ), '_content' => 'http://pear.php.net/rest/', ), ), ), ), ), ), $chf->toArray(), 'Parsed array of default is not correct'); $chf->fromXmlString($chf->toXml()); $phpt->assertTrue($chf->validate(), 're-parsing validate'); $phpt->assertEquals(array ( 'attribs' => array ( 'version' => '1.0', 'xmlns' => 'http://pear.php.net/channel-1.0', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation' => 'http://pear.php.net/dtd/channel-1.0 http://pear.php.net/dtd/channel-1.0.xsd', ), 'name' => 'pear.php.net', 'summary' => 'PHP Extension and Application Repository', 'suggestedalias' => 'pear', 'servers' => array ( 'primary' => array ( 'rest' => array ( 'baseurl' => array ( 0 => array ( 'attribs' => array ( 'type' => 'REST1.0', ), '_content' => 'http://pear.php.net/rest/', ), 1 => array ( 'attribs' => array ( 'type' => 'REST1.1', ), '_content' => 'http://pear.php.net/rest/', ), 2 => array ( 'attribs' => array ( 'type' => 'REST1.2', ), '_content' => 'http://pear.php.net/rest/', ), 3 => array ( 'attribs' => array ( 'type' => 'REST1.3', ), '_content' => 'http://pear.php.net/rest/', ), ), ), ), ), ), $chf->toArray(), 'Re-parsed array of default is not correct'); echo 'tests done'; ?> --EXPECT-- tests done php-pear-1.10.1+submodules+notgz/tests/PEAR_Channelfile/test_parse_basic_compatibility.phpt000066400000000000000000000101541262614675700321630ustar00rootroot00000000000000--TEST-- PEAR_Channelfile basic parsing (compatibility mode) --SKIPIF-- --FILE-- fromXmlString($first = ' pear.php.net pear PHP Extension and Application Repository http://pear.php.net/rest/ http://pear.php.net/rest/ http://pear.php.net/rest/ http://pear.php.net/rest/ '); echo "after parsing\n"; if (!$chf->validate()) { echo "test default failed\n"; var_export($chf->toArray()); var_export($chf->toXml()); } else { $phpt->assertEquals(array ( 'attribs' => array ( 'version' => '1.0', 'xmlns' => 'http://pear.php.net/channel-1.0', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation' => 'http://pear.php.net/dtd/channel-1.0.xsd', ), 'name' => 'pear.php.net', 'suggestedalias' => 'pear', 'summary' => 'PHP Extension and Application Repository', 'servers' => array ( 'primary' => array ( 'rest' => array ( 'baseurl' => array ( 0 => array ( 'attribs' => array ( 'type' => 'REST1.0', ), '_content' => 'http://pear.php.net/rest/', ), 1 => array ( 'attribs' => array ( 'type' => 'REST1.1', ), '_content' => 'http://pear.php.net/rest/', ), 2 => array ( 'attribs' => array ( 'type' => 'REST1.2', ), '_content' => 'http://pear.php.net/rest/', ), 3 => array ( 'attribs' => array ( 'type' => 'REST1.3', ), '_content' => 'http://pear.php.net/rest/', ), ), ), ), ), ), $chf->toArray(), 'Parsed array of default is not correct'); } $chf->fromXmlString($chf->toXml()); echo "after re-parsing\n"; if (!$chf->validate()) { echo "test default failed\n"; var_export($chf->toArray()); var_export($chf->toXml()); } else { $phpt->assertEquals(array ( 'attribs' => array ( 'version' => '1.0', 'xmlns' => 'http://pear.php.net/channel-1.0', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation' => 'http://pear.php.net/dtd/channel-1.0 http://pear.php.net/dtd/channel-1.0.xsd', ), 'name' => 'pear.php.net', 'summary' => 'PHP Extension and Application Repository', 'suggestedalias' => 'pear', 'servers' => array ( 'primary' => array ( 'rest' => array ( 'baseurl' => array ( 0 => array ( 'attribs' => array ( 'type' => 'REST1.0', ), '_content' => 'http://pear.php.net/rest/', ), 1 => array ( 'attribs' => array ( 'type' => 'REST1.1', ), '_content' => 'http://pear.php.net/rest/', ), 2 => array ( 'attribs' => array ( 'type' => 'REST1.2', ), '_content' => 'http://pear.php.net/rest/', ), 3 => array ( 'attribs' => array ( 'type' => 'REST1.3', ), '_content' => 'http://pear.php.net/rest/', ), ), ), ), ), ), $chf->toArray(), 'Re-parsed array of default is not correct'); } ?> --EXPECT-- after parsing after re-parsing php-pear-1.10.1+submodules+notgz/tests/PEAR_Channelfile/test_parse_validatepackage.phpt000066400000000000000000000132071262614675700312600ustar00rootroot00000000000000--TEST-- PEAR_Channelfile basic parsing + validatepackage --SKIPIF-- --FILE-- fromXmlString($first = ' pear.php.net pear PHP Extension and Application Repository http://pear.php.net/rest/ http://pear.php.net/rest/ http://pear.php.net/rest/ http://pear.php.net/rest/ '); $phpt->assertTrue($chf->validate(), 'initial parse'); $phpt->assertEquals(array ( 'attribs' => array ( 'version' => '1.0', 'xmlns' => 'http://pear.php.net/channel-1.0', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation' => 'http://pear.php.net/dtd/channel-1.0.xsd', ), 'name' => 'pear.php.net', 'suggestedalias' => 'pear', 'summary' => 'PHP Extension and Application Repository', 'servers' => array ( 'primary' => array ( 'rest' => array ( 'baseurl' => array ( 0 => array ( 'attribs' => array ( 'type' => 'REST1.0', ), '_content' => 'http://pear.php.net/rest/', ), 1 => array ( 'attribs' => array ( 'type' => 'REST1.1', ), '_content' => 'http://pear.php.net/rest/', ), 2 => array ( 'attribs' => array ( 'type' => 'REST1.2', ), '_content' => 'http://pear.php.net/rest/', ), 3 => array ( 'attribs' => array ( 'type' => 'REST1.3', ), '_content' => 'http://pear.php.net/rest/', ), ), ), ), ), ), $chf->toArray(), 'Parsed array of default is not correct'); $chf->fromXmlString($chf->toXml()); $chf->setValidationPackage('Flongle_pooper', '4.0'); $phpt->assertTrue($chf->validate(), 're-parsing validate'); $phpt->assertEquals(array ( 'attribs' => array ( 'version' => '1.0', 'xmlns' => 'http://pear.php.net/channel-1.0', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation' => 'http://pear.php.net/dtd/channel-1.0 http://pear.php.net/dtd/channel-1.0.xsd', ), 'name' => 'pear.php.net', 'summary' => 'PHP Extension and Application Repository', 'suggestedalias' => 'pear', 'servers' => array ( 'primary' => array ( 'rest' => array ( 'baseurl' => array ( 0 => array ( 'attribs' => array ( 'type' => 'REST1.0', ), '_content' => 'http://pear.php.net/rest/', ), 1 => array ( 'attribs' => array ( 'type' => 'REST1.1', ), '_content' => 'http://pear.php.net/rest/', ), 2 => array ( 'attribs' => array ( 'type' => 'REST1.2', ), '_content' => 'http://pear.php.net/rest/', ), 3 => array ( 'attribs' => array ( 'type' => 'REST1.3', ), '_content' => 'http://pear.php.net/rest/', ), ), ), ), ), 'validatepackage' => array ( '_content' => 'Flongle_pooper', 'attribs' => array ( 'version' => '4.0', ), ), ), $chf->toArray(), 'Re-parsed array of default is not correct'); $chf->fromXmlString($chf->toXml()); $phpt->assertTrue($chf->validate(), 're-parsing validate'); $phpt->assertEquals(array ( 'attribs' => array ( 'version' => '1.0', 'xmlns' => 'http://pear.php.net/channel-1.0', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation' => 'http://pear.php.net/dtd/channel-1.0 http://pear.php.net/dtd/channel-1.0.xsd', ), 'name' => 'pear.php.net', 'summary' => 'PHP Extension and Application Repository', 'suggestedalias' => 'pear', 'validatepackage' => array ( 'attribs' => array ( 'version' => '4.0', ), '_content' => 'Flongle_pooper', ), 'servers' => array ( 'primary' => array ( 'rest' => array ( 'baseurl' => array ( 0 => array ( 'attribs' => array ( 'type' => 'REST1.0', ), '_content' => 'http://pear.php.net/rest/', ), 1 => array ( 'attribs' => array ( 'type' => 'REST1.1', ), '_content' => 'http://pear.php.net/rest/', ), 2 => array ( 'attribs' => array ( 'type' => 'REST1.2', ), '_content' => 'http://pear.php.net/rest/', ), 3 => array ( 'attribs' => array ( 'type' => 'REST1.3', ), '_content' => 'http://pear.php.net/rest/', ), ), ), ), ), ), $chf->toArray(), 'after re-parse 2'); echo 'tests done'; ?> --EXPECT-- tests done php-pear-1.10.1+submodules+notgz/tests/PEAR_Channelfile/test_resetfunctions.phpt000066400000000000000000000060251262614675700300340ustar00rootroot00000000000000--TEST-- PEAR_Channelfile->resetFunctions() --SKIPIF-- --FILE-- fromXmlString($first = ' pear.php.net pear PHP Extension and Application Repository http://pear.php.net/rest/ http://pear.php.net/rest/ http://pear.php.net/rest/ http://pear.php.net/rest/ '); $phpt->assertTrue($chf->validate(), 'initial parse'); $phpt->assertEquals(array ( 'attribs' => array ( 'version' => '1.0', 'xmlns' => 'http://pear.php.net/channel-1.0', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation' => 'http://pear.php.net/dtd/channel-1.0.xsd', ), 'name' => 'pear.php.net', 'suggestedalias' => 'pear', 'summary' => 'PHP Extension and Application Repository', 'servers' => array ( 'primary' => array ( 'rest' => array ( 'baseurl' => array ( 0 => array ( 'attribs' => array ( 'type' => 'REST1.0', ), '_content' => 'http://pear.php.net/rest/', ), 1 => array ( 'attribs' => array ( 'type' => 'REST1.1', ), '_content' => 'http://pear.php.net/rest/', ), 2 => array ( 'attribs' => array ( 'type' => 'REST1.2', ), '_content' => 'http://pear.php.net/rest/', ), 3 => array ( 'attribs' => array ( 'type' => 'REST1.3', ), '_content' => 'http://pear.php.net/rest/', ), ), ), ), ), ), $chf->toArray(), 'Parsed array of default is not correct'); $chf->fromXmlString($chf->toXml()); $chf->resetFunctions('rest'); $phpt->assertTrue($chf->validate(), 're-parsing validate'); $phpt->assertEquals(array ( 'attribs' => array ( 'version' => '1.0', 'xmlns' => 'http://pear.php.net/channel-1.0', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation' => 'http://pear.php.net/dtd/channel-1.0 http://pear.php.net/dtd/channel-1.0.xsd', ), 'name' => 'pear.php.net', 'summary' => 'PHP Extension and Application Repository', 'suggestedalias' => 'pear', 'servers' => array ( 'primary' => array ( ), ), ), $chf->toArray(), 'Re-parsed array of default is not correct'); echo 'tests done'; ?> --EXPECT-- tests done php-pear-1.10.1+submodules+notgz/tests/PEAR_Channelfile/test_resetfunctions_basic.phpt000066400000000000000000000102451262614675700311740ustar00rootroot00000000000000--TEST-- PEAR_Channelfile->resetFunctions() (xmlrpc) --SKIPIF-- --FILE-- fromXmlString($first = ' pear.php.net pear PHP Extension and Application Repository PEAR_Validate logintest package.listLatestReleases package.listAll package.info package.getDownloadURL channel.listAll channel.update '); echo "after parsing\n"; if (!$chf->validate()) { echo "test default failed\n"; var_export($chf->toArray()); var_export($chf->toXml()); } else { $phpt->assertEquals(array ( 'attribs' => array ( 'version' => '1.0', 'xmlns' => 'http://pear.php.net/channel-1.0', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation' => 'http://pear.php.net/dtd/channel-1.0.xsd', ), 'name' => 'pear.php.net', 'suggestedalias' => 'pear', 'summary' => 'PHP Extension and Application Repository', 'validatepackage' => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'PEAR_Validate', ), 'servers' => array ( 'primary' => array ( 'xmlrpc' => array ( 'function' => array ( 0 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'logintest', ), 1 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'package.listLatestReleases', ), 2 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'package.listAll', ), 3 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'package.info', ), 4 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'package.getDownloadURL', ), 5 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'channel.listAll', ), 6 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'channel.update', ), ), ), ), ), ), $chf->toArray(), 'Parsed array of default is not correct'); } $chf->resetFunctions('xmlrpc'); echo "after reset\n"; if (!$chf->validate()) { echo "test default failed\n"; var_export($chf->toArray()); var_export($chf->toXml()); } else { $phpt->assertEquals(array ( 'attribs' => array ( 'version' => '1.0', 'xmlns' => 'http://pear.php.net/channel-1.0', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation' => 'http://pear.php.net/dtd/channel-1.0.xsd', ), 'name' => 'pear.php.net', 'suggestedalias' => 'pear', 'summary' => 'PHP Extension and Application Repository', 'validatepackage' => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'PEAR_Validate', ), 'servers' => array ( 'primary' => array ( ), ), ), $chf->toArray(), 'resetFunctions() did not work as expected'); } ?> --EXPECT-- after parsing after reset php-pear-1.10.1+submodules+notgz/tests/PEAR_Channelfile/test_resetfunctions_mirror.phpt000066400000000000000000000145161262614675700314320ustar00rootroot00000000000000--TEST-- PEAR_Channelfile->resetFunctions() (mirror) --SKIPIF-- --FILE-- fromXmlString($first = ' pear.php.net pear PHP Extension and Application Repository PEAR_Validate logintest package.listLatestReleases package.listAll package.info package.getDownloadURL channel.listAll channel.update package.info '); echo "after parsing\n"; if (!$chf->validate()) { echo "test default failed\n"; var_export($chf->toArray()); var_export($chf->toXml()); } else { $phpt->assertEquals(array ( 'attribs' => array ( 'version' => '1.0', 'xmlns' => 'http://pear.php.net/channel-1.0', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation' => 'http://pear.php.net/dtd/channel-1.0.xsd', ), 'name' => 'pear.php.net', 'suggestedalias' => 'pear', 'summary' => 'PHP Extension and Application Repository', 'validatepackage' => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'PEAR_Validate', ), 'servers' => array ( 'primary' => array ( 'xmlrpc' => array ( 'function' => array ( 0 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'logintest', ), 1 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'package.listLatestReleases', ), 2 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'package.listAll', ), 3 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'package.info', ), 4 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'package.getDownloadURL', ), 5 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'channel.listAll', ), 6 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'channel.update', ), ), ), ), 'mirror' => array ( 'attribs' => array ( 'host' => 'mirror.php.net', ), 'xmlrpc' => array ( 'function' => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'package.info', ), ), ), ), ), $chf->toArray(), 'Parsed array of default is not correct'); } $chf->resetFunctions('xmlrpc', 'mirror.php.net'); echo "after reset\n"; if (!$chf->validate()) { echo "test default failed\n"; var_export($chf->toArray()); var_export($chf->toXml()); } else { $phpt->assertEquals(array ( 'attribs' => array ( 'version' => '1.0', 'xmlns' => 'http://pear.php.net/channel-1.0', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation' => 'http://pear.php.net/dtd/channel-1.0.xsd', ), 'name' => 'pear.php.net', 'suggestedalias' => 'pear', 'summary' => 'PHP Extension and Application Repository', 'validatepackage' => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'PEAR_Validate', ), 'servers' => array ( 'primary' => array ( 'xmlrpc' => array ( 'function' => array ( 0 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'logintest', ), 1 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'package.listLatestReleases', ), 2 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'package.listAll', ), 3 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'package.info', ), 4 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'package.getDownloadURL', ), 5 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'channel.listAll', ), 6 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'channel.update', ), ), ), ), 'mirror' => array ( 'attribs' => array ( 'host' => 'mirror.php.net', ), 'xmlrpc' => array ( 'function' => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'package.info', ), ), ), ), ), $chf->toArray(), 'resetFunctions() did not work as expected'); } ?> --EXPECT-- after parsing after reset php-pear-1.10.1+submodules+notgz/tests/PEAR_Channelfile/test_resetfunctions_rest.phpt000066400000000000000000000043411262614675700310700ustar00rootroot00000000000000--TEST-- PEAR_Channelfile->resetFunctions() (rest) --SKIPIF-- --FILE-- fromXmlString($first = ' pear.php.net pear PHP Extension and Application Repository http://pear.php.net/rest/ '); $phpt->assertTrue($chf->validate(), 'initial parse'); $phpt->assertEquals(array ( 'attribs' => array ( 'version' => '1.0', 'xmlns' => 'http://pear.php.net/channel-1.0', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation' => 'http://pear.php.net/dtd/channel-1.0.xsd', ), 'name' => 'pear.php.net', 'suggestedalias' => 'pear', 'summary' => 'PHP Extension and Application Repository', 'servers' => array ( 'primary' => array ( 'rest' => array ( 'baseurl' => array ( 'attribs' => array ( 'type' => 'REST1.0', ), '_content' => 'http://pear.php.net/rest/', ), ), ), ), ), $chf->toArray(), 'Parsed array of default is not correct'); $chf->fromXmlString($chf->toXml()); $chf->resetFunctions('rest'); $phpt->assertTrue($chf->validate(), 're-parsing validate'); $phpt->assertEquals(array ( 'attribs' => array ( 'version' => '1.0', 'xmlns' => 'http://pear.php.net/channel-1.0', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation' => 'http://pear.php.net/dtd/channel-1.0 http://pear.php.net/dtd/channel-1.0.xsd', ), 'name' => 'pear.php.net', 'summary' => 'PHP Extension and Application Repository', 'suggestedalias' => 'pear', 'servers' => array ( 'primary' => array ( ), ), ), $chf->toArray(), 'Re-parsed array of default is not correct'); echo 'tests done'; ?> --EXPECT-- tests done php-pear-1.10.1+submodules+notgz/tests/PEAR_Channelfile/test_setalias.phpt000066400000000000000000000124761262614675700265750ustar00rootroot00000000000000--TEST-- PEAR_Channelfile->setAlias() --SKIPIF-- --FILE-- fromXmlString($first = ' pear.php.net pear PHP Extension and Application Repository http://pear.php.net/rest/ http://pear.php.net/rest/ http://pear.php.net/rest/ http://pear.php.net/rest/ '); $phpt->assertTrue($chf->validate(), 'initial parse'); $phpt->assertEquals(array ( 'attribs' => array ( 'version' => '1.0', 'xmlns' => 'http://pear.php.net/channel-1.0', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation' => 'http://pear.php.net/dtd/channel-1.0.xsd', ), 'name' => 'pear.php.net', 'suggestedalias' => 'pear', 'summary' => 'PHP Extension and Application Repository', 'servers' => array ( 'primary' => array ( 'rest' => array ( 'baseurl' => array ( 0 => array ( 'attribs' => array ( 'type' => 'REST1.0', ), '_content' => 'http://pear.php.net/rest/', ), 1 => array ( 'attribs' => array ( 'type' => 'REST1.1', ), '_content' => 'http://pear.php.net/rest/', ), 2 => array ( 'attribs' => array ( 'type' => 'REST1.2', ), '_content' => 'http://pear.php.net/rest/', ), 3 => array ( 'attribs' => array ( 'type' => 'REST1.3', ), '_content' => 'http://pear.php.net/rest/', ), ), ), ), ), ), $chf->toArray(), 'Parsed array of default is not correct'); $chf->fromXmlString($chf->toXml()); $chf->setAlias('fronko'); $phpt->assertTrue($chf->validate(), 're-parsing validate'); $phpt->assertEquals(array ( 'attribs' => array ( 'version' => '1.0', 'xmlns' => 'http://pear.php.net/channel-1.0', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation' => 'http://pear.php.net/dtd/channel-1.0 http://pear.php.net/dtd/channel-1.0.xsd', ), 'name' => 'pear.php.net', 'summary' => 'PHP Extension and Application Repository', 'suggestedalias' => 'fronko', 'servers' => array ( 'primary' => array ( 'rest' => array ( 'baseurl' => array ( 0 => array ( 'attribs' => array ( 'type' => 'REST1.0', ), '_content' => 'http://pear.php.net/rest/', ), 1 => array ( 'attribs' => array ( 'type' => 'REST1.1', ), '_content' => 'http://pear.php.net/rest/', ), 2 => array ( 'attribs' => array ( 'type' => 'REST1.2', ), '_content' => 'http://pear.php.net/rest/', ), 3 => array ( 'attribs' => array ( 'type' => 'REST1.3', ), '_content' => 'http://pear.php.net/rest/', ), ), ), ), ), ), $chf->toArray(), 'setalias'); $chf->setAlias('goob', true); $phpt->assertTrue($chf->validate(), 're-parsing validate'); $phpt->assertEquals(array ( 'attribs' => array ( 'version' => '1.0', 'xmlns' => 'http://pear.php.net/channel-1.0', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation' => 'http://pear.php.net/dtd/channel-1.0 http://pear.php.net/dtd/channel-1.0.xsd', ), 'name' => 'pear.php.net', 'summary' => 'PHP Extension and Application Repository', 'suggestedalias' => 'fronko', 'servers' => array ( 'primary' => array ( 'rest' => array ( 'baseurl' => array ( 0 => array ( 'attribs' => array ( 'type' => 'REST1.0', ), '_content' => 'http://pear.php.net/rest/', ), 1 => array ( 'attribs' => array ( 'type' => 'REST1.1', ), '_content' => 'http://pear.php.net/rest/', ), 2 => array ( 'attribs' => array ( 'type' => 'REST1.2', ), '_content' => 'http://pear.php.net/rest/', ), 3 => array ( 'attribs' => array ( 'type' => 'REST1.3', ), '_content' => 'http://pear.php.net/rest/', ), ), ), ), ), 'localalias' => 'goob', ), $chf->toArray(), 'set local alias'); echo 'tests done'; ?> --EXPECT-- tests done php-pear-1.10.1+submodules+notgz/tests/PEAR_Channelfile/test_setname.phpt000066400000000000000000000075171262614675700264240ustar00rootroot00000000000000--TEST-- PEAR_Channelfile->setName() --SKIPIF-- --FILE-- fromXmlString($first = ' pear.php.net pear PHP Extension and Application Repository http://pear.php.net/rest/ http://pear.php.net/rest/ http://pear.php.net/rest/ http://pear.php.net/rest/ '); $phpt->assertTrue($chf->validate(), 'initial parse'); $phpt->assertEquals(array ( 'attribs' => array ( 'version' => '1.0', 'xmlns' => 'http://pear.php.net/channel-1.0', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation' => 'http://pear.php.net/dtd/channel-1.0.xsd', ), 'name' => 'pear.php.net', 'suggestedalias' => 'pear', 'summary' => 'PHP Extension and Application Repository', 'servers' => array ( 'primary' => array ( 'rest' => array ( 'baseurl' => array ( 0 => array ( 'attribs' => array ( 'type' => 'REST1.0', ), '_content' => 'http://pear.php.net/rest/', ), 1 => array ( 'attribs' => array ( 'type' => 'REST1.1', ), '_content' => 'http://pear.php.net/rest/', ), 2 => array ( 'attribs' => array ( 'type' => 'REST1.2', ), '_content' => 'http://pear.php.net/rest/', ), 3 => array ( 'attribs' => array ( 'type' => 'REST1.3', ), '_content' => 'http://pear.php.net/rest/', ), ), ), ), ), ), $chf->toArray(), 'Parsed array of default is not correct'); $chf->fromXmlString($chf->toXml()); $chf->setName('boopie'); $phpt->assertTrue($chf->validate(), 're-parsing validate'); $phpt->assertEquals(array ( 'attribs' => array ( 'version' => '1.0', 'xmlns' => 'http://pear.php.net/channel-1.0', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation' => 'http://pear.php.net/dtd/channel-1.0 http://pear.php.net/dtd/channel-1.0.xsd', ), 'name' => 'boopie', 'summary' => 'PHP Extension and Application Repository', 'suggestedalias' => 'pear', 'servers' => array ( 'primary' => array ( 'rest' => array ( 'baseurl' => array ( 0 => array ( 'attribs' => array ( 'type' => 'REST1.0', ), '_content' => 'http://pear.php.net/rest/', ), 1 => array ( 'attribs' => array ( 'type' => 'REST1.1', ), '_content' => 'http://pear.php.net/rest/', ), 2 => array ( 'attribs' => array ( 'type' => 'REST1.2', ), '_content' => 'http://pear.php.net/rest/', ), 3 => array ( 'attribs' => array ( 'type' => 'REST1.3', ), '_content' => 'http://pear.php.net/rest/', ), ), ), ), ), ), $chf->toArray(), 'setname failed'); echo 'tests done'; ?> --EXPECT-- tests done php-pear-1.10.1+submodules+notgz/tests/PEAR_Channelfile/test_setport.phpt000066400000000000000000000020701262614675700264550ustar00rootroot00000000000000--TEST-- PEAR_Channelfile->setPort() --SKIPIF-- --FILE-- assertTrue($chf->setPort(234), 'first time'); $phpt->assertEquals(234, $chf->getPort(), 'first'); $res = $chf->setPort(234, 'notfound'); $phpt->assertErrors(array( array('package' => 'PEAR_ChannelFile', 'message' => 'Mirror "notfound" does not exist') ), 'errors'); $phpt->assertFalse($res, 'notfound time'); $chf->setName('hi'); $chf->addMirror('blah', 142); $phpt->assertEquals(142, $chf->getPort('blah'), 'blah first'); $res = $chf->setPort(81, 'blah'); $phpt->assertEquals(81, $chf->getPort('blah'), 'blah second'); $chf->addMirror('greg'); $phpt->assertEquals(80, $chf->getPort('greg'), 'greg first'); $res = $chf->setPort(82, 'greg'); $phpt->assertEquals(81, $chf->getPort('blah'), 'blah third'); $phpt->assertEquals(82, $chf->getPort('greg'), 'greg second'); $phpt->assertEquals(234, $chf->getPort(), 'main second'); echo 'tests done'; ?> --EXPECT-- tests done php-pear-1.10.1+submodules+notgz/tests/PEAR_Channelfile/test_setssl.phpt000066400000000000000000000020641262614675700262750ustar00rootroot00000000000000--TEST-- PEAR_Channelfile->setSSL() --SKIPIF-- --FILE-- assertTrue($chf->setSSL(), 'first time'); $phpt->assertEquals(true, $chf->getSSL(), 'first'); $res = $chf->setSSL(true, 'notfound'); $phpt->assertErrors(array( array('package' => 'PEAR_ChannelFile', 'message' => 'Mirror "notfound" does not exist') ), 'errors'); $phpt->assertFalse($res, 'notfound time'); $chf->setName('hi'); $chf->addMirror('blah'); $phpt->assertEquals(false, $chf->getSSL('blah'), 'blah first'); $res = $chf->setSSL(true, 'blah'); $phpt->assertEquals(true, $chf->getSSL('blah'), 'blah second'); $chf->addMirror('greg'); $phpt->assertEquals(80, $chf->getPort('greg'), 'greg first'); $res = $chf->setPort(82, 'greg'); $phpt->assertEquals(true, $chf->getSSL('blah'), 'blah third'); $phpt->assertEquals(false, $chf->getSSL('greg'), 'greg second'); $phpt->assertEquals(true, $chf->getSSL(), 'main second'); echo 'tests done'; ?> --EXPECT-- tests done php-pear-1.10.1+submodules+notgz/tests/PEAR_Channelfile/test_setsummary.phpt000066400000000000000000000127531262614675700271770ustar00rootroot00000000000000--TEST-- PEAR_Channelfile->setSummary() --SKIPIF-- --FILE-- fromXmlString($first = ' pear.php.net pear PHP Extension and Application Repository PEAR_Validate logintest package.listLatestReleases package.listAll package.info package.getDownloadURL channel.listAll channel.update '); echo "after parsing\n"; if (!$chf->validate()) { echo "test default failed\n"; var_export($chf->toArray()); var_export($chf->toXml()); } else { $phpt->assertEquals(array ( 'attribs' => array ( 'version' => '1.0', 'xmlns' => 'http://pear.php.net/channel-1.0', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation' => 'http://pear.php.net/dtd/channel-1.0.xsd', ), 'name' => 'pear.php.net', 'suggestedalias' => 'pear', 'summary' => 'PHP Extension and Application Repository', 'validatepackage' => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'PEAR_Validate', ), 'servers' => array ( 'primary' => array ( 'xmlrpc' => array ( 'function' => array ( 0 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'logintest', ), 1 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'package.listLatestReleases', ), 2 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'package.listAll', ), 3 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'package.info', ), 4 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'package.getDownloadURL', ), 5 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'channel.listAll', ), 6 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'channel.update', ), ), ), ), ), ), $chf->toArray(), 'Parsed array of default is not correct'); } $chf->setSummary('foobar'); echo "after set\n"; if (!$chf->validate()) { echo "test default failed\n"; var_export($chf->toArray()); var_export($chf->toXml()); } else { $phpt->assertEquals(array ( 'attribs' => array ( 'version' => '1.0', 'xmlns' => 'http://pear.php.net/channel-1.0', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation' => 'http://pear.php.net/dtd/channel-1.0.xsd', ), 'name' => 'pear.php.net', 'suggestedalias' => 'pear', 'summary' => 'foobar', 'validatepackage' => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'PEAR_Validate', ), 'servers' => array ( 'primary' => array ( 'xmlrpc' => array ( 'function' => array ( 0 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'logintest', ), 1 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'package.listLatestReleases', ), 2 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'package.listAll', ), 3 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'package.info', ), 4 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'package.getDownloadURL', ), 5 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'channel.listAll', ), 6 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'channel.update', ), ), ), ), ), ), $chf->toArray(), 'setSummary() did not work as expected'); } ?> --EXPECT-- after parsing after set php-pear-1.10.1+submodules+notgz/tests/PEAR_Channelfile/test_setvalidationpackage.phpt000066400000000000000000000130531262614675700311420ustar00rootroot00000000000000--TEST-- PEAR_Channelfile->setValidationPackage() --SKIPIF-- --FILE-- fromXmlString($first = ' pear.php.net pear PHP Extension and Application Repository PEAR_Validate logintest package.listLatestReleases package.listAll package.info package.getDownloadURL channel.listAll channel.update '); echo "after parsing\n"; if (!$chf->validate()) { echo "test default failed\n"; var_export($chf->toArray()); var_export($chf->toXml()); } else { $phpt->assertEquals(array ( 'attribs' => array ( 'version' => '1.0', 'xmlns' => 'http://pear.php.net/channel-1.0', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation' => 'http://pear.php.net/dtd/channel-1.0.xsd', ), 'name' => 'pear.php.net', 'suggestedalias' => 'pear', 'summary' => 'PHP Extension and Application Repository', 'validatepackage' => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'PEAR_Validate', ), 'servers' => array ( 'primary' => array ( 'xmlrpc' => array ( 'function' => array ( 0 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'logintest', ), 1 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'package.listLatestReleases', ), 2 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'package.listAll', ), 3 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'package.info', ), 4 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'package.getDownloadURL', ), 5 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'channel.listAll', ), 6 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'channel.update', ), ), ), ), ), ), $chf->toArray(), 'Parsed array of default is not correct'); } $chf->setValidationPackage('foobar', '2.0'); echo "after set\n"; if (!$chf->validate()) { echo "test default failed\n"; var_export($chf->toArray()); var_export($chf->toXml()); } else { $phpt->assertEquals(array ( 'attribs' => array ( 'version' => '1.0', 'xmlns' => 'http://pear.php.net/channel-1.0', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation' => 'http://pear.php.net/dtd/channel-1.0.xsd', ), 'name' => 'pear.php.net', 'suggestedalias' => 'pear', 'summary' => 'PHP Extension and Application Repository', 'validatepackage' => array ( '_content' => 'foobar', 'attribs' => array ( 'version' => '2.0', ), ), 'servers' => array ( 'primary' => array ( 'xmlrpc' => array ( 'function' => array ( 0 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'logintest', ), 1 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'package.listLatestReleases', ), 2 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'package.listAll', ), 3 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'package.info', ), 4 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'package.getDownloadURL', ), 5 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'channel.listAll', ), 6 => array ( 'attribs' => array ( 'version' => '1.0', ), '_content' => 'channel.update', ), ), ), ), ), ), $chf->toArray(), 'setValidationPackage() did not work as expected'); } ?> --EXPECT-- after parsing after set php-pear-1.10.1+submodules+notgz/tests/PEAR_Command/000077500000000000000000000000001262614675700221705ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command/fakecommands/000077500000000000000000000000001262614675700246205ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command/fakecommands/Foo.php000066400000000000000000000072221262614675700260570ustar00rootroot00000000000000 | // +----------------------------------------------------------------------+ // require_once "PEAR/Command/Common.php"; /** * PEAR commands for managing configuration data. * */ class PEAR_Command_Foo extends PEAR_Command_Common { // {{{ properties var $commands = array( 'smong' => array( 'summary' => 'Connects and authenticates to remote server', 'shortcut' => 'sm', 'function' => 'doLogin', 'options' => array( 'channel' => array( 'shortopt' => 'c', 'doc' => 'list installed packages from this channel', 'arg' => 'CHAN', ), ), 'doc' => ' Log in to the remote server. To use remote functions in the installer that require any kind of privileges, you need to log in first. The username and password you enter here will be stored in your per-user PEAR configuration (~/.pearrc on Unix-like systems). After logging in, your username and password will be sent along in subsequent operations on the remote server.', ), 'yertl' => array( 'summary' => 'Logs out from the remote server', 'shortcut' => 'ye', 'function' => 'doLogout', 'options' => array( 'channel' => array( 'shortopt' => 'c', 'doc' => 'list installed packages from this channel', ), ), 'doc' => ' Logs out from the remote server. This command does not actually connect to the remote server, it only deletes the stored username and password from your user configuration.', ) ); // }}} // {{{ doLogin() /** * Execute the 'login' command. * * @param string $command command name * * @param array $options option_name => value * * @param array $params list of additional parameters * * @return bool TRUE on success, FALSE for unknown commands, or * a PEAR error on failure * * @access public */ function doLogin($command, $options, $params) { } // }}} // {{{ doLogout() /** * Execute the 'logout' command. * * @param string $command command name * * @param array $options option_name => value * * @param array $params list of additional parameters * * @return bool TRUE on success, FALSE for unknown commands, or * a PEAR error on failure * * @access public */ function doLogout($command, $options, $params) { } // }}} } ?> php-pear-1.10.1+submodules+notgz/tests/PEAR_Command/fakecommands/Foo.xml000066400000000000000000000022271262614675700260700ustar00rootroot00000000000000 Connects and authenticates to remote server sm doLogin c list installed packages from this channel CHAN Log in to the remote server. To use remote functions in the installer that require any kind of privileges, you need to log in first. The username and password you enter here will be stored in your per-user PEAR configuration (~/.pearrc on Unix-like systems). After logging in, your username and password will be sent along in subsequent operations on the remote server. Logs out from the remote server ye doLogout c list installed packages from this channel Logs out from the remote server. This command does not actually connect to the remote server, it only deletes the stored username and password from your user configuration. php-pear-1.10.1+submodules+notgz/tests/PEAR_Command/fakecommands/Grunk.php000066400000000000000000000063721262614675700264270ustar00rootroot00000000000000 | // +----------------------------------------------------------------------+ // require_once "PEAR/Command/Common.php"; /** * PEAR commands for managing configuration data. * */ class PEAR_Command_Grunk extends PEAR_Command_Common { // {{{ properties var $commands = array( 'login' => array( 'summary' => 'Connects and authenticates to remote server', 'shortcut' => 'li', 'function' => 'doLogin', 'options' => array(), 'doc' => ' Log in to the remote server. To use remote functions in the installer that require any kind of privileges, you need to log in first. The username and password you enter here will be stored in your per-user PEAR configuration (~/.pearrc on Unix-like systems). After logging in, your username and password will be sent along in subsequent operations on the remote server.', ), 'logout' => array( 'summary' => 'Logs out from the remote server', 'shortcut' => 'lo', 'function' => 'doLogout', 'options' => array(), 'doc' => ' Logs out from the remote server. This command does not actually connect to the remote server, it only deletes the stored username and password from your user configuration.', ) ); // }}} // {{{ doLogin() /** * Execute the 'login' command. * * @param string $command command name * * @param array $options option_name => value * * @param array $params list of additional parameters * * @return bool TRUE on success, FALSE for unknown commands, or * a PEAR error on failure * * @access public */ function doLogin($command, $options, $params) { } // }}} // {{{ doLogout() /** * Execute the 'logout' command. * * @param string $command command name * * @param array $options option_name => value * * @param array $params list of additional parameters * * @return bool TRUE on success, FALSE for unknown commands, or * a PEAR error on failure * * @access public */ function doLogout($command, $options, $params) { } // }}} } ?> php-pear-1.10.1+submodules+notgz/tests/PEAR_Command/fakecommands/Grunk.xml000066400000000000000000000016211262614675700264300ustar00rootroot00000000000000 Connects and authenticates to remote server li doLogin Log in to the remote server. To use remote functions in the installer that require any kind of privileges, you need to log in first. The username and password you enter here will be stored in your per-user PEAR configuration (~/.pearrc on Unix-like systems). After logging in, your username and password will be sent along in subsequent operations on the remote server. Logs out from the remote server lo doLogout Logs out from the remote server. This command does not actually connect to the remote server, it only deletes the stored username and password from your user configuration. php-pear-1.10.1+submodules+notgz/tests/PEAR_Command/setup.php.inc000066400000000000000000000055621262614675700246210ustar00rootroot00000000000000 $server, 'preferred_state' => 'stable', 'cache_dir' => $temp_path . DIRECTORY_SEPARATOR . 'cache', 'php_dir' => $temp_path . DIRECTORY_SEPARATOR . 'php', 'ext_dir' => $temp_path . DIRECTORY_SEPARATOR . 'ext', 'data_dir' => $temp_path . DIRECTORY_SEPARATOR . 'data', 'www_dir' => $temp_path . DIRECTORY_SEPARATOR . 'www', 'doc_dir' => $temp_path . DIRECTORY_SEPARATOR . 'doc', 'test_dir' => $temp_path . DIRECTORY_SEPARATOR . 'test', 'bin_dir' => $temp_path . DIRECTORY_SEPARATOR . 'bin',)); touch($temp_path . DIRECTORY_SEPARATOR . 'pear.conf'); $fp = fopen($temp_path . DIRECTORY_SEPARATOR . 'pear.conf', 'w'); fwrite($fp, $config); fclose($fp); touch($temp_path . DIRECTORY_SEPARATOR . 'pear.ini'); $fp = fopen($temp_path . DIRECTORY_SEPARATOR . 'pear.ini', 'w'); fwrite($fp, $config); fclose($fp); putenv('PHP_PEAR_SYSCONF_DIR='.$temp_path); $home = getenv('HOME'); if (!empty($home)) { // for PEAR_Config initialization putenv('HOME="'.$temp_path); } require_once "PEAR/Downloader.php"; require_once dirname(dirname(__FILE__)) . '/download_test_classes.php.inc'; require_once dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'phpt_test.php.inc'; $phpunit = new PEAR_PHPTest(true); $config = &PEAR_Config::singleton($temp_path . '/pear.ini'); test_PEAR_Dependency2::singleton($config); require_once 'PEAR/Command.php'; ?> php-pear-1.10.1+submodules+notgz/tests/PEAR_Command/teardown.php.inc000066400000000000000000000014761262614675700253040ustar00rootroot00000000000000 php-pear-1.10.1+submodules+notgz/tests/PEAR_Command/test_factory.phpt000066400000000000000000000026021262614675700255730ustar00rootroot00000000000000--TEST-- PEAR_Command::factory() --SKIPIF-- --FILE-- assertErrors(array( array('package' => 'PEAR_Error', 'message' => 'unknown command `smogin\''), ), 'smogin'); $val = &PEAR_Command::factory('sm', $config); $phpunit->assertIsa('PEAR_Command_Foo', $val, 'sm'); $val = &PEAR_Command::factory('smong', $config); $phpunit->assertIsa('PEAR_Command_Foo', $val, 'smong'); $val = &PEAR_Command::factory('ye', $config); $phpunit->assertIsa('PEAR_Command_Foo', $val, 'ye'); $val = &PEAR_Command::factory('yertl', $config); $phpunit->assertIsa('PEAR_Command_Foo', $val, 'yertl'); $val = &PEAR_Command::factory('li', $config); $phpunit->assertIsa('PEAR_Command_Grunk', $val, 'li'); $val = &PEAR_Command::factory('login', $config); $phpunit->assertIsa('PEAR_Command_Grunk', $val, 'login'); $val = &PEAR_Command::factory('lo', $config); $phpunit->assertIsa('PEAR_Command_Grunk', $val, 'lo'); $val = &PEAR_Command::factory('logout', $config); $phpunit->assertIsa('PEAR_Command_Grunk', $val, 'logout'); echo 'tests done'; ?> --CLEAN-- --EXPECT-- tests done php-pear-1.10.1+submodules+notgz/tests/PEAR_Command/test_getFrontendObject.phpt000066400000000000000000000013101262614675700275250ustar00rootroot00000000000000--TEST-- PEAR_Command::getFrontendObject() --SKIPIF-- --FILE-- assertErrors(array( array('package' => 'PEAR_Error', 'message' => 'no such class: fronk_oog_booger') ), 'invalid'); PEAR_Command::setFrontendClass('PEAR_Frontend_CLI'); $ok = &PEAR_Command::getFrontendObject(); $phpunit->assertIsa('PEAR_Frontend_CLI', $ok, 'ok'); $phpunit->assertIsa('PEAR_Error', $err, 'invalid'); echo 'tests done'; ?> --CLEAN-- --EXPECT-- tests done php-pear-1.10.1+submodules+notgz/tests/PEAR_Command/test_registerCommands.phpt000066400000000000000000000067541262614675700274460ustar00rootroot00000000000000--TEST-- PEAR_Command::registerCommands() (non-standard) --SKIPIF-- --FILE-- assertEquals(array ( 'login' => 'PEAR_Command_Grunk', 'logout' => 'PEAR_Command_Grunk', 'smong' => 'PEAR_Command_Foo', 'yertl' => 'PEAR_Command_Foo', ), PEAR_Command::getCommands(), 'getcommands'); $phpunit->assertEquals(array ( 'li' => 'login', 'lo' => 'logout', 'sm' => 'smong', 'ye' => 'yertl', ), PEAR_Command::getShortcuts(), 'getshortcuts'); PEAR_Command::getGetoptArgs('login', $s, $l); $phpunit->assertEquals('', $s, 'short login'); $phpunit->assertEquals(array(), $l, 'long login'); PEAR_Command::getGetoptArgs('logout', $s, $l); $phpunit->assertEquals('', $s, 'short logout'); $phpunit->assertEquals(array(), $l, 'long logout'); PEAR_Command::getGetoptArgs('smong', $s, $l); $phpunit->assertEquals('c:', $s, 'short smong'); $phpunit->assertEquals(array('channel='), $l, 'long smong'); PEAR_Command::getGetoptArgs('yertl', $s, $l); $phpunit->assertEquals('c', $s, 'short yertl'); $phpunit->assertEquals(array('channel'), $l, 'long yertl'); $phpunit->assertEquals('Connects and authenticates to remote server' , PEAR_Command::getDescription('login'), 'login'); $phpunit->assertEquals('Logs out from the remote server' , PEAR_Command::getDescription('logout'), 'logout'); $phpunit->assertEquals('Connects and authenticates to remote server' , PEAR_Command::getDescription('smong'), 'smong'); $phpunit->assertEquals('Logs out from the remote server' , PEAR_Command::getDescription('yertl'), 'yertl'); $phpunit->assertEquals(array ( 0 => ' Log in to the remote server. To use remote functions in the installer that require any kind of privileges, you need to log in first. The username and password you enter here will be stored in your per-user PEAR configuration (~/.pearrc on Unix-like systems). After logging in, your username and password will be sent along in subsequent operations on the remote server.', 1 => NULL, ) , PEAR_Command::getHelp('login'), 'login'); $phpunit->assertEquals(array ( 0 => ' Logs out from the remote server. This command does not actually connect to the remote server, it only deletes the stored username and password from your user configuration.', 1 => NULL, ) , PEAR_Command::getHelp('logout'), 'logout'); $phpunit->assertEquals(array ( 0 => ' Log in to the remote server. To use remote functions in the installer that require any kind of privileges, you need to log in first. The username and password you enter here will be stored in your per-user PEAR configuration (~/.pearrc on Unix-like systems). After logging in, your username and password will be sent along in subsequent operations on the remote server.', 1 => 'Options: -c CHAN, --channel=CHAN list installed packages from this channel ', ) , PEAR_Command::getHelp('smong'), 'smong'); $phpunit->assertEquals(array ( 0 => ' Logs out from the remote server. This command does not actually connect to the remote server, it only deletes the stored username and password from your user configuration.', 1 => 'Options: -c, --channel list installed packages from this channel ', ) , PEAR_Command::getHelp('yertl'), 'yertl'); echo 'tests done'; ?> --CLEAN-- --EXPECT-- tests done php-pear-1.10.1+submodules+notgz/tests/PEAR_Command/test_registerCommands_remoteinstall.phpt000066400000000000000000000454721262614675700324100ustar00rootroot00000000000000--TEST-- PEAR_Command::factory() --SKIPIF-- --FILE-- assertEquals(array ( 'build' => 'PEAR_Command_Build', 'bundle' => 'PEAR_Command_Install', 'channel-add' => 'PEAR_Command_Channels', 'channel-alias' => 'PEAR_Command_Channels', 'channel-delete' => 'PEAR_Command_Channels', 'channel-discover' => 'PEAR_Command_Channels', 'channel-info' => 'PEAR_Command_Channels', 'channel-login' => 'PEAR_Command_Channels', 'channel-logout' => 'PEAR_Command_Channels', 'channel-update' => 'PEAR_Command_Channels', 'clear-cache' => 'PEAR_Command_Remote', 'config-create' => 'PEAR_Command_Config', 'config-get' => 'PEAR_Command_Config', 'config-help' => 'PEAR_Command_Config', 'config-set' => 'PEAR_Command_Config', 'config-show' => 'PEAR_Command_Config', 'convert' => 'PEAR_Command_Package', 'cvsdiff' => 'PEAR_Command_Package', 'cvstag' => 'PEAR_Command_Package', 'download' => 'PEAR_Command_Remote', 'download-all' => 'PEAR_Command_Mirror', 'info' => 'PEAR_Command_Registry', 'install' => 'PEAR_Command_Install', 'list' => 'PEAR_Command_Registry', 'list-all' => 'PEAR_Command_Remote', 'list-categories' => 'PEAR_Command_Categories', 'list-category' => 'PEAR_Command_Categories', 'list-channels' => 'PEAR_Command_Channels', 'list-files' => 'PEAR_Command_Registry', 'list-packages' => 'PEAR_Command_Categories', 'list-upgrades' => 'PEAR_Command_Remote', 'login' => 'PEAR_Command_Auth', 'logout' => 'PEAR_Command_Auth', 'makerpm' => 'PEAR_Command_Package', 'package' => 'PEAR_Command_Package', 'package-dependencies' => 'PEAR_Command_Package', 'package-validate' => 'PEAR_Command_Package', 'pickle' => 'PEAR_Command_Pickle', 'remote-info' => 'PEAR_Command_Remote', 'remote-install' => 'PEAR_Command_Remoteinstall', 'remote-list' => 'PEAR_Command_Remote', 'remote-uninstall' => 'PEAR_Command_Remoteinstall', 'remote-upgrade' => 'PEAR_Command_Remoteinstall', 'remote-upgrade-all' => 'PEAR_Command_Remoteinstall', 'run-scripts' => 'PEAR_Command_Install', 'run-tests' => 'PEAR_Command_Test', 'search' => 'PEAR_Command_Remote', 'shell-test' => 'PEAR_Command_Registry', 'sign' => 'PEAR_Command_Package', 'svntag' => 'PEAR_Command_Package', 'uninstall' => 'PEAR_Command_Install', 'update-channels' => 'PEAR_Command_Channels', 'upgrade' => 'PEAR_Command_Install', 'upgrade-all' => 'PEAR_Command_Install', ), PEAR_Command::getCommands(), 'getcommands'); $phpunit->assertEquals(54, count(PEAR_Command::getCommands()), 'count commands'); $phpunit->assertEquals(54, count(PEAR_Command::getShortcuts()), 'count shortcuts'); $phpunit->assertEquals(array ( 'b' => 'build', 'bun' => 'bundle', 'c2' => 'convert', 'ca' => 'channel-add', 'cat' => 'list-category', 'cats' => 'list-categories', 'cc' => 'clear-cache', 'cd' => 'cvsdiff', 'cde' => 'channel-delete', 'cg' => 'config-get', 'ch' => 'config-help', 'cha' => 'channel-alias', 'ci' => 'channel-info', 'cli' => 'channel-login', 'clo' => 'channel-logout', 'coc' => 'config-create', 'cs' => 'config-set', 'csh' => 'config-show', 'ct' => 'cvstag', 'cu' => 'channel-update', 'd' => 'download', 'da' => 'download-all', 'di' => 'channel-discover', 'fl' => 'list-files', 'i' => 'install', 'in' => 'info', 'inr' => 'remote-install', 'l' => 'list', 'la' => 'list-all', 'lc' => 'list-channels', 'li' => 'login', 'lo' => 'logout', 'lp' => 'list-packages', 'lu' => 'list-upgrades', 'p' => 'package', 'pd' => 'package-dependencies', 'pi' => 'pickle', 'pv' => 'package-validate', 'ri' => 'remote-info', 'rl' => 'remote-list', 'rpm' => 'makerpm', 'rs' => 'run-scripts', 'rt' => 'run-tests', 'si' => 'sign', 'sp' => 'search', 'st' => 'shell-test', 'sv' => 'svntag', 'ua' => 'upgrade-all', 'uar' => 'remote-upgrade-all', 'uc' => 'update-channels', 'un' => 'uninstall', 'unr' => 'remote-uninstall', 'up' => 'upgrade', 'upr' => 'remote-upgrade', ), PEAR_Command::getShortcuts(), 'getshortcuts'); PEAR_Command::getGetoptArgs('build', $s, $l); $phpunit->assertEquals('', $s, 'short build'); $phpunit->assertEquals(array(), $l, 'long build'); PEAR_Command::getGetoptArgs('bundle', $s, $l); $phpunit->assertEquals('d:f', $s, 'short bundle'); $phpunit->assertEquals(array('destination=', 'force'), $l, 'long bundle'); PEAR_Command::getGetoptArgs('channel-add', $s, $l); $phpunit->assertEquals('', $s, 'short channel-add'); $phpunit->assertEquals(array(), $l, 'long channel-add'); PEAR_Command::getGetoptArgs('channel-alias', $s, $l); $phpunit->assertEquals('', $s, 'short channel-alias'); $phpunit->assertEquals(array(), $l, 'long channel-alias'); PEAR_Command::getGetoptArgs('channel-delete', $s, $l); $phpunit->assertEquals('', $s, 'short channel-delete'); $phpunit->assertEquals(array(), $l, 'long channel-delete'); PEAR_Command::getGetoptArgs('channel-discover', $s, $l); $phpunit->assertEquals('', $s, 'short channel-discover'); $phpunit->assertEquals(array(), $l, 'long channel-discover'); PEAR_Command::getGetoptArgs('channel-info', $s, $l); $phpunit->assertEquals('', $s, 'short channel-info'); $phpunit->assertEquals(array(), $l, 'long channel-info'); PEAR_Command::getGetoptArgs('channel-update', $s, $l); $phpunit->assertEquals('fc:', $s, 'short channel-update'); $phpunit->assertEquals(array('force', 'channel='), $l, 'long channel-update'); PEAR_Command::getGetoptArgs('clear-cache', $s, $l); $phpunit->assertEquals('', $s, 'short clear-cache'); $phpunit->assertEquals(array(), $l, 'long clear-cache'); PEAR_Command::getGetoptArgs('config-create', $s, $l); $phpunit->assertEquals('w', $s, 'short config-create'); $phpunit->assertEquals(array('windows'), $l, 'long config-create'); PEAR_Command::getGetoptArgs('config-get', $s, $l); $phpunit->assertEquals('c:', $s, 'short config-get'); $phpunit->assertEquals(array('channel='), $l, 'long config-get'); PEAR_Command::getGetoptArgs('config-set', $s, $l); $phpunit->assertEquals('c:', $s, 'short config-set'); $phpunit->assertEquals(array('channel='), $l, 'long config-set'); PEAR_Command::getGetoptArgs('config-show', $s, $l); $phpunit->assertEquals('c:', $s, 'short config-show'); $phpunit->assertEquals(array('channel='), $l, 'long config-show'); PEAR_Command::getGetoptArgs('convert', $s, $l); $phpunit->assertEquals('f', $s, 'short convert'); $phpunit->assertEquals(array('flat'), $l, 'long convert'); PEAR_Command::getGetoptArgs('cvsdiff', $s, $l); $phpunit->assertEquals('qQD:R:r:cuibBn', $s, 'short cvsdiff'); $phpunit->assertEquals(array ( 0 => 'quiet', 1 => 'reallyquiet', 2 => 'date=', 3 => 'release=', 4 => 'revision=', 5 => 'context', 6 => 'unified', 7 => 'ignore-case', 8 => 'ignore-whitespace', 9 => 'ignore-blank-lines', 10 => 'brief', 11 => 'dry-run', ), $l, 'long cvsdiff'); PEAR_Command::getGetoptArgs('cvstag', $s, $l); $phpunit->assertEquals('qQFdn', $s, 'short cvstag'); $phpunit->assertEquals(array ( 0 => 'quiet', 1 => 'reallyquiet', 2 => 'slide', 3 => 'delete', 4 => 'dry-run', ), $l, 'long cvstag'); PEAR_Command::getGetoptArgs('download', $s, $l); $phpunit->assertEquals('Z', $s, 'short download'); $phpunit->assertEquals(array('nocompress'), $l, 'long download'); PEAR_Command::getGetoptArgs('download-all', $s, $l); $phpunit->assertEquals('c:', $s, 'short download-all'); $phpunit->assertEquals(array('channel='), $l, 'long download-all'); PEAR_Command::getGetoptArgs('info', $s, $l); $phpunit->assertEquals('', $s, 'short info'); $phpunit->assertEquals(array(), $l, 'long info'); PEAR_Command::getGetoptArgs('install', $s, $l); $phpunit->assertEquals('flnrsBZR:P:aoOp', $s, 'short install'); $phpunit->assertEquals(array ( 0 => 'force', 1 => 'loose', 2 => 'nodeps', 3 => 'register-only', 4 => 'soft', 5 => 'nobuild', 6 => 'nocompress', 7 => 'installroot=', 'packagingroot=', 'ignore-errors', 'alldeps', 'onlyreqdeps', 'offline', 'pretend', ), $l, 'long install'); PEAR_Command::getGetoptArgs('list', $s, $l); $phpunit->assertEquals('c:ai', $s, 'short list'); $phpunit->assertEquals(array('channel=', 'allchannels', 'channelinfo'), $l, 'long list'); PEAR_Command::getGetoptArgs('list-all', $s, $l); $phpunit->assertEquals('c:i', $s, 'short list-all'); $phpunit->assertEquals(array('channel=', 'channelinfo'), $l, 'long list-all'); PEAR_Command::getGetoptArgs('list-channels', $s, $l); $phpunit->assertEquals('', $s, 'short list-channels'); $phpunit->assertEquals(array(), $l, 'long list-channels'); PEAR_Command::getGetoptArgs('list-files', $s, $l); $phpunit->assertEquals('', $s, 'short list-files'); $phpunit->assertEquals(array(), $l, 'long list-files'); PEAR_Command::getGetoptArgs('list-upgrades', $s, $l); $phpunit->assertEquals('i', $s, 'short list-upgrades'); $phpunit->assertEquals(array('channelinfo'), $l, 'long list-upgrades'); PEAR_Command::getGetoptArgs('login', $s, $l); $phpunit->assertEquals('', $s, 'short login'); $phpunit->assertEquals(array(), $l, 'long login'); PEAR_Command::getGetoptArgs('logout', $s, $l); $phpunit->assertEquals('', $s, 'short logout'); $phpunit->assertEquals(array(), $l, 'long logout'); PEAR_Command::getGetoptArgs('makerpm', $s, $l); $phpunit->assertEquals('t:p:', $s, 'short makerpm'); $phpunit->assertEquals(array( 0 => 'spec-template=', 1 => 'rpm-pkgname=', ), $l, 'long makerpm'); PEAR_Command::getGetoptArgs('package', $s, $l); $phpunit->assertEquals('Zn', $s, 'short package'); $phpunit->assertEquals(array ( 0 => 'nocompress', 1 => 'showname', ), $l, 'long package'); PEAR_Command::getGetoptArgs('package-dependencies', $s, $l); $phpunit->assertEquals('', $s, 'short package-dependencies'); $phpunit->assertEquals(array (), $l, 'long package-dependencies'); PEAR_Command::getGetoptArgs('package-validate', $s, $l); $phpunit->assertEquals('', $s, 'short package-validate'); $phpunit->assertEquals(array (), $l, 'long package-validate'); PEAR_Command::getGetoptArgs('remote-info', $s, $l); $phpunit->assertEquals('', $s, 'short remote-info'); $phpunit->assertEquals(array (), $l, 'long remote-info'); PEAR_Command::getGetoptArgs('remote-install', $s, $l); $phpunit->assertEquals('fnrsBZR:aoF:Op', $s, 'short remote-install'); $phpunit->assertEquals( array ( 0 => 'force', 1 => 'nodeps', 2 => 'register-only', 3 => 'soft', 4 => 'nobuild', 5 => 'nocompress', 6 => 'installroot=', 7 => 'ignore-errors', 8 => 'alldeps', 9 => 'onlyreqdeps', 10 => 'remoteconfig=', 11 => 'offline', 12 => 'pretend', ) , $l, 'long remote-install'); PEAR_Command::getGetoptArgs('remote-list', $s, $l); $phpunit->assertEquals('c:', $s, 'short remote-list'); $phpunit->assertEquals(array ('channel='), $l, 'long remote-list'); PEAR_Command::getGetoptArgs('remote-uninstall', $s, $l); $phpunit->assertEquals('nrR:F:O', $s, 'short remote-uninstall'); $phpunit->assertEquals(array ( 0 => 'nodeps', 1 => 'register-only', 2 => 'installroot=', 3 => 'ignore-errors', 4 => 'remoteconfig=', 5 => 'offline', ), $l, 'long remote-uninstall'); PEAR_Command::getGetoptArgs('remote-upgrade', $s, $l); $phpunit->assertEquals('fnrBZR:aoF:Op', $s, 'short remote-upgrade'); $phpunit->assertEquals(array ( 0 => 'force', 1 => 'nodeps', 2 => 'register-only', 3 => 'nobuild', 4 => 'nocompress', 5 => 'installroot=', 6 => 'ignore-errors', 7 => 'alldeps', 8 => 'onlyreqdeps', 9 => 'remoteconfig=', 10 => 'offline', 11 => 'pretend', ), $l, 'long remote-upgrade'); PEAR_Command::getGetoptArgs('remote-upgrade-all', $s, $l); $phpunit->assertEquals('nrBZR:F:', $s, 'short remote-upgrade-all'); $phpunit->assertEquals(array ( 0 => 'nodeps', 1 => 'register-only', 2 => 'nobuild', 3 => 'nocompress', 4 => 'installroot=', 5 => 'ignore-errors', 6 => 'remoteconfig=', ), $l, 'long remote-upgrade-all'); PEAR_Command::getGetoptArgs('run-tests', $s, $l); $phpunit->assertEquals('ri:lqsputc:x', $s, 'short run-tests'); $phpunit->assertEquals(array ( 'recur', 'ini=', 'realtimelog', 'quiet', 'simple', 'package', 'phpunit', 'tapoutput', 'cgi=', 'coverage', ), $l, 'long run-tests'); PEAR_Command::getGetoptArgs('search', $s, $l); $phpunit->assertEquals('c:ai', $s, 'short search'); $phpunit->assertEquals(array ('channel=', 'allchannels', 'channelinfo',), $l, 'long search'); PEAR_Command::getGetoptArgs('shell-test', $s, $l); $phpunit->assertEquals('', $s, 'short shell-test'); $phpunit->assertEquals(array (), $l, 'long shell-test'); PEAR_Command::getGetoptArgs('sign', $s, $l); $phpunit->assertEquals('v', $s, 'short sign'); $phpunit->assertEquals(array ('verbose'), $l, 'long sign'); PEAR_Command::getGetoptArgs('uninstall', $s, $l); $phpunit->assertEquals('nrR:O', $s, 'short uninstall'); $phpunit->assertEquals(array ( 0 => 'nodeps', 1 => 'register-only', 2 => 'installroot=', 3 => 'ignore-errors', 4 => 'offline', ), $l, 'long uninstall'); PEAR_Command::getGetoptArgs('update-channels', $s, $l); $phpunit->assertEquals('', $s, 'short update-channels'); $phpunit->assertEquals(array (), $l, 'long update-channels'); PEAR_Command::getGetoptArgs('upgrade', $s, $l); $phpunit->assertEquals('c:flnrBZR:aoOp', $s, 'short upgrade'); $phpunit->assertEquals(array ( 0 => 'channel=', 1 => 'force', 2 => 'loose', 3 => 'nodeps', 4 => 'register-only', 5 => 'nobuild', 6 => 'nocompress', 7 => 'installroot=', 8 => 'ignore-errors', 9 => 'alldeps', 10 => 'onlyreqdeps', 11 => 'offline', 12 => 'pretend', ), $l, 'long upgrade'); PEAR_Command::getGetoptArgs('upgrade-all', $s, $l); $phpunit->assertEquals('c:nrBZR:', $s, 'short upgrade-all'); $phpunit->assertEquals(array ( 0 => 'channel=', 1 => 'nodeps', 2 => 'register-only', 3 => 'nobuild', 4 => 'nocompress', 5 => 'installroot=', 6 => 'ignore-errors', 7 => 'loose', ), $l, 'long upgrade-all'); $phpunit->assertEquals('Build an Extension From C Source' , PEAR_Command::getDescription('build'), 'build'); $phpunit->assertEquals('Unpacks a Pecl Package' , PEAR_Command::getDescription('bundle'), 'bundle'); $phpunit->assertEquals('Add a Channel' , PEAR_Command::getDescription('channel-add'), 'channel-add'); $phpunit->assertEquals('Specify an alias to a channel name' , PEAR_Command::getDescription('channel-alias'), 'channel-alias'); $phpunit->assertEquals('Remove a Channel From the List' , PEAR_Command::getDescription('channel-delete'), 'channel-delete'); $phpunit->assertEquals('Initialize a Channel from its server' , PEAR_Command::getDescription('channel-discover'), 'channel-discover'); $phpunit->assertEquals('Retrieve Information on a Channel' , PEAR_Command::getDescription('channel-info'), 'channel-info'); $phpunit->assertEquals('Update an Existing Channel' , PEAR_Command::getDescription('channel-update'), 'channel-update'); $phpunit->assertEquals('Clear Web Services Cache' , PEAR_Command::getDescription('clear-cache'), 'clear-cache'); $phpunit->assertEquals('Create a Default configuration file' , PEAR_Command::getDescription('config-create'), 'config-create'); $phpunit->assertEquals('Show One Setting' , PEAR_Command::getDescription('config-get'), 'config-get'); $phpunit->assertEquals('Show Information About Setting' , PEAR_Command::getDescription('config-help'), 'config-help'); $phpunit->assertEquals('Change Setting' , PEAR_Command::getDescription('config-set'), 'config-set'); $phpunit->assertEquals('Show All Settings' , PEAR_Command::getDescription('config-show'), 'config-show'); $phpunit->assertEquals('Convert a package.xml 1.0 to package.xml 2.0 format' , PEAR_Command::getDescription('convert'), 'convert'); $phpunit->assertEquals('Run a "cvs diff" for all files in a package' , PEAR_Command::getDescription('cvsdiff'), 'cvsdiff'); $phpunit->assertEquals('Set CVS Release Tag' , PEAR_Command::getDescription('cvstag'), 'cvstag'); $phpunit->assertEquals('Download Package' , PEAR_Command::getDescription('download'), 'download'); $phpunit->assertEquals('Downloads each available package from the default channel' , PEAR_Command::getDescription('download-all'), 'download-all'); $phpunit->assertEquals('Display information about a package' , PEAR_Command::getDescription('info'), 'info'); $phpunit->assertEquals('Install Package' , PEAR_Command::getDescription('install'), 'install'); $phpunit->assertEquals('List Installed Packages In The Default Channel' , PEAR_Command::getDescription('list'), 'list'); $phpunit->assertEquals('List All Packages' , PEAR_Command::getDescription('list-all'), 'list-all'); $phpunit->assertEquals('List Available Channels' , PEAR_Command::getDescription('list-channels'), 'list-channels'); $phpunit->assertEquals('List Files In Installed Package' , PEAR_Command::getDescription('list-files'), 'list-files'); $phpunit->assertEquals('List Available Upgrades' , PEAR_Command::getDescription('list-upgrades'), 'list-upgrades'); $phpunit->assertEquals('Connects and authenticates to remote server [Deprecated in favor of channel-login]' , PEAR_Command::getDescription('login'), 'login'); $phpunit->assertEquals('Logs out from the remote server [Deprecated in favor of channel-logout]' , PEAR_Command::getDescription('logout'), 'logout'); $phpunit->assertEquals('Builds an RPM spec file from a PEAR package' , PEAR_Command::getDescription('makerpm'), 'makerpm'); $phpunit->assertEquals('Build Package' , PEAR_Command::getDescription('package'), 'package'); $phpunit->assertEquals('Show package dependencies' , PEAR_Command::getDescription('package-dependencies'), 'package-dependencies'); $phpunit->assertEquals('Validate Package Consistency' , PEAR_Command::getDescription('package-validate'), 'package-validate'); $phpunit->assertEquals('Information About Remote Packages' , PEAR_Command::getDescription('remote-info'), 'remote-info'); $phpunit->assertEquals('List Remote Packages' , PEAR_Command::getDescription('remote-list'), 'remote-list'); $phpunit->assertEquals('Run Regression Tests' , PEAR_Command::getDescription('run-tests'), 'run-tests'); $phpunit->assertEquals('Search remote package database' , PEAR_Command::getDescription('search'), 'search'); $phpunit->assertEquals('Shell Script Test' , PEAR_Command::getDescription('shell-test'), 'shell-test'); $phpunit->assertEquals('Sign a package distribution file' , PEAR_Command::getDescription('sign'), 'sign'); $phpunit->assertEquals('Un-install Package' , PEAR_Command::getDescription('uninstall'), 'uninstall'); $phpunit->assertEquals('Update the Channel List' , PEAR_Command::getDescription('update-channels'), 'update-channels'); $phpunit->assertEquals('Upgrade Package' , PEAR_Command::getDescription('upgrade'), 'upgrade'); $phpunit->assertEquals('Upgrade All Packages [Deprecated in favor of calling upgrade with no parameters]' , PEAR_Command::getDescription('upgrade-all'), 'upgrade-all'); echo 'tests done'; ?> --CLEAN-- --EXPECT-- tests done php-pear-1.10.1+submodules+notgz/tests/PEAR_Command/test_registerCommands_standard.phpt000066400000000000000000000414631262614675700313220ustar00rootroot00000000000000--TEST-- PEAR_Command::factory() --SKIPIF-- --FILE-- assertEquals(array ( 'build' => 'PEAR_Command_Build', 'bundle' => 'PEAR_Command_Install', 'channel-add' => 'PEAR_Command_Channels', 'channel-alias' => 'PEAR_Command_Channels', 'channel-delete' => 'PEAR_Command_Channels', 'channel-discover' => 'PEAR_Command_Channels', 'channel-info' => 'PEAR_Command_Channels', 'channel-login' => 'PEAR_Command_Channels', 'channel-logout' => 'PEAR_Command_Channels', 'channel-update' => 'PEAR_Command_Channels', 'clear-cache' => 'PEAR_Command_Remote', 'config-create' => 'PEAR_Command_Config', 'config-get' => 'PEAR_Command_Config', 'config-help' => 'PEAR_Command_Config', 'config-set' => 'PEAR_Command_Config', 'config-show' => 'PEAR_Command_Config', 'convert' => 'PEAR_Command_Package', 'cvsdiff' => 'PEAR_Command_Package', 'cvstag' => 'PEAR_Command_Package', 'download' => 'PEAR_Command_Remote', 'download-all' => 'PEAR_Command_Mirror', 'info' => 'PEAR_Command_Registry', 'install' => 'PEAR_Command_Install', 'list' => 'PEAR_Command_Registry', 'list-all' => 'PEAR_Command_Remote', 'list-channels' => 'PEAR_Command_Channels', 'list-files' => 'PEAR_Command_Registry', 'list-upgrades' => 'PEAR_Command_Remote', 'login' => 'PEAR_Command_Auth', 'logout' => 'PEAR_Command_Auth', 'makerpm' => 'PEAR_Command_Package', 'package' => 'PEAR_Command_Package', 'package-dependencies' => 'PEAR_Command_Package', 'package-validate' => 'PEAR_Command_Package', 'pickle' => 'PEAR_Command_Pickle', 'remote-info' => 'PEAR_Command_Remote', 'remote-list' => 'PEAR_Command_Remote', 'run-scripts' => 'PEAR_Command_Install', 'run-tests' => 'PEAR_Command_Test', 'search' => 'PEAR_Command_Remote', 'shell-test' => 'PEAR_Command_Registry', 'sign' => 'PEAR_Command_Package', 'svntag' => 'PEAR_Command_Package', 'uninstall' => 'PEAR_Command_Install', 'update-channels' => 'PEAR_Command_Channels', 'upgrade' => 'PEAR_Command_Install', 'upgrade-all' => 'PEAR_Command_Install', ), PEAR_Command::getCommands(), 'getcommands'); $phpunit->assertEquals(47, count(PEAR_Command::getCommands()), 'count commands'); $phpunit->assertEquals(47, count(PEAR_Command::getShortcuts()), 'count shortcuts'); $phpunit->assertEquals(array ( 'b' => 'build', 'bun' => 'bundle', 'c2' => 'convert', 'ca' => 'channel-add', 'cc' => 'clear-cache', 'cd' => 'cvsdiff', 'cde' => 'channel-delete', 'cg' => 'config-get', 'ch' => 'config-help', 'cha' => 'channel-alias', 'ci' => 'channel-info', 'cli' => 'channel-login', 'clo' => 'channel-logout', 'coc' => 'config-create', 'cs' => 'config-set', 'csh' => 'config-show', 'ct' => 'cvstag', 'cu' => 'channel-update', 'd' => 'download', 'da' => 'download-all', 'di' => 'channel-discover', 'fl' => 'list-files', 'i' => 'install', 'in' => 'info', 'l' => 'list', 'la' => 'list-all', 'lc' => 'list-channels', 'li' => 'login', 'lo' => 'logout', 'lu' => 'list-upgrades', 'p' => 'package', 'pd' => 'package-dependencies', 'pi' => 'pickle', 'pv' => 'package-validate', 'ri' => 'remote-info', 'rl' => 'remote-list', 'rpm' => 'makerpm', 'rs' => 'run-scripts', 'rt' => 'run-tests', 'si' => 'sign', 'sp' => 'search', 'st' => 'shell-test', 'sv' => 'svntag', 'ua' => 'upgrade-all', 'uc' => 'update-channels', 'un' => 'uninstall', 'up' => 'upgrade', ), PEAR_Command::getShortcuts(), 'getshortcuts'); PEAR_Command::getGetoptArgs('build', $s, $l); $phpunit->assertEquals('', $s, 'short build'); $phpunit->assertEquals(array(), $l, 'long build'); PEAR_Command::getGetoptArgs('bundle', $s, $l); $phpunit->assertEquals('d:f', $s, 'short bundle'); $phpunit->assertEquals(array('destination=', 'force'), $l, 'long bundle'); PEAR_Command::getGetoptArgs('channel-add', $s, $l); $phpunit->assertEquals('', $s, 'short channel-add'); $phpunit->assertEquals(array(), $l, 'long channel-add'); PEAR_Command::getGetoptArgs('channel-alias', $s, $l); $phpunit->assertEquals('', $s, 'short channel-alias'); $phpunit->assertEquals(array(), $l, 'long channel-alias'); PEAR_Command::getGetoptArgs('channel-delete', $s, $l); $phpunit->assertEquals('', $s, 'short channel-delete'); $phpunit->assertEquals(array(), $l, 'long channel-delete'); PEAR_Command::getGetoptArgs('channel-discover', $s, $l); $phpunit->assertEquals('', $s, 'short channel-discover'); $phpunit->assertEquals(array(), $l, 'long channel-discover'); PEAR_Command::getGetoptArgs('channel-info', $s, $l); $phpunit->assertEquals('', $s, 'short channel-info'); $phpunit->assertEquals(array(), $l, 'long channel-info'); PEAR_Command::getGetoptArgs('channel-update', $s, $l); $phpunit->assertEquals('fc:', $s, 'short channel-update'); $phpunit->assertEquals(array('force', 'channel='), $l, 'long channel-update'); PEAR_Command::getGetoptArgs('clear-cache', $s, $l); $phpunit->assertEquals('', $s, 'short clear-cache'); $phpunit->assertEquals(array(), $l, 'long clear-cache'); PEAR_Command::getGetoptArgs('config-create', $s, $l); $phpunit->assertEquals('w', $s, 'short config-create'); $phpunit->assertEquals(array('windows'), $l, 'long config-create'); PEAR_Command::getGetoptArgs('config-get', $s, $l); $phpunit->assertEquals('c:', $s, 'short config-get'); $phpunit->assertEquals(array('channel='), $l, 'long config-get'); PEAR_Command::getGetoptArgs('config-set', $s, $l); $phpunit->assertEquals('c:', $s, 'short config-set'); $phpunit->assertEquals(array('channel='), $l, 'long config-set'); PEAR_Command::getGetoptArgs('config-show', $s, $l); $phpunit->assertEquals('c:', $s, 'short config-show'); $phpunit->assertEquals(array('channel='), $l, 'long config-show'); PEAR_Command::getGetoptArgs('convert', $s, $l); $phpunit->assertEquals('f', $s, 'short convert'); $phpunit->assertEquals(array('flat'), $l, 'long convert'); PEAR_Command::getGetoptArgs('cvsdiff', $s, $l); $phpunit->assertEquals('qQD:R:r:cuibBn', $s, 'short cvsdiff'); $phpunit->assertEquals(array ( 0 => 'quiet', 1 => 'reallyquiet', 2 => 'date=', 3 => 'release=', 4 => 'revision=', 5 => 'context', 6 => 'unified', 7 => 'ignore-case', 8 => 'ignore-whitespace', 9 => 'ignore-blank-lines', 10 => 'brief', 11 => 'dry-run', ), $l, 'long cvsdiff'); PEAR_Command::getGetoptArgs('cvstag', $s, $l); $phpunit->assertEquals('qQFdn', $s, 'short cvstag'); $phpunit->assertEquals(array ( 0 => 'quiet', 1 => 'reallyquiet', 2 => 'slide', 3 => 'delete', 4 => 'dry-run', ), $l, 'long cvstag'); PEAR_Command::getGetoptArgs('download', $s, $l); $phpunit->assertEquals('Z', $s, 'short download'); $phpunit->assertEquals(array('nocompress'), $l, 'long download'); PEAR_Command::getGetoptArgs('download-all', $s, $l); $phpunit->assertEquals('c:', $s, 'short download-all'); $phpunit->assertEquals(array('channel='), $l, 'long download-all'); PEAR_Command::getGetoptArgs('info', $s, $l); $phpunit->assertEquals('', $s, 'short info'); $phpunit->assertEquals(array(), $l, 'long info'); PEAR_Command::getGetoptArgs('install', $s, $l); $phpunit->assertEquals('flnrsBZR:P:aoOp', $s, 'short install'); $phpunit->assertEquals(array ( 0 => 'force', 1 => 'loose', 2 => 'nodeps', 3 => 'register-only', 4 => 'soft', 5 => 'nobuild', 6 => 'nocompress', 7 => 'installroot=', 8 => 'packagingroot=', 9 => 'ignore-errors', 10 => 'alldeps', 11 => 'onlyreqdeps', 12 => 'offline', 13 => 'pretend', ), $l, 'long install'); PEAR_Command::getGetoptArgs('list', $s, $l); $phpunit->assertEquals('c:ai', $s, 'short list'); $phpunit->assertEquals(array('channel=', 'allchannels', 'channelinfo'), $l, 'long list'); PEAR_Command::getGetoptArgs('list-all', $s, $l); $phpunit->assertEquals('c:i', $s, 'short list-all'); $phpunit->assertEquals(array('channel=', 'channelinfo'), $l, 'long list-all'); PEAR_Command::getGetoptArgs('list-channels', $s, $l); $phpunit->assertEquals('', $s, 'short list-channels'); $phpunit->assertEquals(array(), $l, 'long list-channels'); PEAR_Command::getGetoptArgs('list-files', $s, $l); $phpunit->assertEquals('', $s, 'short list-files'); $phpunit->assertEquals(array(), $l, 'long list-files'); PEAR_Command::getGetoptArgs('list-upgrades', $s, $l); $phpunit->assertEquals('i', $s, 'short list-upgrades'); $phpunit->assertEquals(array('channelinfo'), $l, 'long list-upgrades'); PEAR_Command::getGetoptArgs('login', $s, $l); $phpunit->assertEquals('', $s, 'short login'); $phpunit->assertEquals(array(), $l, 'long login'); PEAR_Command::getGetoptArgs('logout', $s, $l); $phpunit->assertEquals('', $s, 'short logout'); $phpunit->assertEquals(array(), $l, 'long logout'); PEAR_Command::getGetoptArgs('makerpm', $s, $l); $phpunit->assertEquals('t:p:', $s, 'short makerpm'); $phpunit->assertEquals(array( 0 => 'spec-template=', 1 => 'rpm-pkgname=', ), $l, 'long makerpm'); PEAR_Command::getGetoptArgs('package', $s, $l); $phpunit->assertEquals('Zn', $s, 'short package'); $phpunit->assertEquals(array ( 0 => 'nocompress', 1 => 'showname', ), $l, 'long package'); PEAR_Command::getGetoptArgs('package-dependencies', $s, $l); $phpunit->assertEquals('', $s, 'short package-dependencies'); $phpunit->assertEquals(array (), $l, 'long package-dependencies'); PEAR_Command::getGetoptArgs('package-validate', $s, $l); $phpunit->assertEquals('', $s, 'short package-validate'); $phpunit->assertEquals(array (), $l, 'long package-validate'); PEAR_Command::getGetoptArgs('remote-info', $s, $l); $phpunit->assertEquals('', $s, 'short remote-info'); $phpunit->assertEquals(array (), $l, 'long remote-info'); PEAR_Command::getGetoptArgs('remote-list', $s, $l); $phpunit->assertEquals('c:', $s, 'short remote-list'); $phpunit->assertEquals(array ('channel='), $l, 'long remote-list'); PEAR_Command::getGetoptArgs('run-tests', $s, $l); $phpunit->assertEquals('ri:lqsputc:xd', $s, 'short run-tests'); $phpunit->assertEquals(array ( 'recur', 'ini=', 'realtimelog', 'quiet', 'simple', 'package', 'phpunit', 'tapoutput', 'cgi=', 'coverage', 'showdiff'), $l, 'long run-tests'); PEAR_Command::getGetoptArgs('search', $s, $l); $phpunit->assertEquals('c:ai', $s, 'short search'); $phpunit->assertEquals(array ('channel=', 'allchannels', 'channelinfo'), $l, 'long search'); PEAR_Command::getGetoptArgs('shell-test', $s, $l); $phpunit->assertEquals('', $s, 'short shell-test'); $phpunit->assertEquals(array (), $l, 'long shell-test'); PEAR_Command::getGetoptArgs('sign', $s, $l); $phpunit->assertEquals('v', $s, 'short sign'); $phpunit->assertEquals(array(0 => 'verbose',), $l, 'long sign'); PEAR_Command::getGetoptArgs('uninstall', $s, $l); $phpunit->assertEquals('nrR:O', $s, 'short uninstall'); $phpunit->assertEquals(array ( 0 => 'nodeps', 1 => 'register-only', 2 => 'installroot=', 3 => 'ignore-errors', 4 => 'offline', ), $l, 'long uninstall'); PEAR_Command::getGetoptArgs('update-channels', $s, $l); $phpunit->assertEquals('', $s, 'short update-channels'); $phpunit->assertEquals(array (), $l, 'long update-channels'); PEAR_Command::getGetoptArgs('upgrade', $s, $l); $phpunit->assertEquals('c:flnrBZR:aoOp', $s, 'short upgrade'); $phpunit->assertEquals(array ( 0 => 'channel=', 1 => 'force', 2 => 'loose', 3 => 'nodeps', 4 => 'register-only', 5 => 'nobuild', 6 => 'nocompress', 7 => 'installroot=', 8 => 'ignore-errors', 9 => 'alldeps', 10 => 'onlyreqdeps', 11 => 'offline', 12 => 'pretend', ), $l, 'long upgrade'); PEAR_Command::getGetoptArgs('upgrade-all', $s, $l); $phpunit->assertEquals('c:nrBZR:', $s, 'short upgrade-all'); $phpunit->assertEquals(array ( 0 => 'channel=', 1 => 'nodeps', 2 => 'register-only', 3 => 'nobuild', 4 => 'nocompress', 5 => 'installroot=', 6 => 'ignore-errors', 7 => 'loose', ), $l, 'long upgrade-all'); $phpunit->assertEquals('Build an Extension From C Source' , PEAR_Command::getDescription('build'), 'build'); $phpunit->assertEquals('Unpacks a Pecl Package' , PEAR_Command::getDescription('bundle'), 'bundle'); $phpunit->assertEquals('Add a Channel' , PEAR_Command::getDescription('channel-add'), 'channel-add'); $phpunit->assertEquals('Specify an alias to a channel name' , PEAR_Command::getDescription('channel-alias'), 'channel-alias'); $phpunit->assertEquals('Remove a Channel From the List' , PEAR_Command::getDescription('channel-delete'), 'channel-delete'); $phpunit->assertEquals('Initialize a Channel from its server' , PEAR_Command::getDescription('channel-discover'), 'channel-discover'); $phpunit->assertEquals('Retrieve Information on a Channel' , PEAR_Command::getDescription('channel-info'), 'channel-info'); $phpunit->assertEquals('Update an Existing Channel' , PEAR_Command::getDescription('channel-update'), 'channel-update'); $phpunit->assertEquals('Clear Web Services Cache' , PEAR_Command::getDescription('clear-cache'), 'clear-cache'); $phpunit->assertEquals('Create a Default configuration file' , PEAR_Command::getDescription('config-create'), 'config-create'); $phpunit->assertEquals('Show One Setting' , PEAR_Command::getDescription('config-get'), 'config-get'); $phpunit->assertEquals('Show Information About Setting' , PEAR_Command::getDescription('config-help'), 'config-help'); $phpunit->assertEquals('Change Setting' , PEAR_Command::getDescription('config-set'), 'config-set'); $phpunit->assertEquals('Show All Settings' , PEAR_Command::getDescription('config-show'), 'config-show'); $phpunit->assertEquals('Convert a package.xml 1.0 to package.xml 2.0 format' , PEAR_Command::getDescription('convert'), 'convert'); $phpunit->assertEquals('Run a "cvs diff" for all files in a package' , PEAR_Command::getDescription('cvsdiff'), 'cvsdiff'); $phpunit->assertEquals('Set CVS Release Tag' , PEAR_Command::getDescription('cvstag'), 'cvstag'); $phpunit->assertEquals('Download Package' , PEAR_Command::getDescription('download'), 'download'); $phpunit->assertEquals('Downloads each available package from the default channel' , PEAR_Command::getDescription('download-all'), 'download-all'); $phpunit->assertEquals('Display information about a package' , PEAR_Command::getDescription('info'), 'info'); $phpunit->assertEquals('Install Package' , PEAR_Command::getDescription('install'), 'install'); $phpunit->assertEquals('List Installed Packages In The Default Channel' , PEAR_Command::getDescription('list'), 'list'); $phpunit->assertEquals('List All Packages' , PEAR_Command::getDescription('list-all'), 'list-all'); $phpunit->assertEquals('List Available Channels' , PEAR_Command::getDescription('list-channels'), 'list-channels'); $phpunit->assertEquals('List Files In Installed Package' , PEAR_Command::getDescription('list-files'), 'list-files'); $phpunit->assertEquals('List Available Upgrades' , PEAR_Command::getDescription('list-upgrades'), 'list-upgrades'); $phpunit->assertEquals('Connects and authenticates to remote server [Deprecated in favor of channel-login]' , PEAR_Command::getDescription('login'), 'login'); $phpunit->assertEquals('Logs out from the remote server [Deprecated in favor of channel-logout]' , PEAR_Command::getDescription('logout'), 'logout'); $phpunit->assertEquals('Builds an RPM spec file from a PEAR package' , PEAR_Command::getDescription('makerpm'), 'makerpm'); $phpunit->assertEquals('Build Package' , PEAR_Command::getDescription('package'), 'package'); $phpunit->assertEquals('Show package dependencies' , PEAR_Command::getDescription('package-dependencies'), 'package-dependencies'); $phpunit->assertEquals('Validate Package Consistency' , PEAR_Command::getDescription('package-validate'), 'package-validate'); $phpunit->assertEquals('Information About Remote Packages' , PEAR_Command::getDescription('remote-info'), 'remote-info'); $phpunit->assertEquals('List Remote Packages' , PEAR_Command::getDescription('remote-list'), 'remote-list'); $phpunit->assertEquals('Run Regression Tests' , PEAR_Command::getDescription('run-tests'), 'run-tests'); $phpunit->assertEquals('Search remote package database' , PEAR_Command::getDescription('search'), 'search'); $phpunit->assertEquals('Shell Script Test' , PEAR_Command::getDescription('shell-test'), 'shell-test'); $phpunit->assertEquals('Sign a package distribution file' , PEAR_Command::getDescription('sign'), 'sign'); $phpunit->assertEquals('Un-install Package' , PEAR_Command::getDescription('uninstall'), 'uninstall'); $phpunit->assertEquals('Update the Channel List' , PEAR_Command::getDescription('update-channels'), 'update-channels'); $phpunit->assertEquals('Upgrade Package' , PEAR_Command::getDescription('upgrade'), 'upgrade'); $phpunit->assertEquals('Upgrade All Packages [Deprecated in favor of calling upgrade with no parameters]' , PEAR_Command::getDescription('upgrade-all'), 'upgrade-all'); echo 'tests done'; ?> --CLEAN-- --EXPECT-- tests done php-pear-1.10.1+submodules+notgz/tests/PEAR_Command/test_setFrontendClass.phpt000066400000000000000000000015731262614675700274130ustar00rootroot00000000000000--TEST-- PEAR_Command::setFrontendClass() --SKIPIF-- --FILE-- assertErrors(array( array('package' => 'PEAR_Error', 'message' => 'no such class: foo_gobrmlble') ), 'invalid'); class invalid_frontend { function noUserConfirm() { } } $err = &PEAR_Command::setFrontendClass('invalid_frontend'); $phpunit->assertErrors(array( array('package' => 'PEAR_Error', 'message' => 'not a frontend class: invalid_frontend') ), 'not a frontend'); $ok = &PEAR_Command::setFrontendClass('PEAR_Frontend_CLI'); $phpunit->assertIsa('PEAR_Frontend_CLI', $ok, 'ok'); echo 'tests done'; ?> --CLEAN-- --EXPECT-- tests done php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Auth/000077500000000000000000000000001262614675700231515ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Auth/login/000077500000000000000000000000001262614675700242615ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Auth/login/test.phpt000066400000000000000000000016601262614675700261400ustar00rootroot00000000000000--TEST-- login command --SKIPIF-- skip --FILE-- setDialogOutput(array('login', array('Username', 'Password'), array('text', 'password'), array(@$_ENV['USER'], '')), array('cellog', 'hi')); $pearweb->addXmlrpcConfig("pear.php.net", "logintest", null, true); $command->run('login', array(), array()); $phpunit->assertNoErrors('test'); $phpunit->assertEquals(array ( 0 => array ( 'info' => 'Logging in to pear.php.net.', 'cmd' => 'login', ), 1 => array ( 'info' => 'Logged in.', 'cmd' => 'login', ), ), $fakelog->getLog(), 'log'); $phpunit->assertEquals('cellog', $config->get('username'), 'username'); $phpunit->assertEquals('hi', $config->get('password'), 'password'); echo 'tests done'; ?> --EXPECT-- tests done php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Auth/logout/000077500000000000000000000000001262614675700244625ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Auth/logout/test.phpt000066400000000000000000000024351262614675700263420ustar00rootroot00000000000000--TEST-- logout command --SKIPIF-- skip --FILE-- setDialogOutput(array('login', array('Username', 'Password'), array('text', 'password'), array(@$_ENV['USER'], '')), array('cellog', 'hi')); $pearweb->addXmlrpcConfig("pear.php.net", "logintest", null, true); $command->run('login', array(), array()); $phpunit->assertNoErrors('test'); $phpunit->assertEquals(array ( 0 => array ( 'info' => 'Logging in to pear.php.net.', 'cmd' => 'login', ), 1 => array ( 'info' => 'Logged in.', 'cmd' => 'login', ), ), $fakelog->getLog(), 'log'); $phpunit->assertEquals('cellog', $config->get('username'), 'username'); $phpunit->assertEquals('hi', $config->get('password'), 'password'); $command->run('logout', array(), array()); $phpunit->assertNoErrors('test'); $phpunit->assertEquals(array ( 0 => array ( 'info' => 'Logging out from pear.php.net.', 'cmd' => 'logout', ), ), $fakelog->getLog(), 'log'); $phpunit->assertEquals('', $config->get('username'), 'username'); $phpunit->assertEquals('', $config->get('password'), 'password'); echo 'tests done'; ?> --EXPECT-- tests done php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Auth/setup.php.inc000066400000000000000000000061171262614675700255770ustar00rootroot00000000000000 $server, 'preferred_state' => 'stable', 'cache_dir' => $temp_path . DIRECTORY_SEPARATOR . 'cache', 'php_dir' => $temp_path . DIRECTORY_SEPARATOR . 'php', 'ext_dir' => $temp_path . DIRECTORY_SEPARATOR . 'ext', 'data_dir' => $temp_path . DIRECTORY_SEPARATOR . 'data', 'www_dir' => $temp_path . DIRECTORY_SEPARATOR . 'www', 'doc_dir' => $temp_path . DIRECTORY_SEPARATOR . 'doc', 'test_dir' => $temp_path . DIRECTORY_SEPARATOR . 'test', 'bin_dir' => $temp_path . DIRECTORY_SEPARATOR . 'bin',)); touch($temp_path . DIRECTORY_SEPARATOR . 'pear.conf'); $fp = fopen($temp_path . DIRECTORY_SEPARATOR . 'pear.conf', 'w'); fwrite($fp, $config); fclose($fp); touch($temp_path . DIRECTORY_SEPARATOR . 'pear.ini'); $fp = fopen($temp_path . DIRECTORY_SEPARATOR . 'pear.ini', 'w'); fwrite($fp, $config); fclose($fp); touch($temp_path . DIRECTORY_SEPARATOR . 'pear.conf'); $fp = fopen($temp_path . DIRECTORY_SEPARATOR . 'pear.conf', 'w'); fwrite($fp, $config); fclose($fp); putenv('PHP_PEAR_SYSCONF_DIR='.$temp_path); $home = getenv('HOME'); if (!empty($home)) { // for PEAR_Config initialization putenv('HOME="'.$temp_path); } require_once "PEAR/ChannelFile.php"; require_once dirname(dirname(__FILE__)) . '/download_test_classes.php.inc'; require_once dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'phpt_test.php.inc'; $phpunit = new PEAR_PHPTest(true); $fakelog = new fake_log; $config = new test_PEAR_Config($temp_path . '/pear.ini', $temp_path . '/pear.conf'); require_once 'PEAR/Command/Auth.php'; $command = new PEAR_Command_Auth($fakelog, $config); ?> php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Auth/teardown.php.inc000066400000000000000000000014761262614675700262650ustar00rootroot00000000000000 php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Channels/000077500000000000000000000000001262614675700240035ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Channels/channel-add/000077500000000000000000000000001262614675700261415ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Channels/channel-add/files/000077500000000000000000000000001262614675700272435ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Channels/channel-add/files/remotechannel.xml000066400000000000000000000014571262614675700326200ustar00rootroot00000000000000 prong pear foo logintest package.listLatestReleases package.listAll package.info package.getDownloadURL channel.update channel.listAll php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Channels/channel-add/test.phpt000066400000000000000000000021621262614675700300160ustar00rootroot00000000000000--TEST-- channel-add command --SKIPIF-- --FILE-- setName('fake'); $ch->setSummary('fake'); $ch->setBaseURL('REST1.0', 'http://pear.example.com/rest'); $ch->setDefaultPEARProtocols(); $fp = fopen($temp_path . DIRECTORY_SEPARATOR . 'fakechannel.xml', 'wb'); fwrite($fp, $ch->toXml()); fclose($fp); $e = $command->run('channel-add', array(), array($temp_path . DIRECTORY_SEPARATOR . 'fakechannel.xml')); $phpunit->assertNoErrors('after'); $phpunit->assertEquals(array ( 0 => array ( 'info' => 'Adding Channel "fake" succeeded', 'cmd' => 'channel-add', ), ), $fakelog->getLog(), 'log'); $reg = new PEAR_Registry($temp_path . DIRECTORY_SEPARATOR . 'php'); $chan = $reg->getChannel('fake'); $phpunit->assertIsA('PEAR_ChannelFile', $chan, 'added ok?'); $phpunit->assertEquals('fake', $chan->getName(), 'name ok?'); echo 'tests done'; ?> --CLEAN-- --EXPECT-- tests done php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Channels/channel-add/test_fail.phpt000066400000000000000000000035641262614675700310200ustar00rootroot00000000000000--TEST-- channel-add command failure --SKIPIF-- --FILE-- run('channel-add', array(), array()); $phpunit->assertErrors(array( array('package' => 'PEAR_Error', 'message' => 'channel-add: no channel file specified'), ), 'no params'); $e = $command->run('channel-add', array(), array('@#$#$@')); $phpunit->assertErrors(array( array('package' => 'PEAR_Error', 'message' => 'channel-add: cannot open "@#$#$@"'), ), 'no params'); touch($temp_path . DIRECTORY_SEPARATOR . 'nofile.xml'); $e = $command->run('channel-add', array(), array($temp_path . DIRECTORY_SEPARATOR . 'nofile.xml')); $phpunit->assertErrors(array( array('package' => 'PEAR_Error', 'message' => 'channel-add: invalid channel.xml file'), array('package' => 'PEAR_ChannelFile', 'message' => 'No version number found in tag'), ), 'no params'); $phpunit->assertEquals(array ( 0 => array ( 'info' => 'Error: No version number found in tag', 'cmd' => 'no command', ), ), $fakelog->getLog(), 'log, bad file'); $ch = new PEAR_ChannelFile; $ch->setName('pear.php.net'); $ch->setSummary('fake'); $ch->setDefaultPEARProtocols(); $fp = fopen($temp_path . DIRECTORY_SEPARATOR . 'fakechannel.xml', 'wb'); fwrite($fp, $ch->toXml()); fclose($fp); $e = $command->run('channel-add', array(), array($temp_path . DIRECTORY_SEPARATOR . 'fakechannel.xml')); $phpunit->assertErrors(array( array('package' => 'PEAR_Error', 'message' => 'channel-add: Channel "pear.php.net" exists,' . ' use channel-update to update entry'), ), 'no params'); $phpunit->assertEquals(array ( ), $fakelog->getLog(), 'log, bad file'); echo 'tests done'; ?> --CLEAN-- --EXPECT-- tests done php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Channels/channel-add/test_remotefile.phpt000066400000000000000000000021761262614675700322360ustar00rootroot00000000000000--TEST-- channel-add command (remote channel.xml) --SKIPIF-- --FILE-- addHtmlConfig('http://pear.php.net/remotechannel.xml', $pathtochannelxml); $e = $command->run('channel-add', array(), array('http://pear.php.net/remotechannel.xml')); $phpunit->assertNoErrors('after'); $phpunit->assertEquals(array ( 0 => array ( 'info' => 'Adding Channel "prong" succeeded', 'cmd' => 'channel-add', ), ), $fakelog->getLog(), 'log'); $reg = new PEAR_Registry($temp_path . DIRECTORY_SEPARATOR . 'php'); $chan = $reg->getChannel('prong'); $phpunit->assertIsA('PEAR_ChannelFile', $chan, 'updated ok?'); $phpunit->assertEquals('prong', $chan->getName(), 'name ok?'); $phpunit->assertEquals('foo', $chan->getSummary(), 'summary ok?'); echo 'tests done'; ?> --CLEAN-- --EXPECT-- tests done php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Channels/channel-alias/000077500000000000000000000000001262614675700265025ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Channels/channel-alias/test.phpt000066400000000000000000000015341262614675700303610ustar00rootroot00000000000000--TEST-- channel-alias command --SKIPIF-- --FILE-- getRegistry(); $phpunit->assertFalse($reg->isAlias('foo'), 'test alias before'); $e = $command->run('channel-alias', array(), array('pear.php.net', 'foo')); $phpunit->assertNoErrors('after'); $phpunit->assertEquals(array ( 0 => array ( 'info' => 'Channel "pear.php.net" aliased successfully to "foo"', 'cmd' => 'no command', ), ), $fakelog->getLog(), 'log'); $phpunit->assertTrue($reg->isAlias('foo'), 'test alias foo after'); $phpunit->assertFalse($reg->isAlias('pear'), 'test alias pear after'); echo 'tests done'; ?> --CLEAN-- --EXPECT-- tests done php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Channels/channel-alias/test_fail.phpt000066400000000000000000000030321262614675700313470ustar00rootroot00000000000000--TEST-- channel-alias command failure --SKIPIF-- --FILE-- getRegistry(); $e = $command->run('channel-alias', array(), array('pear.php.net')); $phpunit->assertErrors(array( array('package' => 'PEAR_Error', 'message' => 'No channel alias specified'), ), 'no params'); $e = $command->run('channel-alias', array(), array('pear.php.net', 'foo', 'bar')); $phpunit->assertErrors(array( array('package' => 'PEAR_Error', 'message' => 'Invalid format, correct is: channel-alias channel alias'), ), 'nonexistent'); $e = $command->run('channel-alias', array(), array('zonk', 'pear')); $phpunit->assertErrors(array( array('package' => 'PEAR_Error', 'message' => '"zonk" is not a valid channel'), ), 'pear'); $e = $command->run('channel-alias', array(), array('__uri', 'pear')); $phpunit->assertErrors(array( array('package' => 'PEAR_Error', 'message' => 'Channel "pear.php.net" is already aliased to "pear", cannot re-alias'), ), 'pear.php.net'); $e = $command->run('channel-alias', array(), array('__uri', '@#$^*&@')); $phpunit->assertErrors(array( array('package' => 'PEAR_Error', 'message' => 'Alias "@#$^*&@" is not a valid channel alias'), array('package' => 'PEAR_ChannelFile', 'message' => 'Invalid channel suggestedalias "@#$^*&@"'), ), '__uri'); echo 'tests done'; ?> --CLEAN-- --EXPECT-- tests done php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Channels/channel-delete/000077500000000000000000000000001262614675700266535ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Channels/channel-delete/test.phpt000066400000000000000000000021421262614675700305260ustar00rootroot00000000000000--TEST-- channel-delete command --SKIPIF-- --FILE-- getRegistry(); $ch = new PEAR_ChannelFile; $ch->setName('fake'); $ch->setSummary('fake'); $ch->setDefaultPEARProtocols(); $reg->addChannel($ch); $chan = $reg->getChannel('fake'); $phpunit->assertIsA('PEAR_ChannelFile', $chan, 'added ok?'); $phpunit->assertEquals('fake', $chan->getName(), 'name ok?'); $e = $command->run('channel-delete', array(), array('fake')); $phpunit->assertNoErrors('after'); $phpunit->assertEquals(array ( 0 => array ( 'info' => 'Channel "fake" deleted', 'cmd' => 'channel-delete', ), ), $fakelog->getLog(), 'log'); $chan = $reg->getChannel('fake'); $phpunit->assertErrors(array( array('package' => 'PEAR_Error', 'message' => 'Unknown channel: fake') ), 'after delete'); $phpunit->assertIsa('PEAR_Error', $chan, 'after delete'); echo 'tests done'; ?> --CLEAN-- --EXPECT-- tests done php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Channels/channel-delete/test_fail.phpt000066400000000000000000000053451262614675700315310ustar00rootroot00000000000000--TEST-- channel-delete command failure --SKIPIF-- --FILE-- getRegistry(); $e = $command->run('channel-delete', array(), array()); $phpunit->assertErrors(array( array('package' => 'PEAR_Error', 'message' => 'channel-delete: no channel specified'), ), 'no params'); $e = $command->run('channel-delete', array(), array('@#$#$@')); $phpunit->assertErrors(array( array('package' => 'PEAR_Error', 'message' => 'channel-delete: channel "@#$#$@" does not exist'), ), 'nonexistent'); $e = $command->run('channel-delete', array(), array('pear')); $phpunit->assertErrors(array( array('package' => 'PEAR_Error', 'message' => 'Cannot delete the pear.php.net channel'), ), 'pear'); $e = $command->run('channel-delete', array(), array('pear.php.net')); $phpunit->assertErrors(array( array('package' => 'PEAR_Error', 'message' => 'Cannot delete the pear.php.net channel'), ), 'pear.php.net'); $e = $command->run('channel-delete', array(), array('pecl')); $phpunit->assertErrors(array( array('package' => 'PEAR_Error', 'message' => 'Cannot delete the pecl.php.net channel'), ), 'pear.php.net'); $e = $command->run('channel-delete', array(), array('pecl.php.net')); $phpunit->assertErrors(array( array('package' => 'PEAR_Error', 'message' => 'Cannot delete the pecl.php.net channel'), ), 'pear.php.net'); $e = $command->run('channel-delete', array(), array('__uri')); $phpunit->assertErrors(array( array('package' => 'PEAR_Error', 'message' => 'Cannot delete the __uri pseudo-channel'), ), '__uri'); $ch = new PEAR_ChannelFile; $ch->setName('fake'); $ch->setSummary('fake'); $ch->setDefaultPEARProtocols(); $reg->addChannel($ch); $pf = new PEAR_PackageFile_v2_rw; $pf->setConfig($config); $pf->setPackage('foo'); $pf->setChannel('fake'); $pf->setReleaseStability('stable'); $pf->setAPIStability('stable'); $pf->setReleaseVersion('1.0.0'); $pf->setAPIVersion('1.0.0'); $pf->setDate('2004-12-14'); $pf->setSummary('foo'); $pf->setDescription('foo'); $pf->setNotes('foo'); $pf->setPackageType('php'); $pf->clearContents(); $pf->setPhpDep('4.0.0', '6.0.0'); $pf->setPearinstallerDep('1.4.0a1'); $pf->setLicense('PHP License'); $pf->addFile('', 'foo.php', array('role' => 'php')); $pf->addMaintainer('lead', 'cellog', 'Greg Beaver', 'cellog@php.net'); $reg->addPackage2($pf); $e = $command->run('channel-delete', array(), array('fake')); $phpunit->assertErrors(array( array('package' => 'PEAR_Error', 'message' => 'Channel "fake" has installed packages, cannot delete'), ), 'fake'); echo 'tests done'; ?> --CLEAN-- --EXPECT-- tests done php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Channels/channel-discover/000077500000000000000000000000001262614675700272275ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Channels/channel-discover/files/000077500000000000000000000000001262614675700303315ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Channels/channel-discover/files/channel.xml000066400000000000000000000014701262614675700324650ustar00rootroot00000000000000 zornk.php.net zornk foo logintest package.listLatestReleases package.listAll package.info package.getDownloadURL channel.update channel.listAll php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Channels/channel-discover/test.phpt000066400000000000000000000023351262614675700311060ustar00rootroot00000000000000--TEST-- channel-discover command --SKIPIF-- --FILE-- addHtmlConfig('http://zornk.php.net/channel.xml', $pathtochannelxml); $e = $command->run('channel-discover', array(), array('zornk.php.net')); $phpunit->assertNoErrors('after'); $phpunit->assertEquals(array ( 0 => array ( 'info' => 'Adding Channel "zornk.php.net" succeeded', 'cmd' => 'channel-discover', ), 1 => array ( 'info' => 'Discovery of channel "zornk.php.net" succeeded', 'cmd' => 'channel-discover', ), ), $fakelog->getLog(), 'log'); $reg = new PEAR_Registry($temp_path . DIRECTORY_SEPARATOR . 'php'); $chan = $reg->getChannel('zornk'); $phpunit->assertIsA('PEAR_ChannelFile', $chan, 'updated ok?'); $phpunit->assertEquals('zornk.php.net', $chan->getName(), 'name ok?'); $phpunit->assertEquals('foo', $chan->getSummary(), 'summary ok?'); echo 'tests done'; ?> --CLEAN-- --EXPECT-- tests done php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Channels/channel-discover/test_fail.phpt000066400000000000000000000030051262614675700320740ustar00rootroot00000000000000--TEST-- channel-discover command failure --SKIPIF-- --FILE-- getRegistry(); $e = $command->run('channel-discover', array(), array('pear')); $phpunit->assertErrors(array( array( 'package' => 'PEAR_Error', 'message' => 'A channel alias named "pear" already exists, aliasing channel "pear.php.net"' ), ), 'no params'); $e = $command->run('channel-discover', array(), array('pear.php.net')); $phpunit->assertErrors(array( array( 'package' => 'PEAR_Error', 'message' => 'Channel "pear.php.net" is already initialized' ), ), 'nonexistent'); $e = $command->run('channel-discover', array(), array()); $phpunit->assertErrors(array( array( 'package' => 'PEAR_Error', 'message' => 'No channel server specified' ), ), 'pear'); $e = $command->run('channel-discover', array(), array('zornk.net')); $phpunit->assertErrors(array( array( 'package' => 'PEAR_Error', 'message' => 'Discovery of channel "zornk.net" failed (channel-add: Cannot open "https://zornk.net/channel.xml" (File https://zornk.net:443/channel.xml not valid (received: HTTP/1.1 404 https://zornk.net/channel.xml Is not valid)))' ), ), 'zornk'); $phpunit->assertNoErrors('all errors caught'); echo 'tests done'; ?> --CLEAN-- --EXPECT-- tests done php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Channels/channel-info/000077500000000000000000000000001262614675700263445ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Channels/channel-info/test_fail.phpt000066400000000000000000000011611262614675700312120ustar00rootroot00000000000000--TEST-- channel-info command (remote channel.xml file failure) --SKIPIF-- --FILE-- run('channel-info', array(), array('smurg')); $phpunit->assertErrors(array( array('package' => 'PEAR_Error', 'message' => 'Unknown channel "smurg"'), ), '1'); $phpunit->showall(); $phpunit->assertEquals(array ( ), $fakelog->getLog(), 'log 1'); echo 'tests done'; ?> --CLEAN-- --EXPECT-- tests done php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Channels/channel-info/test_file.phpt000066400000000000000000000105331262614675700312210ustar00rootroot00000000000000--TEST-- channel-info command (channel.xml file) --SKIPIF-- --FILE-- froo froo PHP Extension and Application Repository PEAR_Validate http://pear.php.net/rest/ http://pear.php.net/rest/ http://pear.php.net/rest/ http://pear.php.net/rest/ http://poor.php.net/rest/ http://poor.php.net/rest/ http://poor.php.net/rest/ http://poor.php.net/rest/ '; $fp = fopen($temp_path . DIRECTORY_SEPARATOR . 'channel.xml', 'wb'); fwrite($fp, $c); fclose($fp); $e = $command->run('channel-info', array(), array($temp_path . DIRECTORY_SEPARATOR . 'channel.xml')); $phpunit->assertNoErrors('1'); $phpunit->assertEquals(array ( 0 => array ( 'info' => array ( 'main' => array ( 'caption' => 'Channel froo Information:', 'border' => true, 'data' => array ( 'server' => array ( 0 => 'Name and Server', 1 => 'froo', ), 'summary' => array ( 0 => 'Summary', 1 => 'PHP Extension and Application Repository', ), 'vpackage' => array ( 0 => 'Validation Package Name', 1 => 'PEAR_Validate', ), 'vpackageversion' => array ( 0 => 'Validation Package Version', 1 => '1.0', ), ), ), 'protocols' => array ( 'data' => array ( 0 => array ( 0 => 'rest', 1 => 'REST1.0', 2 => 'http://pear.php.net/rest/', ), 1 => array ( 0 => 'rest', 1 => 'REST1.1', 2 => 'http://pear.php.net/rest/', ), 2 => array ( 0 => 'rest', 1 => 'REST1.2', 2 => 'http://pear.php.net/rest/', ), 3 => array ( 0 => 'rest', 1 => 'REST1.3', 2 => 'http://pear.php.net/rest/', ), ), 'caption' => 'Server Capabilities', 'headline' => array ( 0 => 'Type', 1 => 'Version/REST type', 2 => 'Function Name/REST base', ), ), 'mirrors' => array ( 'data' => array ( 0 => array ( 0 => 'poor.php.net', ), ), 'caption' => 'Channel froo Mirrors:', ), 'mirrorprotocols0' => array ( 'data' => array ( 0 => array ( 0 => 'rest', 1 => 'REST1.0', 2 => 'http://poor.php.net/rest/', ), 1 => array ( 0 => 'rest', 1 => 'REST1.1', 2 => 'http://poor.php.net/rest/', ), 2 => array ( 0 => 'rest', 1 => 'REST1.2', 2 => 'http://poor.php.net/rest/', ), 3 => array ( 0 => 'rest', 1 => 'REST1.3', 2 => 'http://poor.php.net/rest/', ), ), 'caption' => 'Mirror poor.php.net Capabilities', 'headline' => array ( 0 => 'Type', 1 => 'Version/REST type', 2 => 'Function Name/REST base', ), ), ), 'cmd' => 'channel-info', ), ), $fakelog->getLog(), 'log 1'); echo 'tests done'; ?> --CLEAN-- --EXPECT-- tests done php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Channels/channel-info/test_file_fail.phpt000066400000000000000000000054561262614675700322240ustar00rootroot00000000000000--TEST-- channel-info command (channel.xml file, invalid channel.xml) --SKIPIF-- --FILE-- @#%^*@ froo PHP Extension and Application Repository PEAR_Validate logintest package.listLatestReleases package.listAll package.info package.getDownloadURL channel.listAll channel.update package.listLatestReleases package.listAll http://pear.php.net/rest/ logintest package.listLatestReleases package.listAll package.info package.getDownloadURL channel.listAll channel.update package.listLatestReleases package.listAll http://poor.php.net/rest/ '; $fp = fopen($temp_path . DIRECTORY_SEPARATOR . 'channel.xml', 'wb'); fwrite($fp, $c); fclose($fp); $e = $command->run('channel-info', array(), array($temp_path . DIRECTORY_SEPARATOR . 'channel.xml')); $phpunit->assertErrors(array( array('package' => 'PEAR_Error', 'message' => 'Channel file "' . $temp_path . DIRECTORY_SEPARATOR . 'channel.xml" is not valid'), array('package' => 'PEAR_ChannelFile', 'message' => 'Invalid channel name "@#%^*@"'), ), '1'); $phpunit->showall(); $phpunit->assertEquals(array ( 0 => array ( 'info' => 'error: Invalid channel name "@#%^*@"', 'cmd' => 'no command', ), ), $fakelog->getLog(), 'log 1'); echo 'tests done'; ?> --CLEAN-- --EXPECT-- tests done php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Channels/channel-info/test_installed.phpt000066400000000000000000000104621262614675700322620ustar00rootroot00000000000000--TEST-- channel-info command (installed channel) --SKIPIF-- --FILE-- fromXmlString(' froo froo PHP Extension and Application Repository PEAR_Validate http://pear.php.net/rest/ http://pear.php.net/rest/ http://pear.php.net/rest/ http://pear.php.net/rest/ http://poor.php.net/rest/ http://poor.php.net/rest/ http://poor.php.net/rest/ http://poor.php.net/rest/ '); $reg = &$config->getRegistry(); $reg->addChannel($ch); $e = $command->run('channel-info', array(), array('froo')); $phpunit->assertNoErrors('1'); $phpunit->assertEquals(array ( 0 => array ( 'info' => array ( 'main' => array ( 'caption' => 'Channel froo Information:', 'border' => true, 'data' => array ( 'server' => array ( 0 => 'Name and Server', 1 => 'froo', ), 'summary' => array ( 0 => 'Summary', 1 => 'PHP Extension and Application Repository', ), 'vpackage' => array ( 0 => 'Validation Package Name', 1 => 'PEAR_Validate', ), 'vpackageversion' => array ( 0 => 'Validation Package Version', 1 => '1.0', ), ), ), 'protocols' => array ( 'data' => array ( 0 => array ( 0 => 'rest', 1 => 'REST1.0', 2 => 'http://pear.php.net/rest/', ), 1 => array ( 0 => 'rest', 1 => 'REST1.1', 2 => 'http://pear.php.net/rest/', ), 2 => array ( 0 => 'rest', 1 => 'REST1.2', 2 => 'http://pear.php.net/rest/', ), 3 => array ( 0 => 'rest', 1 => 'REST1.3', 2 => 'http://pear.php.net/rest/', ), ), 'caption' => 'Server Capabilities', 'headline' => array ( 0 => 'Type', 1 => 'Version/REST type', 2 => 'Function Name/REST base', ), ), 'mirrors' => array ( 'data' => array ( 0 => array ( 0 => 'poor.php.net', ), ), 'caption' => 'Channel froo Mirrors:', ), 'mirrorprotocols0' => array ( 'data' => array ( 0 => array ( 0 => 'rest', 1 => 'REST1.0', 2 => 'http://poor.php.net/rest/', ), 1 => array ( 0 => 'rest', 1 => 'REST1.1', 2 => 'http://poor.php.net/rest/', ), 2 => array ( 0 => 'rest', 1 => 'REST1.2', 2 => 'http://poor.php.net/rest/', ), 3 => array ( 0 => 'rest', 1 => 'REST1.3', 2 => 'http://poor.php.net/rest/', ), ), 'caption' => 'Mirror poor.php.net Capabilities', 'headline' => array ( 0 => 'Type', 1 => 'Version/REST type', 2 => 'Function Name/REST base', ), ), ), 'cmd' => 'channel-info', ), ), $fakelog->getLog(), 'log 1'); echo 'tests done'; ?> --CLEAN-- --EXPECT-- tests done php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Channels/channel-info/test_remotefile.phpt000066400000000000000000000107771262614675700324470ustar00rootroot00000000000000--TEST-- channel-info command (remote channel.xml file) --SKIPIF-- --FILE-- froo froo PHP Extension and Application Repository PEAR_Validate http://pear.php.net/rest/ http://pear.php.net/rest/ http://pear.php.net/rest/ http://pear.php.net/rest/ http://poor.php.net/rest/ http://poor.php.net/rest/ http://poor.php.net/rest/ http://poor.php.net/rest/ '; $fp = fopen($temp_path . DIRECTORY_SEPARATOR . 'channel.xml', 'wb'); fwrite($fp, $c); fclose($fp); $pathtochannelxml = $temp_path . DIRECTORY_SEPARATOR . 'channel.xml'; $GLOBALS['pearweb']->addHtmlConfig('http://pear.php.net/remotechannel.xml', $pathtochannelxml); $e = $command->run('channel-info', array(), array('http://pear.php.net/remotechannel.xml')); $phpunit->assertNoErrors('1'); $phpunit->assertEquals(array ( 0 => array ( 'info' => array ( 'main' => array ( 'caption' => 'Channel froo Information:', 'border' => true, 'data' => array ( 'server' => array ( 0 => 'Name and Server', 1 => 'froo', ), 'summary' => array ( 0 => 'Summary', 1 => 'PHP Extension and Application Repository', ), 'vpackage' => array ( 0 => 'Validation Package Name', 1 => 'PEAR_Validate', ), 'vpackageversion' => array ( 0 => 'Validation Package Version', 1 => '1.0', ), ), ), 'protocols' => array ( 'data' => array ( 0 => array ( 0 => 'rest', 1 => 'REST1.0', 2 => 'http://pear.php.net/rest/', ), 1 => array ( 0 => 'rest', 1 => 'REST1.1', 2 => 'http://pear.php.net/rest/', ), 2 => array ( 0 => 'rest', 1 => 'REST1.2', 2 => 'http://pear.php.net/rest/', ), 3 => array ( 0 => 'rest', 1 => 'REST1.3', 2 => 'http://pear.php.net/rest/', ), ), 'caption' => 'Server Capabilities', 'headline' => array ( 0 => 'Type', 1 => 'Version/REST type', 2 => 'Function Name/REST base', ), ), 'mirrors' => array ( 'data' => array ( 0 => array ( 0 => 'poor.php.net', ), ), 'caption' => 'Channel froo Mirrors:', ), 'mirrorprotocols0' => array ( 'data' => array ( 0 => array ( 0 => 'rest', 1 => 'REST1.0', 2 => 'http://poor.php.net/rest/', ), 1 => array ( 0 => 'rest', 1 => 'REST1.1', 2 => 'http://poor.php.net/rest/', ), 2 => array ( 0 => 'rest', 1 => 'REST1.2', 2 => 'http://poor.php.net/rest/', ), 3 => array ( 0 => 'rest', 1 => 'REST1.3', 2 => 'http://poor.php.net/rest/', ), ), 'caption' => 'Mirror poor.php.net Capabilities', 'headline' => array ( 0 => 'Type', 1 => 'Version/REST type', 2 => 'Function Name/REST base', ), ), ), 'cmd' => 'channel-info', ), ), $fakelog->getLog(), 'log 1'); echo 'tests done'; ?> --CLEAN-- --EXPECT-- tests done php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Channels/channel-info/test_remotefilefail.phpt000066400000000000000000000014631262614675700332730ustar00rootroot00000000000000--TEST-- channel-info command (remote channel.xml file failure) --SKIPIF-- --FILE-- run('channel-info', array(), array('http://pear.php.net/remotechannel.xml')); $phpunit->assertErrors(array( array('package' => 'PEAR_Error', 'message' => 'Cannot open "http://pear.php.net/remotechannel.xml" (File http://pear.php.net:80/remotechannel.xml not valid (received: HTTP/1.1 404 http://pear.php.net/remotechannel.xml Is not valid))'), ), '1'); $phpunit->showall(); $phpunit->assertEquals(array ( ), $fakelog->getLog(), 'log 1'); echo 'tests done'; ?> --CLEAN-- --EXPECT-- tests done php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Channels/channel-update/000077500000000000000000000000001262614675700266735ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Channels/channel-update/files/000077500000000000000000000000001262614675700277755ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Channels/channel-update/files/invalidchannel.xml000066400000000000000000000015171262614675700335020ustar00rootroot00000000000000 oops.we.changedit pear foo logintest package.listLatestReleases package.listAll package.info package.getDownloadURL channel.update channel.listAll php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Channels/channel-update/files/pearchannel.xml000066400000000000000000000015121262614675700327760ustar00rootroot00000000000000 pear.php.net pear foo logintest package.listLatestReleases package.listAll package.info package.getDownloadURL channel.update channel.listAll php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Channels/channel-update/files/remotechannel.xml000066400000000000000000000015121262614675700333420ustar00rootroot00000000000000 pear.php.net pear foo logintest package.listLatestReleases package.listAll package.info package.getDownloadURL channel.update channel.listAll php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Channels/channel-update/test_localfile.phpt000066400000000000000000000023261262614675700325640ustar00rootroot00000000000000--TEST-- channel-update command (local channel.xml) --SKIPIF-- --FILE-- setName('pear.php.net'); $ch->setSummary('fake'); $ch->setServer('pear.php.net'); $ch->setDefaultPEARProtocols(); $fp = fopen($temp_path . DIRECTORY_SEPARATOR . 'fakechannel.xml', 'wb'); fwrite($fp, $ch->toXml()); fclose($fp); $e = $command->run('channel-update', array(), array($temp_path . DIRECTORY_SEPARATOR . 'fakechannel.xml')); $phpunit->assertNoErrors('after'); $phpunit->assertEquals(array ( 0 => array ( 'info' => 'Update of Channel "pear.php.net" succeeded', 'cmd' => 'no command', ), ), $fakelog->getLog(), 'log'); $reg = new PEAR_Registry($temp_path . DIRECTORY_SEPARATOR . 'php'); $chan = $reg->getChannel('pear.php.net'); $phpunit->assertIsA('PEAR_ChannelFile', $chan, 'updated ok?'); $phpunit->assertEquals('pear.php.net', $chan->getName(), 'name ok?'); $phpunit->assertEquals('fake', $chan->getSummary(), 'summary ok?'); echo 'tests done'; ?> --CLEAN-- --EXPECT-- tests done php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Channels/channel-update/test_remotechannel.phpt000066400000000000000000000024641262614675700334610ustar00rootroot00000000000000--TEST-- channel-update command (remote channel name) --SKIPIF-- --FILE-- getRegistry(); $c = $reg->getChannel(strtolower('pear.php.net')); $pathtochannelxml = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'files'. DIRECTORY_SEPARATOR . 'pearchannel.xml'; $GLOBALS['pearweb']->addHtmlConfig('http://pear.php.net/channel.xml', $pathtochannelxml); $e = $command->run('channel-update', array(), array('pear.php.net')); $phpunit->assertNoErrors('after'); $phpunit->assertEquals(array ( 0 => array ( 'info' => 'Updating channel "pear.php.net"', 'cmd' => 'channel-update', ), 1 => array ( 'info' => 'Update of Channel "pear.php.net" succeeded', 'cmd' => 'no command', ), ), $fakelog->getLog(), 'log'); $reg = new PEAR_Registry($temp_path . DIRECTORY_SEPARATOR . 'php'); $chan = $reg->getChannel('pear.php.net'); $phpunit->assertIsA('PEAR_ChannelFile', $chan, 'updated ok?'); $phpunit->assertEquals('pear.php.net', $chan->getName(), 'name ok?'); $phpunit->assertEquals('foo', $chan->getSummary(), 'summary ok?'); echo 'tests done'; ?> --CLEAN-- --EXPECT-- tests done test_remotechannel_invalid.phpt000066400000000000000000000045451262614675700351120ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Channels/channel-update--TEST-- channel-update command (remote channel name, changes channel name) --SKIPIF-- --FILE-- getRegistry(); $c = $reg->getChannel(strtolower('pear.php.net')); $pathtochannelxml = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'files'. DIRECTORY_SEPARATOR . 'invalidchannel.xml'; $GLOBALS['pearweb']->addHtmlConfig('http://pear.php.net/channel.xml', $pathtochannelxml); $e = $command->run('channel-update', array(), array('pear.php.net')); $phpunit->assertErrors(array( array('package' => 'PEAR_Error', 'message' => 'ERROR: downloaded channel definition file for channel "oops.we.changedit" from channel "pear.php.net"'), ), 'after'); $phpunit->assertEquals(array ( 0 => array ( 'info' => 'Updating channel "pear.php.net"', 'cmd' => 'channel-update', ), ), $fakelog->getLog(), 'log'); $reg = new PEAR_Registry($temp_path . DIRECTORY_SEPARATOR . 'php'); $chan = $reg->getChannel('pear.php.net'); $phpunit->assertIsA('PEAR_ChannelFile', $chan, 'updated ok?'); $phpunit->assertEquals('pear.php.net', $chan->getName(), 'name ok?'); $phpunit->assertEquals('PHP Extension and Application Repository', $chan->getSummary(), 'summary ok?'); $e = $command->run('channel-update', array('force' => true), array('pear.php.net')); $phpunit->assertErrors(array( array('package' => 'PEAR_Error', 'message' => 'Error: Channel "oops.we.changedit" does not exist, use channel-add to add an entry'), ), 'after force'); $phpunit->assertEquals(array ( 0 => array ( 'info' => 'Updating channel "pear.php.net"', 'cmd' => 'channel-update', ), 1 => array ( 0 => 0, 1 => 'WARNING: downloaded channel definition file for channel "oops.we.changedit" from channel "pear.php.net"', ), ), $fakelog->getLog(), 'log force'); $reg = new PEAR_Registry($temp_path . DIRECTORY_SEPARATOR . 'php'); $chan = $reg->getChannel('pear.php.net'); $phpunit->assertIsA('PEAR_ChannelFile', $chan, 'updated ok?'); $phpunit->assertEquals('pear.php.net', $chan->getName(), 'name ok?'); $phpunit->assertEquals('PHP Extension and Application Repository', $chan->getSummary(), 'summary ok?'); echo 'tests done'; ?> --CLEAN-- --EXPECT-- tests done test_remotechannel_uptodate.phpt000066400000000000000000000041051262614675700353010ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Channels/channel-update--TEST-- channel-update command (remote channel name up to date) --SKIPIF-- --FILE-- getRegistry(); $c = $reg->getChannel(strtolower('pear.php.net')); $pathtochannelxml = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'files'. DIRECTORY_SEPARATOR . 'pearchannel.xml'; $GLOBALS['pearweb']->addHtmlConfig('http://pear.php.net/channel.xml', $pathtochannelxml); $return304 = true; $e = $command->run('channel-update', array(), array('pear.php.net')); unset($return304); $phpunit->assertNoErrors('after'); $phpunit->assertEquals(array ( 0 => array ( 'info' => 'Updating channel "pear.php.net"', 'cmd' => 'channel-update', ), 1 => array ( 'info' => 'Channel "pear.php.net" is up to date', 'cmd' => 'no command', ), ), $fakelog->getLog(), 'log'); $reg = new PEAR_Registry($temp_path . DIRECTORY_SEPARATOR . 'php'); $chan = $reg->getChannel('pear.php.net'); $phpunit->assertIsa('PEAR_ChannelFile', $chan, 'updated ok?'); $phpunit->assertEquals('pear.php.net', $chan->getName(), 'name ok?'); $phpunit->assertEquals('PHP Extension and Application Repository', $chan->getSummary(), 'summary ok?'); $e = $command->run('channel-update', array('force' => true), array('pear.php.net')); $phpunit->assertNoErrors('after'); $phpunit->assertEquals(array ( 0 => array ( 'info' => 'Updating channel "pear.php.net"', 'cmd' => 'channel-update', ), 1 => array ( 'info' => 'Update of Channel "pear.php.net" succeeded', 'cmd' => 'no command', ), ), $fakelog->getLog(), 'log'); $reg = new PEAR_Registry($temp_path . DIRECTORY_SEPARATOR . 'php'); $chan = $reg->getChannel('pear.php.net'); $phpunit->assertIsa('PEAR_ChannelFile', $chan, 'updated ok?'); $phpunit->assertEquals('pear.php.net', $chan->getName(), 'name ok?'); $phpunit->assertEquals('foo', $chan->getSummary(), 'summary ok?');echo 'tests done'; ?> --CLEAN-- --EXPECT-- tests done php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Channels/channel-update/test_remotefile.phpt000066400000000000000000000022331262614675700327620ustar00rootroot00000000000000--TEST-- channel-update command (remote channel.xml) --SKIPIF-- --FILE-- addHtmlConfig('http://pear.php.net/remotechannel.xml', $pathtochannelxml); $e = $command->run('channel-update', array(), array('http://pear.php.net/remotechannel.xml')); $phpunit->assertNoErrors('after'); $phpunit->assertEquals(array ( 0 => array ( 'info' => 'Update of Channel "pear.php.net" succeeded', 'cmd' => 'no command', ), ), $fakelog->getLog(), 'log'); $reg = new PEAR_Registry($temp_path . DIRECTORY_SEPARATOR . 'php'); $chan = $reg->getChannel('pear.php.net'); $phpunit->assertIsA('PEAR_ChannelFile', $chan, 'updated ok?'); $phpunit->assertEquals('pear.php.net', $chan->getName(), 'name ok?'); $phpunit->assertEquals('foo', $chan->getSummary(), 'summary ok?'); echo 'tests done'; ?> --CLEAN-- --EXPECT-- tests done php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Channels/list-channels/000077500000000000000000000000001262614675700265475ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Channels/list-channels/test.phpt000066400000000000000000000051141262614675700304240ustar00rootroot00000000000000--TEST-- list-channels command --SKIPIF-- --FILE-- run('list-channels', array(), array()); $phpunit->assertNoErrors('1'); $phpunit->assertEquals(array ( 0 => array ( 'info' => array ( 'caption' => 'Registered Channels:', 'border' => true, 'headline' => array ( 0 => 'Channel', 1 => 'Alias', 2 => 'Summary', ), 'data' => array ( 0 => array ( 0 => 'doc.php.net', 1 => 'phpdocs', 2 => 'PHP Documentation Team', ), 1 => array ( 0 => 'pear.php.net', 1 => 'pear', 2 => 'PHP Extension and Application Repository', ), 2 => array ( 0 => 'pecl.php.net', 1 => 'pecl', 2 => 'PHP Extension Community Library', ), 3 => array ( 0 => '__uri', 1 => '__uri', 2 => 'Pseudo-channel for static packages', ), ), ), 'cmd' => 'list-channels', ), ), $fakelog->getLog(), 'log 1'); $ch = new PEAR_ChannelFile; $ch->setName('fake'); $ch->setSummary('fake'); $ch->setDefaultPEARProtocols(); $reg = &$config->getRegistry(); $reg->addChannel($ch); $e = $command->run('list-channels', array(), array()); $phpunit->assertNoErrors('1'); $phpunit->assertEquals(array ( 0 => array ( 'info' => array ( 'caption' => 'Registered Channels:', 'border' => true, 'headline' => array ( 0 => 'Channel', 1 => 'Alias', 2 => 'Summary', ), 'data' => array ( 0 => array ( 0 => 'doc.php.net', 1 => 'phpdocs', 2 => 'PHP Documentation Team', ), 1 => array ( 0 => 'fake', 1 => 'fake', 2 => 'fake', ), 2 => array ( 0 => 'pear.php.net', 1 => 'pear', 2 => 'PHP Extension and Application Repository', ), 3 => array ( 0 => 'pecl.php.net', 1 => 'pecl', 2 => 'PHP Extension Community Library', ), 4 => array ( 0 => '__uri', 1 => '__uri', 2 => 'Pseudo-channel for static packages', ), ), ), 'cmd' => 'list-channels', ), ), $fakelog->getLog(), 'log 2'); echo 'tests done'; ?> --CLEAN-- --EXPECT-- tests done php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Channels/setup.php.inc000066400000000000000000000066421262614675700264340ustar00rootroot00000000000000 $server, 'preferred_state' => 'stable', 'cache_dir' => $temp_path . DIRECTORY_SEPARATOR . 'cache', 'php_dir' => $temp_path . DIRECTORY_SEPARATOR . 'php', 'ext_dir' => $temp_path . DIRECTORY_SEPARATOR . 'ext', 'data_dir' => $temp_path . DIRECTORY_SEPARATOR . 'data', 'www_dir' => $temp_path . DIRECTORY_SEPARATOR . 'www', 'doc_dir' => $temp_path . DIRECTORY_SEPARATOR . 'doc', 'test_dir' => $temp_path . DIRECTORY_SEPARATOR . 'test', 'download_dir' => $temp_path . DIRECTORY_SEPARATOR . 'tmp', 'temp_dir' => $temp_path . DIRECTORY_SEPARATOR . 'tmp', 'bin_dir' => $temp_path . DIRECTORY_SEPARATOR . 'bin',)); touch($temp_path . DIRECTORY_SEPARATOR . 'pear.conf'); $fp = fopen($temp_path . DIRECTORY_SEPARATOR . 'pear.conf', 'w'); fwrite($fp, $config); fclose($fp); touch($temp_path . DIRECTORY_SEPARATOR . 'pear.ini'); $fp = fopen($temp_path . DIRECTORY_SEPARATOR . 'pear.ini', 'w'); fwrite($fp, $config); fclose($fp); touch($temp_path . DIRECTORY_SEPARATOR . 'pear.conf'); $fp = fopen($temp_path . DIRECTORY_SEPARATOR . 'pear.conf', 'w'); fwrite($fp, $config); fclose($fp); putenv('PHP_PEAR_SYSCONF_DIR='.$temp_path); $home = getenv('HOME'); if (!empty($home)) { // for PEAR_Config initialization putenv('HOME="'.$temp_path); } require_once "PEAR/ChannelFile.php"; require_once dirname(dirname(__FILE__)) . '/download_test_classes.php.inc'; require_once dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'phpt_test.php.inc'; $phpunit = new PEAR_PHPTest(true); $fakelog = new fake_log; $config = new test_PEAR_Config($temp_path . '/pear.ini', $temp_path . '/pear.conf'); require_once 'PEAR/Command/Channels.php'; class test_PEAR_Command_Channels extends PEAR_Command_Channels { function &getDownloader() { $a = new test_PEAR_Downloader($this->ui, array(), $this->config); return $a; } } $command = new test_PEAR_Command_Channels($fakelog, $config); ?> php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Channels/teardown.php.inc000066400000000000000000000014761262614675700271170ustar00rootroot00000000000000 php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Channels/update-channels/000077500000000000000000000000001262614675700270565ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Channels/update-channels/files/000077500000000000000000000000001262614675700301605ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Channels/update-channels/files/hordechannel.xml000066400000000000000000000014701262614675700333360ustar00rootroot00000000000000 horde.orde.de horde foo logintest package.listLatestReleases package.listAll package.info package.getDownloadURL channel.update channel.listAll php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Channels/update-channels/files/pearchannel.xml000066400000000000000000000014661262614675700331710ustar00rootroot00000000000000 pear.php.net pear foo logintest package.listLatestReleases package.listAll package.info package.getDownloadURL channel.update channel.listAll php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Channels/update-channels/files/zornkchannel.xml000066400000000000000000000014711262614675700334010ustar00rootroot00000000000000 zornk.ornk.org zornk foo logintest package.listLatestReleases package.listAll package.info package.getDownloadURL channel.update channel.listAll php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Channels/update-channels/test.phpt000066400000000000000000000071221262614675700307340ustar00rootroot00000000000000--TEST-- update-channels command --SKIPIF-- --FILE-- getRegistry(); $c = $reg->getChannel(strtolower('pear.php.net')); $c->setName('zornk.ornk.org'); $reg->addChannel($c); $c->setName('horde.orde.de'); $reg->addChannel($c); $lastmod = $c->lastModified(); $filesDir = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'files'. DIRECTORY_SEPARATOR; $pathtochannelxml1 = $filesDir . 'pearchannel.xml'; $pathtochannelxml2 = $filesDir . 'zornkchannel.xml'; $pathtochannelxml3 = $filesDir . 'hordechannel.xml'; $GLOBALS['pearweb']->addHtmlConfig('http://pear.php.net/channel.xml', $pathtochannelxml1); $GLOBALS['pearweb']->addHtmlConfig('http://zornk.ornk.org/channel.xml', $pathtochannelxml2); $GLOBALS['pearweb']->addHtmlConfig('http://horde.orde.de/channel.xml', $pathtochannelxml3); $e = $command->run('update-channels', array(), array()); $phpunit->assertNoErrors('after'); $phpunit->showall(); $phpunit->assertEquals(array ( 0 => array ( 'info' => 'Updating channel "doc.php.net"', 'cmd' => 'channel-update', ), 1 => array ( 'info' => 'Channel "doc.php.net" is not responding over http://, failed with message: File http://doc.php.net:80/channel.xml not valid (received: HTTP/1.1 404 http://doc.php.net/channel.xml Is not valid)', 'cmd' => 'no command', ), array ( 'info' => 'Trying channel "doc.php.net" over https:// instead', 'cmd' => 'no command', ), 3 => array ( 'info' => 'Cannot retrieve channel.xml for channel "doc.php.net" (File https://doc.php.net:443/channel.xml not valid (received: HTTP/1.1 404 https://doc.php.net/channel.xml Is not valid))', 'cmd' => 'update-channels', ), 4 => array ( 'info' => 'Updating channel "horde.orde.de"', 'cmd' => 'channel-update', ), 5 => array ( 'info' => 'Update of Channel "horde.orde.de" succeeded', 'cmd' => 'no command', ), 6 => array ( 'info' => 'Updating channel "pear.php.net"', 'cmd' => 'channel-update', ), 7 => array ( 'info' => 'Update of Channel "pear.php.net" succeeded', 'cmd' => 'no command', ), 8 => array ( 'info' => 'Updating channel "pecl.php.net"', 'cmd' => 'channel-update', ), 9 => array ( 'info' => 'Channel "pecl.php.net" is not responding over http://, failed with message: File http://pecl.php.net:80/channel.xml not valid (received: HTTP/1.1 404 http://pecl.php.net/channel.xml Is not valid)', 'cmd' => 'no command', ), 10 => array ( 'info' => 'Trying channel "pecl.php.net" over https:// instead', 'cmd' => 'no command', ), 11 => array ( 'info' => 'Cannot retrieve channel.xml for channel "pecl.php.net" (File https://pecl.php.net:443/channel.xml not valid (received: HTTP/1.1 404 https://pecl.php.net/channel.xml Is not valid))', 'cmd' => 'update-channels', ), 12 => array ( 'info' => 'Updating channel "zornk.ornk.org"', 'cmd' => 'channel-update', ), 13 => array ( 'info' => 'Update of Channel "zornk.ornk.org" succeeded', 'cmd' => 'no command', ), ) , $fakelog->getLog(), 'log'); $reg = new PEAR_Registry($temp_path . DIRECTORY_SEPARATOR . 'php'); $chan = $reg->getChannel('pear.php.net'); $phpunit->assertIsA('PEAR_ChannelFile', $chan, 'updated ok?'); $phpunit->assertEquals('pear.php.net', $chan->getName(), 'name ok?'); $phpunit->assertEquals('foo', $chan->getSummary(), 'summary ok?'); echo 'tests done'; ?> --CLEAN-- --EXPECT-- tests done php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Config/000077500000000000000000000000001262614675700234555ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Config/config-create/000077500000000000000000000000001262614675700261635ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Config/config-create/test.phpt000066400000000000000000000200321262614675700300340ustar00rootroot00000000000000--TEST-- config-create command --SKIPIF-- --FILE-- run('config-create', array(), array($temp_path2 . '/nomake', $temp_path . DIRECTORY_SEPARATOR . 'remote.ini')); $phpunit->assertNoErrors('log errors'); $log = $fakelog->getLog(); $log[0]['info']['data']['Internet Access'] = array_slice($log[0]['info']['data']['Internet Access'], 0, 6); $log[0]['info']['data']['File Locations'] = array_slice($log[0]['info']['data']['File Locations'], 0, 4); $log[0]['info']['data']['File Locations (Advanced)'] = array_slice($log[0]['info']['data']['File Locations (Advanced)'], 0, 13); $log[0]['info']['data']['Advanced'] = array_slice($log[0]['info']['data']['Advanced'], 0, 4); $log[0]['info']['data']['Maintainers'] = array_slice($log[0]['info']['data']['Maintainers'], 0, 6); $phpunit->assertEquals(array ( 0 => array ( 'info' => array ( 'caption' => 'Configuration (channel pear.php.net):', 'data' => array ( 'Internet Access' => array ( 0 => array ( 0 => 'Auto-discover new Channels', 1 => 'auto_discover', 2 => NULL, ), 1 => array ( 0 => 'Default Channel', 1 => 'default_channel', 2 => 'pear.php.net', ), 2 => array ( 0 => 'HTTP Proxy Server Address', 1 => 'http_proxy', 2 => NULL, ), 3 => array ( 0 => 'PEAR server [DEPRECATED]', 1 => 'master_server', 2 => NULL, ), 4 => array ( 0 => 'Default Channel Mirror', 1 => 'preferred_mirror', 2 => NULL, ), 5 => array ( 0 => 'Remote Configuration File', 1 => 'remote_config', 2 => NULL, ), ), 'File Locations' => array ( 0 => array ( 0 => 'PEAR executables directory', 1 => 'bin_dir', 2 => '' . $temp_path2 . '/nomake/pear', ), 1 => array ( 0 => 'PEAR documentation directory', 1 => 'doc_dir', 2 => '' . $temp_path2 . '/nomake/pear/docs', ), 2 => array ( 0 => 'PHP extension directory', 1 => 'ext_dir', 2 => '' . $temp_path2 . '/nomake/pear/ext', ), 3 => array ( 0 => 'PEAR directory', 1 => 'php_dir', 2 => '' . $temp_path2 . '/nomake/pear/php', ), ), 'File Locations (Advanced)' => array ( array ( 0 => 'PEAR Installer cache directory', 1 => 'cache_dir', 2 => '' . $temp_path2 . '/nomake/pear/cache', ), array ( 0 => 'PEAR configuration file directory', 1 => 'cfg_dir', 2 => $temp_path2 . '/nomake/pear/cfg', ), array ( 0 => 'PEAR data directory', 1 => 'data_dir', 2 => '' . $temp_path2 . '/nomake/pear/data', ), array ( 0 => 'PEAR Installer download directory', 1 => 'download_dir', 2 => $temp_path2 . '/nomake/pear/download', ), array ( 0 => 'Systems manpage files directory', 1 => 'man_dir', 2 => $temp_path2 . '/nomake/pear/man', ), array ( 0 => 'PEAR metadata directory', 1 => 'metadata_dir', 2 => NULL, ), array ( 0 => 'PHP CLI/CGI binary', 1 => 'php_bin', 2 => NULL, ), array ( 0 => 'php.ini location', 1 => 'php_ini', 2 => NULL, ), array ( 0 => '--program-prefix passed to PHP\'s ./configure', 1 => 'php_prefix', 2 => NULL, ), array ( 0 => '--program-suffix passed to PHP\'s ./configure', 1 => 'php_suffix', 2 => NULL, ), array ( 0 => 'PEAR Installer temp directory', 1 => 'temp_dir', 2 => $temp_path2 . '/nomake/pear/temp', ), array ( 0 => 'PEAR test directory', 1 => 'test_dir', 2 => '' . $temp_path2 . '/nomake/pear/tests', ), array ( 0 => 'PEAR www files directory', 1 => 'www_dir', 2 => '' . $temp_path2 . '/nomake/pear/www', ), ), 'Advanced' => array ( 0 => array ( 0 => 'Cache TimeToLive', 1 => 'cache_ttl', 2 => NULL, ), 1 => array ( 0 => 'Preferred Package State', 1 => 'preferred_state', 2 => NULL, ), 2 => array ( 0 => 'Unix file mask', 1 => 'umask', 2 => NULL, ), 3 => array ( 0 => 'Debug Log Level', 1 => 'verbose', 2 => NULL, ), ), 'Maintainers' => array ( 0 => array ( 0 => 'PEAR password (for maintainers)', 1 => 'password', 2 => NULL, ), 1 => array ( 0 => 'Signature Handling Program', 1 => 'sig_bin', 2 => NULL, ), 2 => array ( 0 => 'Signature Key Directory', 1 => 'sig_keydir', 2 => NULL, ), 3 => array ( 0 => 'Signature Key Id', 1 => 'sig_keyid', 2 => NULL, ), 4 => array ( 0 => 'Package Signature Type', 1 => 'sig_type', 2 => NULL, ), 5 => array ( 0 => 'PEAR username (for maintainers)', 1 => 'username', 2 => NULL, ), ), 'Config Files' => array ( 0 => array ( 0 => 'User Configuration File', 1 => 'Filename', 2 => $temp_path . DIRECTORY_SEPARATOR . 'remote.ini', ), 1 => array ( 0 => 'System Configuration File', 1 => 'Filename', 2 => '#no#system#config#', ), ), ), ), 'cmd' => 'config-show', ), 1 => array ( 'info' => 'Successfully created default configuration file "' . $temp_path . DIRECTORY_SEPARATOR . 'remote.ini"', 'cmd' => 'config-create', ), ), $log, 'log'); $phpunit->assertFileExists($temp_path . DIRECTORY_SEPARATOR . 'remote.ini', 'not created'); $contents = explode("\n", implode('', file($temp_path . DIRECTORY_SEPARATOR . 'remote.ini'))); $contents = unserialize($contents[1]); $config->readConfigFile($temp_path . DIRECTORY_SEPARATOR . 'remote.ini'); $phpunit->assertEquals(array ( 'php_dir' => $temp_path2 . '/nomake/pear/php', 'data_dir' => $temp_path2 . '/nomake/pear/data', 'www_dir' => $temp_path2 . '/nomake/pear/www', 'cfg_dir' => $temp_path2 . '/nomake/pear/cfg', 'ext_dir' => $temp_path2 . '/nomake/pear/ext', 'doc_dir' => $temp_path2 . '/nomake/pear/docs', 'test_dir' => $temp_path2 . '/nomake/pear/tests', 'cache_dir' => $temp_path2 . '/nomake/pear/cache', 'download_dir' => $temp_path2 . '/nomake/pear/download', 'temp_dir' => $temp_path2 . '/nomake/pear/temp', 'bin_dir' => $temp_path2 . '/nomake/pear', 'man_dir' => $temp_path2 . '/nomake/pear/man', ), $contents, 'ok'); echo 'tests done'; ?> --CLEAN-- --EXPECT-- tests done php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Config/config-create/test_fail.phpt000066400000000000000000000052361262614675700310400ustar00rootroot00000000000000--TEST-- config-create command failure --SKIPIF-- --FILE-- run('config-create', array(), array()); $phpunit->assertErrors(array( array('package' => 'PEAR_Error', 'message' => 'config-create: must have 2 parameters, root path and filename to save as'), ), 'no params'); $e = $command->run('config-create', array(), array('hoo')); $phpunit->assertErrors(array( array('package' => 'PEAR_Error', 'message' => 'config-create: must have 2 parameters, root path and filename to save as'), ), '1 params'); $e = $command->run('config-create', array(), array('default_channel', 'user', 'hoo')); $phpunit->assertErrors(array( array('package' => 'PEAR_Error', 'message' => 'config-create: must have 2 parameters, root path and filename to save as'), ), '3 params'); $e = $command->run('config-create', array(), array('badroot', $temp_path . '/config.ini')); $phpunit->assertErrors(array( array('package' => 'PEAR_Error', 'message' => 'Root directory must be an absolute path beginning with "/", was: "badroot"'), ), 'bad root dir'); $e = $command->run('config-create', array(), array('C:\\badroot', $temp_path . '/config.ini')); $phpunit->assertErrors(array( array('package' => 'PEAR_Error', 'message' => 'Root directory must be an absolute path beginning with "/", was: "C:/badroot"'), ), 'C:\\badroot dir'); $e = $command->run('config-create', array('windows' => true), array('5:\\badroot', $temp_path . '/config.ini')); $phpunit->assertErrors(array( array('package' => 'PEAR_Error', 'message' => 'Root directory must be an absolute path beginning with "\\" or "C:\\", was: "5:/badroot"'), ), 'C:\\badroot dir'); $phpunit->assertFileNotExists($temp_path . '/config.ini', 'make sure no create'); if (OS_WINDOWS) { $e = $command->run('config-create', array(), array('/okroot', $temp_path . '/#\\##/')); $phpunit->assertErrors(array( array('package' => 'PEAR_Error', 'message' => 'Could not create "' . $temp_path . '/#\##/"'), ), 'bad file'); $phpunit->assertFileNotExists($temp_path . '/#\\##/', 'make sure no create #\\##/'); } else { $e = $command->run('config-create', array(), array('/okroot', $temp_path . '/#\\##%$*/')); $phpunit->assertErrors(array( array('package' => 'PEAR_Error', 'message' => 'Could not create "' . $temp_path . '/#\\##%$*/"'), ), 'bad file'); $phpunit->assertFileNotExists($temp_path . '/#\\##%$*/', 'make sure no create #\\##%$*/'); } echo 'tests done'; ?> --CLEAN-- --EXPECT-- tests done php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Config/config-create/test_windows.phpt000066400000000000000000000201101262614675700316030ustar00rootroot00000000000000--TEST-- config-create command --windows --SKIPIF-- --FILE-- run('config-create', array('windows' => true), array($temp_path2 . DIRECTORY_SEPARATOR . 'nomake', $temp_path . DIRECTORY_SEPARATOR . 'remote.ini')); $phpunit->assertNoErrors('log errors'); $log = $fakelog->getLog(); $log[0]['info']['data']['Internet Access'] = array_slice($log[0]['info']['data']['Internet Access'], 0, 6); $log[0]['info']['data']['File Locations'] = array_slice($log[0]['info']['data']['File Locations'], 0, 4); $log[0]['info']['data']['File Locations (Advanced)'] = array_slice($log[0]['info']['data']['File Locations (Advanced)'], 0, 13); $log[0]['info']['data']['Advanced'] = array_slice($log[0]['info']['data']['Advanced'], 0, 4); $log[0]['info']['data']['Maintainers'] = array_slice($log[0]['info']['data']['Maintainers'], 0, 6); $phpunit->assertEquals(array ( 0 => array ( 'info' => array ( 'caption' => 'Configuration (channel pear.php.net):', 'data' => array ( 'Internet Access' => array ( 0 => array ( 0 => 'Auto-discover new Channels', 1 => 'auto_discover', 2 => NULL, ), 1 => array ( 0 => 'Default Channel', 1 => 'default_channel', 2 => 'pear.php.net', ), 2 => array ( 0 => 'HTTP Proxy Server Address', 1 => 'http_proxy', 2 => NULL, ), 3 => array ( 0 => 'PEAR server [DEPRECATED]', 1 => 'master_server', 2 => NULL, ), 4 => array ( 0 => 'Default Channel Mirror', 1 => 'preferred_mirror', 2 => NULL, ), 5 => array ( 0 => 'Remote Configuration File', 1 => 'remote_config', 2 => NULL, ), ), 'File Locations' => array ( 0 => array ( 0 => 'PEAR executables directory', 1 => 'bin_dir', 2 => '' . $temp_path2 . '\\nomake\\pear', ), 1 => array ( 0 => 'PEAR documentation directory', 1 => 'doc_dir', 2 => '' . $temp_path2 . '\\nomake\\pear\\docs', ), 2 => array ( 0 => 'PHP extension directory', 1 => 'ext_dir', 2 => '' . $temp_path2 . '\\nomake\\pear\\ext', ), 3 => array ( 0 => 'PEAR directory', 1 => 'php_dir', 2 => '' . $temp_path2 . '\\nomake\\pear\\php', ), ), 'File Locations (Advanced)' => array ( array ( 0 => 'PEAR Installer cache directory', 1 => 'cache_dir', 2 => '' . $temp_path2 . '\\nomake\\pear\\cache', ), array ( 0 => 'PEAR configuration file directory', 1 => 'cfg_dir', 2 => $temp_path2 . '\\nomake\\pear\\cfg', ), array ( 0 => 'PEAR data directory', 1 => 'data_dir', 2 => '' . $temp_path2 . '\\nomake\\pear\\data', ), array ( 0 => 'PEAR Installer download directory', 1 => 'download_dir', 2 => $temp_path2 . '\\nomake\\pear\\download', ), array ( 0 => 'Systems manpage files directory', 1 => 'man_dir', 2 => $temp_path2 . '\\nomake\\pear\\man', ), array ( 0 => 'PEAR metadata directory', 1 => 'metadata_dir', 2 => NULL, ), array ( 0 => 'PHP CLI/CGI binary', 1 => 'php_bin', 2 => NULL, ), array ( 0 => 'php.ini location', 1 => 'php_ini', 2 => NULL, ), array ( 0 => '--program-prefix passed to PHP\'s ./configure', 1 => 'php_prefix', 2 => NULL, ), array ( 0 => '--program-suffix passed to PHP\'s ./configure', 1 => 'php_suffix', 2 => NULL, ), array ( 0 => 'PEAR Installer temp directory', 1 => 'temp_dir', 2 => $temp_path2 . '\\nomake\\pear\\temp', ), array ( 0 => 'PEAR test directory', 1 => 'test_dir', 2 => '' . $temp_path2 . '\\nomake\\pear\\tests', ), array ( 0 => 'PEAR www files directory', 1 => 'www_dir', 2 => '' . $temp_path2 . '\\nomake\\pear\\www', ), ), 'Advanced' => array ( 0 => array ( 0 => 'Cache TimeToLive', 1 => 'cache_ttl', 2 => NULL, ), 1 => array ( 0 => 'Preferred Package State', 1 => 'preferred_state', 2 => NULL, ), 2 => array ( 0 => 'Unix file mask', 1 => 'umask', 2 => NULL, ), 3 => array ( 0 => 'Debug Log Level', 1 => 'verbose', 2 => NULL, ), ), 'Maintainers' => array ( 0 => array ( 0 => 'PEAR password (for maintainers)', 1 => 'password', 2 => NULL, ), 1 => array ( 0 => 'Signature Handling Program', 1 => 'sig_bin', 2 => NULL, ), 2 => array ( 0 => 'Signature Key Directory', 1 => 'sig_keydir', 2 => NULL, ), 3 => array ( 0 => 'Signature Key Id', 1 => 'sig_keyid', 2 => NULL, ), 4 => array ( 0 => 'Package Signature Type', 1 => 'sig_type', 2 => NULL, ), 5 => array ( 0 => 'PEAR username (for maintainers)', 1 => 'username', 2 => NULL, ), ), 'Config Files' => array ( 0 => array ( 0 => 'User Configuration File', 1 => 'Filename', 2 => $temp_path . DIRECTORY_SEPARATOR . 'remote.ini', ), 1 => array ( 0 => 'System Configuration File', 1 => 'Filename', 2 => '#no#system#config#', ), ), ), ), 'cmd' => 'config-show', ), 1 => array ( 'info' => 'Successfully created default configuration file "' . $temp_path . DIRECTORY_SEPARATOR . 'remote.ini"', 'cmd' => 'config-create', ), ), $log, 'log'); $phpunit->assertFileExists($temp_path . DIRECTORY_SEPARATOR . 'remote.ini', 'not created'); $contents = explode("\n", implode('', file($temp_path . DIRECTORY_SEPARATOR . 'remote.ini'))); $contents = unserialize($contents[1]); $config->readConfigFile($temp_path . DIRECTORY_SEPARATOR . 'remote.ini'); $phpunit->assertEquals(array ( 'php_dir' => $temp_path2 . '\\nomake\\pear\\php', 'data_dir' => $temp_path2 . '\\nomake\\pear\\data', 'www_dir' => $temp_path2 . '\\nomake\\pear\\www', 'cfg_dir' => $temp_path2 . '\\nomake\\pear\\cfg', 'ext_dir' => $temp_path2 . '\\nomake\\pear\\ext', 'doc_dir' => $temp_path2 . '\\nomake\\pear\\docs', 'test_dir' => $temp_path2 . '\\nomake\\pear\\tests', 'cache_dir' => $temp_path2 . '\\nomake\\pear\\cache', 'download_dir' => $temp_path2 . '\\nomake\\pear\\download', 'temp_dir' => $temp_path2 . '\\nomake\\pear\\temp', 'bin_dir' => $temp_path2 . '\\nomake\\pear', 'man_dir' => $temp_path2 . '\\nomake\\pear\\man', ), $contents, 'ok'); echo 'tests done'; ?> --CLEAN-- --EXPECT-- tests done php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Config/config-get/000077500000000000000000000000001262614675700254775ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Config/config-get/bug18581.phpt000066400000000000000000000042201262614675700275560ustar00rootroot00000000000000--TEST-- config-get command: bug #18581, "config-get -c" not returning channel's configuration when using alias --SKIPIF-- --FILE-- fromXmlString($first = ' pear.horde.org Horde PEAR server horde http://pear.horde.org/rest/ http://pear.horde.org/rest/ http://pear.horde.org/rest/ http://pear.horde.org/rest/ '); $phpunit->assertTrue($chf->validate(), 'initial parse'); $phpunit->assertNoErrors('after'); $registry = $config->getRegistry(); $registry->addChannel($chf); $phpunit->assertNoErrors('Add channel to registry'); $e = $command->run('config-set', array('channel' => 'pear.horde.org'), array('www_dir', $temp_path . DIRECTORY_SEPARATOR . 'test')); $phpunit->assertNoErrors('after'); $fakelog->getLog(); // Flush log $e = $command->run('config-get', array('channel' => 'pear.horde.org'), array('www_dir')); $phpunit->assertNoErrors('after'); $phpunit->assertEquals(array( 0 => array ( 'info' => $temp_path . DIRECTORY_SEPARATOR . 'test', 'cmd' => 'config-get', ), ), $fakelog->getLog(), 'Full length channel name config-get'); $e = $command->run('config-get', array('channel' => 'horde'), array('www_dir')); $phpunit->assertNoErrors('after'); $phpunit->assertEquals(array( 0 => array ( 'info' => $temp_path . DIRECTORY_SEPARATOR . 'test', 'cmd' => 'config-get', ), ), $fakelog->getLog(), 'Alias channel name config-get');php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Config/config-get/test.phpt000066400000000000000000000021271262614675700273550ustar00rootroot00000000000000--TEST-- config-get command --SKIPIF-- --FILE-- set('verbose', 34, 'user'); $config->set('verbose', 45, 'system'); $config->set('verbose', 56, 'user', '__uri'); $config->set('verbose', 67, 'system', '__uri'); $e = $command->run('config-get', array(), array('verbose')); $phpunit->assertEquals(array ( 0 => array ( 'info' => 34, 'cmd' => 'config-get', ), ), $fakelog->getLog(), 'verbose'); $e = $command->run('config-get', array(), array('verbose', 'user')); $phpunit->assertEquals(array ( 0 => array ( 'info' => 34, 'cmd' => 'config-get', ), ), $fakelog->getLog(), 'verbose user'); $e = $command->run('config-get', array(), array('verbose', 'system')); $phpunit->assertEquals(array ( 0 => array ( 'info' => 45, 'cmd' => 'config-get', ), ), $fakelog->getLog(), 'verbose system'); echo 'tests done'; ?> --CLEAN-- --EXPECT-- tests done php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Config/config-get/test_default_channel.phpt000066400000000000000000000022261262614675700325510ustar00rootroot00000000000000--TEST-- config-get command with default_channel --SKIPIF-- --FILE-- set('verbose', 34, 'user'); $config->set('verbose', 45, 'system'); $config->set('verbose', 56, 'user', '__uri'); $config->set('verbose', 67, 'system', '__uri'); $config->set('default_channel', '__uri'); $e = $command->run('config-get', array(), array('verbose')); $phpunit->assertEquals(array ( 0 => array ( 'info' => 56, 'cmd' => 'config-get', ), ), $fakelog->getLog(), 'verbose'); $e = $command->run('config-get', array(), array('verbose', 'user')); $phpunit->assertEquals(array ( 0 => array ( 'info' => 56, 'cmd' => 'config-get', ), ), $fakelog->getLog(), 'verbose user'); $e = $command->run('config-get', array(), array('verbose', 'system')); $phpunit->assertEquals(array ( 0 => array ( 'info' => 67, 'cmd' => 'config-get', ), ), $fakelog->getLog(), 'verbose system'); echo 'tests done'; ?> --CLEAN-- --EXPECT-- tests done php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Config/config-get/test_fail.phpt000066400000000000000000000023031262614675700303440ustar00rootroot00000000000000--TEST-- config-get command failure --SKIPIF-- --FILE-- run('config-get', array(), array()); $phpunit->assertErrors(array( array('package' => 'PEAR_Error', 'message' => 'config-get expects 1 or 2 parameters'), ), 'no params'); $e = $command->run('config-get', array(), array('default_channel', 'user', 'hoo')); $phpunit->assertErrors(array( array('package' => 'PEAR_Error', 'message' => 'config-get expects 1 or 2 parameters'), ), '1 params'); $e = $command->run('config-get', array(), array('default_channel', 'gronk')); $phpunit->assertErrors(array( array('package' => 'PEAR_Error', 'message' => 'config-get: only the layers: "user" or "system" are supported'), ), 'unknown layer'); $e = $command->run('config-get', array('channel' => 'gronk'), array('php_dir')); $phpunit->assertErrors(array( array('package' => 'PEAR_Error', 'message' => 'Channel "gronk" does not exist'), ), 'unknown channel as option'); echo 'tests done'; ?> --CLEAN-- --EXPECT-- tests done php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Config/config-get/test_opt.phpt000066400000000000000000000022511262614675700302350ustar00rootroot00000000000000--TEST-- config-get command with --channel option --SKIPIF-- --FILE-- set('verbose', 34, 'user'); $config->set('verbose', 45, 'system'); $config->set('verbose', 56, 'user', '__uri'); $config->set('verbose', 67, 'system', '__uri'); $e = $command->run('config-get', array('channel' => '__uri'), array('verbose')); $phpunit->assertEquals(array ( 0 => array ( 'info' => 56, 'cmd' => 'config-get', ), ), $fakelog->getLog(), 'verbose'); $e = $command->run('config-get', array('channel' => '__uri'), array('verbose', 'user')); $phpunit->assertEquals(array ( 0 => array ( 'info' => 56, 'cmd' => 'config-get', ), ), $fakelog->getLog(), 'verbose user'); $e = $command->run('config-get', array('channel' => '__uri'), array('verbose', 'system')); $phpunit->assertEquals(array ( 0 => array ( 'info' => 67, 'cmd' => 'config-get', ), ), $fakelog->getLog(), 'verbose system'); echo 'tests done'; ?> --CLEAN-- --EXPECT-- tests done php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Config/config-help/000077500000000000000000000000001262614675700256505ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Config/config-help/test.phpt000066400000000000000000000135771262614675700275410ustar00rootroot00000000000000--TEST-- config-help command --SKIPIF-- --FILE-- run('config-help', array(), array()); $phpunit->assertNoErrors('test'); $log = $fakelog->getLog(); $log[0]['info']['data'] = array_slice($log[0]['info']['data'], 0, 33); $phpunit->assertEquals(array ( 0 => array ( 'info' => array ( 'caption' => 'Config help', 'headline' => array ( 0 => 'Name', 1 => 'Type', 2 => 'Description', ), 'border' => true, 'data' => array ( 0 => array ( 0 => 'master_server', 1 => 'string', 2 => 'name of the main PEAR server [NOT USED IN THIS VERSION]', ), 1 => array ( 0 => 'preferred_state', 1 => 'set', 2 => 'the installer will prefer releases with this state when installing packages without a version or state specified Valid set: stable beta alpha devel snapshot', ), 2 => array ( 0 => 'cache_dir', 1 => 'directory', 2 => 'directory which is used for web service cache', ), 3 => array ( 0 => 'php_dir', 1 => 'directory', 2 => 'directory where .php files are installed', ), array ( 0 => 'cfg_dir', 1 => 'directory', 2 => 'directory where modifiable configuration files are installed', ), array ( 0 => 'www_dir', 1 => 'directory', 2 => 'directory where www frontend files (html/js) are installed', ), array ( 0 => 'ext_dir', 1 => 'directory', 2 => 'directory where loadable extensions are installed', ), array ( 0 => 'data_dir', 1 => 'directory', 2 => 'directory where data files are installed', ), array ( 0 => 'doc_dir', 1 => 'directory', 2 => 'directory where documentation is installed', ), array ( 0 => 'test_dir', 1 => 'directory', 2 => 'directory where regression tests are installed', ), array ( 0 => 'bin_dir', 1 => 'directory', 2 => 'directory where executables are installed', ), array ( 0 => 'default_channel', 1 => 'string', 2 => 'the default channel to use for all non explicit commands', ), array ( 0 => 'preferred_mirror', 1 => 'string', 2 => 'the default server or mirror to use for channel actions', ), array ( 0 => 'remote_config', 1 => 'password', 2 => 'ftp url of remote configuration file to use for synchronized install', ), array ( 0 => 'auto_discover', 1 => 'integer', 2 => 'whether to automatically discover new channels', ), array ( 0 => 'http_proxy', 1 => 'string', 2 => 'HTTP proxy (host:port) to use when downloading packages', ), array ( 0 => 'man_dir', 1 => 'directory', 2 => 'directory where unix manual pages are installed', ), array ( 0 => 'temp_dir', 1 => 'directory', 2 => 'directory which is used for all temp files', ), array ( 0 => 'download_dir', 1 => 'directory', 2 => 'directory which is used for all downloaded files', ), array ( 0 => 'php_bin', 1 => 'file', 2 => 'PHP CLI/CGI binary for executing scripts', ), array ( 0 => 'php_prefix', 1 => 'string', 2 => '--program-prefix for php_bin\'s ./configure, used for pecl installs', ), array ( 0 => 'php_suffix', 1 => 'string', 2 => '--program-suffix for php_bin\'s ./configure, used for pecl installs', ), array ( 0 => 'php_ini', 1 => 'file', 2 => 'location of php.ini in which to enable PECL extensions on install', ), array ( 0 => 'metadata_dir', 1 => 'directory', 2 => 'directory where metadata files are installed (registry, filemap, channels, ...)', ), array ( 0 => 'username', 1 => 'string', 2 => '(maintainers) your PEAR account name', ), array ( 0 => 'password', 1 => 'password', 2 => '(maintainers) your PEAR account password', ), array ( 0 => 'verbose', 1 => 'integer', 2 => 'verbosity level 0: really quiet 1: somewhat quiet 2: verbose 3: debug', ), array ( 0 => 'umask', 1 => 'mask', 2 => 'umask used when creating files (Unix-like systems only)', ), array ( 0 => 'cache_ttl', 1 => 'integer', 2 => 'amount of secs where the local cache is used and not updated', ), array ( 0 => 'sig_type', 1 => 'set', 2 => 'which package signature mechanism to use Valid set: gpg', ), array ( 0 => 'sig_bin', 1 => 'string', 2 => 'which package signature mechanism to use', ), array ( 0 => 'sig_keyid', 1 => 'string', 2 => 'which key to use for signing with', ), array ( 0 => 'sig_keydir', 1 => 'directory', 2 => 'directory where signature keys are located', ), ), ), 'cmd' => 'config-help', ), ), $log, 'log'); echo 'tests done'; ?> --CLEAN-- --EXPECT-- tests done php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Config/config-set/000077500000000000000000000000001262614675700255135ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Config/config-set/test.phpt000066400000000000000000000045311262614675700273720ustar00rootroot00000000000000--TEST-- config-set command --SKIPIF-- --FILE-- assertEquals($temp_path . DIRECTORY_SEPARATOR . 'php', $config->get('php_dir'), 'setup'); $command->run('config-set', array(), array('php_dir', $temp_path . DIRECTORY_SEPARATOR . 'poo')); $phpunit->assertNoErrors('after'); $phpunit->assertEquals(array ( 0 => array ( 'info' => 'config-set succeeded', 'cmd' => 'config-set', ), ), $fakelog->getLog(), 'ui log'); $phpunit->assertEquals($temp_path . DIRECTORY_SEPARATOR . 'poo', $config->get('php_dir'), 'php_dir'); $phpunit->assertEquals($temp_path . DIRECTORY_SEPARATOR . 'php', $config->get('php_dir', 'system'), 'setup system'); $command->run('config-set', array(), array('php_dir', $temp_path . DIRECTORY_SEPARATOR . 'poo', 'system')); $phpunit->assertNoErrors('after'); $phpunit->assertEquals(array ( 0 => array ( 'info' => 'config-set succeeded', 'cmd' => 'config-set', ), ), $fakelog->getLog(), 'ui log'); $phpunit->assertEquals($temp_path . DIRECTORY_SEPARATOR . 'poo', $config->get('php_dir', 'system'), 'php_dir'); $configinfo = array('master_server' => $server, 'preferred_state' => 'stable', 'cache_dir' => $temp_path . DIRECTORY_SEPARATOR . 'cache', 'php_dir' => $temp_path . DIRECTORY_SEPARATOR . 'poo', 'cfg_dir' => $temp_path . DIRECTORY_SEPARATOR . 'cfg', 'www_dir' => $temp_path . DIRECTORY_SEPARATOR . 'www', 'ext_dir' => $temp_path . DIRECTORY_SEPARATOR . 'ext', 'data_dir' => $temp_path . DIRECTORY_SEPARATOR . 'data', 'doc_dir' => $temp_path . DIRECTORY_SEPARATOR . 'doc', 'test_dir' => $temp_path . DIRECTORY_SEPARATOR . 'test', 'bin_dir' => $temp_path . DIRECTORY_SEPARATOR . 'bin', '__channels' => array('pecl.php.net' => array(), '__uri' => array())); $info = explode("\n", implode('', file($temp_path . DIRECTORY_SEPARATOR . 'pear.ini'))); $info = unserialize($info[1]); $phpunit->assertEquals($configinfo, $info, 'saved 1'); $info = explode("\n", implode('', file($temp_path . DIRECTORY_SEPARATOR . 'pear.conf'))); $info = unserialize($info[1]); $phpunit->assertEquals($configinfo, $info, 'saved 2'); echo 'tests done'; ?> --CLEAN-- --EXPECT-- tests done php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Config/config-set/test_fail.phpt000066400000000000000000000032351262614675700303650ustar00rootroot00000000000000--TEST-- config-set command failure --SKIPIF-- --FILE-- run('config-set', array(), array()); $phpunit->assertErrors(array( array('package' => 'PEAR_Error', 'message' => 'config-set expects 2 or 3 parameters'), ), 'no params'); $e = $command->run('config-set', array(), array('default_channel')); $phpunit->assertErrors(array( array('package' => 'PEAR_Error', 'message' => 'config-set expects 2 or 3 parameters'), ), '1 params'); $e = $command->run('config-set', array(), array('default_channel', 'pear', 'gronk')); $phpunit->assertErrors(array( array('package' => 'PEAR_Error', 'message' => 'config-set: only the layers: "user" or "system" are supported'), ), 'unknown layer'); $e = $command->run('config-set', array(), array('default_channel', 'gronk')); $phpunit->assertErrors(array( array('package' => 'PEAR_Error', 'message' => 'Channel "gronk" does not exist'), ), 'unknown channel'); $e = $command->run('config-set', array('channel' => 'gronk'), array('php_dir', 'gronk')); $phpunit->assertErrors(array( array('package' => 'PEAR_Error', 'message' => 'Channel "gronk" does not exist'), ), 'unknown channel as option'); $e = $command->run('config-set', array(), array('__channels', 'gronk')); $phpunit->assertErrors(array( array('package' => 'PEAR_Error', 'message' => 'config-set (__channels, gronk, user) failed, channel pear.php.net'), ), 'unknown channel as option'); echo 'tests done'; ?> --CLEAN-- --EXPECT-- tests done php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Config/config-set/test_setchannelval.phpt000066400000000000000000000051331262614675700323000ustar00rootroot00000000000000--TEST-- config-set command, channel-specific value --SKIPIF-- --FILE-- assertEquals($temp_path . DIRECTORY_SEPARATOR . 'php', $config->get('php_dir'), $config->get('php_dir', 'user', '__uri'), 'setup'); $command->run('config-set', array('channel' => '__uri'), array('php_dir', $temp_path . DIRECTORY_SEPARATOR . 'poo')); $phpunit->assertNoErrors('after opt user'); $phpunit->assertEquals(array ( 0 => array ( 'info' => 'config-set succeeded', 'cmd' => 'config-set', ), ), $fakelog->getLog(), 'ui log, opt user'); $phpunit->assertEquals($temp_path . DIRECTORY_SEPARATOR . 'poo', $config->get('php_dir', 'user', '__uri'), 'php_dir opt system'); $phpunit->assertEquals($temp_path . DIRECTORY_SEPARATOR . 'php', $config->get('php_dir', 'system', '__uri'), 'setup opt system'); $command->run('config-set', array('channel' => '__uri'), array('php_dir', $temp_path . DIRECTORY_SEPARATOR . 'poo', 'system')); $phpunit->assertNoErrors('after'); $phpunit->assertEquals(array ( 0 => array ( 'info' => 'config-set succeeded', 'cmd' => 'config-set', ), ), $fakelog->getLog(), 'ui log opt system'); $phpunit->assertEquals($temp_path . DIRECTORY_SEPARATOR . 'poo', $config->get('php_dir', 'system', '__uri'), 'php_dir system opt'); $configinfo = array('master_server' => $server, 'preferred_state' => 'stable', 'cache_dir' => $temp_path . DIRECTORY_SEPARATOR . 'cache', 'php_dir' => $temp_path . DIRECTORY_SEPARATOR . 'php', 'cfg_dir' => $temp_path . DIRECTORY_SEPARATOR . 'cfg', 'www_dir' => $temp_path . DIRECTORY_SEPARATOR . 'www', 'ext_dir' => $temp_path . DIRECTORY_SEPARATOR . 'ext', 'data_dir' => $temp_path . DIRECTORY_SEPARATOR . 'data', 'doc_dir' => $temp_path . DIRECTORY_SEPARATOR . 'doc', 'test_dir' => $temp_path . DIRECTORY_SEPARATOR . 'test', 'bin_dir' => $temp_path . DIRECTORY_SEPARATOR . 'bin', '__channels' => array('pecl.php.net' => array(), '__uri' => array('php_dir' => $temp_path . DIRECTORY_SEPARATOR . 'poo'))); $info = explode("\n", implode('', file($temp_path . DIRECTORY_SEPARATOR . 'pear.ini'))); $info = unserialize($info[1]); $phpunit->assertEquals($configinfo, $info, 'saved 1'); $info = explode("\n", implode('', file($temp_path . DIRECTORY_SEPARATOR . 'pear.conf'))); $info = unserialize($info[1]); $phpunit->assertEquals($configinfo, $info, 'saved 2'); echo 'tests done'; ?> --CLEAN-- --EXPECT-- tests done test_setchannelval_defaultch.phpt000066400000000000000000000053031262614675700342370ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Config/config-set--TEST-- config-set command, channel-specific value --SKIPIF-- --FILE-- set('default_channel', '__uri'); $phpunit->assertEquals($temp_path . DIRECTORY_SEPARATOR . 'php', $config->get('php_dir', 'user', '__uri'), 'setup default_ch'); $command->run('config-set', array(), array('php_dir', $temp_path . DIRECTORY_SEPARATOR . 'poo', 'user')); $phpunit->assertNoErrors('after user default_ch'); $phpunit->assertEquals(array ( 0 => array ( 'info' => 'config-set succeeded', 'cmd' => 'config-set', ), ), $fakelog->getLog(), 'ui log user default_ch'); $phpunit->assertEquals($temp_path . DIRECTORY_SEPARATOR . 'poo', $config->get('php_dir', 'user', '__uri'), 'php_dir user default_ch'); $phpunit->assertEquals($temp_path . DIRECTORY_SEPARATOR . 'php', $config->get('php_dir', 'system', '__uri'), 'setup system default_ch'); $command->run('config-set', array(), array('php_dir', $temp_path . DIRECTORY_SEPARATOR . 'poo', 'system')); $phpunit->assertNoErrors('after'); $phpunit->assertEquals(array ( 0 => array ( 'info' => 'config-set succeeded', 'cmd' => 'config-set', ), ), $fakelog->getLog(), 'ui log system default_ch'); $phpunit->assertEquals($temp_path . DIRECTORY_SEPARATOR . 'poo', $config->get('php_dir', 'system', '__uri'), 'php_dir system default_ch'); $configinfo = array('master_server' => $server, 'preferred_state' => 'stable', 'cache_dir' => $temp_path . DIRECTORY_SEPARATOR . 'cache', 'php_dir' => $temp_path . DIRECTORY_SEPARATOR . 'php', 'cfg_dir' => $temp_path . DIRECTORY_SEPARATOR . 'cfg', 'www_dir' => $temp_path . DIRECTORY_SEPARATOR . 'www', 'ext_dir' => $temp_path . DIRECTORY_SEPARATOR . 'ext', 'data_dir' => $temp_path . DIRECTORY_SEPARATOR . 'data', 'doc_dir' => $temp_path . DIRECTORY_SEPARATOR . 'doc', 'test_dir' => $temp_path . DIRECTORY_SEPARATOR . 'test', 'bin_dir' => $temp_path . DIRECTORY_SEPARATOR . 'bin', '__channels' => array('pecl.php.net' => array(), '__uri' => array('php_dir' => $temp_path . DIRECTORY_SEPARATOR . 'poo')), 'default_channel' => '__uri'); $info = explode("\n", implode('', file($temp_path . DIRECTORY_SEPARATOR . 'pear.ini'))); $info = unserialize($info[1]); $phpunit->assertEquals($configinfo, $info, 'saved 1'); unset($configinfo['default_channel']); $info = explode("\n", implode('', file($temp_path . DIRECTORY_SEPARATOR . 'pear.conf'))); $info = unserialize($info[1]); $phpunit->assertEquals($configinfo, $info, 'saved 2'); echo 'tests done'; ?> --CLEAN-- --EXPECT-- tests done php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Config/config-show/000077500000000000000000000000001262614675700257005ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Config/config-show/test.phpt000066400000000000000000000467521262614675700275720ustar00rootroot00000000000000--TEST-- config-show command failure --SKIPIF-- --FILE-- set('remote_config', 'blah'); $config->set('preferred_state', 'alpha', 'user', '__uri'); $config->set('preferred_state', 'beta', 'user', 'pear.php.net'); $e = $command->run('config-show', array(), array()); $log = $fakelog->getLog(); $log[0]['info']['data']['Internet Access'] = array_slice($log[0]['info']['data']['Internet Access'], 0, 6); $log[0]['info']['data']['File Locations'] = array_slice($log[0]['info']['data']['File Locations'], 0, 4); $log[0]['info']['data']['File Locations (Advanced)'] = array_slice($log[0]['info']['data']['File Locations (Advanced)'], 0, 12); $log[0]['info']['data']['Advanced'] = array_slice($log[0]['info']['data']['Advanced'], 0, 4); $log[0]['info']['data']['Maintainers'] = array_slice($log[0]['info']['data']['Maintainers'], 0, 6); $phpunit->assertEquals(array ( 0 => array ( 'info' => array ( 'caption' => 'Configuration (channel pear.php.net):', 'data' => array ( 'Internet Access' => array ( 0 => array ( 0 => 'Auto-discover new Channels', 1 => 'auto_discover', 2 => 0, ), 1 => array ( 0 => 'Default Channel', 1 => 'default_channel', 2 => 'pear.php.net', ), 2 => array ( 0 => 'HTTP Proxy Server Address', 1 => 'http_proxy', 2 => '', ), 3 => array ( 0 => 'PEAR server [DEPRECATED]', 1 => 'master_server', 2 => 'pear.Chiara', ), 4 => array ( 0 => 'Default Channel Mirror', 1 => 'preferred_mirror', 2 => 'pear.php.net', ), 5 => array ( 0 => 'Remote Configuration File', 1 => 'remote_config', 2 => '********', ), ), 'File Locations' => array ( 0 => array ( 0 => 'PEAR executables directory', 1 => 'bin_dir', 2 => $temp_path . DIRECTORY_SEPARATOR . 'bin', ), 1 => array ( 0 => 'PEAR documentation directory', 1 => 'doc_dir', 2 => $temp_path . DIRECTORY_SEPARATOR . 'doc', ), 2 => array ( 0 => 'PHP extension directory', 1 => 'ext_dir', 2 => $temp_path . DIRECTORY_SEPARATOR . 'ext', ), 3 => array ( 0 => 'PEAR directory', 1 => 'php_dir', 2 => $temp_path . DIRECTORY_SEPARATOR . 'php', ), ), 'File Locations (Advanced)' => array ( 0 => array ( 0 => 'PEAR Installer cache directory', 1 => 'cache_dir', 2 => $temp_path . DIRECTORY_SEPARATOR . 'cache', ), 1 => array ( 0 => 'PEAR configuration file directory', 1 => 'cfg_dir', 2 => $temp_path . DIRECTORY_SEPARATOR . 'cfg', ), array( 0 => 'PEAR data directory', 1 => 'data_dir', 2 => $temp_path . DIRECTORY_SEPARATOR . 'data', ), array ( 0 => 'PEAR Installer download directory', 1 => 'download_dir', 2 => PEAR_CONFIG_DEFAULT_DOWNLOAD_DIR, ), array ( 0 => 'Systems manpage files directory', 1 => 'man_dir', 2 => PEAR_CONFIG_DEFAULT_MAN_DIR, ), array ( 0 => 'PEAR metadata directory', 1 => 'metadata_dir', 2 => '', ), array ( 0 => 'PHP CLI/CGI binary', 1 => 'php_bin', 2 => PEAR_CONFIG_DEFAULT_PHP_BIN, ), array ( 0 => 'php.ini location', 1 => 'php_ini', 2 => '', ), array ( 0 => '--program-prefix passed to PHP\'s ./configure', 1 => 'php_prefix', 2 => '', ), array ( 0 => '--program-suffix passed to PHP\'s ./configure', 1 => 'php_suffix', 2 => '', ), array ( 0 => 'PEAR Installer temp directory', 1 => 'temp_dir', 2 => PEAR_CONFIG_DEFAULT_TEMP_DIR, ), array ( 0 => 'PEAR test directory', 1 => 'test_dir', 2 => $temp_path . DIRECTORY_SEPARATOR . 'test', ), ), 'Advanced' => array ( 0 => array ( 0 => 'Cache TimeToLive', 1 => 'cache_ttl', 2 => 3600, ), 1 => array ( 0 => 'Preferred Package State', 1 => 'preferred_state', 2 => 'beta', ), 2 => array ( 0 => 'Unix file mask', 1 => 'umask', 2 => PEAR_CONFIG_DEFAULT_UMASK, ), 3 => array ( 0 => 'Debug Log Level', 1 => 'verbose', 2 => 1, ), ), 'Maintainers' => array ( 0 => array ( 0 => 'PEAR password (for maintainers)', 1 => 'password', 2 => '', ), 1 => array ( 0 => 'Signature Handling Program', 1 => 'sig_bin', 2 => PEAR_CONFIG_DEFAULT_SIG_BIN, ), 2 => array ( 0 => 'Signature Key Directory', 1 => 'sig_keydir', 2 => PEAR_CONFIG_DEFAULT_SIG_KEYDIR, ), 3 => array ( 0 => 'Signature Key Id', 1 => 'sig_keyid', 2 => '', ), 4 => array ( 0 => 'Package Signature Type', 1 => 'sig_type', 2 => 'gpg', ), 5 => array ( 0 => 'PEAR username (for maintainers)', 1 => 'username', 2 => '', ), ), 'Config Files' => array ( 0 => array ( 0 => 'User Configuration File', 1 => 'Filename', 2 => $temp_path . '/pear.ini', ), 1 => array ( 0 => 'System Configuration File', 1 => 'Filename', 2 => $temp_path . '/pear.conf', ), ), ), ), 'cmd' => 'config-show', ), ), $log, 'normal'); $e = $command->run('config-show', array('channel' => '__uri'), array()); $log = $fakelog->getLog(); $log[0]['info']['data']['Internet Access'] = array_slice($log[0]['info']['data']['Internet Access'], 0, 6); $log[0]['info']['data']['File Locations'] = array_slice($log[0]['info']['data']['File Locations'], 0, 4); $log[0]['info']['data']['File Locations (Advanced)'] = array_slice($log[0]['info']['data']['File Locations (Advanced)'], 0, 12); $log[0]['info']['data']['Advanced'] = array_slice($log[0]['info']['data']['Advanced'], 0, 4); $log[0]['info']['data']['Maintainers'] = array_slice($log[0]['info']['data']['Maintainers'], 0, 6); $phpunit->assertEquals(array ( 0 => array ( 'info' => array ( 'caption' => 'Configuration (channel __uri):', 'data' => array ( 'Internet Access' => array ( 0 => array ( 0 => 'Auto-discover new Channels', 1 => 'auto_discover', 2 => 0, ), 1 => array ( 0 => 'Default Channel', 1 => 'default_channel', 2 => 'pear.php.net', ), 2 => array ( 0 => 'HTTP Proxy Server Address', 1 => 'http_proxy', 2 => '', ), 3 => array ( 0 => 'PEAR server [DEPRECATED]', 1 => 'master_server', 2 => 'pear.Chiara', ), 4 => array ( 0 => 'Default Channel Mirror', 1 => 'preferred_mirror', 2 => '__uri', ), 5 => array ( 0 => 'Remote Configuration File', 1 => 'remote_config', 2 => '********', ), ), 'File Locations' => array ( 0 => array ( 0 => 'PEAR executables directory', 1 => 'bin_dir', 2 => $temp_path . DIRECTORY_SEPARATOR . 'bin', ), 1 => array ( 0 => 'PEAR documentation directory', 1 => 'doc_dir', 2 => $temp_path . DIRECTORY_SEPARATOR . 'doc', ), 2 => array ( 0 => 'PHP extension directory', 1 => 'ext_dir', 2 => $temp_path . DIRECTORY_SEPARATOR . 'ext', ), 3 => array ( 0 => 'PEAR directory', 1 => 'php_dir', 2 => $temp_path . DIRECTORY_SEPARATOR . 'php', ), ), 'File Locations (Advanced)' => array ( 0 => array ( 0 => 'PEAR Installer cache directory', 1 => 'cache_dir', 2 => $temp_path . DIRECTORY_SEPARATOR . 'cache', ), 1 => array ( 0 => 'PEAR configuration file directory', 1 => 'cfg_dir', 2 => $temp_path . DIRECTORY_SEPARATOR . 'cfg', ), array( 0 => 'PEAR data directory', 1 => 'data_dir', 2 => $temp_path . DIRECTORY_SEPARATOR . 'data', ), array ( 0 => 'PEAR Installer download directory', 1 => 'download_dir', 2 => PEAR_CONFIG_DEFAULT_DOWNLOAD_DIR, ), array ( 0 => 'Systems manpage files directory', 1 => 'man_dir', 2 => PEAR_CONFIG_DEFAULT_MAN_DIR, ), array ( 0 => 'PEAR metadata directory', 1 => 'metadata_dir', 2 => '', ), array ( 0 => 'PHP CLI/CGI binary', 1 => 'php_bin', 2 => PEAR_CONFIG_DEFAULT_PHP_BIN, ), array ( 0 => 'php.ini location', 1 => 'php_ini', 2 => '', ), array ( 0 => '--program-prefix passed to PHP\'s ./configure', 1 => 'php_prefix', 2 => '', ), array ( 0 => '--program-suffix passed to PHP\'s ./configure', 1 => 'php_suffix', 2 => '', ), array ( 0 => 'PEAR Installer temp directory', 1 => 'temp_dir', 2 => PEAR_CONFIG_DEFAULT_TEMP_DIR, ), array ( 0 => 'PEAR test directory', 1 => 'test_dir', 2 => $temp_path . DIRECTORY_SEPARATOR . 'test', ), ), 'Advanced' => array ( 0 => array ( 0 => 'Cache TimeToLive', 1 => 'cache_ttl', 2 => 3600, ), 1 => array ( 0 => 'Preferred Package State', 1 => 'preferred_state', 2 => 'alpha', ), 2 => array ( 0 => 'Unix file mask', 1 => 'umask', 2 => PEAR_CONFIG_DEFAULT_UMASK, ), 3 => array ( 0 => 'Debug Log Level', 1 => 'verbose', 2 => 1, ), ), 'Maintainers' => array ( 0 => array ( 0 => 'PEAR password (for maintainers)', 1 => 'password', 2 => '', ), 1 => array ( 0 => 'Signature Handling Program', 1 => 'sig_bin', 2 => PEAR_CONFIG_DEFAULT_SIG_BIN, ), 2 => array ( 0 => 'Signature Key Directory', 1 => 'sig_keydir', 2 => PEAR_CONFIG_DEFAULT_SIG_KEYDIR, ), 3 => array ( 0 => 'Signature Key Id', 1 => 'sig_keyid', 2 => '', ), 4 => array ( 0 => 'Package Signature Type', 1 => 'sig_type', 2 => 'gpg', ), 5 => array ( 0 => 'PEAR username (for maintainers)', 1 => 'username', 2 => '', ), ), 'Config Files' => array ( 0 => array ( 0 => 'User Configuration File', 1 => 'Filename', 2 => $temp_path . '/pear.ini', ), 1 => array ( 0 => 'System Configuration File', 1 => 'Filename', 2 => $temp_path . '/pear.conf', ), ), ), ), 'cmd' => 'config-show', ), ), $log, 'opt'); $config->set('default_channel', '__uri'); $e = $command->run('config-show', array(), array()); $log = $fakelog->getLog(); $log[0]['info']['data']['Internet Access'] = array_slice($log[0]['info']['data']['Internet Access'], 0, 6); $log[0]['info']['data']['File Locations'] = array_slice($log[0]['info']['data']['File Locations'], 0, 4); $log[0]['info']['data']['File Locations (Advanced)'] = array_slice($log[0]['info']['data']['File Locations (Advanced)'], 0, 12); $log[0]['info']['data']['Advanced'] = array_slice($log[0]['info']['data']['Advanced'], 0, 4); $log[0]['info']['data']['Maintainers'] = array_slice($log[0]['info']['data']['Maintainers'], 0, 6); $phpunit->assertEquals(array ( 0 => array ( 'info' => array ( 'caption' => 'Configuration (channel __uri):', 'data' => array ( 'Internet Access' => array ( 0 => array ( 0 => 'Auto-discover new Channels', 1 => 'auto_discover', 2 => 0, ), 1 => array ( 0 => 'Default Channel', 1 => 'default_channel', 2 => '__uri', ), 2 => array ( 0 => 'HTTP Proxy Server Address', 1 => 'http_proxy', 2 => '', ), 3 => array ( 0 => 'PEAR server [DEPRECATED]', 1 => 'master_server', 2 => 'pear.Chiara', ), 4 => array ( 0 => 'Default Channel Mirror', 1 => 'preferred_mirror', 2 => '__uri', ), 5 => array ( 0 => 'Remote Configuration File', 1 => 'remote_config', 2 => '********', ), ), 'File Locations' => array ( 0 => array ( 0 => 'PEAR executables directory', 1 => 'bin_dir', 2 => $temp_path . DIRECTORY_SEPARATOR . 'bin', ), 1 => array ( 0 => 'PEAR documentation directory', 1 => 'doc_dir', 2 => $temp_path . DIRECTORY_SEPARATOR . 'doc', ), 2 => array ( 0 => 'PHP extension directory', 1 => 'ext_dir', 2 => $temp_path . DIRECTORY_SEPARATOR . 'ext', ), 3 => array ( 0 => 'PEAR directory', 1 => 'php_dir', 2 => $temp_path . DIRECTORY_SEPARATOR . 'php', ), ), 'File Locations (Advanced)' => array ( 0 => array ( 0 => 'PEAR Installer cache directory', 1 => 'cache_dir', 2 => $temp_path . DIRECTORY_SEPARATOR . 'cache', ), 1 => array ( 0 => 'PEAR configuration file directory', 1 => 'cfg_dir', 2 => $temp_path . DIRECTORY_SEPARATOR . 'cfg', ), array( 0 => 'PEAR data directory', 1 => 'data_dir', 2 => $temp_path . DIRECTORY_SEPARATOR . 'data', ), array ( 0 => 'PEAR Installer download directory', 1 => 'download_dir', 2 => PEAR_CONFIG_DEFAULT_DOWNLOAD_DIR, ), array ( 0 => 'Systems manpage files directory', 1 => 'man_dir', 2 => PEAR_CONFIG_DEFAULT_MAN_DIR, ), array ( 0 => 'PEAR metadata directory', 1 => 'metadata_dir', 2 => '', ), array ( 0 => 'PHP CLI/CGI binary', 1 => 'php_bin', 2 => PEAR_CONFIG_DEFAULT_PHP_BIN, ), array ( 0 => 'php.ini location', 1 => 'php_ini', 2 => '', ), array ( 0 => '--program-prefix passed to PHP\'s ./configure', 1 => 'php_prefix', 2 => '', ), array ( 0 => '--program-suffix passed to PHP\'s ./configure', 1 => 'php_suffix', 2 => '', ), array ( 0 => 'PEAR Installer temp directory', 1 => 'temp_dir', 2 => PEAR_CONFIG_DEFAULT_TEMP_DIR, ), array ( 0 => 'PEAR test directory', 1 => 'test_dir', 2 => $temp_path . DIRECTORY_SEPARATOR . 'test', ), ), 'Advanced' => array ( 0 => array ( 0 => 'Cache TimeToLive', 1 => 'cache_ttl', 2 => 3600, ), 1 => array ( 0 => 'Preferred Package State', 1 => 'preferred_state', 2 => 'alpha', ), 2 => array ( 0 => 'Unix file mask', 1 => 'umask', 2 => PEAR_CONFIG_DEFAULT_UMASK, ), 3 => array ( 0 => 'Debug Log Level', 1 => 'verbose', 2 => 1, ), ), 'Maintainers' => array ( 0 => array ( 0 => 'PEAR password (for maintainers)', 1 => 'password', 2 => '', ), 1 => array ( 0 => 'Signature Handling Program', 1 => 'sig_bin', 2 => PEAR_CONFIG_DEFAULT_SIG_BIN, ), 2 => array ( 0 => 'Signature Key Directory', 1 => 'sig_keydir', 2 => PEAR_CONFIG_DEFAULT_SIG_KEYDIR, ), 3 => array ( 0 => 'Signature Key Id', 1 => 'sig_keyid', 2 => '', ), 4 => array ( 0 => 'Package Signature Type', 1 => 'sig_type', 2 => 'gpg', ), 5 => array ( 0 => 'PEAR username (for maintainers)', 1 => 'username', 2 => '', ), ), 'Config Files' => array ( 0 => array ( 0 => 'User Configuration File', 1 => 'Filename', 2 => $temp_path . '/pear.ini', ), 1 => array ( 0 => 'System Configuration File', 1 => 'Filename', 2 => $temp_path . '/pear.conf', ), ), ), ), 'cmd' => 'config-show', ), ), $log, 'default channel'); echo 'tests done'; ?> --CLEAN-- --EXPECT-- tests done php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Config/config-show/test_fail.phpt000066400000000000000000000014201262614675700305440ustar00rootroot00000000000000--TEST-- config-show command failure --SKIPIF-- --FILE-- run('config-show', array(), array('gronk')); $phpunit->assertErrors(array( array('package' => 'PEAR_Error', 'message' => 'config-show: only the layers: "user" or "system" are supported'), ), 'unknown layer'); $e = $command->run('config-show', array('channel' => 'gronk'), array()); $phpunit->assertErrors(array( array('package' => 'PEAR_Error', 'message' => 'Channel "gronk" does not exist'), ), 'unknown channel as option'); echo 'tests done'; ?> --CLEAN-- --EXPECT-- tests done php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Config/setup.php.inc000066400000000000000000000073271262614675700261070ustar00rootroot00000000000000 $server, 'preferred_state' => 'stable', 'cache_dir' => $temp_path . DIRECTORY_SEPARATOR . 'cache', 'php_dir' => $temp_path . DIRECTORY_SEPARATOR . 'php', 'cfg_dir' => $temp_path . DIRECTORY_SEPARATOR . 'cfg', 'www_dir' => $temp_path . DIRECTORY_SEPARATOR . 'www', 'ext_dir' => $temp_path . DIRECTORY_SEPARATOR . 'ext', 'data_dir' => $temp_path . DIRECTORY_SEPARATOR . 'data', 'doc_dir' => $temp_path . DIRECTORY_SEPARATOR . 'doc', 'test_dir' => $temp_path . DIRECTORY_SEPARATOR . 'test', 'bin_dir' => $temp_path . DIRECTORY_SEPARATOR . 'bin',)); touch($temp_path . DIRECTORY_SEPARATOR . 'pear.conf'); $fp = fopen($temp_path . DIRECTORY_SEPARATOR . 'pear.conf', 'w'); fwrite($fp, $config); fclose($fp); touch($temp_path . DIRECTORY_SEPARATOR . 'pear.ini'); $fp = fopen($temp_path . DIRECTORY_SEPARATOR . 'pear.ini', 'w'); fwrite($fp, $config); fclose($fp); touch($temp_path . DIRECTORY_SEPARATOR . 'pear.conf'); $fp = fopen($temp_path . DIRECTORY_SEPARATOR . 'pear.conf', 'w'); fwrite($fp, $config); fclose($fp); putenv('PHP_PEAR_SYSCONF_DIR='.$temp_path); $home = getenv('HOME'); if (!empty($home)) { // for PEAR_Config initialization putenv('HOME="'.$temp_path); } require_once "PEAR/Downloader.php"; require_once dirname(dirname(__FILE__)) . '/download_test_classes.php.inc'; require_once dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'phpt_test.php.inc'; $phpunit = new PEAR_PHPTest(true); $fakelog = new fake_log; $config = &PEAR_Config::singleton($temp_path . '/pear.ini', $temp_path . '/pear.conf'); test_PEAR_Dependency2::singleton($config); require_once 'PEAR/Downloader/Package.php'; /** * @param array * @return PEAR_Downloader_Package */ function newDownloaderPackage($options) { global $config, $fakelog; $downloader = new test_PEAR_Downloader($fakelog, $options, $config); $p = new PEAR_Downloader_Package($downloader); return $p; } require_once 'PEAR/Command/Config.php'; $command = new PEAR_Command_Config($fakelog, $config); ?> php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Config/teardown.php.inc000066400000000000000000000014761262614675700265710ustar00rootroot00000000000000 php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Install/000077500000000000000000000000001262614675700236565ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Install/bundle/000077500000000000000000000000001262614675700251275ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Install/bundle/packages/000077500000000000000000000000001262614675700267055ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Install/bundle/packages/Archive_Tar/000077500000000000000000000000001262614675700310745ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Install/bundle/packages/Archive_Tar/Archive/000077500000000000000000000000001262614675700324555ustar00rootroot00000000000000Tar.php000066400000000000000000001625201262614675700336430ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Install/bundle/packages/Archive_Tar/Archive | // +----------------------------------------------------------------------+ // // $Id: Tar.php,v 1.19 2004/05/08 09:56:26 vblavet Exp $ require_once 'PEAR.php'; define ('ARCHIVE_TAR_ATT_SEPARATOR', 90001); /** * Creates a (compressed) Tar archive * * @author Vincent Blavet * @version $Revision: 1.19 $ * @package Archive */ class Archive_Tar extends PEAR { /** * @var string Name of the Tar */ var $_tarname=''; /** * @var boolean if true, the Tar file will be gzipped */ var $_compress=false; /** * @var string Type of compression : 'none', 'gz' or 'bz2' */ var $_compress_type='none'; /** * @var string Explode separator */ var $_separator=' '; /** * @var file descriptor */ var $_file=0; /** * @var string Local Tar name of a remote Tar (http:// or ftp://) */ var $_temp_tarname=''; // {{{ constructor /** * Archive_Tar Class constructor. This flavour of the constructor only * declare a new Archive_Tar object, identifying it by the name of the * tar file. * If the compress argument is set the tar will be read or created as a * gzip or bz2 compressed TAR file. * * @param string $p_tarname The name of the tar archive to create * @param string $p_compress can be null, 'gz' or 'bz2'. This * parameter indicates if gzip or bz2 compression * is required. For compatibility reason the * boolean value 'true' means 'gz'. * @access public */ function Archive_Tar($p_tarname, $p_compress = null) { $this->PEAR(); $this->_compress = false; $this->_compress_type = 'none'; if ($p_compress === null) { if (@file_exists($p_tarname)) { if ($fp = @fopen($p_tarname, "rb")) { // look for gzip magic cookie $data = fread($fp, 2); fclose($fp); if ($data == "\37\213") { $this->_compress = true; $this->_compress_type = 'gz'; // No sure it's enought for a magic code .... } elseif ($data == "BZ") { $this->_compress = true; $this->_compress_type = 'bz2'; } } } else { // probably a remote file or some file accessible // through a stream interface if (substr($p_tarname, -2) == 'gz') { $this->_compress = true; $this->_compress_type = 'gz'; } elseif ((substr($p_tarname, -3) == 'bz2') || (substr($p_tarname, -2) == 'bz')) { $this->_compress = true; $this->_compress_type = 'bz2'; } } } else { if (($p_compress === true) || ($p_compress == 'gz')) { $this->_compress = true; $this->_compress_type = 'gz'; } else if ($p_compress == 'bz2') { $this->_compress = true; $this->_compress_type = 'bz2'; } } $this->_tarname = $p_tarname; if ($this->_compress) { // assert zlib or bz2 extension support if ($this->_compress_type == 'gz') $extname = 'zlib'; else if ($this->_compress_type == 'bz2') $extname = 'bz2'; if (!extension_loaded($extname)) { PEAR::loadExtension($extname); } if (!extension_loaded($extname)) { die("The extension '$extname' couldn't be found.\n". "Please make sure your version of PHP was built ". "with '$extname' support.\n"); return false; } } } // }}} // {{{ destructor function _Archive_Tar() { $this->_close(); // ----- Look for a local copy to delete if ($this->_temp_tarname != '') @unlink($this->_temp_tarname); $this->_PEAR(); } // }}} // {{{ create() /** * This method creates the archive file and add the files / directories * that are listed in $p_filelist. * If a file with the same name exist and is writable, it is replaced * by the new tar. * The method return false and a PEAR error text. * The $p_filelist parameter can be an array of string, each string * representing a filename or a directory name with their path if * needed. It can also be a single string with names separated by a * single blank. * For each directory added in the archive, the files and * sub-directories are also added. * See also createModify() method for more details. * * @param array $p_filelist An array of filenames and directory names, or a single * string with names separated by a single blank space. * @return true on success, false on error. * @see createModify() * @access public */ function create($p_filelist) { return $this->createModify($p_filelist, '', ''); } // }}} // {{{ add() /** * This method add the files / directories that are listed in $p_filelist in * the archive. If the archive does not exist it is created. * The method return false and a PEAR error text. * The files and directories listed are only added at the end of the archive, * even if a file with the same name is already archived. * See also createModify() method for more details. * * @param array $p_filelist An array of filenames and directory names, or a single * string with names separated by a single blank space. * @return true on success, false on error. * @see createModify() * @access public */ function add($p_filelist) { return $this->addModify($p_filelist, '', ''); } // }}} // {{{ extract() function extract($p_path='') { return $this->extractModify($p_path, ''); } // }}} // {{{ listContent() function listContent() { $v_list_detail = array(); if ($this->_openRead()) { if (!$this->_extractList('', $v_list_detail, "list", '', '')) { unset($v_list_detail); $v_list_detail = 0; } $this->_close(); } return $v_list_detail; } // }}} // {{{ createModify() /** * This method creates the archive file and add the files / directories * that are listed in $p_filelist. * If the file already exists and is writable, it is replaced by the * new tar. It is a create and not an add. If the file exists and is * read-only or is a directory it is not replaced. The method return * false and a PEAR error text. * The $p_filelist parameter can be an array of string, each string * representing a filename or a directory name with their path if * needed. It can also be a single string with names separated by a * single blank. * The path indicated in $p_remove_dir will be removed from the * memorized path of each file / directory listed when this path * exists. By default nothing is removed (empty path '') * The path indicated in $p_add_dir will be added at the beginning of * the memorized path of each file / directory listed. However it can * be set to empty ''. The adding of a path is done after the removing * of path. * The path add/remove ability enables the user to prepare an archive * for extraction in a different path than the origin files are. * See also addModify() method for file adding properties. * * @param array $p_filelist An array of filenames and directory names, or a single * string with names separated by a single blank space. * @param string $p_add_dir A string which contains a path to be added to the * memorized path of each element in the list. * @param string $p_remove_dir A string which contains a path to be removed from * the memorized path of each element in the list, when * relevant. * @return boolean true on success, false on error. * @access public * @see addModify() */ function createModify($p_filelist, $p_add_dir, $p_remove_dir='') { $v_result = true; if (!$this->_openWrite()) return false; if ($p_filelist != '') { if (is_array($p_filelist)) $v_list = $p_filelist; elseif (is_string($p_filelist)) $v_list = explode($this->_separator, $p_filelist); else { $this->_cleanFile(); $this->_error('Invalid file list'); return false; } $v_result = $this->_addList($v_list, $p_add_dir, $p_remove_dir); } if ($v_result) { $this->_writeFooter(); $this->_close(); } else $this->_cleanFile(); return $v_result; } // }}} // {{{ addModify() /** * This method add the files / directories listed in $p_filelist at the * end of the existing archive. If the archive does not yet exists it * is created. * The $p_filelist parameter can be an array of string, each string * representing a filename or a directory name with their path if * needed. It can also be a single string with names separated by a * single blank. * The path indicated in $p_remove_dir will be removed from the * memorized path of each file / directory listed when this path * exists. By default nothing is removed (empty path '') * The path indicated in $p_add_dir will be added at the beginning of * the memorized path of each file / directory listed. However it can * be set to empty ''. The adding of a path is done after the removing * of path. * The path add/remove ability enables the user to prepare an archive * for extraction in a different path than the origin files are. * If a file/dir is already in the archive it will only be added at the * end of the archive. There is no update of the existing archived * file/dir. However while extracting the archive, the last file will * replace the first one. This results in a none optimization of the * archive size. * If a file/dir does not exist the file/dir is ignored. However an * error text is send to PEAR error. * If a file/dir is not readable the file/dir is ignored. However an * error text is send to PEAR error. * * @param array $p_filelist An array of filenames and directory names, or a single * string with names separated by a single blank space. * @param string $p_add_dir A string which contains a path to be added to the * memorized path of each element in the list. * @param string $p_remove_dir A string which contains a path to be removed from * the memorized path of each element in the list, when * relevant. * @return true on success, false on error. * @access public */ function addModify($p_filelist, $p_add_dir, $p_remove_dir='') { $v_result = true; if (!@is_file($this->_tarname)) $v_result = $this->createModify($p_filelist, $p_add_dir, $p_remove_dir); else { if (is_array($p_filelist)) $v_list = $p_filelist; elseif (is_string($p_filelist)) $v_list = explode($this->_separator, $p_filelist); else { $this->_error('Invalid file list'); return false; } $v_result = $this->_append($v_list, $p_add_dir, $p_remove_dir); } return $v_result; } // }}} // {{{ addString() /** * This method add a single string as a file at the * end of the existing archive. If the archive does not yet exists it * is created. * * @param string $p_filename A string which contains the full filename path * that will be associated with the string. * @param string $p_string The content of the file added in the archive. * @return true on success, false on error. * @access public */ function addString($p_filename, $p_string) { $v_result = true; if (!@is_file($this->_tarname)) { if (!$this->_openWrite()) { return false; } $this->_close(); } if (!$this->_openAppend()) return false; // Need to check the get back to the temporary file ? .... $v_result = $this->_addString($p_filename, $p_string); $this->_writeFooter(); $this->_close(); return $v_result; } // }}} // {{{ extractModify() /** * This method extract all the content of the archive in the directory * indicated by $p_path. When relevant the memorized path of the * files/dir can be modified by removing the $p_remove_path path at the * beginning of the file/dir path. * While extracting a file, if the directory path does not exists it is * created. * While extracting a file, if the file already exists it is replaced * without looking for last modification date. * While extracting a file, if the file already exists and is write * protected, the extraction is aborted. * While extracting a file, if a directory with the same name already * exists, the extraction is aborted. * While extracting a directory, if a file with the same name already * exists, the extraction is aborted. * While extracting a file/directory if the destination directory exist * and is write protected, or does not exist but can not be created, * the extraction is aborted. * If after extraction an extracted file does not show the correct * stored file size, the extraction is aborted. * When the extraction is aborted, a PEAR error text is set and false * is returned. However the result can be a partial extraction that may * need to be manually cleaned. * * @param string $p_path The path of the directory where the files/dir need to by * extracted. * @param string $p_remove_path Part of the memorized path that can be removed if * present at the beginning of the file/dir path. * @return boolean true on success, false on error. * @access public * @see extractList() */ function extractModify($p_path, $p_remove_path) { $v_result = true; $v_list_detail = array(); if ($v_result = $this->_openRead()) { $v_result = $this->_extractList($p_path, $v_list_detail, "complete", 0, $p_remove_path); $this->_close(); } return $v_result; } // }}} // {{{ extractInString() /** * This method extract from the archive one file identified by $p_filename. * The return value is a string with the file content, or NULL on error. * @param string $p_filename The path of the file to extract in a string. * @return a string with the file content or NULL. * @access public */ function extractInString($p_filename) { if ($this->_openRead()) { $v_result = $this->_extractInString($p_filename); $this->_close(); } else { $v_result = NULL; } return $v_result; } // }}} // {{{ extractList() /** * This method extract from the archive only the files indicated in the * $p_filelist. These files are extracted in the current directory or * in the directory indicated by the optional $p_path parameter. * If indicated the $p_remove_path can be used in the same way as it is * used in extractModify() method. * @param array $p_filelist An array of filenames and directory names, or a single * string with names separated by a single blank space. * @param string $p_path The path of the directory where the files/dir need to by * extracted. * @param string $p_remove_path Part of the memorized path that can be removed if * present at the beginning of the file/dir path. * @return true on success, false on error. * @access public * @see extractModify() */ function extractList($p_filelist, $p_path='', $p_remove_path='') { $v_result = true; $v_list_detail = array(); if (is_array($p_filelist)) $v_list = $p_filelist; elseif (is_string($p_filelist)) $v_list = explode($this->_separator, $p_filelist); else { $this->_error('Invalid string list'); return false; } if ($v_result = $this->_openRead()) { $v_result = $this->_extractList($p_path, $v_list_detail, "partial", $v_list, $p_remove_path); $this->_close(); } return $v_result; } // }}} // {{{ setAttribute() /** * This method set specific attributes of the archive. It uses a variable * list of parameters, in the format attribute code + attribute values : * $arch->setAttribute(ARCHIVE_TAR_ATT_SEPARATOR, ','); * @param mixed $argv variable list of attributes and values * @return true on success, false on error. * @access public */ function setAttribute() { $v_result = true; // ----- Get the number of variable list of arguments if (($v_size = func_num_args()) == 0) { return true; } // ----- Get the arguments $v_att_list = &func_get_args(); // ----- Read the attributes $i=0; while ($i<$v_size) { // ----- Look for next option switch ($v_att_list[$i]) { // ----- Look for options that request a string value case ARCHIVE_TAR_ATT_SEPARATOR : // ----- Check the number of parameters if (($i+1) >= $v_size) { $this->_error('Invalid number of parameters for attribute ARCHIVE_TAR_ATT_SEPARATOR'); return false; } // ----- Get the value $this->_separator = $v_att_list[$i+1]; $i++; break; default : $this->_error('Unknow attribute code '.$v_att_list[$i].''); return false; } // ----- Next attribute $i++; } return $v_result; } // }}} // {{{ _error() function _error($p_message) { // ----- To be completed $this->raiseError($p_message); } // }}} // {{{ _warning() function _warning($p_message) { // ----- To be completed $this->raiseError($p_message); } // }}} // {{{ _openWrite() function _openWrite() { if ($this->_compress_type == 'gz') $this->_file = @gzopen($this->_tarname, "wb"); else if ($this->_compress_type == 'bz2') $this->_file = @bzopen($this->_tarname, "wb"); else if ($this->_compress_type == 'none') $this->_file = @fopen($this->_tarname, "wb"); else $this->_error('Unknown or missing compression type ('.$this->_compress_type.')'); if ($this->_file == 0) { $this->_error('Unable to open in write mode \''.$this->_tarname.'\''); return false; } return true; } // }}} // {{{ _openRead() function _openRead() { if (strtolower(substr($this->_tarname, 0, 7)) == 'http://') { // ----- Look if a local copy need to be done if ($this->_temp_tarname == '') { $this->_temp_tarname = uniqid('tar').'.tmp'; if (!$v_file_from = @fopen($this->_tarname, 'rb')) { $this->_error('Unable to open in read mode \''.$this->_tarname.'\''); $this->_temp_tarname = ''; return false; } if (!$v_file_to = @fopen($this->_temp_tarname, 'wb')) { $this->_error('Unable to open in write mode \''.$this->_temp_tarname.'\''); $this->_temp_tarname = ''; return false; } while ($v_data = @fread($v_file_from, 1024)) @fwrite($v_file_to, $v_data); @fclose($v_file_from); @fclose($v_file_to); } // ----- File to open if the local copy $v_filename = $this->_temp_tarname; } else // ----- File to open if the normal Tar file $v_filename = $this->_tarname; if ($this->_compress_type == 'gz') $this->_file = @gzopen($v_filename, "rb"); else if ($this->_compress_type == 'bz2') $this->_file = @bzopen($v_filename, "rb"); else if ($this->_compress_type == 'none') $this->_file = @fopen($v_filename, "rb"); else $this->_error('Unknown or missing compression type ('.$this->_compress_type.')'); if ($this->_file == 0) { $this->_error('Unable to open in read mode \''.$v_filename.'\''); return false; } return true; } // }}} // {{{ _openReadWrite() function _openReadWrite() { if ($this->_compress_type == 'gz') $this->_file = @gzopen($this->_tarname, "r+b"); else if ($this->_compress_type == 'bz2') $this->_file = @bzopen($this->_tarname, "r+b"); else if ($this->_compress_type == 'none') $this->_file = @fopen($this->_tarname, "r+b"); else $this->_error('Unknown or missing compression type ('.$this->_compress_type.')'); if ($this->_file == 0) { $this->_error('Unable to open in read/write mode \''.$this->_tarname.'\''); return false; } return true; } // }}} // {{{ _close() function _close() { //if (isset($this->_file)) { if (is_resource($this->_file)) { if ($this->_compress_type == 'gz') @gzclose($this->_file); else if ($this->_compress_type == 'bz2') @bzclose($this->_file); else if ($this->_compress_type == 'none') @fclose($this->_file); else $this->_error('Unknown or missing compression type ('.$this->_compress_type.')'); $this->_file = 0; } // ----- Look if a local copy need to be erase // Note that it might be interesting to keep the url for a time : ToDo if ($this->_temp_tarname != '') { @unlink($this->_temp_tarname); $this->_temp_tarname = ''; } return true; } // }}} // {{{ _cleanFile() function _cleanFile() { $this->_close(); // ----- Look for a local copy if ($this->_temp_tarname != '') { // ----- Remove the local copy but not the remote tarname @unlink($this->_temp_tarname); $this->_temp_tarname = ''; } else { // ----- Remove the local tarname file @unlink($this->_tarname); } $this->_tarname = ''; return true; } // }}} // {{{ _writeBlock() function _writeBlock($p_binary_data, $p_len=null) { if (is_resource($this->_file)) { if ($p_len === null) { if ($this->_compress_type == 'gz') @gzputs($this->_file, $p_binary_data); else if ($this->_compress_type == 'bz2') @bzwrite($this->_file, $p_binary_data); else if ($this->_compress_type == 'none') @fputs($this->_file, $p_binary_data); else $this->_error('Unknown or missing compression type ('.$this->_compress_type.')'); } else { if ($this->_compress_type == 'gz') @gzputs($this->_file, $p_binary_data, $p_len); else if ($this->_compress_type == 'bz2') @bzwrite($this->_file, $p_binary_data, $p_len); else if ($this->_compress_type == 'none') @fputs($this->_file, $p_binary_data, $p_len); else $this->_error('Unknown or missing compression type ('.$this->_compress_type.')'); } } return true; } // }}} // {{{ _readBlock() function _readBlock($p_len=null) { $v_block = null; if (is_resource($this->_file)) { if ($p_len === null) $p_len = 512; if ($this->_compress_type == 'gz') $v_block = @gzread($this->_file, 512); else if ($this->_compress_type == 'bz2') $v_block = @bzread($this->_file, 512); else if ($this->_compress_type == 'none') $v_block = @fread($this->_file, 512); else $this->_error('Unknown or missing compression type ('.$this->_compress_type.')'); } return $v_block; } // }}} // {{{ _jumpBlock() function _jumpBlock($p_len=null) { if (is_resource($this->_file)) { if ($p_len === null) $p_len = 1; if ($this->_compress_type == 'gz') @gzseek($this->_file, @gztell($this->_file)+($p_len*512)); else if ($this->_compress_type == 'bz2') { // ----- Replace missing bztell() and bzseek() for ($i=0; $i<$p_len; $i++) $this->_readBlock(); } else if ($this->_compress_type == 'none') @fseek($this->_file, @ftell($this->_file)+($p_len*512)); else $this->_error('Unknown or missing compression type ('.$this->_compress_type.')'); } return true; } // }}} // {{{ _writeFooter() function _writeFooter() { if (is_resource($this->_file)) { // ----- Write the last 0 filled block for end of archive $v_binary_data = pack("a512", ''); $this->_writeBlock($v_binary_data); } return true; } // }}} // {{{ _addList() function _addList($p_list, $p_add_dir, $p_remove_dir) { $v_result=true; $v_header = array(); // ----- Remove potential windows directory separator $p_add_dir = $this->_translateWinPath($p_add_dir); $p_remove_dir = $this->_translateWinPath($p_remove_dir, false); if (!$this->_file) { $this->_error('Invalid file descriptor'); return false; } if (sizeof($p_list) == 0) return true; for ($j=0; ($j_tarname) continue; if ($v_filename == '') continue; if (!file_exists($v_filename)) { $this->_warning("File '$v_filename' does not exist"); continue; } // ----- Add the file or directory header if (!$this->_addFile($v_filename, $v_header, $p_add_dir, $p_remove_dir)) return false; if (@is_dir($v_filename)) { if (!($p_hdir = opendir($v_filename))) { $this->_warning("Directory '$v_filename' can not be read"); continue; } $p_hitem = readdir($p_hdir); // '.' directory $p_hitem = readdir($p_hdir); // '..' directory while (false !== ($p_hitem = readdir($p_hdir))) { if ($v_filename != ".") $p_temp_list[0] = $v_filename.'/'.$p_hitem; else $p_temp_list[0] = $p_hitem; $v_result = $this->_addList($p_temp_list, $p_add_dir, $p_remove_dir); } unset($p_temp_list); unset($p_hdir); unset($p_hitem); } } return $v_result; } // }}} // {{{ _addFile() function _addFile($p_filename, &$p_header, $p_add_dir, $p_remove_dir) { if (!$this->_file) { $this->_error('Invalid file descriptor'); return false; } if ($p_filename == '') { $this->_error('Invalid file name'); return false; } // ----- Calculate the stored filename $p_filename = $this->_translateWinPath($p_filename, false);; $v_stored_filename = $p_filename; if (strcmp($p_filename, $p_remove_dir) == 0) { return true; } if ($p_remove_dir != '') { if (substr($p_remove_dir, -1) != '/') $p_remove_dir .= '/'; if (substr($p_filename, 0, strlen($p_remove_dir)) == $p_remove_dir) $v_stored_filename = substr($p_filename, strlen($p_remove_dir)); } $v_stored_filename = $this->_translateWinPath($v_stored_filename); if ($p_add_dir != '') { if (substr($p_add_dir, -1) == '/') $v_stored_filename = $p_add_dir.$v_stored_filename; else $v_stored_filename = $p_add_dir.'/'.$v_stored_filename; } $v_stored_filename = $this->_pathReduction($v_stored_filename); if (is_file($p_filename)) { if (($v_file = @fopen($p_filename, "rb")) == 0) { $this->_warning("Unable to open file '$p_filename' in binary read mode"); return true; } if (!$this->_writeHeader($p_filename, $v_stored_filename)) return false; while (($v_buffer = fread($v_file, 512)) != '') { $v_binary_data = pack("a512", "$v_buffer"); $this->_writeBlock($v_binary_data); } fclose($v_file); } else { // ----- Only header for dir if (!$this->_writeHeader($p_filename, $v_stored_filename)) return false; } return true; } // }}} // {{{ _addString() function _addString($p_filename, $p_string) { if (!$this->_file) { $this->_error('Invalid file descriptor'); return false; } if ($p_filename == '') { $this->_error('Invalid file name'); return false; } // ----- Calculate the stored filename $p_filename = $this->_translateWinPath($p_filename, false);; if (!$this->_writeHeaderBlock($p_filename, strlen($p_string), 0, 0, "", 0, 0)) return false; $i=0; while (($v_buffer = substr($p_string, (($i++)*512), 512)) != '') { $v_binary_data = pack("a512", $v_buffer); $this->_writeBlock($v_binary_data); } return true; } // }}} // {{{ _writeHeader() function _writeHeader($p_filename, $p_stored_filename) { if ($p_stored_filename == '') $p_stored_filename = $p_filename; $v_reduce_filename = $this->_pathReduction($p_stored_filename); if (strlen($v_reduce_filename) > 99) { if (!$this->_writeLongHeader($v_reduce_filename)) return false; } $v_info = stat($p_filename); $v_uid = sprintf("%6s ", DecOct($v_info[4])); $v_gid = sprintf("%6s ", DecOct($v_info[5])); $v_perms = sprintf("%6s ", DecOct(fileperms($p_filename))); $v_mtime = sprintf("%11s", DecOct(filemtime($p_filename))); if (@is_dir($p_filename)) { $v_typeflag = "5"; $v_size = sprintf("%11s ", DecOct(0)); } else { $v_typeflag = ''; clearstatcache(); $v_size = sprintf("%11s ", DecOct(filesize($p_filename))); } $v_linkname = ''; $v_magic = ''; $v_version = ''; $v_uname = ''; $v_gname = ''; $v_devmajor = ''; $v_devminor = ''; $v_prefix = ''; $v_binary_data_first = pack("a100a8a8a8a12A12", $v_reduce_filename, $v_perms, $v_uid, $v_gid, $v_size, $v_mtime); $v_binary_data_last = pack("a1a100a6a2a32a32a8a8a155a12", $v_typeflag, $v_linkname, $v_magic, $v_version, $v_uname, $v_gname, $v_devmajor, $v_devminor, $v_prefix, ''); // ----- Calculate the checksum $v_checksum = 0; // ..... First part of the header for ($i=0; $i<148; $i++) $v_checksum += ord(substr($v_binary_data_first,$i,1)); // ..... Ignore the checksum value and replace it by ' ' (space) for ($i=148; $i<156; $i++) $v_checksum += ord(' '); // ..... Last part of the header for ($i=156, $j=0; $i<512; $i++, $j++) $v_checksum += ord(substr($v_binary_data_last,$j,1)); // ----- Write the first 148 bytes of the header in the archive $this->_writeBlock($v_binary_data_first, 148); // ----- Write the calculated checksum $v_checksum = sprintf("%6s ", DecOct($v_checksum)); $v_binary_data = pack("a8", $v_checksum); $this->_writeBlock($v_binary_data, 8); // ----- Write the last 356 bytes of the header in the archive $this->_writeBlock($v_binary_data_last, 356); return true; } // }}} // {{{ _writeHeaderBlock() function _writeHeaderBlock($p_filename, $p_size, $p_mtime=0, $p_perms=0, $p_type='', $p_uid=0, $p_gid=0) { $p_filename = $this->_pathReduction($p_filename); if (strlen($p_filename) > 99) { if (!$this->_writeLongHeader($p_filename)) return false; } if ($p_type == "5") { $v_size = sprintf("%11s ", DecOct(0)); } else { $v_size = sprintf("%11s ", DecOct($p_size)); } $v_uid = sprintf("%6s ", DecOct($p_uid)); $v_gid = sprintf("%6s ", DecOct($p_gid)); $v_perms = sprintf("%6s ", DecOct($p_perms)); $v_mtime = sprintf("%11s", DecOct($p_mtime)); $v_linkname = ''; $v_magic = ''; $v_version = ''; $v_uname = ''; $v_gname = ''; $v_devmajor = ''; $v_devminor = ''; $v_prefix = ''; $v_binary_data_first = pack("a100a8a8a8a12A12", $p_filename, $v_perms, $v_uid, $v_gid, $v_size, $v_mtime); $v_binary_data_last = pack("a1a100a6a2a32a32a8a8a155a12", $p_type, $v_linkname, $v_magic, $v_version, $v_uname, $v_gname, $v_devmajor, $v_devminor, $v_prefix, ''); // ----- Calculate the checksum $v_checksum = 0; // ..... First part of the header for ($i=0; $i<148; $i++) $v_checksum += ord(substr($v_binary_data_first,$i,1)); // ..... Ignore the checksum value and replace it by ' ' (space) for ($i=148; $i<156; $i++) $v_checksum += ord(' '); // ..... Last part of the header for ($i=156, $j=0; $i<512; $i++, $j++) $v_checksum += ord(substr($v_binary_data_last,$j,1)); // ----- Write the first 148 bytes of the header in the archive $this->_writeBlock($v_binary_data_first, 148); // ----- Write the calculated checksum $v_checksum = sprintf("%6s ", DecOct($v_checksum)); $v_binary_data = pack("a8", $v_checksum); $this->_writeBlock($v_binary_data, 8); // ----- Write the last 356 bytes of the header in the archive $this->_writeBlock($v_binary_data_last, 356); return true; } // }}} // {{{ _writeLongHeader() function _writeLongHeader($p_filename) { $v_size = sprintf("%11s ", DecOct(strlen($p_filename))); $v_typeflag = 'L'; $v_linkname = ''; $v_magic = ''; $v_version = ''; $v_uname = ''; $v_gname = ''; $v_devmajor = ''; $v_devminor = ''; $v_prefix = ''; $v_binary_data_first = pack("a100a8a8a8a12A12", '././@LongLink', 0, 0, 0, $v_size, 0); $v_binary_data_last = pack("a1a100a6a2a32a32a8a8a155a12", $v_typeflag, $v_linkname, $v_magic, $v_version, $v_uname, $v_gname, $v_devmajor, $v_devminor, $v_prefix, ''); // ----- Calculate the checksum $v_checksum = 0; // ..... First part of the header for ($i=0; $i<148; $i++) $v_checksum += ord(substr($v_binary_data_first,$i,1)); // ..... Ignore the checksum value and replace it by ' ' (space) for ($i=148; $i<156; $i++) $v_checksum += ord(' '); // ..... Last part of the header for ($i=156, $j=0; $i<512; $i++, $j++) $v_checksum += ord(substr($v_binary_data_last,$j,1)); // ----- Write the first 148 bytes of the header in the archive $this->_writeBlock($v_binary_data_first, 148); // ----- Write the calculated checksum $v_checksum = sprintf("%6s ", DecOct($v_checksum)); $v_binary_data = pack("a8", $v_checksum); $this->_writeBlock($v_binary_data, 8); // ----- Write the last 356 bytes of the header in the archive $this->_writeBlock($v_binary_data_last, 356); // ----- Write the filename as content of the block $i=0; while (($v_buffer = substr($p_filename, (($i++)*512), 512)) != '') { $v_binary_data = pack("a512", "$v_buffer"); $this->_writeBlock($v_binary_data); } return true; } // }}} // {{{ _readHeader() function _readHeader($v_binary_data, &$v_header) { if (strlen($v_binary_data)==0) { $v_header['filename'] = ''; return true; } if (strlen($v_binary_data) != 512) { $v_header['filename'] = ''; $this->_error('Invalid block size : '.strlen($v_binary_data)); return false; } // ----- Calculate the checksum $v_checksum = 0; // ..... First part of the header for ($i=0; $i<148; $i++) $v_checksum+=ord(substr($v_binary_data,$i,1)); // ..... Ignore the checksum value and replace it by ' ' (space) for ($i=148; $i<156; $i++) $v_checksum += ord(' '); // ..... Last part of the header for ($i=156; $i<512; $i++) $v_checksum+=ord(substr($v_binary_data,$i,1)); $v_data = unpack("a100filename/a8mode/a8uid/a8gid/a12size/a12mtime/a8checksum/a1typeflag/a100link/a6magic/a2version/a32uname/a32gname/a8devmajor/a8devminor", $v_binary_data); // ----- Extract the checksum $v_header['checksum'] = OctDec(trim($v_data['checksum'])); if ($v_header['checksum'] != $v_checksum) { $v_header['filename'] = ''; // ----- Look for last block (empty block) if (($v_checksum == 256) && ($v_header['checksum'] == 0)) return true; $this->_error('Invalid checksum for file "'.$v_data['filename'].'" : '.$v_checksum.' calculated, '.$v_header['checksum'].' expected'); return false; } // ----- Extract the properties $v_header['filename'] = trim($v_data['filename']); $v_header['mode'] = OctDec(trim($v_data['mode'])); $v_header['uid'] = OctDec(trim($v_data['uid'])); $v_header['gid'] = OctDec(trim($v_data['gid'])); $v_header['size'] = OctDec(trim($v_data['size'])); $v_header['mtime'] = OctDec(trim($v_data['mtime'])); if (($v_header['typeflag'] = $v_data['typeflag']) == "5") { $v_header['size'] = 0; } /* ----- All these fields are removed form the header because they do not carry interesting info $v_header[link] = trim($v_data[link]); $v_header[magic] = trim($v_data[magic]); $v_header[version] = trim($v_data[version]); $v_header[uname] = trim($v_data[uname]); $v_header[gname] = trim($v_data[gname]); $v_header[devmajor] = trim($v_data[devmajor]); $v_header[devminor] = trim($v_data[devminor]); */ return true; } // }}} // {{{ _readLongHeader() function _readLongHeader(&$v_header) { $v_filename = ''; $n = floor($v_header['size']/512); for ($i=0; $i<$n; $i++) { $v_content = $this->_readBlock(); $v_filename .= $v_content; } if (($v_header['size'] % 512) != 0) { $v_content = $this->_readBlock(); $v_filename .= $v_content; } // ----- Read the next header $v_binary_data = $this->_readBlock(); if (!$this->_readHeader($v_binary_data, $v_header)) return false; $v_header['filename'] = $v_filename; return true; } // }}} // {{{ _extractInString() /** * This method extract from the archive one file identified by $p_filename. * The return value is a string with the file content, or NULL on error. * @param string $p_filename The path of the file to extract in a string. * @return a string with the file content or NULL. * @access private */ function _extractInString($p_filename) { $v_result_str = ""; While (strlen($v_binary_data = $this->_readBlock()) != 0) { if (!$this->_readHeader($v_binary_data, $v_header)) return NULL; if ($v_header['filename'] == '') continue; // ----- Look for long filename if ($v_header['typeflag'] == 'L') { if (!$this->_readLongHeader($v_header)) return NULL; } if ($v_header['filename'] == $p_filename) { if ($v_header['typeflag'] == "5") { $this->_error('Unable to extract in string a directory entry {'.$v_header['filename'].'}'); return NULL; } else { $n = floor($v_header['size']/512); for ($i=0; $i<$n; $i++) { $v_result_str .= $this->_readBlock(); } if (($v_header['size'] % 512) != 0) { $v_content = $this->_readBlock(); $v_result_str .= substr($v_content, 0, ($v_header['size'] % 512)); } return $v_result_str; } } else { $this->_jumpBlock(ceil(($v_header['size']/512))); } } return NULL; } // }}} // {{{ _extractList() function _extractList($p_path, &$p_list_detail, $p_mode, $p_file_list, $p_remove_path) { $v_result=true; $v_nb = 0; $v_extract_all = true; $v_listing = false; $p_path = $this->_translateWinPath($p_path, false); if ($p_path == '' || (substr($p_path, 0, 1) != '/' && substr($p_path, 0, 3) != "../" && !strpos($p_path, ':'))) { $p_path = "./".$p_path; } $p_remove_path = $this->_translateWinPath($p_remove_path); // ----- Look for path to remove format (should end by /) if (($p_remove_path != '') && (substr($p_remove_path, -1) != '/')) $p_remove_path .= '/'; $p_remove_path_size = strlen($p_remove_path); switch ($p_mode) { case "complete" : $v_extract_all = TRUE; $v_listing = FALSE; break; case "partial" : $v_extract_all = FALSE; $v_listing = FALSE; break; case "list" : $v_extract_all = FALSE; $v_listing = TRUE; break; default : $this->_error('Invalid extract mode ('.$p_mode.')'); return false; } clearstatcache(); While (strlen($v_binary_data = $this->_readBlock()) != 0) { $v_extract_file = FALSE; $v_extraction_stopped = 0; if (!$this->_readHeader($v_binary_data, $v_header)) return false; if ($v_header['filename'] == '') continue; // ----- Look for long filename if ($v_header['typeflag'] == 'L') { if (!$this->_readLongHeader($v_header)) return false; } if ((!$v_extract_all) && (is_array($p_file_list))) { // ----- By default no unzip if the file is not found $v_extract_file = false; for ($i=0; $i strlen($p_file_list[$i])) && (substr($v_header['filename'], 0, strlen($p_file_list[$i])) == $p_file_list[$i])) { $v_extract_file = TRUE; break; } } // ----- It is a file, so compare the file names elseif ($p_file_list[$i] == $v_header['filename']) { $v_extract_file = TRUE; break; } } } else { $v_extract_file = TRUE; } // ----- Look if this file need to be extracted if (($v_extract_file) && (!$v_listing)) { if (($p_remove_path != '') && (substr($v_header['filename'], 0, $p_remove_path_size) == $p_remove_path)) $v_header['filename'] = substr($v_header['filename'], $p_remove_path_size); if (($p_path != './') && ($p_path != '/')) { while (substr($p_path, -1) == '/') $p_path = substr($p_path, 0, strlen($p_path)-1); if (substr($v_header['filename'], 0, 1) == '/') $v_header['filename'] = $p_path.$v_header['filename']; else $v_header['filename'] = $p_path.'/'.$v_header['filename']; } if (file_exists($v_header['filename'])) { if ((@is_dir($v_header['filename'])) && ($v_header['typeflag'] == '')) { $this->_error('File '.$v_header['filename'].' already exists as a directory'); return false; } if ((is_file($v_header['filename'])) && ($v_header['typeflag'] == "5")) { $this->_error('Directory '.$v_header['filename'].' already exists as a file'); return false; } if (!is_writeable($v_header['filename'])) { $this->_error('File '.$v_header['filename'].' already exists and is write protected'); return false; } if (filemtime($v_header['filename']) > $v_header['mtime']) { // To be completed : An error or silent no replace ? } } // ----- Check the directory availability and create it if necessary elseif (($v_result = $this->_dirCheck(($v_header['typeflag'] == "5"?$v_header['filename']:dirname($v_header['filename'])))) != 1) { $this->_error('Unable to create path for '.$v_header['filename']); return false; } if ($v_extract_file) { if ($v_header['typeflag'] == "5") { if (!@file_exists($v_header['filename'])) { if (!@mkdir($v_header['filename'], 0777)) { $this->_error('Unable to create directory {'.$v_header['filename'].'}'); return false; } } } else { if (($v_dest_file = @fopen($v_header['filename'], "wb")) == 0) { $this->_error('Error while opening {'.$v_header['filename'].'} in write binary mode'); return false; } else { $n = floor($v_header['size']/512); for ($i=0; $i<$n; $i++) { $v_content = $this->_readBlock(); fwrite($v_dest_file, $v_content, 512); } if (($v_header['size'] % 512) != 0) { $v_content = $this->_readBlock(); fwrite($v_dest_file, $v_content, ($v_header['size'] % 512)); } @fclose($v_dest_file); // ----- Change the file mode, mtime @touch($v_header['filename'], $v_header['mtime']); // To be completed //chmod($v_header[filename], DecOct($v_header[mode])); } // ----- Check the file size clearstatcache(); if (filesize($v_header['filename']) != $v_header['size']) { $this->_error('Extracted file '.$v_header['filename'].' does not have the correct file size \''.filesize($v_filename).'\' ('.$v_header['size'].' expected). Archive may be corrupted.'); return false; } } } else { $this->_jumpBlock(ceil(($v_header['size']/512))); } } else { $this->_jumpBlock(ceil(($v_header['size']/512))); } /* TBC : Seems to be unused ... if ($this->_compress) $v_end_of_file = @gzeof($this->_file); else $v_end_of_file = @feof($this->_file); */ if ($v_listing || $v_extract_file || $v_extraction_stopped) { // ----- Log extracted files if (($v_file_dir = dirname($v_header['filename'])) == $v_header['filename']) $v_file_dir = ''; if ((substr($v_header['filename'], 0, 1) == '/') && ($v_file_dir == '')) $v_file_dir = '/'; $p_list_detail[$v_nb++] = $v_header; } } return true; } // }}} // {{{ _openAppend() function _openAppend() { if (filesize($this->_tarname) == 0) return $this->_openWrite(); if ($this->_compress) { $this->_close(); if (!@rename($this->_tarname, $this->_tarname.".tmp")) { $this->_error('Error while renaming \''.$this->_tarname.'\' to temporary file \''.$this->_tarname.'.tmp\''); return false; } if ($this->_compress_type == 'gz') $v_temp_tar = @gzopen($this->_tarname.".tmp", "rb"); elseif ($this->_compress_type == 'bz2') $v_temp_tar = @bzopen($this->_tarname.".tmp", "rb"); if ($v_temp_tar == 0) { $this->_error('Unable to open file \''.$this->_tarname.'.tmp\' in binary read mode'); @rename($this->_tarname.".tmp", $this->_tarname); return false; } if (!$this->_openWrite()) { @rename($this->_tarname.".tmp", $this->_tarname); return false; } if ($this->_compress_type == 'gz') { $v_buffer = @gzread($v_temp_tar, 512); // ----- Read the following blocks but not the last one if (!@gzeof($v_temp_tar)) { do{ $v_binary_data = pack("a512", $v_buffer); $this->_writeBlock($v_binary_data); $v_buffer = @gzread($v_temp_tar, 512); } while (!@gzeof($v_temp_tar)); } @gzclose($v_temp_tar); } elseif ($this->_compress_type == 'bz2') { $v_buffered_lines = array(); $v_buffered_lines[] = @bzread($v_temp_tar, 512); // ----- Read the following blocks but not the last one while (strlen($v_buffered_lines[] = @bzread($v_temp_tar, 512)) > 0) { $v_binary_data = pack("a512", array_shift($v_buffered_lines)); $this->_writeBlock($v_binary_data); } @bzclose($v_temp_tar); } if (!@unlink($this->_tarname.".tmp")) { $this->_error('Error while deleting temporary file \''.$this->_tarname.'.tmp\''); } } else { // ----- For not compressed tar, just add files before the last 512 bytes block if (!$this->_openReadWrite()) return false; clearstatcache(); $v_size = filesize($this->_tarname); fseek($this->_file, $v_size-512); } return true; } // }}} // {{{ _append() function _append($p_filelist, $p_add_dir='', $p_remove_dir='') { if (!$this->_openAppend()) return false; if ($this->_addList($p_filelist, $p_add_dir, $p_remove_dir)) $this->_writeFooter(); $this->_close(); return true; } // }}} // {{{ _dirCheck() /** * Check if a directory exists and create it (including parent * dirs) if not. * * @param string $p_dir directory to check * * @return bool TRUE if the directory exists or was created */ function _dirCheck($p_dir) { if ((@is_dir($p_dir)) || ($p_dir == '')) return true; $p_parent_dir = dirname($p_dir); if (($p_parent_dir != $p_dir) && ($p_parent_dir != '') && (!$this->_dirCheck($p_parent_dir))) return false; if (!@mkdir($p_dir, 0777)) { $this->_error("Unable to create directory '$p_dir'"); return false; } return true; } // }}} // {{{ _pathReduction() /** * Compress path by changing for example "/dir/foo/../bar" to "/dir/bar", and * remove double slashes. * * @param string $p_dir path to reduce * * @return string reduced path * * @access private * */ function _pathReduction($p_dir) { $v_result = ''; // ----- Look for not empty path if ($p_dir != '') { // ----- Explode path by directory names $v_list = explode('/', $p_dir); // ----- Study directories from last to first for ($i=sizeof($v_list)-1; $i>=0; $i--) { // ----- Look for current path if ($v_list[$i] == ".") { // ----- Ignore this directory // Should be the first $i=0, but no check is done } else if ($v_list[$i] == "..") { // ----- Ignore it and ignore the $i-1 $i--; } else if (($v_list[$i] == '') && ($i!=(sizeof($v_list)-1)) && ($i!=0)) { // ----- Ignore only the double '//' in path, // but not the first and last / } else { $v_result = $v_list[$i].($i!=(sizeof($v_list)-1)?'/'.$v_result:''); } } } $v_result = strtr($v_result, '\\', '/'); return $v_result; } // }}} // {{{ _translateWinPath() function _translateWinPath($p_path, $p_remove_disk_letter=true) { if (OS_WINDOWS) { // ----- Look for potential disk letter if (($p_remove_disk_letter) && (($v_position = strpos($p_path, ':')) != false)) { $p_path = substr($p_path, $v_position+1); } // ----- Change potential windows directory separator if ((strpos($p_path, '\\') > 0) || (substr($p_path, 0,1) == '\\')) { $p_path = strtr($p_path, '\\', '/'); } } return $p_path; } // }}} } ?> php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Install/bundle/packages/Archive_Tar/docs/000077500000000000000000000000001262614675700320245ustar00rootroot00000000000000Archive_Tar.txt000066400000000000000000000446101262614675700347020ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Install/bundle/packages/Archive_Tar/docsDocumentation for class Archive_Tar =================================== Last update : 2001-08-15 Overview : ---------- The Archive_Tar class helps in creating and managing GNU TAR format files compressed by GNU ZIP or not. The class offers basic functions like creating an archive, adding files in the archive, extracting files from the archive and listing the archive content. It also provide advanced functions that allow the adding and extraction of files with path manipulation. Sample : -------- // ----- Creating the object (uncompressed archive) $tar_object = new Archive_Tar("tarname.tar"); $tar_object->setErrorHandling(PEAR_ERROR_PRINT); // ----- Creating the archive $v_list[0]="file.txt"; $v_list[1]="data/"; $v_list[2]="file.log"; $tar_object->create($v_list); // ----- Adding files $v_list[0]="dev/file.txt"; $v_list[1]="dev/data/"; $v_list[2]="log/file.log"; $tar_object->add($v_list); // ----- Adding more files $tar_object->add("release/newfile.log release/readme.txt"); // ----- Listing the content if (($v_list = $tar_object->listContent()) != 0) for ($i=0; $i"; echo " .size :'".$v_list[$i][size]."'
"; echo " .mtime :'".$v_list[$i][mtime]."' (".date("l dS of F Y h:i:s A", $v_list[$i][mtime]).")
"; echo " .mode :'".$v_list[$i][mode]."'
"; echo " .uid :'".$v_list[$i][uid]."'
"; echo " .gid :'".$v_list[$i][gid]."'
"; echo " .typeflag :'".$v_list[$i][typeflag]."'
"; } // ----- Extracting the archive in directory "install" $tar_object->extract("install"); Public arguments : ------------------ None Public Methods : ---------------- Method : Archive_Tar($p_tarname, $compress = null) Description : Archive_Tar Class constructor. This flavour of the constructor only declare a new Archive_Tar object, identifying it by the name of the tar file. If the compress argument is set the tar will be read or created as a gzip or bz2 compressed TAR file. Arguments : $p_tarname : A valid filename for the tar archive file. $p_compress : can be null, 'gz' or 'bz2'. For compatibility reason it can also be true. This parameter indicates if gzip or bz2 compression is required. Return value : The Archive_Tar object. Sample : $tar_object = new Archive_Tar("tarname.tar"); $tar_object_compressed = new Archive_Tar("tarname.tgz", true); How it works : Initialize the object. Method : create($p_filelist) Description : This method creates the archive file and add the files / directories that are listed in $p_filelist. If the file already exists and is writable, it is replaced by the new tar. It is a create and not an add. If the file exists and is read-only or is a directory it is not replaced. The method return false and a PEAR error text. The $p_filelist parameter can be an array of string, each string representing a filename or a directory name with their path if needed. It can also be a single string with names separated by a single blank. See also createModify() method for more details. Arguments : $p_filelist : An array of filenames and directory names, or a single string with names separated by a single blank space. Return value : true on success, false on error. Sample 1 : $tar_object = new Archive_Tar("tarname.tar"); $tar_object->setErrorHandling(PEAR_ERROR_PRINT); // Optional error handling $v_list[0]="file.txt"; $v_list[1]="data/"; (Optional '/' at the end) $v_list[2]="file.log"; $tar_object->create($v_list); Sample 2 : $tar_object = new Archive_Tar("tarname.tar"); $tar_object->setErrorHandling(PEAR_ERROR_PRINT); // Optional error handling $tar_object->create("file.txt data/ file.log"); How it works : Just calling the createModify() method with the right parameters. Method : createModify($p_filelist, $p_add_dir, $p_remove_dir = "") Description : This method creates the archive file and add the files / directories that are listed in $p_filelist. If the file already exists and is writable, it is replaced by the new tar. It is a create and not an add. If the file exists and is read-only or is a directory it is not replaced. The method return false and a PEAR error text. The $p_filelist parameter can be an array of string, each string representing a filename or a directory name with their path if needed. It can also be a single string with names separated by a single blank. The path indicated in $p_remove_dir will be removed from the memorized path of each file / directory listed when this path exists. By default nothing is removed (empty path "") The path indicated in $p_add_dir will be added at the beginning of the memorized path of each file / directory listed. However it can be set to empty "". The adding of a path is done after the removing of path. The path add/remove ability enables the user to prepare an archive for extraction in a different path than the origin files are. See also addModify() method for file adding properties. Arguments : $p_filelist : An array of filenames and directory names, or a single string with names separated by a single blank space. $p_add_dir : A string which contains a path to be added to the memorized path of each element in the list. $p_remove_dir : A string which contains a path to be removed from the memorized path of each element in the list, when relevant. Return value : true on success, false on error. Sample 1 : $tar_object = new Archive_Tar("tarname.tar"); $tar_object->setErrorHandling(PEAR_ERROR_PRINT); // Optional error handling $v_list[0]="file.txt"; $v_list[1]="data/"; (Optional '/' at the end) $v_list[2]="file.log"; $tar_object->createModify($v_list, "install"); // files are stored in the archive as : // install/file.txt // install/data // install/data/file1.txt // install/data/... all the files and sub-dirs of data/ // install/file.log Sample 2 : $tar_object = new Archive_Tar("tarname.tar"); $tar_object->setErrorHandling(PEAR_ERROR_PRINT); // Optional error handling $v_list[0]="dev/file.txt"; $v_list[1]="dev/data/"; (Optional '/' at the end) $v_list[2]="log/file.log"; $tar_object->createModify($v_list, "install", "dev"); // files are stored in the archive as : // install/file.txt // install/data // install/data/file1.txt // install/data/... all the files and sub-dirs of data/ // install/log/file.log How it works : Open the file in write mode (erasing the existing one if one), call the _addList() method for adding the files in an empty archive, add the tar footer (512 bytes block), close the tar file. Method : addModify($p_filelist, $p_add_dir, $p_remove_dir="") Description : This method add the files / directories listed in $p_filelist at the end of the existing archive. If the archive does not yet exists it is created. The $p_filelist parameter can be an array of string, each string representing a filename or a directory name with their path if needed. It can also be a single string with names separated by a single blank. The path indicated in $p_remove_dir will be removed from the memorized path of each file / directory listed when this path exists. By default nothing is removed (empty path "") The path indicated in $p_add_dir will be added at the beginning of the memorized path of each file / directory listed. However it can be set to empty "". The adding of a path is done after the removing of path. The path add/remove ability enables the user to prepare an archive for extraction in a different path than the origin files are. If a file/dir is already in the archive it will only be added at the end of the archive. There is no update of the existing archived file/dir. However while extracting the archive, the last file will replace the first one. This results in a none optimization of the archive size. If a file/dir does not exist the file/dir is ignored. However an error text is send to PEAR error. If a file/dir is not readable the file/dir is ignored. However an error text is send to PEAR error. If the resulting filename/dirname (after the add/remove option or not) string is greater than 99 char, the file/dir is ignored. However an error text is send to PEAR error. Arguments : $p_filelist : An array of filenames and directory names, or a single string with names separated by a single blank space. $p_add_dir : A string which contains a path to be added to the memorized path of each element in the list. $p_remove_dir : A string which contains a path to be removed from the memorized path of each element in the list, when relevant. Return value : true on success, false on error. Sample 1 : $tar_object = new Archive_Tar("tarname.tar"); [...] $v_list[0]="dev/file.txt"; $v_list[1]="dev/data/"; (Optional '/' at the end) $v_list[2]="log/file.log"; $tar_object->addModify($v_list, "install"); // files are stored in the archive as : // install/file.txt // install/data // install/data/file1.txt // install/data/... all the files and sub-dirs of data/ // install/file.log Sample 2 : $tar_object = new Archive_Tar("tarname.tar"); [...] $v_list[0]="dev/file.txt"; $v_list[1]="dev/data/"; (Optional '/' at the end) $v_list[2]="log/file.log"; $tar_object->addModify($v_list, "install", "dev"); // files are stored in the archive as : // install/file.txt // install/data // install/data/file1.txt // install/data/... all the files and sub-dirs of data/ // install/log/file.log How it works : If the archive does not exists it create it and add the files. If the archive does exists and is not compressed, it open it, jump before the last empty 512 bytes block (tar footer) and add the files at this point. If the archive does exists and is compressed, a temporary copy file is created. This temporary file is then 'gzip' read block by block until the last empty block. The new files are then added in the compressed file. The adding of files is done by going through the file/dir list, adding files per files, in a recursive way through the directory. Each time a path need to be added/removed it is done before writing the file header in the archive. Method : add($p_filelist) Description : This method add the files / directories listed in $p_filelist at the end of the existing archive. If the archive does not yet exists it is created. The $p_filelist parameter can be an array of string, each string representing a filename or a directory name with their path if needed. It can also be a single string with names separated by a single blank. See addModify() method for details and limitations. Arguments : $p_filelist : An array of filenames and directory names, or a single string with names separated by a single blank space. Return value : true on success, false on error. Sample 1 : $tar_object = new Archive_Tar("tarname.tar"); [...] $v_list[0]="dev/file.txt"; $v_list[1]="dev/data/"; (Optional '/' at the end) $v_list[2]="log/file.log"; $tar_object->add($v_list); Sample 2 : $tar_object = new Archive_Tar("tarname.tgz", true); [...] $v_list[0]="dev/file.txt"; $v_list[1]="dev/data/"; (Optional '/' at the end) $v_list[2]="log/file.log"; $tar_object->add($v_list); How it works : Simply call the addModify() method with the right parameters. Method : addString($p_filename, $p_string) Description : This method add a single string as a file at the end of the existing archive. If the archive does not yet exists it is created. Arguments : $p_filename : A string which contains the full filename path that will be associated with the string. $p_string : The content of the file added in the archive. Return value : true on success, false on error. Sample 1 : $v_archive = & new Archive_Tar($p_filename); $v_archive->setErrorHandling(PEAR_ERROR_PRINT); $v_result = $v_archive->addString('data/test.txt', 'This is the text of the string'); Method : extract($p_path = "") Description : This method extract all the content of the archive in the directory indicated by $p_path.If $p_path is optional, if not set the archive is extracted in the current directory. While extracting a file, if the directory path does not exists it is created. See extractModify() for details and limitations. Arguments : $p_path : Optional path where the files/dir need to by extracted. Return value : true on success, false on error. Sample : $tar_object = new Archive_Tar("tarname.tar"); $tar_object->extract(); How it works : Simply call the extractModify() method with appropriate parameters. Method : extractModify($p_path, $p_remove_path) Description : This method extract all the content of the archive in the directory indicated by $p_path. When relevant the memorized path of the files/dir can be modified by removing the $p_remove_path path at the beginning of the file/dir path. While extracting a file, if the directory path does not exists it is created. While extracting a file, if the file already exists it is replaced without looking for last modification date. While extracting a file, if the file already exists and is write protected, the extraction is aborted. While extracting a file, if a directory with the same name already exists, the extraction is aborted. While extracting a directory, if a file with the same name already exists, the extraction is aborted. While extracting a file/directory if the destination directory exist and is write protected, or does not exist but can not be created, the extraction is aborted. If after extraction an extracted file does not show the correct stored file size, the extraction is aborted. When the extraction is aborted, a PEAR error text is set and false is returned. However the result can be a partial extraction that may need to be manually cleaned. Arguments : $p_path : The path of the directory where the files/dir need to by extracted. $p_remove_path : Part of the memorized path that can be removed if present at the beginning of the file/dir path. Return value : true on success, false on error. Sample : // Imagine tarname.tar with files : // dev/data/file.txt // dev/data/log.txt // readme.txt $tar_object = new Archive_Tar("tarname.tar"); $tar_object->extractModify("install", "dev"); // Files will be extracted there : // install/data/file.txt // install/data/log.txt // install/readme.txt How it works : Open the archive and call a more generic function that can extract only a part of the archive or all the archive. See extractList() method for more details. Method : extractInString($p_filename) Description : This method extract from the archive one file identified by $p_filename. The return value is a string with the file content, or NULL on error. Arguments : $p_filename : The path of the file to extract in a string. Return value : a string with the file content or NULL. Sample : // Imagine tarname.tar with files : // dev/data/file.txt // dev/data/log.txt // dev/readme.txt $v_archive = & new Archive_Tar('tarname.tar'); $v_archive->setErrorHandling(PEAR_ERROR_PRINT); $v_string = $v_archive->extractInString('dev/readme.txt'); echo $v_string; Method : listContent() Description : This method returns an array of arrays that describe each file/directory present in the archive. The array is not sorted, so it show the position of the file in the archive. The file informations are : $file[filename] : Name and path of the file/dir. $file[mode] : File permissions (result of fileperms()) $file[uid] : user id $file[gid] : group id $file[size] : filesize $file[mtime] : Last modification time (result of filemtime()) $file[typeflag] : "" for file, "5" for directory Arguments : Return value : An array of arrays or 0 on error. Sample : $tar_object = new Archive_Tar("tarname.tar"); if (($v_list = $tar_object->listContent()) != 0) for ($i=0; $i"; echo " .size :'".$v_list[$i][size]."'
"; echo " .mtime :'".$v_list[$i][mtime]."' (". date("l dS of F Y h:i:s A", $v_list[$i][mtime]).")
"; echo " .mode :'".$v_list[$i][mode]."'
"; echo " .uid :'".$v_list[$i][uid]."'
"; echo " .gid :'".$v_list[$i][gid]."'
"; echo " .typeflag :'".$v_list[$i][typeflag]."'
"; } How it works : Call the same function as an extract however with a flag to only go through the archive without extracting the files. Method : extractList($p_filelist, $p_path = "", $p_remove_path = "") Description : This method extract from the archive only the files indicated in the $p_filelist. These files are extracted in the current directory or in the directory indicated by the optional $p_path parameter. If indicated the $p_remove_path can be used in the same way as it is used in extractModify() method. Arguments : $p_filelist : An array of filenames and directory names, or a single string with names separated by a single blank space. $p_path : The path of the directory where the files/dir need to by extracted. $p_remove_path : Part of the memorized path that can be removed if present at the beginning of the file/dir path. Return value : true on success, false on error. Sample : // Imagine tarname.tar with files : // dev/data/file.txt // dev/data/log.txt // readme.txt $tar_object = new Archive_Tar("tarname.tar"); $tar_object->extractList("dev/data/file.txt readme.txt", "install", "dev"); // Files will be extracted there : // install/data/file.txt // install/readme.txt How it works : Go through the archive and extract only the files present in the list. php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Install/bundle/packages/Archive_Tar/package.xml000066400000000000000000000066301262614675700332160ustar00rootroot00000000000000 Archive_Tar Tar file management class This class provides handling of tar files in PHP. It supports creating, listing, extracting and adding to tar files. Gzip support is available if PHP has the zlib extension built-in or loaded. Bz2 compression is also supported with the bz2 extension loaded. vblavet Vincent Blavet vincent@phpconcept.net lead ssb Stig Sther Bakken stig@php.net helper 1.2 2004-05-08 PHP License stable Add support for other separator than the space char and bug correction 1.1 2003-05-28 stable * Add support for BZ2 compression * Add support for add and extract without using temporary files : methods addString() and extractInString() 1.0 2003-01-24 stable Change status to stable 0.10-b1 2003-01-08 beta Add support for long filenames (greater than 99 characters) 0.9 2002-05-27 stable Auto-detect gzip'ed files 0.4 2002-05-20 stable Windows bugfix: use forward slashes inside archives 0.2 2002-02-18 stable From initial commit to stable 0.3 2002-04-13 stable Windows bugfix: used wrong directory separators php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Install/bundle/test_simple.phpt000066400000000000000000000042711262614675700303600ustar00rootroot00000000000000--TEST-- bundle command, simplest possible test --SKIPIF-- --FILE-- assertFileNotExists($temp_path . '/Archive_Tar', 'before'); $res = $command->run('bundle', array(), array($pathtopackagexml)); $phpunit->assertNoErrors('after bundle'); $phpunit->assertNull($res, 'result'); $phpunit->assertFileExists($temp_path . '/ext/Archive_Tar', 'after'); $phpunit->assertFileExists($temp_path . '/ext/Archive_Tar/Archive', 'after 2'); $phpunit->assertFileExists($temp_path . '/ext/Archive_Tar/docs', 'after 3'); $phpunit->assertFileExists($temp_path . '/ext/Archive_Tar/package.xml', 'package.xml exists'); $tp = $temp_path . '/ext/Archive_Tar'; $phpunit->assertEquals( file_get_contents($ap . DIRECTORY_SEPARATOR . 'package.xml'), file_get_contents($tp . DIRECTORY_SEPARATOR . 'package.xml'), 'package.xml same' ); $phpunit->assertFileExists($tp . '/Archive/Tar.php', 'Archive/Tar.php exists'); $phpunit->assertEquals( file_get_contents($ap . DIRECTORY_SEPARATOR . 'Archive/Tar.php'), file_get_contents($tp . DIRECTORY_SEPARATOR . 'Archive/Tar.php'), 'Archive/Tar.php same' ); $phpunit->assertFileExists($tp . '/docs/Archive_Tar.txt', 'doc/Archive_Tar.txt exists'); $phpunit->assertEquals( file_get_contents($ap . DIRECTORY_SEPARATOR . 'docs/Archive_Tar.txt'), file_get_contents($tp . DIRECTORY_SEPARATOR . 'docs/Archive_Tar.txt'), 'docs/Archive_Tar.txt same' ); $phpunit->assertEquals(array( 0 => array ( 'info' => "Package ready at '" . dirname($path) . "/testinstallertemp/ext/Archive_Tar'", 'cmd' => 'no command', ), ), $fakelog->getLog(), 'log messages'); echo 'tests done'; ?> --CLEAN-- --EXPECT-- tests done php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Install/install/000077500000000000000000000000001262614675700253245ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Install/install/packages/000077500000000000000000000000001262614675700271025ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Install/install/packages/bug3671_1.xml000066400000000000000000000054761262614675700311560ustar00rootroot00000000000000 PEAR pear.php.net PEAR Base System The PEAR package contains: * the PEAR installer, for creating, distributing and installing packages * the alpha-quality PEAR_Exception PHP5 error handling mechanism * 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 of common operations with files and directories * the PEAR base class Stig Bakken ssb stig@php.net yes Tomas V.V.Cox cox cox@idecnet.com yes Pierre-Alain Joye pajoye pajoye@pearfr.org yes Greg Beaver cellog cellog@php.net yes Martin Jansen mj mj@php.net yes 2005-03-12 1.4.0a5 1.4.0 alpha alpha PHP License This is a major milestone release for PEAR. In addition to several killer features, 4.2 6.0.0 1.4.0dev13 PEAR_Frontend_Web pear.php.net 0.5.0 PEAR_Frontend_Gtk pear.php.net 0.4.0 PEAR_Frontend_Web pear.php.net 0.5.0 PEAR_Frontend_Gtk pear.php.net 0.4.0 php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Install/install/packages/dependsonpecl.xml000066400000000000000000000016271262614675700324550ustar00rootroot00000000000000 PEAR PEAR Base System hi cellog lead Greg Beaver cellog@php.net 1.4.0a1 2004-10-21 PHP License alpha and HTML_Template_Flexy installation was attempted) peclpkg php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Install/install/packages/extpkg_bin_win.xml000066400000000000000000000025141262614675700326350ustar00rootroot00000000000000 extpkg_bin_win pear.php.net extension package source package extension source Greg Beaver cellog cellog@php.net yes 2004-09-30 1.3.0 1.3.0 stable stable PHP License stuff 4.2.0 6.0.0 1.4.0dev13 windows extpkg extpkg_src php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Install/install/packages/extpkg_src.xml000066400000000000000000000024511262614675700317770ustar00rootroot00000000000000 extpkg_src pear.php.net extension package source package extension source Greg Beaver cellog cellog@php.net yes 2004-09-30 1.3.0 1.3.0 stable stable PHP License stuff 4.2.0 6.0.0 1.4.0dev13 extpkg extpkg_bin_win php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Install/install/packages/foo.php000066400000000000000000000000111262614675700303660ustar00rootroot00000000000000 php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Install/install/packages/installed.xml000066400000000000000000000044541262614675700316120ustar00rootroot00000000000000 Installed pear.php.net PEAR Base System The PEAR package contains: * the PEAR installer, for creating, distributing and installing packages * the alpha-quality PEAR_Exception PHP5 error handling mechanism * 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 of common operations with files and directories * the PEAR base class Stig Bakken ssb stig@php.net yes Greg Beaver cellog cellog@php.net yes Tomas V.V.Cox cox cox@idecnet.com yes Pierre-Alain Joye pajoye pajoye@pearfr.org yes Martin Jansen mj mj@php.net yes 2007-04-01 1.4.0a1 1.4.0a1 alpha alpha PHP License Installer Roles/Tasks: 4.0.0 1.4.3 Console_Getopt pear.php.net php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Install/install/packages/package.xml000077500000000000000000000024521262614675700312250ustar00rootroot00000000000000 peclpkg pecl.php.net extension package source package extension source Greg Beaver cellog cellog@php.net yes 2005-05-22 1.3.0 1.3.0 stable stable PHP License stuff 4.2.0 1.4.0dev13 extpkg php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Install/install/packages/package2.xml000066400000000000000000000044501262614675700313040ustar00rootroot00000000000000 PEAR1 pear.php.net PEAR Base System The PEAR package contains: * the PEAR installer, for creating, distributing and installing packages * the alpha-quality PEAR_Exception PHP5 error handling mechanism * 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 of common operations with files and directories * the PEAR base class Stig Bakken ssb stig@php.net yes Tomas V.V.Cox cox cox@idecnet.com yes Pierre-Alain Joye pajoye pajoye@pearfr.org yes Greg Beaver cellog cellog@php.net yes Martin Jansen mj mj@php.net yes 2004-09-30 1.5.0a1 1.4.0 alpha alpha PHP License stuff 4.2.0 6.0.0 1.4.0dev13 Foo pear.php.net Bar pear.php.net 1.0.0 php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Install/install/packages/peclpackage.xml000066400000000000000000000023201262614675700320600ustar00rootroot00000000000000 peclpkg pecl.php.net extension package source package extension source Greg Beaver cellog cellog@php.net yes 2004-09-30 1.3.0 1.3.0 stable stable PHP License stuff 4.2.0 1.4.0dev13 extpkg php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Install/install/packages/peclpkg-1.3.0/000077500000000000000000000000001262614675700311645ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Install/install/packages/peclpkg-1.3.0/foo.php000077500000000000000000000000111262614675700324530ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Install/install/packages/simplepackage.xml000066400000000000000000000112071262614675700324320ustar00rootroot00000000000000 PEAR PEAR Base System The PEAR package contains: * the PEAR installer, for creating, distributing and installing packages * the alpha-quality PEAR_Exception PHP5 error handling mechanism * 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 of common operations with files and directories * the PEAR base class ssb lead Stig Bakken stig@php.net cellog lead Greg Beaver cellog@php.net cox lead Tomas V.V.Cox cox@idecnet.com pajoye lead Pierre-Alain Joye pajoye@pearfr.org mj developer Martin Jansen mj@php.net 1.4.0a1 2004-10-21 PHP License alpha Installer Roles/Tasks: * package.xml 2.0 uses a command pattern, allowing extensibility * implement the replace, postinstallscript, and preinstallscript tasks Installer Dependency Support: * package.xml 2.0 has continued to improve and evolve * Downloader/Package.php is now used to coordinate downloading. Old code has not yet been deleted, as error handling is crappy right now. Uninstall ordering is broken, and needs to be redone. * Pre-download dependency resolution works, mostly. * There is no way to disable dependency resolution at the moment, this will be done. * Dependency2.php is used by the new PEAR_Downloader_Channel to resolve dependencies and include downloaded files in the calculations. * DependencyDB.php is used to resolve complex dependencies between installed packages and any dependencies installed later (a conflicts/not dependency cannot be honored without this DB) Installer Channel Support: * channel XSD is available on pearweb * add channel.listAll and channel.update to default PEAR protocols * add ability to "pear channel-update channelname" to retrieve updates manually for individual channels * fix channel.xml generation to use a valid schema declaration Installer: * with --remoteconfig option, it is possible to remotely install and uninstall packages to an FTP server. It works by mirroring a local installation, and requires a special, separate local install. * Channels implemented * Bug #1242: array-to-string conversion * 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 * Major bug in Registry - false file conflicts on data/doc/test role was possible (and would happen if HTML_Template_IT was installed and HTML_Template_Flexy installation was attempted) 1.3.3 2004-10-28 stable 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 php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Install/install/test_bug3550.phpt000066400000000000000000000174271262614675700303650ustar00rootroot00000000000000--TEST-- install command, bug #3550 --SKIPIF-- --FILE-- getRegistry(); $chan = $reg->getChannel('pear.php.net'); $chan->setBaseURL('REST1.0', 'http://pear.php.net/rest/'); $reg->updateChannel($chan); $GLOBALS['pearweb']->addHtmlConfig('http://pear.php.net/get/PEAR_Frontend_Web-0.4.tgz', $packageDir . 'PEAR_Frontend_Web-0.4.tgz'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/pear_frontend_web/allreleases.xml", '

PEAR_Frontend_Web

pear.php.net 0.4beta 0.3beta 0.2.2beta 0.2.1beta 0.2beta 0.1beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/pear_frontend_web/info.xml", '

PEAR_Frontend_Web pear.php.net PEAR PHP License Webbased PEAR Package Manager The most accessible way to manage your pear-compatible packages. This frontend\'s most valuable features are: * Webbased: no remote shell access needed. * Fully channel aware: no default channel, all channels are managed at the same time * Unique docviewer: read the installed documentation in your borwser. * Plus all features of the PEAR Installer. You can view a demo at http://tias.ulyssis.org/frontweb_demo/ (An include error on PEAR/WebInstaller.php means you upgraded from a very old version, check docs/index.php.txt)

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/pear_frontend_web/0.4.xml", '

PEAR_Frontend_Web

pear.php.net 0.4 beta PHP License tias Webbased PEAR Package Manager The most accessible way to manage your pear-compatible packages. This frontend\'s most valuable features are: * Webbased: no remote shell access needed. * Fully channel aware: no default channel, all channels are managed at the same time * Unique docviewer: read the installed documentation in your borwser. * Plus all features of the PEAR Installer. 2003-06-07 Bugfixes release: - Remove Pager dep - Should work well on non apache system (ie IIS) - The \'installed packages\' is now the entry page (no more remote connection during startup) 53152 http://pear.php.net/get/PEAR_Frontend_Web-0.4
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/pear_frontend_web/deps.0.4.txt", 'a:2:{i:1;a:3:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:4:"name";s:20:"Net_UserAgent_Detect";}i:2;a:3:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:4:"name";s:16:"HTML_Template_IT";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/pear_frontend_gtk/allreleases.xml", '

PEAR_Frontend_Gtk

pear.php.net 0.3beta 0.2snapshot 0.1snapshot
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/pear_frontend_gtk/info.xml", '

PEAR_Frontend_Gtk pear.php.net PEAR PHP License Gtk (Desktop) PEAR Package Manager Desktop Interface to the PEAR Package Manager, Requires PHP-GTK

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/pear_frontend_gtk/0.3.xml", '

PEAR_Frontend_Gtk

pear.php.net 0.3 beta PHP License alan_k Gtk (Desktop) PEAR Package Manager Desktop Interface to the PEAR Package Manager, Requires PHP-GTK 2002-07-25 09:11:00 Attempt to fix package file so it installs, some of the warnings have been fixed 70008 http://pear.php.net/get/PEAR_Frontend_Gtk-0.3
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/pear_frontend_gtk/deps.0.3.txt", 'b:0;', 'text/xml'); $nu = $packageDir . 'Net_UserAgent_Detect-2.0.1.tgz'; $hi = $packageDir . 'HTML_Template_IT-1.1.tgz'; $at = $packageDir . 'Archive_Tar-1.2.tgz'; $cg = $packageDir . 'Console_Getopt-1.2.tgz'; $xr = $packageDir . 'XML_RPC-1.2.0RC6.tgz'; $pe = $packageDir . 'PEAR-1.4.0a1.tgz'; $_test_dep->setPEARVersion('1.4.0a1'); $_test_dep->setPHPVersion('4.3.10'); $_test_dep->setExtensions(array('xml' => '1.0', 'pcre' => '1.0')); $res = $command->run('install', array(), array($nu, $hi, $at, $cg, $xr, $pe)); $phpunit->assertTrue($res, 'result'); $fakelog->getLog(); $fakelog->getDownload(); $res = $command->run('install', array(), array('PEAR_Frontend_Web-beta')); $phpunit->assertEquals( array ( 0 => array ( 0 => 2, 1 => 'pear/PEAR_Frontend_Web: Skipping required dependency "pear/Net_UserAgent_Detect", is already installed', ), 1 => array ( 0 => 2, 1 => 'pear/PEAR_Frontend_Web: Skipping required dependency "pear/HTML_Template_IT", is already installed', ), 2 => array ( 0 => 0, 1 => 'pear/pear requires package "pear/PEAR_Frontend_Web" (version >= 0.5.0), downloaded version is 0.4', ), 3 => array ( 0 => 0, 1 => 'pear/pear requires package "pear/PEAR_Frontend_Web" (version >= 0.5.0), downloaded version is 0.4', ), 4 => array ( 0 => 0, 1 => 'pear/PEAR_Frontend_Web cannot be installed, conflicts with installed packages', ), 5 => array ( 'info' => array ( 'data' => array ( 0 => array ( 0 => 'No valid packages found', ), ), 'headline' => 'Install Errors', ), 'cmd' => 'no command', ), ) , $fakelog->getLog(), 'log'); echo 'tests done'; ?> --CLEAN-- --EXPECT-- tests done php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Install/install/test_bug3671.phpt000066400000000000000000000640671262614675700303730ustar00rootroot00000000000000--TEST-- install command, bug #3671 --SKIPIF-- --FILE-- getRegistry(); $chan = $reg->getChannel('pear.php.net'); $chan->setBaseURL('REST1.0', 'http://pear.php.net/rest/'); $reg->updateChannel($chan); $pearweb->addRESTConfig("http://pear.php.net/rest/r/pear/allreleases.xml", '

PEAR

pear.php.net 1.4.0a5alpha 1.4.0a4alpha 1.4.0a3alpha 1.4.0a2alpha 1.4.0a1alpha 1.3.5stable 1.3.4stable 1.3.3.1stable 1.3.3stable 1.3.1stable 1.3stable 1.3b6beta 1.3b5beta 1.3b3beta 1.3b2beta 1.3b1beta 1.2.1stable 1.2stable 1.2b5beta 1.2b4beta 1.2b3beta 1.2b2beta 1.2b1beta 1.1stable 1.0.1stable 1.0stable 1.0b3stable 1.0b2stable 1.0b1stable 0.90beta 0.11beta 0.10beta 0.9stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/pear_frontend_web/allreleases.xml", '

PEAR_Frontend_Web

pear.php.net 0.4beta 0.3beta 0.2.2beta 0.2.1beta 0.2beta 0.1beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/pear_frontend_web/info.xml", '

PEAR_Frontend_Web pear.php.net PEAR PHP License Webbased PEAR Package Manager The most accessible way to manage your pear-compatible packages. This frontend\'s most valuable features are: * Webbased: no remote shell access needed. * Fully channel aware: no default channel, all channels are managed at the same time * Unique docviewer: read the installed documentation in your borwser. * Plus all features of the PEAR Installer. You can view a demo at http://tias.ulyssis.org/frontweb_demo/ (An include error on PEAR/WebInstaller.php means you upgraded from a very old version, check docs/index.php.txt)

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/pear_frontend_web/0.4.xml", '

PEAR_Frontend_Web

pear.php.net 0.4 beta PHP License tias Webbased PEAR Package Manager The most accessible way to manage your pear-compatible packages. This frontend\'s most valuable features are: * Webbased: no remote shell access needed. * Fully channel aware: no default channel, all channels are managed at the same time * Unique docviewer: read the installed documentation in your borwser. * Plus all features of the PEAR Installer. 2003-06-07 Bugfixes release: - Remove Pager dep - Should work well on non apache system (ie IIS) - The \'installed packages\' is now the entry page (no more remote connection during startup) 53152 http://pear.php.net/get/PEAR_Frontend_Web-0.4
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/pear_frontend_web/deps.0.4.txt", 'a:2:{i:1;a:3:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:4:"name";s:20:"Net_UserAgent_Detect";}i:2;a:3:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:4:"name";s:16:"HTML_Template_IT";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/pear_frontend_gtk/allreleases.xml", '

PEAR_Frontend_Gtk

pear.php.net 0.4.0beta 0.3beta 0.2snapshot 0.1snapshot
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/pear_frontend_gtk/info.xml", '

PEAR_Frontend_Gtk pear.php.net PEAR PHP License Gtk (Desktop) PEAR Package Manager Desktop Interface to the PEAR Package Manager, Requires PHP-GTK

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/pear_frontend_gtk/0.4.0.xml", '

PEAR_Frontend_Gtk

pear.php.net 0.4.0 beta PHP License alan_k Gtk (Desktop) PEAR Package Manager Desktop Interface to the PEAR Package Manager, Requires PHP-GTK 2005-03-14 02:22:46 Implement channels, support PEAR 1.4.0 (Greg Beaver) Tidy up logging a little. 69762 http://pear.php.net/get/PEAR_Frontend_Gtk-0.4.0
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/pear_frontend_gtk/deps.0.4.0.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/pear/info.xml", '

PEAR pear.php.net PEAR PHP License PEAR Base System The PEAR package contains: * the PEAR installer, for creating, distributing and installing packages * the PEAR_Exception PHP5 error handling mechanism * the 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 of common operations with files and directories * the PEAR base class Features in a nutshell: * full support for channels * pre-download dependency validation * new package.xml 2.0 format allows tremendous flexibility while maintaining BC * support for optional dependency groups and limited support for sub-packaging * robust dependency support * full dependency validation on uninstall * remote install for hosts with only ftp access - no more problems with restricted host installation * full support for mirroring * support for bundling several packages into a single tarball * support for static dependencies on a url-based package * support for custom file roles and installation tasks

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/pear/1.4.0a5.xml", '

PEAR

pear.php.net 1.4.0a5 alpha PHP License cellog PEAR Base System The PEAR package contains: * the PEAR installer, for creating, distributing and installing packages * the alpha-quality PEAR_Exception PHP5 error handling mechanism * 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 of common operations with files and directories * the PEAR base class 2005-03-17 00:47:09 This is a major milestone release for PEAR. In addition to several killer features, every single element of PEAR has a regression test, and so stability is much higher than any previous PEAR release, even with the alpha label. New features in a nutshell: * full support for channels * pre-download dependency validation * new package.xml 2.0 format allows tremendous flexibility while maintaining BC * support for optional dependency groups and limited support for sub-packaging * robust dependency support * full dependency validation on uninstall * support for binary PECL packages * remote install for hosts with only ftp access - no more problems with restricted host installation * full support for mirroring * support for bundling several packages into a single tarball * support for static dependencies on a url-based package Specific changes from 1.3.5: * Implement request #1789: SSL support for xml-rpc and download * Everything above here that you just read Specific changes from 1.4.0a1: * Fix Bug #3610: fix for PDO package in 1.3.5 was never merged to 1.4.0a1 * Fix Bug #3612: fatal error in PEAR_Downloader_Package * Use 1.2.0 as recommended version of XML_RPC Specific changes from 1.4.0a2: BC BREAK FOR PECL DEVS ONLY: In order to circumvent strict package-validation, use "pear channel-update pecl.php.net" prior to packaging a pecl release. * Fix package.xml version 2.0 generation from package.xml 1.0 * Fix Bug #3634: still too many pear-specific restrictions on package valid * Implement Request #3647: "pear package" only includes one package.xml * Fix Bug #3677: Post-Install script message needs to display channel name Specific changes from 1.4.0a3: * upgrade suggested XML_RPC version to 1.2.1 Specific changes from 1.4.0a4: * upgrade suggested XML_RPC version to 1.2.2 * upgrade suggested Archive_Tar version to 1.3.0 * attempt to address memory issues * relax validation further * disable debug_backtrace() in PEAR_Error constructor of PEAR installer * fix a strange version number condition when two packages were upgraded at the same time. * fix Bug #3808 channel packages with non-baseinstalldir files will conflict on upgrade * fix Bug #3801 [PATCH] analyzeSourceCode() reports PHP4 code as PHP5 * fix Bug #3671 Installing package features doesn\'t work as expected * implement Request #3717 [Patch] Implement Simple run-tests output 245495 http://pear.php.net/get/PEAR-1.4.0a5
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/pear/deps.1.4.0a5.txt", 'a:3:{s:8:"required";a:4:{s:3:"php";a:2:{s:3:"min";s:3:"4.2";s:3:"max";s:5:"6.0.0";}s:13:"pearinstaller";a:1:{s:3:"min";s:10:"1.4.0dev13";}s:7:"package";a:3:{i:0;a:5:{s:4:"name";s:11:"Archive_Tar";s:7:"channel";s:12:"pear.php.net";s:3:"min";s:3:"1.1";s:11:"recommended";s:3:"1.2";s:7:"exclude";s:5:"1.3.0";}i:1;a:4:{s:4:"name";s:14:"Console_Getopt";s:7:"channel";s:12:"pear.php.net";s:3:"min";s:3:"1.2";s:11:"recommended";s:3:"1.2";}i:2;a:4:{s:4:"name";s:7:"XML_RPC";s:7:"channel";s:12:"pear.php.net";s:3:"min";s:8:"1.2.0RC1";s:11:"recommended";s:5:"1.2.2";}}s:9:"extension";a:2:{i:0;a:1:{s:4:"name";s:3:"xml";}i:1;a:1:{s:4:"name";s:4:"pcre";}}}s:8:"optional";a:1:{s:7:"package";a:2:{i:0;a:3:{s:4:"name";s:17:"PEAR_Frontend_Web";s:7:"channel";s:12:"pear.php.net";s:3:"min";s:5:"0.5.0";}i:1;a:3:{s:4:"name";s:17:"PEAR_Frontend_Gtk";s:7:"channel";s:12:"pear.php.net";s:3:"min";s:5:"0.4.0";}}}s:5:"group";a:3:{i:0;a:2:{s:7:"attribs";a:2:{s:4:"hint";s:59:"adds the ability to install packages to a remote ftp server";s:4:"name";s:13:"remoteinstall";}s:7:"package";a:4:{s:4:"name";s:7:"Net_FTP";s:7:"channel";s:12:"pear.php.net";s:3:"min";s:8:"1.3.0RC1";s:11:"recommended";s:5:"1.3.0";}}i:1;a:2:{s:7:"attribs";a:2:{s:4:"hint";s:26:"PEAR\'s web-based installer";s:4:"name";s:12:"webinstaller";}s:7:"package";a:3:{s:4:"name";s:17:"PEAR_Frontend_Web";s:7:"channel";s:12:"pear.php.net";s:3:"min";s:5:"0.5.0";}}i:2;a:2:{s:7:"attribs";a:2:{s:4:"hint";s:30:"PEAR\'s PHP-GTK-based installer";s:4:"name";s:12:"gtkinstaller";}s:7:"package";a:3:{s:4:"name";s:17:"PEAR_Frontend_Gtk";s:7:"channel";s:12:"pear.php.net";s:3:"min";s:5:"0.4.0";}}}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/archive_tar/allreleases.xml", '

Archive_Tar

pear.php.net 1.3.2stable 1.3.1stable 1.3.0stable 1.2stable 1.1stable 1.0stable 0.10-b1beta 0.9stable 0.4stable 0.3stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/archive_tar/info.xml", '

Archive_Tar pear.php.net File Formats PHP License Tar file management class This class provides handling of tar files in PHP. It supports creating, listing, extracting and adding to tar files. Gzip support is available if PHP has the zlib extension built-in or loaded. Bz2 compression is also supported with the bz2 extension loaded.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/archive_tar/1.2.xml", '

Archive_Tar

pear.php.net 1.2 stable PHP License vblavet Tar file management class This class provides handling of tar files in PHP. It supports creating, listing, extracting and adding to tar files. Gzip support is available if PHP has the zlib extension built-in or loaded. Bz2 compression is also supported with the bz2 extension loaded. 2004-05-08 10:03:17 Add support for other separator than the space char and bug correction 14792 http://pear.php.net/get/Archive_Tar-1.2
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/archive_tar/deps.1.2.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/console_getopt/allreleases.xml", '

Console_Getopt

pear.php.net 1.2.3stablepear.php.net

PEAR

1.4.01.6.0
1.2.2stablepear.php.net

PEAR

1.4.01.5.0
1.2.1stable 1.2stable 1.0stable 0.11beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/console_getopt/info.xml", '

Console_Getopt pear.php.net Console PHP License Command-line option parser This is a PHP implementation of "getopt" supporting both short and long options.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/console_getopt/1.2.xml", '

Console_Getopt

pear.php.net 1.2 stable PHP License andrei Command-line option parser This is a PHP implementation of "getopt" supporting both short and long options. 2003-12-11 14:26:46 Fix to preserve BC with 1.0 and allow correct behaviour for new users 3370 http://pear.php.net/get/Console_Getopt-1.2
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/console_getopt/deps.1.2.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/xml_rpc/allreleases.xml", '

XML_RPC

pear.php.net 1.5.1stable 1.5.0stable 1.5.0RC2beta 1.5.0RC1beta 1.4.8stable 1.4.7stable 1.4.6stable 1.4.5stable 1.4.4stable 1.4.3stablepear.php.net

PEAR

1.4.0a11.4.1
1.4.2stablepear.php.net

PEAR

1.4.0a11.4.0a14
1.4.1stablepear.php.net

PEAR

1.4.0a11.4.0a14
1.4.0stablepear.php.net

PEAR

1.4.0a11.4.0a12
1.3.3stablepear.php.net

PEAR

1.4.0a11.4.0a12
1.3.2stablepear.php.net

PEAR

1.4.0a11.4.0a12
1.3.1stablepear.php.net

PEAR

1.4.0a11.4.0a12
1.3.0stablepear.php.net

PEAR

1.4.0a11.4.0a12
1.3.0RC3beta 1.3.0RC2betapear.php.net

PEAR

1.4.0a11.4.0a10
1.3.0RC1betapear.php.net

PEAR

1.4.0a11.4.0a10
1.2.2stablepear.php.net

PEAR

1.4.0a11.4.0a4
1.2.1stablepear.php.net

PEAR

1.4.0a11.4.0a2
1.2.0stablepear.php.net

PEAR

1.4.0a11.4.0a1
1.2.0RC7beta 1.2.0RC6beta 1.2.0RC5beta 1.2.0RC4beta 1.2.0RC3beta 1.2.0RC2beta 1.2.0RC1beta 1.1.0stable 1.0.4stable 1.0.3stable 1.0.2stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/xml_rpc/info.xml", '

XML_RPC pear.php.net Web Services PHP License PHP implementation of the XML-RPC protocol A PEAR-ified version of Useful Inc\'s XML-RPC for PHP. It has support for HTTP/HTTPS transport, proxies and authentication.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/xml_rpc/1.4.3.xml", '

XML_RPC

pear.php.net 1.4.3 stable PHP License danielc PHP implementation of the XML-RPC protocol A PEAR-ified version of Useful Inc\'s XML-RPC for PHP. It has support for HTTP/HTTPS transport, proxies and authentication. 2005-09-24 14:22:55 * Make XML_RPC_encode() properly handle dateTime.iso8601. Request 5117. 27198 http://pear.php.net/get/XML_RPC-1.4.3
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/xml_rpc/deps.1.4.3.txt", 'a:1:{s:8:"required";a:2:{s:3:"php";a:1:{s:3:"min";s:5:"4.2.0";}s:13:"pearinstaller";a:1:{s:3:"min";s:7:"1.4.0a1";}}}', 'text/xml'); $_test_dep->setPHPVersion('4.3.10'); $_test_dep->setPEARversion('1.4.0a5'); $at = $packageDir . 'Archive_Tar-1.2.tgz'; $cg = $packageDir . 'Console_Getopt-1.2.tgz'; $xr = $packageDir . 'XML_RPC-1.2.0RC6.tgz'; $res = $command->run('install', array(), array($at, $cg, $xr)); $phpunit->assertTrue($res, 'result'); $fakelog->getLog(); $fakelog->getDownload(); $res = $command->run('install', array(), array($pathtopackagexml)); $phpunit->assertNoErrors('after install setup'); $fakelog->getLog(); $fakelog->getDownload(); $config->set('preferred_state', 'alpha'); $res = $command->run('install', array(), array('pear#webinstaller')); $phpunit->assertEquals(array( array ( 0 => 3, 1 => 'pear/PEAR: Skipping required dependency "pear/Archive_Tar" version 1.2, already installed as version 1.2', ), 1 => array ( 0 => 3, 1 => 'pear/PEAR: Skipping required dependency "pear/Console_Getopt" version 1.2, already installed as version 1.2', ), array ( 0 => 3, 1 => 'pear/PEAR: Skipping required dependency "pear/XML_RPC" version 1.4.3, already installed as version 1.2.0RC6', ), array ( 0 => 3, 1 => 'Notice: package "pear/PEAR" optional dependency "pear/PEAR_Frontend_Web" will not be automatically downloaded', ), array ( 0 => 3, 1 => 'Notice: package "pear/PEAR" optional dependency "pear/PEAR_Frontend_Gtk" will not be automatically downloaded', ), array ( 0 => 1, 1 => 'Did not download optional dependencies: pear/PEAR_Frontend_Web, pear/PEAR_Frontend_Gtk, use --alldeps to download automatically', ), array ( 0 => 0, 1 => 'Failed to download pear/PEAR_Frontend_Web (version >= 0.5.0), latest release is version 0.4, stability "beta", use "channel://pear.php.net/PEAR_Frontend_Web-0.4" to install', ), array ( 0 => 1, 1 => 'Skipping package "pear/PEAR", already installed as version 1.4.0a5', ), array ( 'info' => array ( 'data' => array ( 0 => array ( 0 => 'No valid packages found', ), ), 'headline' => 'Install Errors', ), 'cmd' => 'no command', ), ), $fakelog->getLog(), 'log'); echo 'tests done'; ?> --CLEAN-- --EXPECT-- tests done php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Install/install/test_bug5513.phpt000066400000000000000000001074001262614675700303550ustar00rootroot00000000000000--TEST-- install command, bug #5513 test - PEAR 1.4 does not install non-pear.php.net packages [EXTREMELY slow test] --SKIPIF-- --FILE-- getRegistry(); $chan = $reg->getChannel('pear.php.net'); $chan->setBaseURL('REST1.0', 'http://pear.php.net/rest/'); $reg->updateChannel($chan); $pearweb->addRESTConfig("http://pear.php.net/rest/r/versioncontrol_svn/allreleases.xml", '

VersionControl_SVN

pear.php.net 0.3.0alpha1alpha
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/versioncontrol_svn/0.3.0alpha1.xml", '

VersionControl_SVN

pear.php.net 0.3.0alpha1 alpha BSD License clay Simple OO wrapper interface for the Subversion command-line client. What is VersionControl_SVN? VersionControl_SVN is a simple OO-style interface for Subversion, the free/open-source version control system. VersionControl_SVN can be used to manage trees of source code, text files, image files -- just about any collection of files. Some of VersionControl_SVN\'s features: * Full support of svn command-line client\'s subcommands. * Use of flexible error reporting provided by PEAR_ErrorStack. * Multi-object factory. * Source fully documented with PHPDoc. * Stable, extensible interface. * Collection of helpful quickstart examples and tutorials. What can be done with VersionControl_SVN? * Make your source code available to your remote dev team or project manager. * Build your own WYSIWYG web interface to a Subversion repository. * Add true version control to a content management system! Note: Requires a Subversion installation. Subverison is available from http://subversion.tigris.org/ VersionControl_SVN is tested against Subversion 1.0.4 2004-06-09 13:05:00 - Completed all svn subcommand packages. 33829 http://pear.php.net/get/VersionControl_SVN-0.3.0alpha1
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/versioncontrol_svn/deps.0.3.0alpha1.txt", 'a:2:{i:1;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.3.1";s:8:"optional";s:2:"no";s:4:"name";s:4:"PEAR";}i:2;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.0.1";s:8:"optional";s:2:"no";s:4:"name";s:10:"XML_Parser";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/phpunit2/allreleases.xml", '

PHPUnit2

pear.php.net 2.3.0beta5beta 2.3.0beta4beta 2.3.0beta3beta 2.3.0beta2beta 2.3.0beta1beta 2.2.1stable 2.2.0stable 2.2.0beta7beta 2.2.0beta6beta 2.1.6stable 2.2.0beta5beta 2.1.5stable 2.2.0beta4beta 2.2.0beta3beta 2.2.0beta2beta 2.2.0beta1beta 2.1.4stable 2.1.3stable 2.1.2stable 2.1.1stable 2.1.0stable 2.0.3stable 2.0.2stable 2.0.1stable 2.0.0stable 2.0.0beta2beta 2.0.0beta1beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/phpunit2/2.3.0beta5.xml", '

PHPUnit2

pear.php.net 2.3.0beta5 beta PHP License sebastian Regression testing framework for unit tests. PHPUnit is a regression testing framework used by the developer who implements unit tests in PHP. This is the version to be used with PHP 5. 2005-09-09 04:35:31 + Added PHPUnit2_Framework_Assert::assertNotEquals(). + Added PHPUnit2_Framework_TestSuite::addTestFile() and PHPUnit2_Framework_TestSuite::addTestFiles () as convenience methods that wrap PHPUnit2_Framework_TestSuite::addTest() and PHPUnit2_Framework_TestSuite::addTestSuite(). Contribution by Stefano F. Rausch <stefano@rausch-e.net>. + Added BankAccount and Money samples. * Made the mechanism provided by PHPUnit2_Extensions_TestSetup actually work. * The PHPUnit2_Runner_StandardTestSuiteLoader now checks the test suite sourcefile for syntax errors before loading it. Before, a syntax error in the test suite sourcefile caused a termination of the TextUI test runner, for instance, without any error information being printed. Please note that sourcefiles included by the test suite sourcefile are not checked. This will be done at a later time utilizing the sandboxed interpreter feature of the Runkit extension. * PHPUnit2_Framework_TestResult::run() now saves the $GLOBALS array before and restores it after each test execution for better isolation. * Code Coverage collection has been moved from PHPUnit2_Framework_TestCase to PHPUnit2_Framework_TestResult. This allows for Code Coverage analysis of tests that are written in a class that does not inherit from PHPUnit2_Framework_TestCase. * Code Coverage information is no longer collected by default (when the Xdebug extension is available) but only when it is requested (by using the --coverage-* parameters with the TextUI TestRunner, for instance). PHPUnit2_Framework_TestResult::collectCodeCoverageInformation(TRUE) has to be called to enable the collection of Code Coverage information. * PHPUnit2_Framework_Assert::assertSame() and PHPUnit2_Framework_AssertNotSame() now work on non-objects and assert that two variables (do not) have the same type and value. * PHPUnit2_Framework_Assert::assertType() and PHPUnit2_Framework_AssertNotType() now consider subclasses when used on objects. * PHPUnit2_Util_Skeleton now generates stubs for the setUp() and tearDown() methods. * PHPUnit2_Extensions_TestDox_NamePrettifier now removes digits from the end of test method names and PHPUnit2_Extensions_TestDox_ResultPrinter treats test methods like testBalanceCannotBecomeNegative() and testBalanceCannotBecomeNegative2() as one and prints "Balance cannot become negative" only once. * PHPUnit2 now uses the Standard PHP Library (SPL)\'s specialized exceptions InvalidArgumentException and RuntimeException instead of the generic Exception exception class. * Renamed Extensions_CodeCoverage_*, Extensions_Log_*, and Extensions_TestDox_* to Util_CodeCoverage_*, Util_Log_*, and Util_TestDox_* as the Extensions_* namespace is intended for extensions of the framework. * Stacktraces for failed tests now show the failing assertion. * PHPUnit2_Util_Printer no longer uses fopen/fputs/fclose to write to STDOUT. * Implemented RFE #4456. * Moved tests outside of installation directory. ! PHP 5.1.0 (or greater) is now required. 44001 http://pear.php.net/get/PHPUnit2-2.3.0beta5
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/phpunit2/deps.2.3.0beta5.txt", 'a:7:{i:1;a:3:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:7:"5.1.0b1";}i:2;a:3:{s:4:"type";s:3:"ext";s:3:"rel";s:3:"has";s:4:"name";s:3:"dom";}i:3;a:3:{s:4:"type";s:3:"ext";s:3:"rel";s:3:"has";s:4:"name";s:4:"pcre";}i:4;a:3:{s:4:"type";s:3:"ext";s:3:"rel";s:3:"has";s:4:"name";s:3:"spl";}i:5;a:5:{s:4:"type";s:3:"ext";s:3:"rel";s:2:"ge";s:7:"version";s:10:"2.0.0beta2";s:8:"optional";s:3:"yes";s:4:"name";s:6:"xdebug";}i:6;a:3:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:4:"name";s:9:"Benchmark";}i:7;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:3:"yes";s:4:"name";s:3:"Log";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/phpdocumentor/allreleases.xml", '

PhpDocumentor

pear.php.net 1.3.0RC3beta 1.3.0RC2beta 1.3.0RC1beta 1.2.3stable 1.2.2.1stable 1.2.1stable 1.2.0astable 1.2.0stable 1.2.0beta3beta 1.2.0beta2beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/phpdocumentor/1.3.0RC3.xml", '

PhpDocumentor

pear.php.net 1.3.0RC3 beta PHP License cellog The phpDocumentor package provides automatic documenting of php api directly from the source. The phpDocumentor tool is a standalone auto-documentor similar to JavaDoc written in PHP. It differs from PHPDoc in that it is MUCH faster, parses a much wider range of php files, and comes with many customizations including 11 HTML templates, windows help file CHM output, PDF output, and XML DocBook peardoc2 output for use with documenting PEAR. In addition, it can do PHPXref source code highlighting and linking. Features (short list): -output in HTML, PDF (directly), CHM (with windows help compiler), XML DocBook -very fast -web and command-line interface -fully customizable output with Smarty-based templates -recognizes JavaDoc-style documentation with special tags customized for PHP 4 -automatic linking, class inheritance diagrams and intelligent override -customizable source code highlighting, with phpxref-style cross-referencing -parses standard README/CHANGELOG/INSTALL/FAQ files and includes them directly in documentation -generates a todo list from @todo tags in source -generates multiple documentation sets based on @access private, @internal and {@internal} tags -example php files can be placed directly in documentation with highlighting and phpxref linking using the @example tag -linking between external manual and API documentation is possible at the sub-section level in all output formats -easily extended for specific documentation needs with Converter -full documentation of every feature, manual can be generated directly from the source code with "phpdoc -c makedocs" in any format desired. -current manual always available at http://www.phpdoc.org/manual.php -user .ini files can be used to control output, multiple outputs can be generated at once **WARNING**: To use the web interface, you must set PEAR\'s data_dir to a subdirectory of document root. If browsing to http://localhost/index.php displays /path/to/htdocs/index.php, set data_dir to a subdirectory of /path/to/htdocs: $ pear config-set data_dir /path/to/htdocs/pear $ pear install PhpDocumentor http://localhost/pear/PhpDocumentor is the web interface 2004-04-10 15:16:24 PHP 5 support and more, fix bugs This will be the last release in the 1.x series. 2.0 is next Features added to this release include: * Full PHP 5 support, phpDocumentor both runs in and parses Zend Engine 2 language constructs. Note that you must be running phpDocumentor in PHP 5 in order to parse PHP 5 code * XML:DocBook/peardoc2:default converter now beautifies the source using PEAR\'s XML_Beautifier if available * inline {@example} tag - this works just like {@source} except that it displays the contents of another file. In tutorials, it works like <programlisting> * customizable README/INSTALL/CHANGELOG files * phpDocumentor tries to run .ini files out of the current directory first, to allow you to put them anywhere you want to * multi-national characters are now allowed in package/subpackage names * images in tutorials with the <graphic> tag * un-modified output with <programlisting role="html"> * html/xml source highlighting with <programlisting role="tutorial"> From both Windows and Unix, both the command-line version of phpDocumentor and the web interface will work out of the box by using command phpdoc - guaranteed :) WARNING: in order to use the web interface through PEAR, you must set your data_dir to a subdirectory of your document root. $ pear config-set data_dir /path/to/public_html/pear on Windows with default apache setup, it might be C:\\> pear config-set data_dir "C:\\Program Files\\Apache\\htdocs\\pear" After this, install/upgrade phpDocumentor $ pear upgrade phpDocumentor and you can browse to: http://localhost/pear/PhpDocumentor/ for the web interface ------ WARNING: The PDF Converter will not work in PHP5. The PDF library that it relies upon segfaults with the simplest of files. Generation still works great in PHP4 ------ - WARNING: phpDocumentor installs phpdoc in the scripts directory, and this will conflict with PHPDoc, you can\'t have both installed at the same time - Switched to Smarty 2.6.0, now it will work in PHP 5. Other changes made to the code to make it work in PHP 5, including parsing of private/public/static/etc. access modifiers - fixed these bugs: [ 834941 ] inline @link doesn\'t work within <b> [ 839092 ] CHM:default:default produces bad links [ 839466 ] {$array[\'Key\']} in heredoc [ 840792 ] File Missing XML:DocBook/peardoc2:default "errors.tpl" [ 850731 ] No DocBlock template after page-level DocBlock? [ 850767 ] MHW Reference wrong [ 854321 ] web interface errors with template directory [ 856310 ] HTML:frames:DOM/earthli missing Class_logo.png image [ 865126 ] CHM files use hard paths [ 875525 ] <li> escapes <pre> and ignores paragraphs [ 876674 ] first line of pre and code gets left trimmed [ 877229 ] PHP 5 incompatibilities bork tutorial parsing [ 877233 ] PHP 5 incompatibilities bork docblock source highlighting [ 878911 ] [PHP 5 incompatibility] argv [ 879068 ] var arrays tripped up by comments [ 879151 ] HTML:frames:earthli Top row too small for IE [ 880070 ] PHP5 visability for member variables not working [ 880488 ] \'0\' file stops processing [ 884863 ] Multiple authors get added in wrong order. [ 884869 ] Wrong highligthing of object type variables [ 892305 ] peardoc2: summary require_once Path/File.php is PathFile.php [ 892306 ] peardoc2: @see of method not working [ 892479 ] {@link} in // comment is escaped [ 893470 ] __clone called directly in PackagePageElements.inc [ 895656 ] initialized private variables not recognized as private [ 904823 ] IntermediateParser fatal error [ 910676 ] Fatal error: Smarty error: unable to write to $compile_dir [ 915770 ] Classes in file not showing [ 924313 ] Objec access on array 2711672 http://pear.php.net/get/PhpDocumentor-1.3.0RC3
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/phpdocumentor/deps.1.3.0RC3.txt", 'a:3:{i:1;a:4:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"4.1.0";s:8:"optional";s:2:"no";}i:2;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:3:"1.1";s:8:"optional";s:2:"no";s:4:"name";s:11:"Archive_Tar";}i:3;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:3:"1.1";s:8:"optional";s:3:"yes";s:4:"name";s:14:"XML_Beautifier";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/xdebug/allreleases.xml", false, false); $pearweb->addRESTConfig("http://pecl.php.net/rest/r/xdebug/allreleases.xml", '

xdebug

pecl.php.net 2.0.0beta4beta 2.0.0beta3beta 2.0.0beta2beta 2.0.0beta1beta 1.3.2stable 1.3.1stable 1.3.0stable 1.3.0rc2beta 1.3.0rc1beta 1.2.0stable
', 'text/xml'); $pearweb->addRESTConfig("http://pecl.php.net/rest/r/xdebug/2.0.0beta4.xml", '

xdebug

pecl.php.net 2.0.0beta4 beta BSD style derick Provides functions for function traces and profiling The Xdebug extension helps you debugging your script by providing a lot of valuable debug information. The debug information that Xdebug can provide includes the following: * stack and function traces in error messages with: o full parameter display for user defined functions o function name, file name and line indications o support for member functions * memory allocation * protection for infinite recursions Xdebug also provides: * profiling information for PHP scripts * script execution analysis * capabilities to debug your scripts interactively with a debug client 2005-09-24 18:03:07 + Added new features: - Added xdebug_debug_zval_stdout(). - Added xdebug_get_profile_filename() function which returns the current profiler dump file. - Updated for latest 5.1 and 6.0 CVS versions of PHP. - Added FR #148: Option to append to cachegrind files, instead of overwriting. - Implemented FR #114: Rename tests/*.php to tests/*.inc - Changed features: - Allow "xdebug.default_enable" to be set everywhere. = Fixed bugs: - DBGP: Xdebug should return "array" with property get, which is defined in the typemap to the common type "hash". - Debugclient: Will now build with an older libedit as found in FreeBSD 4.9. - Fixed bug #142: xdebug crashes with implicit destructor calls. - Fixed bug #136: The "type" attribute is missing from stack_get returns. - Fixed bug #133: PHP scripts exits with 0 on PHP error. - Fixed bug #132: use of eval causes a segmentation fault. 228343 http://pecl.php.net/get/xdebug-2.0.0beta4
', 'text/xml'); $pearweb->addRESTConfig("http://pecl.php.net/rest/r/xdebug/2.0.0beta4.xml", '

xdebug

pecl.php.net 2.0.0beta4 beta BSD style derick Provides functions for function traces and profiling The Xdebug extension helps you debugging your script by providing a lot of valuable debug information. The debug information that Xdebug can provide includes the following: * stack and function traces in error messages with: o full parameter display for user defined functions o function name, file name and line indications o support for member functions * memory allocation * protection for infinite recursions Xdebug also provides: * profiling information for PHP scripts * script execution analysis * capabilities to debug your scripts interactively with a debug client 2005-09-24 18:03:07 + Added new features: - Added xdebug_debug_zval_stdout(). - Added xdebug_get_profile_filename() function which returns the current profiler dump file. - Updated for latest 5.1 and 6.0 CVS versions of PHP. - Added FR #148: Option to append to cachegrind files, instead of overwriting. - Implemented FR #114: Rename tests/*.php to tests/*.inc - Changed features: - Allow "xdebug.default_enable" to be set everywhere. = Fixed bugs: - DBGP: Xdebug should return "array" with property get, which is defined in the typemap to the common type "hash". - Debugclient: Will now build with an older libedit as found in FreeBSD 4.9. - Fixed bug #142: xdebug crashes with implicit destructor calls. - Fixed bug #136: The "type" attribute is missing from stack_get returns. - Fixed bug #133: PHP scripts exits with 0 on PHP error. - Fixed bug #132: use of eval causes a segmentation fault. 228343 http://pecl.php.net/get/xdebug-2.0.0beta4
', 'text/xml'); $pearweb->addRESTConfig("http://pecl.php.net/rest/r/xdebug/deps.2.0.0beta4.txt", 'a:1:{s:8:"required";a:2:{s:3:"php";a:1:{s:3:"min";s:5:"4.3.0";}s:13:"pearinstaller";a:1:{s:3:"min";s:7:"1.4.0b1";}}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/archive_tar/allreleases.xml", '

Archive_Tar

pear.php.net 1.3.1stable 1.3.0stable 1.2stable 1.1stable 1.0stable 0.10-b1beta 0.9stable 0.4stable 0.3stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/archive_tar/1.3.1.xml", '

Archive_Tar

pear.php.net 1.3.1 stable PHP License vblavet Tar file management class This class provides handling of tar files in PHP. It supports creating, listing, extracting and adding to tar files. Gzip support is available if PHP has the zlib extension built-in or loaded. Bz2 compression is also supported with the bz2 extension loaded. 2005-03-17 16:09:16 Correct Bug #3855 15102 http://pear.php.net/get/Archive_Tar-1.3.1
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/archive_tar/deps.1.3.1.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/pear_packagefilemanager/allreleases.xml", '

PEAR_PackageFileManager

pear.php.net 1.6.0a3alpha 1.6.0a2alpha 1.6.0a1alpha 1.5.2stable 1.5.1stable 1.5.0stable 1.4.0stable 1.3.0stable 1.2.1stable 1.2.0stable 1.1.0stable 1.0stable 0.15beta 0.14beta 0.13beta 0.12beta 0.11beta 0.10beta 0.9alpha 0.8alpha 0.7alpha 0.6alpha 0.5alpha 0.4alpha 0.3alpha 0.2alpha 0.1alpha
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/pear_packagefilemanager/1.6.0a3.xml", '

PEAR_PackageFileManager

pear.php.net 1.6.0a3 alpha PHP License cellog PEAR_PackageFileManager takes an existing package.xml file and updates it with a new filelist and changelog This package revolutionizes the maintenance of PEAR packages. With a few parameters, the entire package.xml is automatically updated with a listing of all files in a package. Features include - manages the new package.xml 2.0 format in PEAR 1.4.0 - can detect PHP and extension dependencies using PHP_CompatInfo - reads in an existing package.xml file, and only changes the release/changelog - a plugin system for retrieving files in a directory. Currently two plugins exist, one for standard recursive directory content listing, and one that reads the CVS/Entries files and generates a file listing based on the contents of a checked out CVS repository - incredibly flexible options for assigning install roles to files/directories - ability to ignore any file based on a * ? wildcard-enabled string(s) - ability to include only files that match a * ? wildcard-enabled string(s) - ability to manage dependencies - can output the package.xml in any directory, and read in the package.xml file from any directory. - can specify a different name for the package.xml file PEAR_PackageFileManager is fully unit tested. The new PEAR_PackageFileManager2 class is not. 2005-09-06 19:26:57 Bugfix release * add addIgnoreToRelease() to replace PEAR_PackageFile_v2_rw::addIgnore() 60127 http://pear.php.net/get/PEAR_PackageFileManager-1.6.0a3
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/versioncontrol_svn/info.xml", '

VersionControl_SVN pear.php.net Version Control BSD License Simple OO wrapper interface for the Subversion command-line client. What is VersionControl_SVN? VersionControl_SVN is a simple OO-style interface for Subversion, the free/open-source version control system. VersionControl_SVN can be used to manage trees of source code, text files, image files -- just about any collection of files. Some of VersionControl_SVN\'s features: * Full support of svn command-line client\'s subcommands. * Use of flexible error reporting provided by PEAR_ErrorStack. * Multi-object factory. * Source fully documented with PHPDoc. * Stable, extensible interface. * Collection of helpful quickstart examples and tutorials. What can be done with VersionControl_SVN? * Make your source code available to your remote dev team or project manager. * Build your own WYSIWYG web interface to a Subversion repository. * Add true version control to a content management system! Note: Requires a Subversion installation. Subverison is available from http://subversion.tigris.org/ VersionControl_SVN is tested against Subversion 1.0.4

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/phpunit2/info.xml", '

PHPUnit2 pear.php.net Testing BSD License Regression testing framework for unit tests. PHPUnit is a regression testing framework used by the developer who implements unit tests in PHP. This is the version to be used with PHP 5.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/phpdocumentor/info.xml", '

PhpDocumentor pear.php.net Tools and Utilities PHP License The phpDocumentor package provides automatic documenting of php api directly from the source. The phpDocumentor tool is a standalone auto-documentor similar to JavaDoc written in PHP. It differs from PHPDoc in that it is MUCH faster, parses a much wider range of php files, and comes with many customizations including 11 HTML templates, windows help file CHM output, PDF output, and XML DocBook peardoc2 output for use with documenting PEAR. In addition, it can do PHPXref source code highlighting and linking. Features (short list): -output in HTML, PDF (directly), CHM (with windows help compiler), XML DocBook -very fast -web and command-line interface -fully customizable output with Smarty-based templates -recognizes JavaDoc-style documentation with special tags customized for PHP 4 -automatic linking, class inheritance diagrams and intelligent override -customizable source code highlighting, with phpxref-style cross-referencing -parses standard README/CHANGELOG/INSTALL/FAQ files and includes them directly in documentation -generates a todo list from @todo tags in source -generates multiple documentation sets based on @access private, @internal and {@internal} tags -example php files can be placed directly in documentation with highlighting and phpxref linking using the @example tag -linking between external manual and API documentation is possible at the sub-section level in all output formats -easily extended for specific documentation needs with Converter -full documentation of every feature, manual can be generated directly from the source code with "phpdoc -c makedocs" in any format desired. -current manual always available at http://www.phpdoc.org/manual.php -user .ini files can be used to control output, multiple outputs can be generated at once **WARNING**: To use the web interface, you must set PEAR\'s data_dir to a subdirectory of document root. If browsing to http://localhost/index.php displays /path/to/htdocs/index.php, set data_dir to a subdirectory of /path/to/htdocs: $ pear config-set data_dir /path/to/htdocs/pear $ pear install PhpDocumentor http://localhost/pear/PhpDocumentor is the web interface

', 'text/xml'); $pearweb->addRESTConfig("http://pecl.php.net/rest/p/xdebug/info.xml", '

Xdebug pecl.php.net PHP BSD style Provides functions for function traces and profiling The Xdebug extension helps you debugging your script by providing a lot of valuable debug information. The debug information that Xdebug can provide includes the following: * stack and function traces in error messages with: o full parameter display for user defined functions o function name, file name and line indications o support for member functions * memory allocation * protection for infinite recursions Xdebug also provides: * profiling information for PHP scripts * script execution analysis * capabilities to debug your scripts interactively with a debug client

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/archive_tar/info.xml", '

Archive_Tar pear.php.net File Formats PHP License Tar file management class This class provides handling of tar files in PHP. It supports creating, listing, extracting and adding to tar files. Gzip support is available if PHP has the zlib extension built-in or loaded. Bz2 compression is also supported with the bz2 extension loaded.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/pear_packagefilemanager/info.xml", '

PEAR_PackageFileManager pear.php.net PEAR PHP License 3.0 PEAR_PackageFileManager takes an existing package.xml file and updates it with a new filelist and changelog This package revolutionizes the maintenance of PEAR packages. With a few parameters, the entire package.xml is automatically updated with a listing of all files in a package. Features include - manages the new package.xml 2.0 format in PEAR 1.4.0 - can detect PHP and extension dependencies using PHP_CompatInfo - reads in an existing package.xml file, and only changes the release/changelog - a plugin system for retrieving files in a directory. Currently two plugins exist, one for standard recursive directory content listing, and one that reads the CVS/Entries files and generates a file listing based on the contents of a checked out CVS repository - incredibly flexible options for assigning install roles to files/directories - ability to ignore any file based on a * ? wildcard-enabled string(s) - ability to include only files that match a * ? wildcard-enabled string(s) - ability to manage dependencies - can output the package.xml in any directory, and read in the package.xml file from any directory. - can specify a different name for the package.xml file PEAR_PackageFileManager is fully unit tested. The new PEAR_PackageFileManager2 class is not.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/pear_packagefilemanager/deps.1.6.0a3.txt", 'a:1:{s:8:"required";a:2:{s:3:"php";a:1:{s:3:"min";s:5:"4.2.0";}s:13:"pearinstaller";a:1:{s:3:"min";s:7:"1.4.0b1";}}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/phing/allreleases.xml", false, false); $pearweb->addRESTConfig("http://pecl.php.net/rest/r/phing/allreleases.xml", false, false); $pathtopackagexml = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'packages'. DIRECTORY_SEPARATOR . 'phing-current.tgz'; $pathtobarxml = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'packages'. DIRECTORY_SEPARATOR . 'agavi-current.tgz'; $_test_dep->setPHPVersion('5.0.4'); $_test_dep->setPEARVersion('1.4.1'); $config->set('preferred_state', 'alpha'); $res = $command->run('install', array(), array($pathtopackagexml)); $phpunit->assertNoErrors('after install'); $phpunit->assertTrue($res, 'result'); $fakelog->getLog(); $res = $command->run('install', array(), array($pathtobarxml)); $phpunit->assertNoErrors('after install'); $phpunit->assertTrue($res, 'result'); echo 'tests done'; ?> --CLEAN-- --EXPECT-- tests done php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Install/install/test_bug5810.phpt000066400000000000000000000024041262614675700303530ustar00rootroot00000000000000--TEST-- install command, bug #5810 (internet should not be contacted on install if dependencies are installed) --SKIPIF-- --FILE-- getChannel('pear.php.net'); $chan->setBaseURL('REST1.0', 'http://pear.php.net/rest/'); $reg->updateChannel($chan); $pearweb->_continue = true; $_test_dep->setPEARVersion('1.4.3'); $_test_dep->setPHPVersion('5.0.0'); $_test_dep->setExtensions(array('gd' => 0)); $dir = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'packages'. DIRECTORY_SEPARATOR; $res = $command->run('install', array(), array($dir . 'Image_Color-1.0.2.tgz', $dir . 'Image_Canvas-0.2.2.tgz')); $phpunit->assertNoErrors('setup'); $fakelog->getLog(); $res = $command->run('install', array(), array($dir . 'Image_Canvas-0.2.2.tgz')); $phpunit->assertEquals(array( 0 => array ( 'info' => 'Ignoring installed package pear/Image_Canvas', 'cmd' => 'no command', ), 1 => array ( 'info' => 'Nothing to install', 'cmd' => 'no command', ), ), $fakelog->getLog(), 'log'); echo 'tests done'; ?> --CLEAN-- --EXPECT-- tests done php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Install/install/test_complex_rest.phpt000066400000000000000000000314551262614675700317740ustar00rootroot00000000000000--TEST-- install command, complex test --SKIPIF-- --FILE-- setName('smork'); $ch->setSummary('smork'); $ch->setBaseURL('REST1.0', 'http://smork/rest/'); $reg = &$config->getRegistry(); $phpunit->assertTrue($reg->addChannel($ch), 'smork setup'); $chan = $reg->getChannel('pear.php.net'); $chan->setBaseURL('REST1.0', 'http://pear.php.net/rest/'); $reg->updateChannel($chan); $packageDir = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'packages' . DIRECTORY_SEPARATOR; $pathtopackagexml = $packageDir . 'package2.xml'; $pathtobarxml = $packageDir . 'Bar-1.5.2.tgz'; $pathtofoobarxml = $packageDir . 'Foobar-1.5.0a1.tgz'; $GLOBALS['pearweb']->addHtmlConfig('http://www.example.com/Bar-1.5.2.tgz', $pathtobarxml); $GLOBALS['pearweb']->addHtmlConfig('http://www.example.com/Foobar-1.5.0a1.tgz', $pathtofoobarxml); $pearweb->addRESTConfig("http://pear.php.net/rest/r/bar/allreleases.xml", '

Bar

pear.php.net 1.5.2stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/bar/deps.1.5.2.txt", 'a:1:{s:8:"required";a:3:{s:3:"php";a:2:{s:3:"min";s:5:"4.3.6";s:3:"max";s:5:"6.0.0";}s:13:"pearinstaller";a:1:{s:3:"min";s:7:"1.4.0a1";}s:7:"package";a:2:{s:4:"name";s:6:"Foobar";s:7:"channel";s:5:"smork";}}}', 'text/plain'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/bar/1.5.2.xml", '

Bar

pear.php.net 1.5.2 stable PHP License cellog PEAR Base System The PEAR package contains: * the PEAR installer, for creating, distributing and installing packages * the alpha-quality PEAR_Exception PHP5 error handling mechanism * 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 of common operations with files and directories * the PEAR base class 2005-04-17 18:40:51 Release notes 252733 http://www.example.com/Bar-1.5.2
', 'text/xml'); $pearweb->addRESTConfig("http://smork/rest/r/foobar/allreleases.xml", '

Foobar

smork 1.5.0a1stable
', 'text/xml'); $pearweb->addRESTConfig("http://smork/rest/r/foobar/deps.1.5.0a1.txt", 'a:1:{s:8:"required";a:2:{s:3:"php";a:2:{s:3:"min";s:5:"4.3.6";s:3:"max";s:5:"6.0.0";}s:13:"pearinstaller";a:1:{s:3:"min";s:7:"1.4.0a1";}}}', 'text/plain'); $pearweb->addRESTConfig("http://smork/rest/r/foobar/1.5.0a1.xml", '

Foobar

smork 1.5.0a1 alpha PHP License cellog PEAR Base System The PEAR package contains: * the PEAR installer, for creating, distributing and installing packages * the alpha-quality PEAR_Exception PHP5 error handling mechanism * 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 of common operations with files and directories * the PEAR base class 2005-04-17 18:40:51 Release notes 252733 http://www.example.com/Foobar-1.5.0a1
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/bar/info.xml", '

bar pear.php.net PEAR PHP License 3.0 PEAR_PackageFileManager takes an existing package.xml file and updates it with a new filelist and changelog This package revolutionizes the maintenance of PEAR packages. With a few parameters, the entire package.xml is automatically updated with a listing of all files in a package. Features include - manages the new package.xml 2.0 format in PEAR 1.4.0 - can detect PHP and extension dependencies using PHP_CompatInfo - reads in an existing package.xml file, and only changes the release/changelog - a plugin system for retrieving files in a directory. Currently two plugins exist, one for standard recursive directory content listing, and one that reads the CVS/Entries files and generates a file listing based on the contents of a checked out CVS repository - incredibly flexible options for assigning install roles to files/directories - ability to ignore any file based on a * ? wildcard-enabled string(s) - ability to include only files that match a * ? wildcard-enabled string(s) - ability to manage dependencies - can output the package.xml in any directory, and read in the package.xml file from any directory. - can specify a different name for the package.xml file PEAR_PackageFileManager is fully unit tested. The new PEAR_PackageFileManager2 class is not.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/foobar/info.xml", '

foobar pear.php.net PEAR PHP License 3.0 PEAR_PackageFileManager takes an existing package.xml file and updates it with a new filelist and changelog This package revolutionizes the maintenance of PEAR packages. With a few parameters, the entire package.xml is automatically updated with a listing of all files in a package. Features include - manages the new package.xml 2.0 format in PEAR 1.4.0 - can detect PHP and extension dependencies using PHP_CompatInfo - reads in an existing package.xml file, and only changes the release/changelog - a plugin system for retrieving files in a directory. Currently two plugins exist, one for standard recursive directory content listing, and one that reads the CVS/Entries files and generates a file listing based on the contents of a checked out CVS repository - incredibly flexible options for assigning install roles to files/directories - ability to ignore any file based on a * ? wildcard-enabled string(s) - ability to include only files that match a * ? wildcard-enabled string(s) - ability to manage dependencies - can output the package.xml in any directory, and read in the package.xml file from any directory. - can specify a different name for the package.xml file PEAR_PackageFileManager is fully unit tested. The new PEAR_PackageFileManager2 class is not.

', 'text/xml'); $pearweb->addRESTConfig("http://smork/rest/p/foobar/info.xml", '

foobar smork PEAR PHP License 3.0 PEAR_PackageFileManager takes an existing package.xml file and updates it with a new filelist and changelog This package revolutionizes the maintenance of PEAR packages. With a few parameters, the entire package.xml is automatically updated with a listing of all files in a package. Features include - manages the new package.xml 2.0 format in PEAR 1.4.0 - can detect PHP and extension dependencies using PHP_CompatInfo - reads in an existing package.xml file, and only changes the release/changelog - a plugin system for retrieving files in a directory. Currently two plugins exist, one for standard recursive directory content listing, and one that reads the CVS/Entries files and generates a file listing based on the contents of a checked out CVS repository - incredibly flexible options for assigning install roles to files/directories - ability to ignore any file based on a * ? wildcard-enabled string(s) - ability to include only files that match a * ? wildcard-enabled string(s) - ability to manage dependencies - can output the package.xml in any directory, and read in the package.xml file from any directory. - can specify a different name for the package.xml file PEAR_PackageFileManager is fully unit tested. The new PEAR_PackageFileManager2 class is not.

', 'text/xml'); $_test_dep->setPHPVersion('4.3.11'); $_test_dep->setPEARVersion('1.4.0a1'); $config->set('preferred_state', 'alpha'); $res = $command->run('install', array(), array($pathtopackagexml)); $phpunit->assertNoErrors('after install'); $phpunit->assertTrue($res, 'result'); $dummy = null; $dl = &$command->getDownloader($dummy, array()); $tmpdir = $temp_path . DIRECTORY_SEPARATOR . 'php' . DIRECTORY_SEPARATOR; // Don't forget umask ! permission of new file is 0666 $umask = decoct(0666 & ( 0777 - umask())); echoFakelog($fakelog); $phpunit->assertEquals(array ( array ( 0 => 'http://pear.php.net/rest/r/bar/allreleases.xml', 1 => '200', ), array ( 0 => 'http://pear.php.net/rest/p/bar/info.xml', 1 => '200', ), array ( 0 => 'http://pear.php.net/rest/r/bar/1.5.2.xml', 1 => '200', ), array ( 0 => 'http://pear.php.net/rest/r/bar/deps.1.5.2.txt', 1 => '200', ), array ( 0 => 'http://smork/rest/r/foobar/allreleases.xml', 1 => '200', ), array ( 0 => 'http://smork/rest/p/foobar/info.xml', 1 => '200', ), array ( 0 => 'http://smork/rest/r/foobar/1.5.0a1.xml', 1 => '200', ), array ( 0 => 'http://smork/rest/r/foobar/deps.1.5.0a1.txt', 1 => '200', ), ), $pearweb->getRESTCalls(), 'rest'); echo 'tests done'; ?> --CLEAN-- --EXPECTF-- 3;Downloading "http://www.example.com/Bar-1.5.2.tgz" 1;downloading Bar-1.5.2.tgz ... 1;Starting to download Bar-1.5.2.tgz (2,213 bytes) 1;. 1;...done: 2,213 bytes 3;Downloading "http://www.example.com/Foobar-1.5.0a1.tgz" 1;downloading Foobar-1.5.0a1.tgz ... 1;Starting to download Foobar-1.5.0a1.tgz (2,208 bytes) 1;...done: 2,208 bytes 3;+ cp %s/Foobar-1.5.0a1/foo12.php %s/php/.tmpfoo12.php 2;md5sum ok: %s/php/foo12.php 3;adding to transaction: chmod 6%d4 %s/php/.tmpfoo12.php 3;adding to transaction: rename %s/php/.tmpfoo12.php %s/php/foo12.php 3;adding to transaction: installed_as foo12.php %s/php/foo12.php %s/php / 2;about to commit 3 file operations for Foobar 3;+ chmod 6%d4 %s/php/.tmpfoo12.php 3;+ mv %s/php/.tmpfoo12.php %s/php/foo12.php 2;successfully committed 3 file operations array ( 'info' => array ( 'data' => 'install ok: channel://smork/Foobar-1.5.0a1', ), 'cmd' => 'install', ) 3;+ cp %s/Bar-1.5.2/foo1.php %s/php/.tmpfoo1.php 2;md5sum ok: %s/php/foo1.php 3;adding to transaction: chmod 6%d4 %s/php/.tmpfoo1.php 3;adding to transaction: rename %s/php/.tmpfoo1.php %s/php/foo1.php 3;adding to transaction: installed_as foo1.php %s/php/foo1.php %s/php / 2;about to commit 3 file operations for Bar 3;+ chmod 6%d4 %s/php/.tmpfoo1.php 3;+ mv %s/php/.tmpfoo1.php %s/php/foo1.php 2;successfully committed 3 file operations array ( 'info' => array ( 'data' => 'install ok: channel://pear.php.net/Bar-1.5.2', ), 'cmd' => 'install', ) 3;+ cp %s/PEAR_Command_Install/install/packages/foo.php %s/php/.tmpfoo.php 3;adding to transaction: chmod 6%d4 %s/php/.tmpfoo.php 3;adding to transaction: rename %s/php/.tmpfoo.php %s/php/foo.php 3;adding to transaction: installed_as foo.php %s/php/foo.php %s/php / 2;about to commit 3 file operations for PEAR1 3;+ chmod 6%d4 %s/php/.tmpfoo.php 3;+ mv %s/php/.tmpfoo.php %s/php/foo.php 2;successfully committed 3 file operations array ( 'info' => array ( 'data' => 'install ok: channel://pear.php.net/PEAR1-1.5.0a1', ), 'cmd' => 'install', ) tests done php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Install/install/test_dependsonpecl.phpt000066400000000000000000000113761262614675700321130ustar00rootroot00000000000000--TEST-- install command, package.xml 1.0 package depends on pecl --SKIPIF-- --FILE-- getRegistry(); $chan = $reg->getChannel('pear.php.net'); $chan->setBaseURL('REST1.0', 'http://pear.php.net/rest/'); $reg->updateChannel($chan); $chan = $reg->getChannel('pecl.php.net'); $chan->setBaseURL('REST1.0', 'http://pecl.php.net/rest/'); $reg->updateChannel($chan); $pathtopackagexml = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'packages'. DIRECTORY_SEPARATOR . 'dependsonpecl.xml'; $pathtopackage = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'packages'. DIRECTORY_SEPARATOR . 'peclpkg-1.3.0.tgz'; $pearweb->addHtmlConfig('http://pecl.php.net/get/peclpackage-1.3.0.tgz', $pathtopackage); $pearweb->addRESTConfig("http://pear.php.net/rest/r/peclpkg/allreleases.xml", false, false); $pearweb->addRESTConfig("http://pecl.php.net/rest/r/peclpkg/allreleases.xml", '

peclpkg

pecl.php.net 1.3.0stable 1.2.5stable 1.2.4stable 1.2.3stable 1.2.2stable 1.2.1stable 1.2stable 1.1stable
', 'text/xml'); $pearweb->addRESTConfig("http://pecl.php.net/rest/p/peclpkg/info.xml", '

peclpkg pecl.php.net Authentication BSD extension package source package extension source

', 'text/xml'); $pearweb->addRESTConfig("http://pecl.php.net/rest/r/peclpkg/1.3.0.xml", '

peclpkg

pecl.php.net 1.3.0 stable BSD cellog extension package source package extension source 2007-03-18 17:02:49 stuff 29750 http://pecl.php.net/get/peclpackage-1.3.0
', 'text/xml'); $pearweb->addRESTConfig("http://pecl.php.net/rest/r/peclpkg/deps.1.3.0.txt", 'a:1:{s:8:"required";a:2:{s:3:"php";a:1:{s:3:"min";s:5:"4.2.0";}s:13:"pearinstaller";a:1:{s:3:"min";s:7:"1.4.0b1";}}}', 'text/xml'); $res = $command->run('install', array(), array($pathtopackagexml)); $phpunit->assertErrors(array( array( 'package' => 'PEAR_Error', 'message' => 'install failed' ), ), 'after install'); $dummy = null; $dl = &$command->getDownloader($dummy, array()); $log = $fakelog->getLog(); $phpunit->assertEquals(array ( array ( 0 => 3, 1 => 'Notice: package "pear/PEAR" required dependency "pecl/peclpkg" will not be automatically downloaded', ), array ( 0 => 1, 1 => 'Did not download dependencies: pecl/peclpkg, use --alldeps or --onlyreqdeps to download automatically', ), array ( 0 => 0, 1 => 'pear/PEAR requires package "pear/peclpkg"', ), array ( 'info' => array ( 'data' => array ( 0 => array ( 0 => 'No valid packages found', ), ), 'headline' => 'Install Errors', ), 'cmd' => 'no command', ), ), $log, 'log messages'); $phpunit->assertEquals( array ( 0 => array ( 0 => 'http://pear.php.net/rest/r/peclpkg/allreleases.xml', 1 => '404', ), 1 => array ( 0 => 'http://pecl.php.net/rest/r/peclpkg/allreleases.xml', 1 => '200', ), 2 => array ( 0 => 'http://pecl.php.net/rest/p/peclpkg/info.xml', 1 => '200', ), 3 => array ( 0 => 'http://pecl.php.net/rest/r/peclpkg/1.3.0.xml', 1 => '200', ), 4 => array ( 0 => 'http://pecl.php.net/rest/r/peclpkg/deps.1.3.0.txt', 1 => '200', ), ) , $pearweb->getRESTCalls(), 'rest calls'); echo 'tests done'; ?> --CLEAN-- --EXPECT-- tests done php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Install/install/test_extinstall.phpt000066400000000000000000000277531262614675700314650ustar00rootroot00000000000000--TEST-- install command, binary package install --SKIPIF-- --FILE-- setName('smork'); $ch->setSummary('smork'); $ch->setBaseURL('REST1.0', 'http://smork/rest/'); $reg = &$config->getRegistry(); $phpunit->assertTrue($reg->addChannel($ch), 'smork setup'); $chan = $reg->getChannel('pear.php.net'); $chan->setBaseURL('REST1.0', 'http://pear.php.net/rest/'); $reg->updateChannel($chan); $packageDir = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'packages' . DIRECTORY_SEPARATOR; $pathtopackagexml = $packageDir . 'package2.xml'; $pathtobarxml = $packageDir . 'Bar-1.5.2.tgz'; $pathtofoobarxml = $packageDir . 'Foobar-1.5.0a1.tgz'; $GLOBALS['pearweb']->addHtmlConfig('http://www.example.com/Bar-1.5.2.tgz', $pathtobarxml); $GLOBALS['pearweb']->addHtmlConfig('http://www.example.com/Foobar-1.5.0a1.tgz', $pathtofoobarxml); $pearweb->addRESTConfig("http://pear.php.net/rest/r/bar/allreleases.xml", '

Bar

pear.php.net 1.5.2stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/bar/deps.1.5.2.txt", 'a:1:{s:8:"required";a:3:{s:3:"php";a:2:{s:3:"min";s:5:"4.3.6";s:3:"max";s:5:"6.0.0";}s:13:"pearinstaller";a:1:{s:3:"min";s:7:"1.4.0a1";}s:7:"package";a:2:{s:4:"name";s:6:"Foobar";s:7:"channel";s:5:"smork";}}}', 'text/plain'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/bar/1.5.2.xml", '

Bar

pear.php.net 1.5.2 stable PHP License cellog PEAR Base System The PEAR package contains: * the PEAR installer, for creating, distributing and installing packages * the alpha-quality PEAR_Exception PHP5 error handling mechanism * 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 of common operations with files and directories * the PEAR base class 2005-04-17 18:40:51 Release notes 252733 http://www.example.com/Bar-1.5.2
', 'text/xml'); $pearweb->addRESTConfig("http://smork/rest/r/foobar/allreleases.xml", '

Foobar

smork 1.5.0a1stable
', 'text/xml'); $pearweb->addRESTConfig("http://smork/rest/r/foobar/deps.1.5.0a1.txt", 'a:1:{s:8:"required";a:2:{s:3:"php";a:2:{s:3:"min";s:5:"4.3.6";s:3:"max";s:5:"6.0.0";}s:13:"pearinstaller";a:1:{s:3:"min";s:7:"1.4.0a1";}}}', 'text/plain'); $pearweb->addRESTConfig("http://smork/rest/r/foobar/1.5.0a1.xml", '

Foobar

smork 1.5.0a1 alpha PHP License cellog PEAR Base System The PEAR package contains: * the PEAR installer, for creating, distributing and installing packages * the alpha-quality PEAR_Exception PHP5 error handling mechanism * 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 of common operations with files and directories * the PEAR base class 2005-04-17 18:40:51 Release notes 252733 http://www.example.com/Foobar-1.5.0a1
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/bar/info.xml", '

bar pear.php.net PEAR PHP License 3.0 PEAR_PackageFileManager takes an existing package.xml file and updates it with a new filelist and changelog This package revolutionizes the maintenance of PEAR packages. With a few parameters, the entire package.xml is automatically updated with a listing of all files in a package. Features include - manages the new package.xml 2.0 format in PEAR 1.4.0 - can detect PHP and extension dependencies using PHP_CompatInfo - reads in an existing package.xml file, and only changes the release/changelog - a plugin system for retrieving files in a directory. Currently two plugins exist, one for standard recursive directory content listing, and one that reads the CVS/Entries files and generates a file listing based on the contents of a checked out CVS repository - incredibly flexible options for assigning install roles to files/directories - ability to ignore any file based on a * ? wildcard-enabled string(s) - ability to include only files that match a * ? wildcard-enabled string(s) - ability to manage dependencies - can output the package.xml in any directory, and read in the package.xml file from any directory. - can specify a different name for the package.xml file PEAR_PackageFileManager is fully unit tested. The new PEAR_PackageFileManager2 class is not.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/foobar/info.xml", '

foobar pear.php.net PEAR PHP License 3.0 PEAR_PackageFileManager takes an existing package.xml file and updates it with a new filelist and changelog This package revolutionizes the maintenance of PEAR packages. With a few parameters, the entire package.xml is automatically updated with a listing of all files in a package. Features include - manages the new package.xml 2.0 format in PEAR 1.4.0 - can detect PHP and extension dependencies using PHP_CompatInfo - reads in an existing package.xml file, and only changes the release/changelog - a plugin system for retrieving files in a directory. Currently two plugins exist, one for standard recursive directory content listing, and one that reads the CVS/Entries files and generates a file listing based on the contents of a checked out CVS repository - incredibly flexible options for assigning install roles to files/directories - ability to ignore any file based on a * ? wildcard-enabled string(s) - ability to include only files that match a * ? wildcard-enabled string(s) - ability to manage dependencies - can output the package.xml in any directory, and read in the package.xml file from any directory. - can specify a different name for the package.xml file PEAR_PackageFileManager is fully unit tested. The new PEAR_PackageFileManager2 class is not.

', 'text/xml'); $pearweb->addRESTConfig("http://smork/rest/p/foobar/info.xml", '

foobar smork PEAR PHP License 3.0 PEAR_PackageFileManager takes an existing package.xml file and updates it with a new filelist and changelog This package revolutionizes the maintenance of PEAR packages. With a few parameters, the entire package.xml is automatically updated with a listing of all files in a package. Features include - manages the new package.xml 2.0 format in PEAR 1.4.0 - can detect PHP and extension dependencies using PHP_CompatInfo - reads in an existing package.xml file, and only changes the release/changelog - a plugin system for retrieving files in a directory. Currently two plugins exist, one for standard recursive directory content listing, and one that reads the CVS/Entries files and generates a file listing based on the contents of a checked out CVS repository - incredibly flexible options for assigning install roles to files/directories - ability to ignore any file based on a * ? wildcard-enabled string(s) - ability to include only files that match a * ? wildcard-enabled string(s) - ability to manage dependencies - can output the package.xml in any directory, and read in the package.xml file from any directory. - can specify a different name for the package.xml file PEAR_PackageFileManager is fully unit tested. The new PEAR_PackageFileManager2 class is not.

', 'text/xml'); $_test_dep->setPHPVersion('4.3.11'); $_test_dep->setPEARVersion('1.4.0a1'); $config->set('preferred_state', 'alpha'); $res = $command->run('install', array(), array($pathtopackagexml)); $phpunit->assertNoErrors('after install'); $phpunit->assertTrue($res, 'result'); $dummy = null; $dl = &$command->getDownloader($dummy, array()); $tmpdir = $temp_path . DIRECTORY_SEPARATOR . 'php' . DIRECTORY_SEPARATOR; echoFakelog($fakelog); echo 'tests done'; ?> --CLEAN-- --EXPECTF-- 3;Downloading "http://www.example.com/Bar-1.5.2.tgz" 1;downloading Bar-1.5.2.tgz ... 1;Starting to download Bar-1.5.2.tgz (2,213 bytes) 1;. 1;...done: 2,213 bytes 3;Downloading "http://www.example.com/Foobar-1.5.0a1.tgz" 1;downloading Foobar-1.5.0a1.tgz ... 1;Starting to download Foobar-1.5.0a1.tgz (2,208 bytes) 1;...done: 2,208 bytes 3;+ cp %s/Foobar-1.5.0a1/foo12.php %s/php/.tmpfoo12.php 2;md5sum ok: %s/php/foo12.php 3;adding to transaction: chmod 6%d4 %s/php/.tmpfoo12.php 3;adding to transaction: rename %s/php/.tmpfoo12.php %s/php/foo12.php 3;adding to transaction: installed_as foo12.php %s/php/foo12.php %s/php / 2;about to commit 3 file operations for Foobar 3;+ chmod 6%d4 %s/php/.tmpfoo12.php 3;+ mv %s/php/.tmpfoo12.php %s/php/foo12.php 2;successfully committed 3 file operations array ( 'info' => array ( 'data' => 'install ok: channel://smork/Foobar-1.5.0a1', ), 'cmd' => 'install', ) 3;+ cp %s/Bar-1.5.2/foo1.php %s/php/.tmpfoo1.php 2;md5sum ok: %s/php/foo1.php 3;adding to transaction: chmod 6%d4 %s/php/.tmpfoo1.php 3;adding to transaction: rename %s/php/.tmpfoo1.php %s/php/foo1.php 3;adding to transaction: installed_as foo1.php %s/php/foo1.php %s/php / 2;about to commit 3 file operations for Bar 3;+ chmod 6%d4 %s/php/.tmpfoo1.php 3;+ mv %s/php/.tmpfoo1.php %s/php/foo1.php 2;successfully committed 3 file operations array ( 'info' => array ( 'data' => 'install ok: channel://pear.php.net/Bar-1.5.2', ), 'cmd' => 'install', ) 3;+ cp %s/PEAR_Command_Install/install/packages/foo.php %s/php/.tmpfoo.php 3;adding to transaction: chmod 6%d4 %s/php/.tmpfoo.php 3;adding to transaction: rename %s/php/.tmpfoo.php %s/php/foo.php 3;adding to transaction: installed_as foo.php %s/php/foo.php %s/php / 2;about to commit 3 file operations for PEAR1 3;+ chmod 6%d4 %s/php/.tmpfoo.php 3;+ mv %s/php/.tmpfoo.php %s/php/foo.php 2;successfully committed 3 file operations array ( 'info' => array ( 'data' => 'install ok: channel://pear.php.net/PEAR1-1.5.0a1', ), 'cmd' => 'install', ) tests done php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Install/install/test_installgroup.phpt000066400000000000000000000114361262614675700320100ustar00rootroot00000000000000--TEST-- install command, test pear install Installed#group where Installed is already installed --SKIPIF-- --FILE-- addRESTConfig("http://pear.php.net/rest/r/console_getopt/allreleases.xml", '

Console_Getopt

pear.php.net 1.2stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/console_getopt/info.xml", '

Console_Getopt pear.php.net Console PHP License Command-line option parser This is a PHP implementation of "getopt" supporting both short and long options.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/console_getopt/1.2.xml", '

Console_Getopt

pear.php.net 1.2 stable PHP License andrei Command-line option parser This is a PHP implementation of "getopt" supporting both short and long options. 2003-12-11 14:26:46 Fix to preserve BC with 1.0 and allow correct behaviour for new users 3370 http://pear.php.net/get/Console_Getopt-1.2
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/console_getopt/deps.1.2.txt", 'b:0;', 'text/xml'); $pearweb->addHTMLConfig('http://pear.php.net/get/Console_Getopt-1.2.tgz', $cg); $_test_dep->setPHPVersion('5.2.1'); $_test_dep->setPEARVersion('1.5.1'); $reg = &$config->getRegistry(); $chan = $reg->getChannel('pear.php.net'); $chan->setBaseURL('REST1.0', 'http://pear.php.net/rest/'); $chan->setBaseURL('REST1.1', 'http://pear.php.net/rest/'); $reg->updateChannel($chan); $pathtopackagexml = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'packages'. DIRECTORY_SEPARATOR . 'installed.xml'; $res = $command->run('install', array(), array($pathtopackagexml)); $phpunit->assertNoErrors('after install'); $phpunit->assertTrue($res, 'result'); $fakelog->getLog(); // install sub-group $res = $command->run('install', array(), array($pathtopackagexml . '#test')); $phpunit->assertNoErrors('after install'); $phpunit->assertTrue($res, 'result'); $phpunit->showAll(); $dummy = null; $dl = &$command->getDownloader($dummy, array()); echoFakelog($fakelog); echo 'tests done'; ?> --CLEAN-- --EXPECTF-- 1;Skipping package "pear/Installed", already installed as version 1.4.0a1 3;Downloading "http://pear.php.net/get/Console_Getopt-1.2.tgz" 1;downloading Console_Getopt-1.2.tgz ... 1;Starting to download Console_Getopt-1.2.tgz (3,371 bytes) 1;. 1;...done: 3,371 bytes 3;adding to transaction: mkdir %s/php/Console 2;+ create dir %s/php/Console 3;+ mkdir %s/php/Console 3;+ cp %s/Console_Getopt-1.2/Console/Getopt.php %s/php/Console/.tmpGetopt.php 2;md5sum ok: %s/php/Console/Getopt.php 3;adding to transaction: chmod 6%d4 %s/php/Console/.tmpGetopt.php 3;adding to transaction: rename %s/php/Console/.tmpGetopt.php %s/php/Console/Getopt.php 3;adding to transaction: installed_as Console/Getopt.php %s/php/Console/Getopt.php %s/php /Console 2;about to commit 4 file operations for Console_Getopt 3;+ chmod 6%d4 %s/php/Console/.tmpGetopt.php 3;+ mv %s/php/Console/.tmpGetopt.php %s/php/Console/Getopt.php 2;successfully committed 4 file operations array ( 'info' => array ( 'data' => 'install ok: channel://pear.php.net/Console_Getopt-1.2', ), 'cmd' => 'install', ) tests done php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Install/install/test_simple.phpt000066400000000000000000000077741262614675700305700ustar00rootroot00000000000000--TEST-- install command, simplest possible test --SKIPIF-- --FILE-- run('install', array(), array($pathtopackagexml)); $phpunit->assertNoErrors('after install'); $phpunit->assertTrue($res, 'result'); $dummy = null; $dl = &$command->getDownloader($dummy, array()); if (OS_WINDOWS) { $phpunit->assertEquals(array ( 0 => array ( 0 => 3, 1 => '+ cp ' . dirname(__FILE__) . DIRECTORY_SEPARATOR . 'packages' . DIRECTORY_SEPARATOR . 'foo.php ' . $temp_path . DIRECTORY_SEPARATOR . 'php' . DIRECTORY_SEPARATOR . '.tmpfoo.php', ), 1 => array ( 0 => 3, 1 => 'adding to transaction: rename ' . $temp_path . DIRECTORY_SEPARATOR . 'php' . DIRECTORY_SEPARATOR . '.tmpfoo.php ' . $temp_path . DIRECTORY_SEPARATOR . 'php' . DIRECTORY_SEPARATOR . 'foo.php ', ), 2 => array ( 0 => 3, 1 => 'adding to transaction: installed_as foo.php ' . $temp_path . DIRECTORY_SEPARATOR . 'php' . DIRECTORY_SEPARATOR . 'foo.php ' . $temp_path . DIRECTORY_SEPARATOR . 'php ' . DIRECTORY_SEPARATOR, ), 3 => array ( 0 => 2, 1 => 'about to commit 2 file operations for PEAR', ), 4 => array ( 0 => 3, 1 => '+ mv ' . $temp_path . DIRECTORY_SEPARATOR . 'php' . DIRECTORY_SEPARATOR . '.tmpfoo.php ' . $temp_path . DIRECTORY_SEPARATOR . 'php' . DIRECTORY_SEPARATOR . 'foo.php', ), 5 => array ( 0 => 2, 1 => 'successfully committed 2 file operations', ), 6 => array ( 'info' => array ( 'data' => 'install ok: channel://pear.php.net/PEAR-1.4.0a1', ), 'cmd' => 'install', ), ), $fakelog->getLog(), 'log messages'); } else { // Don't forget umask ! permission of new file is 0666 $umask = decoct(0666 & ( 0777 - umask())); $phpunit->assertEquals(array ( 0 => array ( 0 => 3, 1 => '+ cp ' . dirname(__FILE__) . DIRECTORY_SEPARATOR . 'packages' . DIRECTORY_SEPARATOR . 'foo.php ' . $temp_path . DIRECTORY_SEPARATOR . 'php' . DIRECTORY_SEPARATOR . '.tmpfoo.php', ), 1 => array ( 0 => 3, 1 => 'adding to transaction: chmod '.$umask.' ' . $temp_path . DIRECTORY_SEPARATOR . 'php' . DIRECTORY_SEPARATOR . '.tmpfoo.php', ), 2 => array ( 0 => 3, 1 => 'adding to transaction: rename ' . $temp_path . DIRECTORY_SEPARATOR . 'php' . DIRECTORY_SEPARATOR . '.tmpfoo.php ' . $temp_path . DIRECTORY_SEPARATOR . 'php' . DIRECTORY_SEPARATOR . 'foo.php ', ), 3 => array ( 0 => 3, 1 => 'adding to transaction: installed_as foo.php ' . $temp_path . DIRECTORY_SEPARATOR . 'php' . DIRECTORY_SEPARATOR . 'foo.php ' . $temp_path . DIRECTORY_SEPARATOR . 'php ' . DIRECTORY_SEPARATOR, ), 4 => array ( 0 => 2, 1 => 'about to commit 3 file operations for PEAR', ), 5 => array ( 0 => 3, 1 => '+ chmod '.$umask.' ' . $temp_path . DIRECTORY_SEPARATOR . 'php' . DIRECTORY_SEPARATOR . '.tmpfoo.php', ), 6 => array ( 0 => 3, 1 => '+ mv ' . $temp_path . DIRECTORY_SEPARATOR . 'php' . DIRECTORY_SEPARATOR . '.tmpfoo.php ' . $temp_path . DIRECTORY_SEPARATOR . 'php' . DIRECTORY_SEPARATOR . 'foo.php', ), 7 => array ( 0 => 2, 1 => 'successfully committed 3 file operations', ), 8 => array ( 'info' => array ( 'data' => 'install ok: channel://pear.php.net/PEAR-1.4.0a1', ), 'cmd' => 'install', ), ), $fakelog->getLog(), 'log messages'); } echo 'tests done'; ?> --CLEAN-- --EXPECT-- tests done php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Install/setup.php.inc000066400000000000000000000102411262614675700262750ustar00rootroot00000000000000getLog() as $logMsg) { if (isset($logMsg['cmd'])) { echo var_export($logMsg, true) . "\n"; } else { echo implode(';', $logMsg) . "\n"; } } } require_once dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'download_test_classes.php.inc'; cleanall($temp_path); $statedir = $temp_path; if (!is_dir($temp_path)) { mkdir($temp_path); } if (!is_dir($temp_path . DIRECTORY_SEPARATOR . 'php')) { mkdir($temp_path . DIRECTORY_SEPARATOR . 'php'); } if (!is_dir($temp_path . DIRECTORY_SEPARATOR . 'data')) { mkdir($temp_path . DIRECTORY_SEPARATOR . 'data'); } if (!is_dir($temp_path . DIRECTORY_SEPARATOR . 'doc')) { mkdir($temp_path . DIRECTORY_SEPARATOR . 'doc'); } if (!is_dir($temp_path . DIRECTORY_SEPARATOR . 'test')) { mkdir($temp_path . DIRECTORY_SEPARATOR . 'test'); } if (!is_dir($temp_path . DIRECTORY_SEPARATOR . 'ext')) { mkdir($temp_path . DIRECTORY_SEPARATOR . 'ext'); } if (!is_dir($temp_path . DIRECTORY_SEPARATOR . 'script')) { mkdir($temp_path . DIRECTORY_SEPARATOR . 'script'); } if (!is_dir($temp_path . DIRECTORY_SEPARATOR . 'tmp')) { mkdir($temp_path . DIRECTORY_SEPARATOR . 'tmp'); } if (!is_dir($temp_path . DIRECTORY_SEPARATOR . 'bin')) { mkdir($temp_path . DIRECTORY_SEPARATOR . 'bin'); } if (!is_dir($temp_path . DIRECTORY_SEPARATOR . 'cache')) { mkdir($temp_path . DIRECTORY_SEPARATOR . 'cache'); } // make the fake configuration - we'll use one of these and it should work $config = serialize(array('master_server' => $server, 'preferred_state' => 'stable', 'cache_dir' => $temp_path . DIRECTORY_SEPARATOR . 'cache', 'php_dir' => $temp_path . DIRECTORY_SEPARATOR . 'php', 'ext_dir' => $temp_path . DIRECTORY_SEPARATOR . 'ext', 'data_dir' => $temp_path . DIRECTORY_SEPARATOR . 'data', 'www_dir' => $temp_path . DIRECTORY_SEPARATOR . 'www', 'doc_dir' => $temp_path . DIRECTORY_SEPARATOR . 'doc', 'test_dir' => $temp_path . DIRECTORY_SEPARATOR . 'test', 'download_dir' => $temp_path . DIRECTORY_SEPARATOR . 'tmp', 'bin_dir' => $temp_path . DIRECTORY_SEPARATOR . 'bin',)); touch($temp_path . DIRECTORY_SEPARATOR . 'pear.conf'); $fp = fopen($temp_path . DIRECTORY_SEPARATOR . 'pear.conf', 'w'); fwrite($fp, $config); fclose($fp); touch($temp_path . DIRECTORY_SEPARATOR . 'pear.ini'); $fp = fopen($temp_path . DIRECTORY_SEPARATOR . 'pear.ini', 'w'); fwrite($fp, $config); fclose($fp); touch($temp_path . DIRECTORY_SEPARATOR . 'pear.conf'); $fp = fopen($temp_path . DIRECTORY_SEPARATOR . 'pear.conf', 'w'); fwrite($fp, $config); fclose($fp); putenv('PHP_PEAR_SYSCONF_DIR='.$temp_path); $home = getenv('HOME'); if (!empty($home)) { // for PEAR_Config initialization putenv('HOME="'.$temp_path); } require_once "PEAR/ChannelFile.php"; require_once dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'phpt_test.php.inc'; $phpunit = new PEAR_PHPTest(true); $fakelog = new fake_log; $config = &test_PEAR_Config::singleton($temp_path . '/pear.ini', $temp_path . '/pear.conf'); $reg = &$config->getRegistry(); $chan = $reg->getChannel('pear.php.net'); $chan->resetFunctions('rest'); $reg->updateChannel($chan); test_PEAR_Dependency2::singleton($config); require_once 'PEAR/Command/Install.php'; class test_PEAR_Command_Install extends PEAR_Command_Install { function &getDownloader(&$a, $b, &$c = null) { if (!isset($GLOBALS['__Stupid_php4_a'])) { $GLOBALS['__Stupid_php4_a'] = new test_PEAR_Downloader($this->ui, $b, $this->config); } return $GLOBALS['__Stupid_php4_a']; } function &getInstaller(&$ui) { if (!isset($GLOBALS['__Stupid_php4_b'])) { $GLOBALS['__Stupid_php4_b'] = new test_PEAR_Installer($this->ui, array(), $this->config); } return $GLOBALS['__Stupid_php4_b']; } function _reset_downloader() { unset($GLOBALS['__Stupid_php4_a']); } } $command = new test_PEAR_Command_Install($fakelog, $config); ?> php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Install/teardown.php.inc000066400000000000000000000014761262614675700267720ustar00rootroot00000000000000 php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Install/uninstall/000077500000000000000000000000001262614675700256675ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Install/uninstall/test_uninstallSOAP.phpt000066400000000000000000000026771262614675700323330ustar00rootroot00000000000000--TEST-- uninstall command - real-world example (uninstall the SOAP package) --SKIPIF-- --FILE-- setPHPVersion('4.3.10'); $_test_dep->setExtensions(array('pcre' => '1.0')); $command->run('install', array(), $packages); $phpunit->assertNoErrors('after install'); $fakelog->getLog(); $paramnames = array('Mail_Mime', 'SOAP', 'Net_DIME', 'HTTP_Request', 'Net_URL', 'Net_Socket'); $command->run('uninstall', array(), $paramnames); $phpunit->assertNoErrors('after uninstall'); echo 'tests done'; ?> --CLEAN-- --EXPECT-- tests done php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Install/upgrade-all/000077500000000000000000000000001262614675700260535ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Install/upgrade-all/test.phpt000066400000000000000000020500231262614675700277310ustar00rootroot00000000000000--TEST-- upgrade-all command - real-world example from Bug #3388 --SKIPIF-- --FILE-- getRegistry(); $chan = $reg->getChannel('pear.php.net'); $chan->setBaseURL('REST1.0', 'http://pear.php.net/rest/'); $reg->updateChannel($chan); $chan = $reg->getChannel('pecl.php.net'); $chan->setBaseURL('REST1.0', 'http://pecl.php.net/rest/'); $reg->updateChannel($chan); $pearweb->addHtmlConfig('http://pear.php.net/get/Net_Sieve-1.1.1.tgz', $packageDir . 'Net_Sieve-1.1.1.tgz'); $pearweb->addHtmlConfig('http://pear.php.net/get/File-1.1.0RC5.tgz', $packageDir . 'File-1.1.0RC5.tgz'); $pearweb->addHtmlConfig('http://pear.php.net/get/file-1.1.0RC5.tgz', $packageDir . 'File-1.1.0RC5.tgz'); $pearweb->addHtmlConfig('http://pear.php.net/get/file-1.1.0RC5.tgz', $packageDir . 'File-1.1.0RC5.tgz'); $pearweb->addHtmlConfig('http://pear.php.net/get/Text_Highlighter-0.6.2.tgz', $packageDir . 'Text_Highlighter-0.6.2.tgz'); $pearweb->addHtmlConfig('http://pear.php.net/get/Text_Wiki-0.25.0.tgz', $packageDir . 'Text_Wiki-0.25.0.tgz'); $pearweb->addHtmlConfig('http://pear.php.net/get/XML_RPC-1.2.0RC6.tgz', $packageDir . 'XML_RPC-1.2.0RC6.tgz'); $pearweb->addRESTConfig("http://pecl.php.net/rest/p/packages.xml", false, false); $pearweb->addRESTConfig("http://pear.php.net/rest/p/packages.xml", ' pear.php.net

Archive_Tar

Archive_Zip

AsteriskManager

Auth

Auth_HTTP

Auth_PrefManager

Auth_PrefManager2

Auth_RADIUS

Auth_SASL

Benchmark

Cache

Cache_Lite

Calendar

CodeGen

CodeGen_MySQL

CodeGen_MySQL_Plugin

CodeGen_MySQL_UDF

CodeGen_PECL

Config

Console_Color

Console_CommandLine

Console_Getargs

Console_Getopt

Console_GetoptPlus

Console_ProgressBar

Console_Table

Contact_AddressBook

Contact_Vcard_Build

Contact_Vcard_Parse

Crypt_Blowfish

Crypt_CBC

Crypt_CHAP

Crypt_DiffieHellman

Crypt_GPG

Crypt_HMAC

Crypt_HMAC2

Crypt_MicroID

Crypt_RC4

Crypt_RSA

Crypt_Xtea

Crypt_XXTEA

Date

Date_Holidays

Date_Holidays_Austria

Date_Holidays_Brazil

Date_Holidays_Denmark

Date_Holidays_Discordian

Date_Holidays_EnglandWales

Date_Holidays_Germany

Date_Holidays_Iceland

Date_Holidays_Ireland

Date_Holidays_Italy

Date_Holidays_Japan

Date_Holidays_Netherlands

Date_Holidays_Norway

Date_Holidays_PHPdotNet

Date_Holidays_Romania

Date_Holidays_Slovenia

Date_Holidays_Sweden

Date_Holidays_Ukraine

Date_Holidays_UNO

Date_Holidays_USA

DB

DBA

DBA_Relational

DB_ado

DB_DataObject

DB_DataObject_FormBuilder

DB_ldap

DB_ldap2

DB_NestedSet

DB_NestedSet2

DB_odbtp

DB_Pager

DB_QueryTool

DB_Sqlite_Tools

DB_Table

Event_Dispatcher

Event_SignalEmitter

File

File_Archive

File_Bittorrent

File_Bittorrent2

File_Cabinet

File_CSV

File_CSV_DataSource

File_DeliciousLibrary

File_DICOM

File_DNS

File_Find

File_Fortune

File_Fstab

File_Gettext

File_HtAccess

File_IMC

File_Infopath

File_MARC

File_Mogile

File_Ogg

File_Passwd

File_PDF

File_SearchReplace

File_Sitemap

File_SMBPasswd

File_Util

File_XSPF

FSM

Games_Chess

Genealogy_Gedcom

Gtk2_EntryDialog

Gtk2_ExceptionDump

Gtk2_FileDrop

Gtk2_IndexedComboBox

Gtk2_PHPConfig

Gtk2_ScrollingLabel

Gtk2_VarDump

Gtk_FileDrop

Gtk_MDB_Designer

Gtk_ScrollingLabel

Gtk_Styled

Gtk_VarDump

HTML_AJAX

HTML_BBCodeParser

HTML_Common

HTML_Common2

HTML_Crypt

HTML_CSS

HTML_Entities

HTML_Form

HTML_Javascript

HTML_Menu

HTML_Page

HTML_Page2

HTML_Progress

HTML_Progress2

HTML_QuickForm

HTML_QuickForm2

HTML_QuickForm_advmultiselect

HTML_QuickForm_altselect

HTML_QuickForm_CAPTCHA

HTML_QuickForm_Controller

HTML_QuickForm_DHTMLRulesTableless

HTML_QuickForm_ElementGrid

HTML_QuickForm_Livesearch

HTML_QuickForm_Renderer_Tableless

HTML_QuickForm_Rule_Spelling

HTML_QuickForm_SelectFilter

HTML_Safe

HTML_Select

HTML_Select_Common

HTML_Table

HTML_Table_Matrix

HTML_TagCloud

HTML_Template_Flexy

HTML_Template_IT

HTML_Template_PHPLIB

HTML_Template_Sigma

HTML_Template_Xipe

HTML_TreeMenu

HTTP

HTTP_Client

HTTP_Download

HTTP_FloodControl

HTTP_Header

HTTP_Request

HTTP_Request2

HTTP_Server

HTTP_Session

HTTP_Session2

HTTP_SessionServer

HTTP_Upload

HTTP_WebDAV_Client

HTTP_WebDAV_Server

I18N

I18Nv2

I18N_UnicodeNormalizer

I18N_UnicodeString

Image_3D

Image_Barcode

Image_Canvas

Image_Color

Image_Color2

Image_GIS

Image_Graph

Image_GraphViz

Image_IPTC

Image_JpegMarkerReader

Image_JpegXmpReader

Image_MonoBMP

Image_Puzzle

Image_Remote

Image_Text

Image_Tools

Image_Transform

Image_WBMP

Image_XBM

Inline_C

LiveUser

LiveUser_Admin

Log

Mail

Mail_IMAP

Mail_IMAPv2

Mail_Mbox

Mail_Mime

Mail_mimeDecode

Mail_Queue

Math_Basex

Math_BigInteger

Math_BinaryUtils

Math_Combinatorics

Math_Complex

Math_Derivative

Math_Fibonacci

Math_Finance

Math_Fraction

Math_Histogram

Math_Integer

Math_Matrix

Math_Numerical_RootFinding

Math_Polynomial

Math_Quaternion

Math_RPN

Math_Stats

Math_TrigOp

Math_Vector

MDB

MDB2

MDB2_Driver_fbsql

MDB2_Driver_ibase

MDB2_Driver_mssql

MDB2_Driver_mysql

MDB2_Driver_mysqli

MDB2_Driver_oci8

MDB2_Driver_pgsql

MDB2_Driver_querysim

MDB2_Driver_sqlite

MDB2_Schema

MDB2_TableBrowser

MDB_QueryTool

Message

MIME_Type

MP3_Id

MP3_IDv2

MP3_Playlist

Net_CDDB

Net_CheckIP

Net_CheckIP2

Net_Curl

Net_Cyrus

Net_Dict

Net_Dig

Net_DIME

Net_DNS

Net_DNSBL

Net_Finger

Net_FTP

Net_FTP2

Net_GameServerQuery

Net_Gearman

Net_Geo

Net_GeoIP

Net_Growl

Net_HL7

Net_Ident

Net_IDNA

Net_IMAP

Net_IPv4

Net_IPv6

Net_IRC

Net_LDAP

Net_LDAP2

Net_LMTP

Net_MAC

Net_Monitor

Net_MPD

Net_Nmap

Net_NNTP

Net_Ping

Net_POP3

Net_Portscan

Net_Server

Net_Sieve

Net_SmartIRC

Net_SMPP

Net_SMPP_Client

Net_SMS

Net_SMTP

Net_Socket

Net_Traceroute

Net_URL

Net_URL2

Net_URL_Mapper

Net_UserAgent_Detect

Net_UserAgent_Mobile

Net_UserAgent_Mobile_GPS

Net_Vpopmaild

Net_Whois

Net_Wifi

Numbers_Roman

Numbers_Words

OLE

OpenDocument

Pager

Pager_Sliding

Payment_Clieop

Payment_DTA

Payment_PayPal_SOAP

Payment_Process

PEAR

pearweb

pearweb_channelxml

pearweb_gopear

pearweb_index

pearweb_phars

PEAR_Command_Packaging

PEAR_Delegator

PEAR_ErrorStack

PEAR_Frontend_Gtk

PEAR_Frontend_Gtk2

PEAR_Frontend_Web

PEAR_Info

PEAR_PackageFileManager

PEAR_PackageFileManager2

PEAR_PackageFileManager_Cli

PEAR_PackageFileManager_Frontend

PEAR_PackageFileManager_Frontend_Web

PEAR_PackageFileManager_GUI_Gtk

PEAR_PackageFileManager_Plugins

PEAR_PackageUpdate

PEAR_PackageUpdate_Gtk2

PEAR_PackageUpdate_Web

PEAR_RemoteInstaller

PEAR_Size

PHPDoc

PhpDocumentor

PHPUnit

PHPUnit2

PHP_Annotation

PHP_Archive

PHP_ArrayOf

PHP_Beautifier

PHP_CodeSniffer

PHP_Compat

PHP_CompatInfo

PHP_Debug

PHP_DocBlockGenerator

PHP_Fork

PHP_FunctionCallTracer

PHP_LexerGenerator

PHP_Parser

PHP_ParserGenerator

PHP_Parser_DocblockParser

PHP_Shell

PHP_UML

QA_Peardoc_Coverage

RDF

RDF_N3

RDF_NTriple

RDF_RDQL

Science_Chemistry

ScriptReorganizer

Search_Mnogosearch

Services_Akismet

Services_Akismet2

Services_Amazon

Services_Amazon_S3

Services_Amazon_SQS

Services_Atlassian_Crowd

Services_Blogging

Services_Compete

Services_Delicious

Services_Digg

Services_DynDNS

Services_Ebay

Services_ExchangeRates

Services_Facebook

Services_GeoNames

Services_Google

Services_Hatena

Services_oEmbed

Services_OpenSearch

Services_Pingback

Services_ProjectHoneyPot

Services_SharedBook

Services_Technorati

Services_TinyURL

Services_Trackback

Services_TwitPic

Services_Twitter

Services_urlTea

Services_W3C_CSSValidator

Services_W3C_HTMLValidator

Services_Weather

Services_Webservice

Services_Yadis

Services_Yahoo

Services_Yahoo_JP

Services_YouTube

SOAP

SOAP_Interop

Spreadsheet_Excel_Writer

SQL_Parser

Stream_SHM

Stream_Var

Structures_BibTex

Structures_DataGrid

Structures_DataGrid_DataSource_Array

Structures_DataGrid_DataSource_CSV

Structures_DataGrid_DataSource_DataObject

Structures_DataGrid_DataSource_DB

Structures_DataGrid_DataSource_DBQuery

Structures_DataGrid_DataSource_DBTable

Structures_DataGrid_DataSource_Excel

Structures_DataGrid_DataSource_MDB2

Structures_DataGrid_DataSource_PDO

Structures_DataGrid_DataSource_RSS

Structures_DataGrid_DataSource_XML

Structures_DataGrid_Renderer_Console

Structures_DataGrid_Renderer_CSV

Structures_DataGrid_Renderer_Flexy

Structures_DataGrid_Renderer_HTMLSortForm

Structures_DataGrid_Renderer_HTMLTable

Structures_DataGrid_Renderer_Pager

Structures_DataGrid_Renderer_Smarty

Structures_DataGrid_Renderer_XLS

Structures_DataGrid_Renderer_XML

Structures_DataGrid_Renderer_XUL

Structures_Form

Structures_Form_Gtk2

Structures_Graph

Structures_LinkedList

System_Command

System_Daemon

System_Folders

System_Mount

System_ProcWatch

System_SharedMemory

System_Socket

System_WinDrives

Testing_DocTest

Testing_FIT

Testing_Selenium

Text_CAPTCHA

Text_CAPTCHA_Numeral

Text_Diff

Text_Figlet

Text_Highlighter

Text_Huffman

Text_LanguageDetect

Text_Password

Text_PathNavigator

Text_Spell_Audio

Text_Statistics

Text_TeXHyphen

Text_Wiki

Text_Wiki_BBCode

Text_Wiki_Cowiki

Text_Wiki_Creole

Text_Wiki_Doku

Text_Wiki_Mediawiki

Text_Wiki_Tiki

Translation

Translation2

Tree

UDDI

URI_Template

Validate

Validate_AR

Validate_AT

Validate_AU

Validate_BE

Validate_CA

Validate_CH

Validate_DE

Validate_DK

Validate_ES

Validate_FI

Validate_Finance

Validate_Finance_CreditCard

Validate_FR

Validate_HU

Validate_IE

Validate_IN

Validate_IS

Validate_ISPN

Validate_IT

Validate_LV

Validate_NL

Validate_NZ

Validate_PL

Validate_ptBR

Validate_RU

Validate_UK

Validate_US

Validate_ZA

Var_Dump

VersionControl_SVN

VFS

XML_Beautifier

XML_CSSML

XML_DB_eXist

XML_DTD

XML_FastCreate

XML_Feed_Parser

XML_fo2pdf

XML_FOAF

XML_GRDDL

XML_HTMLSax

XML_HTMLSax3

XML_image2svg

XML_Indexing

XML_MXML

XML_NITF

XML_Parser

XML_Query2XML

XML_RDDL

XML_RPC

XML_RPC2

XML_RSS

XML_SaxFilters

XML_Serializer

XML_sql2xml

XML_Statistics

XML_SVG

XML_svg2image

XML_Transformer

XML_Tree

XML_Util

XML_Wddx

XML_XPath

XML_XPath2

XML_XSLT_Wrapper

XML_XUL

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/archive_tar/info.xml", '

Archive_Tar pear.php.net File Formats PHP License Tar file management class This class provides handling of tar files in PHP. It supports creating, listing, extracting and adding to tar files. Gzip support is available if PHP has the zlib extension built-in or loaded. Bz2 compression is also supported with the bz2 extension loaded.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/archive_tar/allreleases.xml", '

Archive_Tar

pear.php.net 1.2stable 1.1stable 1.0stable 0.10-b1beta 0.9stable 0.4stable 0.3stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/archive_tar/deps.1.3.1.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/archive_zip/info.xml", '

Archive_Zip pear.php.net File Formats PHP License Zip file management class This class provides handling of zip files in PHP. It supports creating, listing, extracting and adding to zip files.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/archive_zip/allreleases.xml", false, false); $pearweb->addRESTConfig("http://pear.php.net/rest/p/auth/info.xml", '

Auth pear.php.net Authentication PHP License Creating an authentication system. The PEAR::Auth package provides methods for creating an authentication system using PHP. Currently it supports the following storage containers to read/write the login data: * All databases supported by the PEAR database layer * All databases supported by the MDB database layer * All databases supported by the MDB2 database layer * Plaintext files * LDAP servers * POP3 servers * IMAP servers * vpopmail accounts * RADIUS * SAMBA password files * SOAP

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/auth/allreleases.xml", '

Auth

pear.php.net 1.3.0r3beta 1.3.0r2beta 1.3.0r1beta 1.2.3stable 1.2.2stable 1.2.1stable 1.2.0stable 1.1.1stable 1.1.0stable 1.0.2stable 1.0.1stable 1.0
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/auth/deps.1.3.0r3.txt", 'a:7:{i:1;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"0.9.5";s:8:"optional";s:3:"yes";s:4:"name";s:11:"File_Passwd";}i:2;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:3:"1.3";s:8:"optional";s:3:"yes";s:4:"name";s:8:"Net_POP3";}i:3;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:3:"yes";s:4:"name";s:2:"DB";}i:4;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:3:"yes";s:4:"name";s:3:"MDB";}i:5;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:3:"yes";s:4:"name";s:4:"MDB2";}i:6;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:3:"yes";s:4:"name";s:11:"Auth_RADIUS";}i:7;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:3:"yes";s:4:"name";s:14:"File_SMBPasswd";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/auth_enterprise/info.xml", '

Auth_Enterprise pear.php.net Authentication PHP License Enterprise quality Authentication and Authorization Service As the name implies, this package aims to provide an enterprise level authentication and authorization service. There are two parts to this package, the service layer which handles requests and a PHP5 client. Support for other clients (e.g. PHP4, Java, ASP/VB, etc) is possible further supporting cross-platform enterprise needs. Main features are: Web Service-based, implements notion of a Provider which is capable of hitting a specific data store (DBMS, LDAP, etc), Implements a single credential set across a single provider, 100% OO-PHP with the client producing a user object that can be serialized to a PHP session.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/auth_enterprise/allreleases.xml", false, false); $pearweb->addRESTConfig("http://pear.php.net/rest/p/auth_http/info.xml", '

Auth_HTTP pear.php.net Authentication PHP License HTTP authentication The PEAR::Auth_HTTP class provides methods for creating an HTTP authentication system using PHP, that is similar to Apache\'s realm-based .htaccess authentication.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/auth_http/allreleases.xml", '

Auth_HTTP

pear.php.net 2.1.6stable 2.1.6RC1beta 2.1.4stable 2.1.3rc1beta 2.1.1beta 2.1.0beta 2.1.0RC2beta 2.1RC1beta 2.0stable 1.0.1stable 1.0stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/auth_http/deps.2.1.6.txt", 'a:1:{s:8:"required";a:3:{s:3:"php";a:2:{s:3:"min";s:5:"4.1.0";s:3:"max";s:5:"6.0.0";}s:13:"pearinstaller";a:1:{s:3:"min";s:7:"1.4.0a2";}s:7:"package";a:3:{s:4:"name";s:4:"Auth";s:7:"channel";s:12:"pear.php.net";s:3:"min";s:5:"1.2.0";}}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/auth_prefmanager/info.xml", '

Auth_PrefManager pear.php.net Authentication PHP License Preferences management class Preference Manager is a class to handle user preferences in a web application, looking them up in a table using a combination of their userid, and the preference name to get a value, and (optionally) returning a default value for the preference if no value could be found for that user. It is designed to be used alongside the PEAR Auth class, but can be used with anything that allows you to obtain the user\'s id - including your own code.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/auth_prefmanager/allreleases.xml", '

Auth_PrefManager

pear.php.net 1.1.4stable 1.1.3stable 1.1.2stable 1.1.1stable 1.1.0stable 1.0.4stable 1.0.3stable 1.0.2stable 1.0.1stable 1.0stable 0.2.31stable 0.2.3devel 0.2.2devel 0.2.1devel 0.2.0devel 0.11devel
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/auth_prefmanager/deps.1.1.4.txt", 'a:1:{i:1;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.6.0";s:4:"name";s:2:"DB";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/auth_prefmanager2/info.xml", '

Auth_PrefManager2 pear.php.net Authentication PHP License Preferences management class Preference Manager is a class to handle user preferences in a web application, looking them up in a table using a combination of their userid, and the preference name to get a value, and (optionally) returning a default value for the preference if no value could be found for that user. Auth_PrefManager2 supports data containers to allow reading/writing with different sources, currently PEAR DB and a simple array based container are supported, although support is planned for an LDAP container as well. If you don\'t need support for different sources, or setting preferences for multiple applications you should probably use Auth_PrefManager instead.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/auth_prefmanager2/allreleases.xml", '

Auth_PrefManager2

pear.php.net 2.0.0dev1alpha
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/auth_prefmanager2/deps.2.0.0dev1.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/auth_radius/info.xml", '

Auth_RADIUS pear.php.net Authentication BSD Wrapper Classes for the RADIUS PECL. This package provides wrapper-classes for the RADIUS PECL. There are different Classes for the different authentication methods. If you are using CHAP-MD5 or MS-CHAP you need also the Crypt_CHAP package. If you are using MS-CHAP you need also the mhash and mcrypt extension.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/auth_radius/allreleases.xml", '

Auth_RADIUS

pear.php.net 1.0.4stable 1.0.3stable 1.0.2stable 1.0.1stable 1.0stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/auth_radius/deps.1.0.4.txt", 'a:1:{i:1;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.2.4";s:4:"name";s:6:"radius";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/auth_sasl/info.xml", '

Auth_SASL pear.php.net Authentication BSD Abstraction of various SASL mechanism responses Provides code to generate responses to common SASL mechanisms, including: o Digest-MD5 o CramMD5 o Plain o Anonymous o Login (Pseudo mechanism)

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/auth_sasl/allreleases.xml", '

Auth_SASL

pear.php.net 1.0.1stable 1.0.0stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/auth_sasl/deps.1.0.1.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/benchmark/info.xml", '

Benchmark pear.php.net Benchmarking PHP License Framework to benchmark PHP scripts or function calls. Framework to benchmark PHP scripts or function calls.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/benchmark/allreleases.xml", '

Benchmark

pear.php.net 1.2.3stable 1.2.2stable 1.2.2beta1beta 1.2.1stable 1.2stable 1.1stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/benchmark/deps.1.2.3.txt", 'a:1:{i:1;a:4:{s:4:"type";s:3:"ext";s:3:"rel";s:3:"has";s:8:"optional";s:3:"yes";s:4:"name";s:6:"bcmath";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/cache/info.xml", '

Cache pear.php.net Caching PHP License Framework for caching of arbitrary data. With the PEAR Cache you can cache the result of certain function calls, as well as the output of a whole script run or share data between applications.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/cache/allreleases.xml", '

Cache

pear.php.net 1.5.5RC4beta 1.5.5RC3beta 1.5.5RC2beta 1.5.5RC1beta 1.5.4stable 1.5.3stable 1.5.2stable 1.5.1stable 1.5stable 1.4stable 1.3stable 1.2
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/cache/deps.1.5.5RC4.txt", 'a:2:{i:1;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.3.5";s:8:"optional";s:2:"no";s:4:"name";s:4:"PEAR";}i:2;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:3:"yes";s:4:"name";s:12:"HTTP_Request";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/cache_lite/info.xml", '

Cache_Lite pear.php.net Caching lgpl Fast and Safe little cache system This package is a little cache system optimized for file containers. It is fast and safe (because it uses file locking and/or anti-corruption tests).

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/cache_lite/allreleases.xml", '

Cache_Lite

pear.php.net 1.5.2stable 1.5.1stable 1.5.0beta 1.4.1stable 1.4.0stable 1.4.0beta1beta 1.3.1stable 1.3stable 1.2stable 1.1stable 1.0.1stable 1.0stable 0.4beta 0.3beta 0.2.0beta 0.1.1beta 0.1beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/cache_lite/deps.1.5.2.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/calendar/info.xml", '

Calendar pear.php.net Date and Time PHP A package for building Calendar data structures (irrespective of output) Calendar provides an API for building Calendar data structures. Using the simple iterator and it\'s "query" API, a user interface can easily be built on top of the calendar data structure, at the same time easily connecting it to some kind of underlying data store, where "event" information is being held. It provides different calculation "engines" the default being based on Unix timestamps (offering fastest performance) with an alternative using PEAR::Date which extends the calendar past the limitations of Unix timestamps. Other engines should be implementable for other types of calendar (e.g. a Chinese Calendar based on lunar cycles).

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/calendar/allreleases.xml", '

Calendar

pear.php.net 0.5.2beta 0.5.1beta 0.5beta 0.4beta 0.3beta 0.2beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/calendar/deps.0.5.2.txt", 'a:2:{i:1;a:3:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"4.0.5";}i:2;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:3:"yes";s:4:"name";s:4:"Date";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/codegen/info.xml", '

CodeGen pear.php.net Tools and Utilities PHP Tool to create Code generaters that operate on XML descriptions This is an \'abstract\' package, it provides the base framework for applications like CodeGen_PECL and CodeGen_MySqlUDF (not released yet).

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/codegen/allreleases.xml", '

CodeGen

pear.php.net 1.0.0rc1beta 0.9.0beta 0.9.0rc1beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/codegen/deps.1.0.0rc1.txt", 'a:3:{i:1;a:3:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:1:"5";}i:2;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:3:"1.3";s:4:"name";s:4:"PEAR";}i:3;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:3:"1.0";s:4:"name";s:14:"Console_Getopt";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/codegen_mysql_udf/info.xml", '

CodeGen_MySQL_UDF pear.php.net Tools and Utilities PHP Tool to generate MySQL UDF extensions from an XML description UDF_Gen is a code generator for MySQL User Defined Function (UDF) extensions similar to PECL_Gen for PHP. It reads in configuration options, function prototypes and code fragments from an XML description file and generates a complete ready-to-compile UDF extension. Preliminary documentation can be found here: http://talks.php.net/show/UDF_Gen

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/codegen_mysql_udf/allreleases.xml", '

CodeGen_MySQL_UDF

pear.php.net 0.9.2devalpha
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/codegen_mysql_udf/deps.0.9.2dev.txt", 'a:3:{i:1;a:3:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:3:"5.0";}i:2;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:3:"1.2";s:4:"name";s:4:"PEAR";}i:3;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:3:"0.9";s:4:"name";s:7:"CodeGen";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/codegen_pecl/info.xml", '

CodeGen_PECL pear.php.net Tools and Utilities PHP Tool to generate PECL extensions from an XML description CodeGen_PECL (formerly known as PECL_Gen) is a pure PHP replacement for the ext_skel shell script that comes with the PHP 4 source. It reads in configuration options, function prototypes and code fragments from an XML description file and generates a complete ready-to-compile PECL extension.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/codegen_pecl/allreleases.xml", '

CodeGen_PECL

pear.php.net 1.0.0rc1beta 0.9.0beta 0.9.0rc5beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/codegen_pecl/deps.1.0.0rc1.txt", 'a:3:{i:1;a:3:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:1:"5";}i:2;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:3:"1.2";s:4:"name";s:4:"PEAR";}i:3;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:3:"0.9";s:4:"name";s:7:"CodeGen";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/config/info.xml", '

Config pear.php.net Configuration PHP License Your configurations swiss-army knife. The Config package provides methods for configuration manipulation. * Creates configurations from scratch * Parses and outputs different formats (XML, PHP, INI, Apache...) * Edits existing configurations * Converts configurations to other formats * Allows manipulation of sections, comments, directives... * Parses configurations into a tree structure * Provides XPath like access to directives

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/config/allreleases.xml", '

Config

pear.php.net 1.10.4stable 1.10.3stable 1.10.2stable 1.10.1stable 1.10stable 1.9stable 1.8.1stable 1.8stable 1.7stable 1.6stable 1.5stable 1.4stable 1.3stable 1.2stable 1.1beta 1.0beta 0.3.1stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/config/deps.1.10.4.txt", 'a:2:{i:1;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:3:"yes";s:4:"name";s:10:"XML_Parser";}i:2;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:3:"yes";s:4:"name";s:8:"XML_Util";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/console_color/info.xml", '

Console_Color pear.php.net Console PHP This Class allows you to easily use ANSI console colors in your application. You can use Console_Color::convert to transform colorcodes like %r into ANSI control codes. print Console_Color::convert("%rHello World!%n"); would print "Hello World" in red, for example.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/console_color/allreleases.xml", '

Console_Color

pear.php.net 0.0.3beta 0.0.2beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/console_color/deps.0.0.3.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/console_getargs/info.xml", '

Console_Getargs pear.php.net Console PHP License A command-line arguments parser The Console_Getargs package implements a Command Line arguments and parameters parser for your CLI applications. It performs some basic arguments validation and automatically creates a formatted help text, based on the given configuration.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/console_getargs/allreleases.xml", '

Console_Getargs

pear.php.net 1.3.0stable 1.2.1stable 1.2.0stable 1.1.0stable 1.0.0stable 0.1.0beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/console_getargs/deps.1.3.0.txt", 'a:1:{i:1;a:3:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"4.1.0";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/console_getopt/info.xml", '

Console_Getopt pear.php.net Console PHP License Command-line option parser This is a PHP implementation of "getopt" supporting both short and long options.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/console_getopt/allreleases.xml", '

Console_Getopt

pear.php.net 1.2stable 1.0stable 0.11beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/console_getopt/deps.1.2.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/console_progressbar/info.xml", '

Console_ProgressBar pear.php.net Console PHP This class provides you with an easy-to-use interface to progress bars. The class allows you to display progress bars in your terminal. You can use this for displaying the status of downloads or other tasks that take some time.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/console_progressbar/allreleases.xml", '

Console_ProgressBar

pear.php.net 0.2beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/console_progressbar/deps.0.2.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/console_table/info.xml", '

Console_Table pear.php.net Console BSD Class that makes it easy to build console style tables Provides methods such as addRow(), insertRow(), addCol() etc to build Console tables. Can be with or without headers, and has various configurable options.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/console_table/allreleases.xml", '

Console_Table

pear.php.net 1.0.2stable 1.0.1stable 1.0stable 0.8beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/console_table/deps.1.0.2.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/contact_addressbook/info.xml", '

Contact_AddressBook pear.php.net File Formats BSD License Address book export-import class Package provide export-import address book mechanism. Contact_AddressBook refers to needed structure, convert the various address book structure format into it, then you can easily to store it into file, database or another storage media. Current supported formats: 1. Ms Windows Address Book (WAB) CSV 2. Ms Outlook CSV 3. Mozilla Mailer/Thunderbird/Netscape Mailer CSV 4. KMail Address Book CSV 5. Yahoo! Mail Address Book CSV 6. Palm Pilot Address Book CSV 7. Eudora Address Book

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/contact_addressbook/allreleases.xml", '

Contact_AddressBook

pear.php.net 0.4.0alpha1alpha 0.1.0dev1devel
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/contact_addressbook/deps.0.4.0alpha1.txt", 'a:3:{i:1;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.2.1";s:8:"optional";s:2:"no";s:4:"name";s:4:"PEAR";}i:2;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.2.1";s:8:"optional";s:2:"no";s:4:"name";s:4:"File";}i:3;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"2.0.1";s:8:"optional";s:2:"no";s:4:"name";s:20:"Net_UserAgent_Detect";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/contact_vcard_build/info.xml", '

Contact_Vcard_Build pear.php.net File Formats PHP License Build (create) and fetch vCard 2.1 and 3.0 text blocks. Allows you to programmatically create a vCard, version 2.1 or 3.0, and fetch the vCard text.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/contact_vcard_build/allreleases.xml", '

Contact_Vcard_Build

pear.php.net 1.1.1stable 1.1stable 1.0stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/contact_vcard_build/deps.1.1.1.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/contact_vcard_parse/info.xml", '

Contact_Vcard_Parse pear.php.net File Formats PHP License Parse vCard 2.1 and 3.0 files. Allows you to parse vCard files and text blocks, and get back an array of the elements of each vCard in the file or text.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/contact_vcard_parse/allreleases.xml", '

Contact_Vcard_Parse

pear.php.net 1.31.0stable 1.30stable 1.21stable 1.2stable 1.1stable 1.0stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/contact_vcard_parse/deps.1.31.0.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/crypt_blowfish/info.xml", '

Crypt_Blowfish pear.php.net Encryption PHP Allows for quick two-way blowfish encryption without requiring the Mcrypt PHP extension. This package allows you to preform two-way blowfish on the fly using only PHP. This package does not require the Mcrypt PHP extension to work.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/crypt_blowfish/allreleases.xml", '

Crypt_Blowfish

pear.php.net 1.0.1stable 1.0.0stable 0.8.1beta 0.7.0beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/crypt_blowfish/deps.1.0.1.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/crypt_cbc/info.xml", '

Crypt_CBC pear.php.net Encryption PHP 2.02 A class to emulate Perl\'s Crypt::CBC module. A class to emulate Perl\'s Crypt::CBC module.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/crypt_cbc/allreleases.xml", '

Crypt_CBC

pear.php.net 0.4stable 0.3stable 0.2stable 0.1stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/crypt_cbc/deps.0.4.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/crypt_chap/info.xml", '

Crypt_CHAP pear.php.net Encryption BSD Generating CHAP packets. This package provides Classes for generating CHAP packets. Currently these types of CHAP are supported: * CHAP-MD5 * MS-CHAPv1 * MS-CHAPv2 For MS-CHAP the mhash and mcrypt extensions must be loaded.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/crypt_chap/allreleases.xml", '

Crypt_CHAP

pear.php.net 1.0.0stable 0.8.6alpha 0.8.5alpha 0.8.2alpha
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/crypt_chap/deps.1.0.0.txt", 'a:2:{i:1;a:3:{s:4:"type";s:3:"ext";s:3:"rel";s:3:"has";s:4:"name";s:5:"mhash";}i:2;a:3:{s:4:"type";s:3:"ext";s:3:"rel";s:3:"has";s:4:"name";s:6:"mcrypt";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/crypt_crypt/info.xml", '

Crypt_Crypt pear.php.net Encryption BSD Abstraction class for encryption algorithms A generic class that allows a user to use a single set of functions to perform encryption and decryption. The class prefers to use native extensions like mcrypt, but will automatically attempt to load crypto modules written in php if the requested algorithm is unsupported natively or by extensions. **NEWS** After a long hiatus, this is an active project again. Updates will be posted as I get back up to speed. Please contact the project lead with questions or suggestions.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/crypt_crypt/allreleases.xml", false, false); $pearweb->addRESTConfig("http://pear.php.net/rest/p/crypt_hmac/info.xml", '

Crypt_HMAC pear.php.net Encryption PHP A class to calculate RFC 2104 compliant hashes. A class to calculate RFC 2104 compliant hashes.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/crypt_hmac/allreleases.xml", '

Crypt_HMAC

pear.php.net 1.0.1stable 1.0.0stable 0.9beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/crypt_hmac/deps.1.0.1.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/crypt_rc4/info.xml", '

Crypt_RC4 pear.php.net Encryption PHP Encryption class for RC4 encryption RC4 encryption class

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/crypt_rc4/allreleases.xml", '

Crypt_RC4

pear.php.net 1.0.2stable 1.0.1stable 1.0stable 0.1stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/crypt_rc4/deps.1.0.2.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/crypt_rsa/info.xml", '

Crypt_RSA pear.php.net Encryption PHP Provides RSA-like key generation, encryption/decryption, signing and signature checking This package allows you to use two-key strong cryptography like RSA with arbitrary key length. It uses one of the following extensions for math calculations: - PECL big_int extension ( http://pecl.php.net/packages/big_int ) version greater than or equal to 1.0.3 - PHP GMP extension ( http://php.net/gmp ) - PHP BCMath extension ( http://php.net/manual/en/ref.bc.php ) for both PHP4 and PHP5

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/crypt_rsa/allreleases.xml", '

Crypt_RSA

pear.php.net 1.0.0stable 1.0.0RC6beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/crypt_rsa/deps.1.0.0.txt", 'a:3:{i:1;a:4:{s:4:"type";s:3:"ext";s:3:"rel";s:3:"has";s:8:"optional";s:3:"yes";s:4:"name";s:6:"bcmath";}i:2;a:4:{s:4:"type";s:3:"ext";s:3:"rel";s:3:"has";s:8:"optional";s:3:"yes";s:4:"name";s:3:"gmp";}i:3;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.0.3";s:8:"optional";s:3:"yes";s:4:"name";s:7:"big_int";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/crypt_xtea/info.xml", '

Crypt_Xtea pear.php.net Encryption PHP 2.02 A class that implements the Tiny Encryption Algorithm (TEA) (New Variant). A class that implements the Tiny Encryption Algorithm (TEA) (New Variant). This class does not depend on mcrypt. Since the latest fix handles properly dealing with unsigned integers, which where solved by introducing new functions _rshift(), _add(), the speed of the encryption and decryption has radically dropped. Do not use for large amounts of data. Original code from http://vader.brad.ac.uk/tea/source.shtml#new_ansi Currently to be found at: http://www.simonshepherd.supanet.com/source.shtml#new_ansi

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/crypt_xtea/allreleases.xml", '

Crypt_Xtea

pear.php.net 1.1.0RC4beta 1.1.0RC3beta 1.1.0RC2beta 1.1.0RC1beta 1.0stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/crypt_xtea/deps.1.1.0RC4.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/date/info.xml", '

Date pear.php.net Date and Time PHP License Date and Time Zone Classes Generic classes for representation and manipulation of dates, times and time zones without the need of timestamps, which is a huge limitation for php programs. Includes time zone data, time zone conversions and many date/time conversions. It does not rely on 32-bit system date stamps, so you can display calendars and compare dates that date pre 1970 and post 2038. This package also provides a class to convert date strings between Gregorian and Human calendar formats.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/date/allreleases.xml", '

Date

pear.php.net 1.4.3stable 1.4.2stable 1.4.1stable 1.4stable 1.4rc1beta 1.3.1betabeta 1.3stable 1.2stable 1.1stable 1.0stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/date/deps.1.4.3.txt", 'a:1:{i:1;a:3:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:3:"4.2";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/date_holidays/info.xml", '

Date_Holidays pear.php.net Date and Time PHP License Driver based class to calculate holidays. Date_Holidays helps you calculating the dates and titles of holidays and other special celebrations. The calculation is driver-based so it is easy to add new drivers that calculate a country\'s holidays. The methods of the class can be used to get a holiday\'s date and title in various languages.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/date_holidays/allreleases.xml", '

Date_Holidays

pear.php.net 0.13.0alpha 0.12.0alpha 0.11.0alpha 0.10.0alpha 0.9.0alpha
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/date_holidays/deps.0.13.0.txt", 'a:2:{i:1;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.3.1";s:8:"optional";s:2:"no";s:4:"name";s:4:"PEAR";}i:2;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:2:"no";s:4:"name";s:4:"Date";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/db/info.xml", '

DB pear.php.net Database PHP License Database Abstraction Layer DB is a database abstraction layer providing: * an OO-style query API * portability features that make programs written for one DBMS work with other DBMS\'s * a DSN (data source name) format for specifying database servers * prepare/execute (bind) emulation for databases that don\'t support it natively * a result object for each query response * portable error codes * sequence emulation * sequential and non-sequential row fetching as well as bulk fetching * formats fetched rows as associative arrays, ordered arrays or objects * row limit support * transactions support * table information interface * DocBook and phpDocumentor API documentation DB layers itself on top of PHP\'s existing database extensions. Drivers for the following extensions pass the complete test suite and provide interchangeability when all of DB\'s portability options are enabled: fbsql, ibase, informix, msql, mssql, mysql, mysqli, oci8, odbc, pgsql, sqlite and sybase. There is also a driver for the dbase extension, but it can\'t be used interchangeably because dbase doesn\'t support many standard DBMS features. DB is compatible with both PHP 4 and PHP 5.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/db/allreleases.xml", '

DB

pear.php.net 1.7.6stable 1.7.5stable 1.7.4stable 1.7.3stable 1.7.2stable 1.7.1stable 1.7.0stable 1.7.0RC1beta 1.6.8stable 1.6.7stable 1.6.6stable 1.6.5stable 1.6.4stable 1.6.3stable 1.6.2stable 1.6.1stable 1.6.0stable 1.6.0RC6stable 1.6.0RC5beta 1.6.0RC4beta 1.6.0RC3beta 1.6.0RC2beta 1.6.0RC1beta 1.5.0RC2stable 1.5.0RC1stable 1.4.0stable 1.4b1beta 1.3stable 1.2stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/db/deps.1.7.6.txt", 'a:2:{i:1;a:3:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"4.2.0";}i:2;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.0b1";s:4:"name";s:4:"PEAR";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/dba/info.xml", '

DBA pear.php.net Database LGPL Berkely-style database abstraction class DBA is a wrapper for the php DBA functions. It includes a file-based emulator and provides a uniform, object-based interface for the Berkeley-style database systems.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/dba/allreleases.xml", '

DBA

pear.php.net 1.1stable 1.0stable 1.0-rc1stable 0.9.5beta 0.9.4beta 0.9.3beta 0.9.2beta 0.9.1beta 0.9beta 0.18devel 0.17devel 0.16beta 0.15beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/dba/deps.1.1.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/dba_relational/info.xml", '

DBA_Relational pear.php.net Database LGPL Berkely-style database abstraction class Table management extension to DBA

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/dba_relational/allreleases.xml", '

DBA_Relational

pear.php.net 0.19devel
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/dba_relational/deps.0.19.txt", 'a:2:{i:1;a:3:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:8:"4.0.4pl1";}i:2;a:3:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:4:"name";s:3:"DBA";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/db_ado/info.xml", '

DB_ado pear.php.net Database LGPL DB driver which use MS ADODB library DB_ado is a database independent query interface definition for Microsoft\'s ADODB library using PHP\'s COM extension. This class allows you to connect to different data sources like MS Access, MS SQL Server, Oracle and other RDBMS on a Win32 operating system. Moreover the possibility exists to use MS Excel spreadsheets, XML, text files and other not relational data as data source.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/db_ado/allreleases.xml", '

DB_ado

pear.php.net 1.3stable 1.2stable 1.1stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/db_ado/deps.1.3.txt", 'a:3:{i:1;a:3:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:3:"4.1";}i:2;a:3:{s:4:"type";s:3:"ext";s:3:"rel";s:3:"has";s:4:"name";s:3:"com";}i:3;a:3:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:4:"name";s:2:"DB";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/db_dataobject/info.xml", '

DB_DataObject pear.php.net Database PHP License An SQL Builder, Object Interface to Database Tables DataObject performs 2 tasks: 1. Builds SQL statements based on the objects vars and the builder methods. 2. acts as a datastore for a table row. The core class is designed to be extended for each of your tables so that you put the data logic inside the data classes. included is a Generator to make your configuration files and your base classes.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/db_dataobject/allreleases.xml", '

DB_DataObject

pear.php.net 1.7.15stable 1.7.14stable 1.7.13stable 1.7.12stable 1.7.11stable 1.7.10stable 1.7.9stable 1.7.8stable 1.7.7stable 1.7.6stable 1.7.5stable 1.7.2stable 1.7.1stable 1.7.0stable 1.6.1stable 1.6.0stable 1.5.3stable 1.5.2stable 1.5.1stable 1.5stable 1.4stable 1.3stable 1.2stable 1.1stable 1.0.2stable 1.0.1stable 1.0stable 0.19stable 0.18stable 0.17stable 0.16stable 0.15stable 0.14stable 0.13stable 0.12stable 0.11stable 0.10stable 0.9stable 0.8stable 0.6beta 0.5beta 0.4beta 0.3beta 0.2beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/db_dataobject/deps.1.7.15.txt", 'a:4:{i:1;a:3:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:3:"4.3";}i:2;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.7.0";s:4:"name";s:2:"DB";}i:3;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"0.1.1";s:8:"optional";s:3:"yes";s:4:"name";s:8:"Validate";}i:4;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.4.3";s:4:"name";s:4:"Date";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/db_dataobject_formbuilder/info.xml", '

DB_DataObject_FormBuilder pear.php.net Database PHP License Class to automatically build HTML_QuickForm objects from a DB_DataObject-derived class DB_DataObject_FormBuilder will aid you in rapid application development using the packages DB_DataObject and HTML_QuickForm. For having a quick but working prototype of your application, simply model the database, run DataObject\'s createTable script over it and write a script that passes one of the resulting objects to the FormBuilder class. The FormBuilder will automatically generate a simple but working HTML_QuickForm object that you can use to test your application. It also provides a processing method that will automatically detect if an insert() or update() command has to be executed after the form has been submitted. If you have set up DataObject\'s links.ini file correctly, it will also automatically detect if a table field is a foreign key and will populate a selectbox with the linked table\'s entries. There are many optional parameters that you can place in your DataObjects.ini or in the properties of your derived classes, that you can use to fine-tune the form-generation, gradually turning the prototypes into fully-featured forms, and you can take control at any stage of the process.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/db_dataobject_formbuilder/allreleases.xml", '

DB_DataObject_FormBuilder

pear.php.net 0.18.1beta 0.18.0beta 0.17.2beta 0.17.1beta 0.17.0alpha 0.16.0alpha 0.15.0beta 0.14.0beta 0.13.3beta 0.13.2beta 0.13.1beta 0.13.0beta 0.12.1beta 0.12.0beta 0.11.5beta 0.11.4beta 0.11.3beta 0.11.2beta 0.11.1beta 0.10.3beta 0.10.2beta 0.10.1beta 0.10.0beta 0.9.0beta 0.8.2beta 0.8.1beta 0.8beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/db_dataobject_formbuilder/deps.0.18.1.txt", 'a:2:{s:8:"required";a:3:{s:3:"php";a:1:{s:3:"min";s:5:"4.3.0";}s:13:"pearinstaller";a:1:{s:3:"min";s:7:"1.4.0a1";}s:7:"package";a:2:{i:0;a:2:{s:4:"name";s:13:"DB_DataObject";s:7:"channel";s:12:"pear.php.net";}i:1;a:3:{s:4:"name";s:14:"HTML_QuickForm";s:7:"channel";s:12:"pear.php.net";s:3:"min";s:5:"3.2.4";}}}s:8:"optional";a:1:{s:7:"package";a:2:{i:0;a:2:{s:4:"name";s:4:"Date";s:7:"channel";s:12:"pear.php.net";}i:1;a:2:{s:4:"name";s:10:"HTML_Table";s:7:"channel";s:12:"pear.php.net";}}}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/db_ldap/info.xml", '

DB_ldap pear.php.net Database LGPL DB interface to LDAP server The PEAR::DB_ldap class provides a DB compliant interface to LDAP servers

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/db_ldap/allreleases.xml", '

DB_ldap

pear.php.net 1.1.1stable 1.1.0stable 1.1stable 1.0stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/db_ldap/deps.1.1.1.txt", 'a:2:{i:1;a:3:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:4:"name";s:4:"PEAR";}i:2;a:3:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:4:"name";s:2:"DB";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/db_ldap2/info.xml", '

DB_ldap2 pear.php.net Database LGPL DB drivers for LDAP v2 and v3 database DB_ldap2 and DB_ldap3 classes extend DB_common to provide DB compliant access to LDAP servers with protocol version 2 and 3. The drivers provide common DB interface as much as possible and support prepare/execute statements.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/db_ldap2/allreleases.xml", '

DB_ldap2

pear.php.net 0.4beta 0.3beta 0.2devel 0.1devel
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/db_ldap2/deps.0.4.txt", 'a:2:{i:1;a:3:{s:4:"type";s:3:"ext";s:3:"rel";s:3:"has";s:4:"name";s:4:"ldap";}i:2;a:3:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:4:"name";s:2:"DB";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/db_nestedset/info.xml", '

DB_NestedSet pear.php.net Database PHP License API to build and query nested sets DB_NestedSet let\'s you create trees with infinite depth inside a relational database. The package provides a way to o create/update/delete nodes o query nodes, trees and subtrees o copy (clone) nodes, trees and subtrees o move nodes, trees and subtrees o Works with PEAR::DB, PEAR::MDB, PEAR::MDB2 o output the tree with - PEAR::HTML_TreeMenu - TigraMenu (http://www.softcomplex.com/products/tigra_menu/) - CoolMenus (http://www.dhtmlcentral.com/projects/coolmenus/) - PEAR::Image_GraphViz (http://pear.php.net/package/Image_GraphViz) - PEAR::HTML_Menu

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/db_nestedset/allreleases.xml", '

DB_NestedSet

pear.php.net 1.3.6beta 1.3.5beta 1.3.4beta 1.3.3beta 1.3.2beta 1.3.1beta 1.3beta 1.2.4stable 1.2.3stable 1.2.2stable 1.2.1stable 1.2stable 1.1-betabeta 1.0-betabeta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/db_nestedset/deps.1.3.6.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/db_odbtp/info.xml", '

DB_odbtp pear.php.net Database PHP DB interface for ODBTP DB_odbtp is a PEAR DB driver that uses the ODBTP extension to connect to a database. It can be used to remotely access any Win32-ODBC accessible database from any platform.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/db_odbtp/allreleases.xml", '

DB_odbtp

pear.php.net 1.0.3stable 1.0.2stable 1.0.1RC1beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/db_odbtp/deps.1.0.3.txt", 'a:2:{i:1;a:3:{s:4:"type";s:3:"ext";s:3:"rel";s:3:"has";s:4:"name";s:5:"odbtp";}i:2;a:3:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:4:"name";s:2:"DB";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/db_pager/info.xml", '

DB_Pager pear.php.net Database LGPL Retrieve and return information of database result sets This class handles all the stuff needed for displaying paginated results from a database query of Pear DB. including fetching only the needed rows and giving extensive information for helping build an HTML or GTK query result display.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/db_pager/allreleases.xml", '

DB_Pager

pear.php.net 0.7stable 0.6stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/db_pager/deps.0.7.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/db_querytool/info.xml", '

DB_QueryTool pear.php.net Database PHP An OO-interface for easily retrieving and modifying data in a DB. This package is an OO-abstraction to the SQL-Query language, it provides methods such as setWhere, setOrder, setGroup, setJoin, etc. to easily build queries. It also provides an easy to learn interface that interacts nicely with HTML-forms using arrays that contain the column data, that shall be updated/added in a DB. This package bases on an SQL-Builder which lets you easily build SQL-Statements and execute them.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/db_querytool/allreleases.xml", '

DB_QueryTool

pear.php.net 1.0.1stable 1.0.0stable 0.11.1stable 0.10.1stable 0.9.8stable 0.9.7stable 0.9.6stable 0.9.5stable 0.9.4stable 0.9.3stable 0.9.2stable 0.9.1stable 0.9stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/db_querytool/deps.1.0.1.txt", 'a:2:{i:1;a:3:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:4:"name";s:2:"DB";}i:2;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:3:"1.7";s:4:"name";s:3:"Log";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/db_sqlite_tools/info.xml", '

DB_Sqlite_Tools pear.php.net Database BSD License DB_Sqlite_Tools is an object oriented interface to effectively manage and backup Sqlite databases. DB_Sqlite_Tools is an object oriented interface to effectively manage and backup Sqlite databases.It extends the existing functionality by providing a comprehensive solution for database backup, live replication, export in XML format, performance optmization and other functionalities like the insertion and retrieval of encrypted data from an Sqlite database without any external extension.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/db_sqlite_tools/allreleases.xml", '

DB_Sqlite_Tools

pear.php.net 0.1.3alpha 0.1.2alpha 0.1.1alpha 0.1.0alpha
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/db_sqlite_tools/deps.0.1.3.txt", 'a:1:{i:1;a:4:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"5.0.0";s:8:"optional";s:2:"no";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/db_table/info.xml", '

DB_Table pear.php.net Database LGPL Builds on PEAR DB to abstract datatypes and automate table creation, data validation, insert, update, delete, and select; combines these with PEAR HTML_QuickForm to automatically generate input forms that match the table column definitions. Builds on PEAR DB to abstract datatypes and automate table creation, data validation, insert, update, delete, and select; combines these with PEAR HTML_QuickForm to automatically generate input forms that match the table column definitions.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/db_table/allreleases.xml", '

DB_Table

pear.php.net 1.2.1stable 1.2.0stable 1.1.0stable 1.0.1stable 1.0.0stable 1.0.0RC1beta 0.23.0beta 0.22.0beta 0.21.2alpha 0.21.1alpha 0.21alpha 0.18alpha 0.17alpha
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/db_table/deps.1.2.1.txt", 'a:3:{i:1;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:2:"no";s:4:"name";s:2:"DB";}i:2;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:2:"no";s:4:"name";s:4:"Date";}i:3;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:3:"yes";s:4:"name";s:14:"HTML_QuickForm";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/event_dispatcher/info.xml", '

Event_Dispatcher pear.php.net Event BSD License Dispatch notifications using PHP callbacks The Event_Dispatcher acts as a notification dispatch table. It is used to notify other objects of interesting things. This information is encapsulated in Event_Notification objects. Client objects register themselves with the Event_Dispatcher as observers of specific notifications posted by other objects. When an event occurs, an object posts an appropriate notification to the Event_Dispatcher. The Event_Dispatcher dispatches a message to each registered observer, passing the notification as the sole argument.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/event_dispatcher/allreleases.xml", '

Event_Dispatcher

pear.php.net 0.9.1beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/event_dispatcher/deps.0.9.1.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/file/info.xml", '

File pear.php.net File System PHP Common file and directory routines Provides easy access to read/write to files along with some common routines to deal with paths. Also provides interface for handling CSV files.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/file/allreleases.xml", '

File

pear.php.net 1.1.0RC5beta 1.1.0RC4beta 1.1.0RC3beta 1.1.0RC2beta 1.1.0RC1beta 1.0.3stable 1.0.2stable 1.0.1stable 1.0.0stable 0.9.2beta 0.9.1beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/file/deps.1.2.2.txt", 'a:4:{i:1;a:4:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"4.2.0";s:8:"optional";s:2:"no";}i:2;a:4:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"4.3.0";s:8:"optional";s:3:"yes";}i:3;a:4:{s:4:"type";s:3:"ext";s:3:"rel";s:3:"has";s:8:"optional";s:2:"no";s:4:"name";s:4:"pcre";}i:4;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:2:"no";s:4:"name";s:4:"PEAR";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/file_archive/info.xml", '

File_Archive pear.php.net File Formats LGPL File_Archive will let you manipulate easily the tar, gz, tgz, bz2, tbz, zip, ar (or deb) files This library is strongly object oriented. It makes it very easy to use, writing simple code, yet the library is very powerfull. It lets you easily read or generate tar, gz, tgz, bz2, tbz, zip, ar (or deb) archives to files, memory, mail or standard output. See http://poocl.la-grotte.org for a tutorial

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/file_archive/allreleases.xml", '

File_Archive

pear.php.net 1.5.3stable 1.5.2stable 1.5.1stable 1.5.0stable 1.4.1stable 1.4.0stable 1.3.0stable 1.2.0stable 1.1.0stable 1.0.1stable 1.0.0stable 0.3.0beta 0.2.0beta 0.1.0alpha
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/file_archive/deps.1.5.3.txt", 'a:5:{i:1;a:3:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"4.3.0";}i:2;a:3:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:4:"name";s:9:"MIME_Type";}i:3;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:3:"yes";s:4:"name";s:9:"Mail_Mime";}i:4;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:3:"yes";s:4:"name";s:4:"Mail";}i:5;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.5.0";s:8:"optional";s:3:"yes";s:4:"name";s:10:"Cache_Lite";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/file_bittorrent/info.xml", '

File_Bittorrent pear.php.net File Formats PHP License Decode and Encode data in Bittorrent format This package consists of three classes which handles the encoding and decoding of data in Bittorrent format. You can also extract useful informations from .torrent files, create .torrent files and query the torrent\'s scrape page to get its statistics.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/file_bittorrent/allreleases.xml", '

File_Bittorrent

pear.php.net 1.0.0RC2beta 1.0.0RC1beta 0.1.8beta 0.1.7beta 0.1.6beta 0.1.5beta 0.1.4beta 0.1.3beta 0.1.2alpha
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/file_bittorrent/deps.1.0.0RC2.txt", 'a:1:{i:1;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.1.0";s:4:"name";s:10:"PHP_Compat";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/file_dicom/info.xml", '

File_DICOM pear.php.net File Formats LGPL Package for reading and modifying DICOM files File_DICOM allows reading and modifying of DICOM files. DICOM stands for Digital Imaging and COmmunications in Medicine, and is a standard for creating, storing and transfering digital images (X-rays, tomography) and related information used in medicine. This package in particular does not support the exchange/transfer of DICOM data, nor any network related functionality. More information on the DICOM standard can be found at: http://medical.nema.org/ Please be aware that any use of the information produced by this package for diagnosing purposes is strongly discouraged by the author. See http://www.gnu.org/licenses/lgpl.html for more information.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/file_dicom/allreleases.xml", '

File_DICOM

pear.php.net 0.3beta 0.2beta 0.1alpha
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/file_dicom/deps.0.3.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/file_dns/info.xml", '

File_DNS pear.php.net File Formats PHP License Manipulate RFC1033-style DNS Zonefiles The File_DNS class provides a way to read, edit and write RFC1033 style DNS Zones.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/file_dns/allreleases.xml", '

File_DNS

pear.php.net 0.0.8devel
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/file_dns/deps.0.0.8.txt", 'a:2:{i:1;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:2:"no";s:4:"name";s:4:"File";}i:2;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:2:"no";s:4:"name";s:4:"PEAR";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/file_find/info.xml", '

File_Find pear.php.net File System PHP A Class the facillitates the search of filesystems File_Find, created as a replacement for its Perl counterpart, also named File_Find, is a directory searcher, which handles, globbing, recursive directory searching, as well as a slew of other cool features.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/file_find/allreleases.xml", '

File_Find

pear.php.net 1.1.0stable 1.0.1stable 1.0.0stable 0.4.0beta 0.3.1beta 0.3.0beta 0.2.0stable 0.1stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/file_find/deps.1.1.0.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/file_fortune/info.xml", '

File_Fortune pear.php.net File Formats PHP File_Fortune and File_Fortune_Writer provide an interface for reading from and writing to fortune files. File_Fortune provides a PHP interface to reading fortune files. With it, you may retrieve a single fortune, a random fortune, or all fortunes in the file. File_Fortune_Writer provides an interface for manipulating the contents of a fortune file. It allows you to write a complete fortune file and the associated binary header file from an array of fortunes. You may also add fortunes, delete fortunes, or update individual fortunes in a fortune file. All write operations will produce a binary header file to allow for greater compatibility with the fortune and fortune-mod programs (as well as other fortune interfaces).

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/file_fortune/allreleases.xml", '

File_Fortune

pear.php.net 0.9.0beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/file_fortune/deps.0.9.0.txt", 'a:1:{s:8:"required";a:3:{s:3:"php";a:1:{s:3:"min";s:5:"5.0.0";}s:13:"pearinstaller";a:1:{s:3:"min";s:7:"1.4.0a1";}s:7:"package";a:3:{s:4:"name";s:4:"PEAR";s:7:"channel";s:12:"pear.php.net";s:3:"min";s:5:"1.3.4";}}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/file_fstab/info.xml", '

File_Fstab pear.php.net File Formats PHP License v3.0 Read and write fstab files File_Fstab is an easy-to-use package which can read & write UNIX fstab files. It presents a pleasant object-oriented interface to the fstab. Features: * Supports blockdev, label, and UUID specification of mount device. * Extendable to parse non-standard fstab formats by defining a new Entry class for that format. * Easily examine and set mount options for an entry. * Stable, functional interface. * Fully documented with PHPDoc.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/file_fstab/allreleases.xml", '

File_Fstab

pear.php.net 2.0.2stable 2.0.1stable 2.0.0stable 2.0.0beta1beta 1.0.4stable 1.0.3stable 1.0.2stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/file_fstab/deps.2.0.2.txt", 'a:1:{i:1;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:2:"no";s:4:"name";s:4:"PEAR";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/file_gettext/info.xml", '

File_Gettext pear.php.net File Formats PHP GNU Gettext file parser Reader and writer for GNU PO and MO files.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/file_gettext/allreleases.xml", '

File_Gettext

pear.php.net 0.3.4beta 0.3.3beta 0.3.2beta 0.3.1beta 0.3.0beta 0.2.0alpha
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/file_gettext/deps.0.3.4.txt", 'a:3:{i:1;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:2:"no";s:4:"name";s:4:"PEAR";}i:2;a:4:{s:4:"type";s:3:"ext";s:3:"rel";s:3:"has";s:8:"optional";s:2:"no";s:4:"name";s:4:"pcre";}i:3;a:4:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"4.1.0";s:8:"optional";s:2:"no";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/file_htaccess/info.xml", '

File_HtAccess pear.php.net File Formats PHP Manipulate .htaccess files Provides methods to create and manipulate .htaccess files.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/file_htaccess/allreleases.xml", '

File_HtAccess

pear.php.net 1.1.0stable 1.0.0stable 0.9.1beta 0.9.0beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/file_htaccess/deps.1.1.0.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/file_imc/info.xml", '

File_IMC pear.php.net File Formats PHP License Create and parse Internet Mail Consortium-style files (like vCard and vCalendar) Allows you to programmatically create a vCard or vCalendar, and fetch the text. IMPORTANT: The array structure has changed slightly from Contact_Vcard_Parse. See the example output for the new structure. Also different from Contact_Vcard is the use of a factory pattern. Again, see the examples.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/file_imc/allreleases.xml", '

File_IMC

pear.php.net 0.3beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/file_imc/deps.0.3.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/file_ogg/info.xml", '

File_Ogg pear.php.net File Formats PHP License Access Ogg bitstreams. This package provides access to various media types inside an Ogg bitsream.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/file_ogg/allreleases.xml", '

File_Ogg

pear.php.net 0.1.3alpha 0.1.2alpha 0.1.1alpha 0.1alpha
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/file_ogg/deps.0.1.3.txt", 'a:1:{i:1;a:4:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"4.1.0";s:8:"optional";s:2:"no";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/file_passwd/info.xml", '

File_Passwd pear.php.net File Formats PHP Manipulate many kinds of password files Provides methods to manipulate and authenticate against standard Unix, SMB server, AuthUser (.htpasswd), AuthDigest (.htdigest), CVS pserver and custom formatted password files.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/file_passwd/allreleases.xml", '

File_Passwd

pear.php.net 1.1.5stable 1.1.4stable 1.1.3stable 1.1.2stable 1.1.1stable 1.1.0stable 1.0.2stable 1.0.1stable 1.0.0stable 1.0b2beta 1.0b1beta 0.9.5beta 0.9.4beta 0.9.3beta 0.9.2abeta 0.9.2beta 0.9.1beta 0.9.0beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/file_passwd/deps.1.1.5.txt", 'a:5:{i:1;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:2:"no";s:4:"name";s:4:"PEAR";}i:2;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.0.0";s:8:"optional";s:3:"yes";s:4:"name";s:10:"Crypt_CHAP";}i:3;a:4:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"4.3.0";s:8:"optional";s:3:"yes";}i:4;a:4:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"4.0.6";s:8:"optional";s:2:"no";}i:5;a:4:{s:4:"type";s:3:"ext";s:3:"rel";s:3:"has";s:8:"optional";s:2:"no";s:4:"name";s:4:"pcre";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/file_pdf/info.xml", '

File_PDF pear.php.net File Formats LGPL PDF generation using only PHP. This package provides PDF generation using only PHP, without requiring any external libraries.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/file_pdf/allreleases.xml", '

File_PDF

pear.php.net 0.0.2beta 0.0.1beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/file_pdf/deps.0.0.2.txt", 'a:2:{i:1;a:3:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"4.2.0";}i:2;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:3:"yes";s:4:"name";s:13:"HTTP_Download";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/file_searchreplace/info.xml", '

File_SearchReplace pear.php.net File System BSD Performs search and replace routines Provides various functions to perform search/replace on files. Preg/Ereg regex supported along with faster but more basic str_replace routine.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/file_searchreplace/allreleases.xml", '

File_SearchReplace

pear.php.net 1.0.1stable 1.0stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/file_searchreplace/deps.1.0.1.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/file_smbpasswd/info.xml", '

File_SMBPasswd pear.php.net File Formats BSD Class for managing SAMBA style password files. With this package, you can maintain smbpasswd-files, usually used by SAMBA.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/file_smbpasswd/allreleases.xml", '

File_SMBPasswd

pear.php.net 1.0.2stable 1.0.1stable 1.0.0stable 0.9.0beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/file_smbpasswd/deps.1.0.2.txt", 'a:2:{i:1;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.0.0";s:4:"name";s:10:"Crypt_CHAP";}i:2;a:3:{s:4:"type";s:3:"ext";s:3:"rel";s:3:"has";s:4:"name";s:5:"mhash";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/fsm/info.xml", '

FSM pear.php.net Processing PHP License Finite State Machine The FSM package provides a simple class that implements a Finite State Machine.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/fsm/allreleases.xml", '

FSM

pear.php.net 1.2.2stable 1.2.1stable 1.2.0stable 1.1.0stable 1.0.0stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/fsm/deps.1.2.2.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/games_chess/info.xml", '

Games_Chess pear.php.net Structures PHP License Construct and validate a logical chess game, does not display The logic of handling a chessboard and parsing standard FEN (Farnsworth-Edwards Notation) for describing a position as well as SAN (Standard Algebraic Notation) for describing individual moves is handled. This class can be used as a backend driver for playing chess, or for validating and/or creating PGN files using the File_ChessPGN package. Although this package is alpha, it is fully unit-tested. The code works, but the API is fluid, and may change dramatically as it is put into use and better ways are found to use it. When the API stabilizes, the stability will increase.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/games_chess/allreleases.xml", '

Games_Chess

pear.php.net 0.9.0alpha 0.8.1alpha 0.8.0alpha 0.7.0alpha 0.6alphaalpha 0.5alphaalpha 0.3alpha
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/games_chess/deps.0.9.0.txt", 'a:1:{i:1;a:4:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"4.2.0";s:8:"optional";s:2:"no";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/genealogy_gedcom/info.xml", '

Genealogy_Gedcom pear.php.net File Formats PHP License Gedcom parser This package was written to parse .ged (gedcom) file.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/genealogy_gedcom/allreleases.xml", '

Genealogy_Gedcom

pear.php.net 1.0.0beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/genealogy_gedcom/deps.1.0.0.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/gtk_filedrop/info.xml", '

Gtk_FileDrop pear.php.net Gtk Components PHP License Make Gtk widgets accept file drops A class which makes it easy to make a GtkWidget accept the dropping of files or folders

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/gtk_filedrop/allreleases.xml", '

Gtk_FileDrop

pear.php.net 1.0.1stable 1.0.0stable 0.1.0beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/gtk_filedrop/deps.1.0.1.txt", 'a:1:{i:1;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:10:"1.0.0beta3";s:4:"name";s:9:"MIME_Type";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/gtk_mdb_designer/info.xml", '

Gtk_MDB_Designer pear.php.net Database PHP License An Gtk Database schema designer A graphical database schema designer, based loosely around the MDB schema, it features - table boxes which are dragged around a window to layout your database - add/delete tables - add delete columns - support for NotNull, Indexes, Sequences , Unique Indexes and defaults - works totally in non-connected mode (eg. no database or setting up required) - stores in MDB like xml file. - saves to any supported database SQL create tables files. - screenshots at http://devel.akbkhome.com/screenshots/Gtk_MDB/ Future enhancements: - real MDB schema exports - relationships = with lines etc. Note: the primary aim is to generate SQL files, (so that I can get my work done) however it is eventually planned to support MDB schema\'s fully.. - just a matter of time.. To use - just pear install and run gtkmdbdesigner ** Note - this package is not activily being maintained. If you find it useful, and what to take over please contact the developer.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/gtk_mdb_designer/allreleases.xml", '

Gtk_MDB_Designer

pear.php.net 0.1beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/gtk_mdb_designer/deps.0.1.txt", 'a:3:{i:1;a:3:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:3:"4.3";}i:2;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.1.1";s:4:"name";s:3:"MDB";}i:3;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.0.1";s:4:"name";s:10:"XML_Parser";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/gtk_scrollinglabel/info.xml", '

Gtk_ScrollingLabel pear.php.net Gtk Components PHP License A scrolling label for PHP-Gtk This is a class to encapsulate the functionality needed for a scrolling gtk label. This class provides a simple, easy to understand API for setting up and controlling the label. It allows for the ability to scroll in either direction, start and stop the scroll, pause and unpause the scroll, get and set the text, and set display properites of the text.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/gtk_scrollinglabel/allreleases.xml", '

Gtk_ScrollingLabel

pear.php.net 1.0.0stable 0.3.0beta1beta 0.2.0alpha1alpha 0.1.0dev1devel
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/gtk_scrollinglabel/deps.1.0.0.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/gtk_styled/info.xml", '

Gtk_Styled pear.php.net Gtk Components PHP License PHP-GTK pseudo-widgets that mimic GtkData based objects and allow the look and feel to be controlled by the programmer. While it is possible to control some style elements of a GtkScrollBar, other elements cannot be controlled so easily. Items such as the images at the beginning and end (usually arrows) and the scroll bar that is dragged to scroll the element cannot be changed. This leads to applications that either must conform to the windowing systems look and feel or appear incomplete. The goal of this family of PHP-GTK classes is to provide all the same functionality as a normal scroll bar but allow the user to have better control over the look and feel.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/gtk_styled/allreleases.xml", '

Gtk_Styled

pear.php.net 0.9.0beta1beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/gtk_styled/deps.0.9.0beta1.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/gtk_vardump/info.xml", '

Gtk_VarDump pear.php.net Gtk Components PHP License A simple GUI to example php data trees Just a regedit type interface to examine PHP data trees.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/gtk_vardump/allreleases.xml", '

Gtk_VarDump

pear.php.net 0.2.0beta 0.1beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/gtk_vardump/deps.0.2.0.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/html_ajax/info.xml", '

HTML_AJAX pear.php.net HTML PHP License PHP and JavaScript AJAX library Provides PHP and JavaScript libraries for performing AJAX (Communication from JavaScript to your browser without reloading the page) Offers OO proxies in JavaScript of registered PHP or proxyless operation Serialization of data sent between PHP and JavaScript is provided by a driver model, currently JSON and Null encodings are provided

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/html_ajax/allreleases.xml", '

HTML_AJAX

pear.php.net 0.1.4alpha 0.1.3alpha 0.1.0alpha
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/html_ajax/deps.0.1.4.txt", 'a:2:{i:1;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.3.5";s:8:"optional";s:2:"no";s:4:"name";s:4:"PEAR";}i:2;a:4:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"4.3.0";s:8:"optional";s:2:"no";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/html_bbcodeparser/info.xml", '

HTML_BBCodeParser pear.php.net HTML PHP License This is a parser to replace UBB style tags with their html equivalents. This is a parser to replace UBB style tags with their html equivalents. It does not simply do some regex calls, but is complete stack based parse engine. This ensures that all tags are properly nested, if not, extra tags are added to maintain the nesting. This parser should only produce xhtml 1.0 compliant code. All tags are validated and so are all their attributes. It should be easy to extend this parser with your own tags.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/html_bbcodeparser/allreleases.xml", '

HTML_BBCodeParser

pear.php.net 1.1stable 1.1b1beta 1.0stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/html_bbcodeparser/deps.1.1.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/html_common/info.xml", '

HTML_Common pear.php.net HTML PHP License PEAR::HTML_Common is a base class for other HTML classes. The PEAR::HTML_Common package provides methods for html code display and attributes handling. * Methods to set, remove, update html attributes. * Handles comments in HTML code. * Handles layout, tabs, line endings for nicer HTML code.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/html_common/allreleases.xml", '

HTML_Common

pear.php.net 1.2.2stable 1.2.1stable 1.2stable 1.1stable 1.0stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/html_common/deps.1.2.2.txt", 'a:1:{s:8:"required";a:2:{s:3:"php";a:1:{s:3:"min";s:5:"4.0.0";}s:13:"pearinstaller";a:1:{s:3:"min";s:7:"1.4.0b1";}}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/html_common2/info.xml", '

HTML_Common2 pear.php.net HTML PHP License Abstract base class for HTML classes (PHP5 port of HTML_Common package). The HTML_Common2 package provides methods for HTML code display and attributes handling. * Methods to set, remove, update html attributes. * Handles comments in HTML code. * Handles global document options (encoding, linebreak and indentation characters). * Handles indentation for nicer HTML code.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/html_common2/allreleases.xml", '

HTML_Common2

pear.php.net 0.1.0devel
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/html_common2/deps.0.1.0.txt", 'a:1:{i:1;a:3:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"5.0.0";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/html_crypt/info.xml", '

HTML_Crypt pear.php.net HTML PHP License Encrypts text which is later decoded using javascript on the client side The PEAR::HTML_Crypt provides methods to encrypt text, which can be later be decrypted using JavaScript on the client side This is very useful to prevent spam robots collecting email addresses from your site, included is a method to add mailto links to the text being generated

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/html_crypt/allreleases.xml", '

HTML_Crypt

pear.php.net 1.2.2stable 1.2.1stable 1.2stable 1.1stable 1.0stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/html_crypt/deps.1.2.2.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/html_css/info.xml", '

HTML_CSS pear.php.net HTML PHP License 3.0 HTML_CSS is a class for generating CSS declarations. HTML_CSS provides a simple interface for generating a stylesheet declaration. It is completely standards compliant, and has some great features: * Simple OO interface to CSS definitions * Can parse existing CSS (string or file) * Output to - Inline stylesheet declarations - Document internal stylesheet declarations - Standalone stylesheet declarations - Array of definitions - File In addition, it shares the following with HTML_Common based classes: * Indent style support * Line ending style

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/html_css/allreleases.xml", '

HTML_CSS

pear.php.net 1.0.0RC1beta 0.3.4beta 0.3.3beta 0.3.2beta 0.3.1beta 0.3.0beta 0.2.0stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/html_css/deps.1.0.0RC1.txt", 'a:2:{i:1;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:2:"no";s:4:"name";s:4:"PEAR";}i:2;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:3:"1.2";s:8:"optional";s:2:"no";s:4:"name";s:11:"HTML_Common";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/html_form/info.xml", '

HTML_Form pear.php.net HTML PHP License Simple HTML form package This is a simple HTML form generator. It supports all the HTML form element types including file uploads, may return or print the form, just individual form elements or the full form in "table mode" with a fixed layout. This package has been superseded by HTML_QuickForm.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/html_form/allreleases.xml", '

HTML_Form

pear.php.net 1.2.0stable 1.1.3stable 1.1.2stable 1.1.1stable 1.1.0stable 1.1.0RC4beta 1.1.0RC3beta 1.1.0RC2beta 1.1.0RC1beta 1.0.1stable 1.0stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/html_form/deps.1.2.0.txt", 'a:1:{i:1;a:3:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"4.0.0";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/html_javascript/info.xml", '

HTML_Javascript pear.php.net HTML PHP 3.0 Provides an interface for creating simple JS scripts. Provides two classes: HTML_Javascript for performing basic JS operations. HTML_Javascript_Convert for converting variables Allow output data to a file, to the standart output(print), or return

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/html_javascript/allreleases.xml", '

HTML_Javascript

pear.php.net 1.1.1stable 1.1.0stable 1.1.0rc1beta 1.0.0stable 0.9.2beta 0.9.1beta 0.9beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/html_javascript/deps.1.1.1.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/html_menu/info.xml", '

HTML_Menu pear.php.net HTML PHP License Generates HTML menus from multidimensional hashes. With the HTML_Menu class one can easily create and maintain a navigation structure for websites, configuring it via a multidimensional hash structure. Different modes for the HTML output are supported.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/html_menu/allreleases.xml", '

HTML_Menu

pear.php.net 2.1.1stable 2.1stable 2.0pl1stable 2.0stable 1.0stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/html_menu/deps.2.1.1.txt", 'a:1:{i:1;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:3:"yes";s:4:"name";s:19:"HTML_Template_Sigma";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/html_page/info.xml", '

HTML_Page pear.php.net HTML PHP License 3.0 PEAR::HTML_Page is a base class for XHTML page generation. *** DEPRECIATED PACKAGE *** *** use HTML_Page2 instead *** ***************************** Other than renaming a class, HTML_Page2 is compatible and offers many more features, including frameset support. ***************************** The PEAR::HTML_Page package provides a simple interface for generating an XHTML compliant page. * supports virtually all HTML doctypes, from HTML 2.0 through XHTML 1.1 and XHTML Basic 1.0 plus preliminary support for XHTML 2.0 * namespace support * global language declaration for the document * line ending styles * full META tag support * support for stylesheet declaration in the head section * support for linked stylesheets and scripts * body can be a string, object with toHtml or toString methods or an array (can be combined)

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/html_page/allreleases.xml", '

HTML_Page

pear.php.net 2.0.0RC2beta 2.0.0RC1beta 2.0.0b7beta 2.0.0b6beta 2.0.0b5beta 2.0.0b4beta 2.0.0b3beta 2.0.0b2beta 2.0.0b1beta 1.0beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/html_page/deps.2.0.0RC2.txt", 'a:1:{i:1;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:3:"1.2";s:4:"name";s:11:"HTML_Common";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/html_page2/info.xml", '

HTML_Page2 pear.php.net HTML PHP License 3.0 PEAR::HTML_Page2 is a base class for XHTML page generation. The PEAR::HTML_Page2 package provides a simple interface for generating an XHTML compliant page. * supports virtually all HTML doctypes, from HTML 2.0 through XHTML 1.1 and XHTML Basic 1.0 plus preliminary support for XHTML 2.0 * namespace support * global language declaration for the document * line ending styles * full META tag support * support for stylesheet declaration in the head section * support for script declaration in the head section * support for linked stylesheets and scripts * full support for header link tags * body can be a string, object with toHtml or toString methods or an array (can be combined) Ideas for use: * Use to validate the output of a class for XHTML compliance * Quick prototyping using PEAR packages is now a breeze

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/html_page2/allreleases.xml", '

HTML_Page2

pear.php.net 0.5.0betabeta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/html_page2/deps.0.5.0beta.txt", 'a:1:{i:1;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:3:"1.2";s:4:"name";s:11:"HTML_Common";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/html_progress/info.xml", '

HTML_Progress pear.php.net HTML PHP License 3.0 How to include a loading bar in your XHTML documents quickly and easily. This package provides a way to add a loading bar fully customizable in existing XHTML documents. Your browser should accept DHTML feature. Features: - create horizontal, vertival bar and also circle, ellipse and polygons (square, rectangle). - allows usage of existing external StyleSheet and/or JavaScript. - all elements (progress, cells, labels) are customizable by their html properties. - percent/labels are floating all around the progress meter. - compliant with all CSS/XHMTL standards. - integration with all template engines is very easy. - implements Observer design pattern. It is possible to add Listeners. - adds a customizable monitor pattern to display a progress bar. User-end can abort progress at any time. - Look and feel can be sets by internal API or external config file - allows many progress meter on same page without uses of iframe solution.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/html_progress/allreleases.xml", '

HTML_Progress

pear.php.net 1.2.3stable 1.2.2stable 1.2.1stable 1.2.0stable 1.2.0RC3beta 1.2.0RC2beta 1.2.0RC1beta 1.1stable 1.0stable 0.6.2stable 0.6.1stable 0.6.0stable 0.5.0stable 0.4.2stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/html_progress/deps.1.2.3.txt", 'a:12:{i:1;a:4:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"4.2.0";s:8:"optional";s:2:"no";}i:2;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.2.1";s:8:"optional";s:2:"no";s:4:"name";s:11:"HTML_Common";}i:3;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.3.5";s:8:"optional";s:3:"yes";s:4:"name";s:4:"PEAR";}i:4;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"gt";s:7:"version";s:5:"3.2.4";s:8:"optional";s:3:"yes";s:4:"name";s:14:"HTML_QuickForm";}i:5;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.0.4";s:8:"optional";s:3:"yes";s:4:"name";s:25:"HTML_QuickForm_Controller";}i:6;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.0.1";s:8:"optional";s:3:"yes";s:4:"name";s:11:"Image_Color";}i:7;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"0.5.0";s:8:"optional";s:3:"yes";s:4:"name";s:10:"HTML_Page2";}i:8;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:3:"1.1";s:8:"optional";s:3:"yes";s:4:"name";s:16:"HTML_Template_IT";}i:9;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.1.2";s:8:"optional";s:3:"yes";s:4:"name";s:19:"HTML_Template_Sigma";}i:10;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.8.7";s:8:"optional";s:3:"yes";s:4:"name";s:3:"Log";}i:11;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:4:"1.10";s:8:"optional";s:3:"yes";s:4:"name";s:6:"Config";}i:12;a:4:{s:4:"type";s:3:"ext";s:3:"rel";s:3:"has";s:8:"optional";s:3:"yes";s:4:"name";s:2:"gd";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/html_progress2/info.xml", '

HTML_Progress2 pear.php.net HTML PHP License 3.0 How to include a loading bar in your XHTML documents quickly and easily. This package provides a way to add a loading bar fully customizable in existing XHTML documents. Your browser should accept DHTML feature. Features: - create horizontal, vertival bar and also circle, ellipse and polygons (square, rectangle). - allows usage of existing external StyleSheet and/or JavaScript. - all elements (progress, cells, labels) are customizable by their html properties. - percent/labels are floating all around the progress meter. - compliant with all CSS/XHMTL standards. - integration with all template engines is very easy. - implements Observer design pattern. It is possible to add Listeners. - adds a customizable monitor pattern to display a progress bar. User-end can abort progress at any time. - allows many progress meter on same page without uses of iframe solution. - error handling system that support native PEAR_Error, but also PEAR_ErrorStack, and any other system you might want to plug-in. - PHP 5 ready.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/html_progress2/allreleases.xml", '

HTML_Progress2

pear.php.net 2.0.0RC2beta 2.0.0RC1beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/html_progress2/deps.2.0.0RC2.txt", 'a:13:{i:1;a:4:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"4.2.0";s:8:"optional";s:2:"no";}i:2;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.4.1";s:8:"optional";s:2:"no";s:4:"name";s:10:"PHP_Compat";}i:3;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.2.1";s:8:"optional";s:2:"no";s:4:"name";s:11:"HTML_Common";}i:4;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"0.9.1";s:8:"optional";s:2:"no";s:4:"name";s:16:"Event_Dispatcher";}i:5;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.3.5";s:8:"optional";s:3:"yes";s:4:"name";s:4:"PEAR";}i:6;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"gt";s:7:"version";s:5:"3.2.4";s:8:"optional";s:3:"yes";s:4:"name";s:14:"HTML_QuickForm";}i:7;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.0.4";s:8:"optional";s:3:"yes";s:4:"name";s:25:"HTML_QuickForm_Controller";}i:8;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.0.1";s:8:"optional";s:3:"yes";s:4:"name";s:11:"Image_Color";}i:9;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"0.5.0";s:8:"optional";s:3:"yes";s:4:"name";s:10:"HTML_Page2";}i:10;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:3:"1.1";s:8:"optional";s:3:"yes";s:4:"name";s:16:"HTML_Template_IT";}i:11;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.1.2";s:8:"optional";s:3:"yes";s:4:"name";s:19:"HTML_Template_Sigma";}i:12;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.8.7";s:8:"optional";s:3:"yes";s:4:"name";s:3:"Log";}i:13;a:4:{s:4:"type";s:3:"ext";s:3:"rel";s:3:"has";s:8:"optional";s:3:"yes";s:4:"name";s:2:"gd";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/html_quickform/info.xml", '

HTML_QuickForm pear.php.net HTML PHP License The PEAR::HTML_QuickForm package provides methods for creating, validating, processing HTML forms. The HTML_QuickForm package provides methods for dynamically create, validate and render HTML forms. Features: * More than 20 ready-to-use form elements. * XHTML compliant generated code. * Numerous mixable and extendable validation rules. * Automatic server-side validation and filtering. * On request javascript code generation for client-side validation. * File uploads support. * Total customization of form rendering. * Support for external template engines (ITX, Sigma, Flexy, Smarty). * Pluggable elements, rules and renderers extensions.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/html_quickform/allreleases.xml", '

HTML_QuickForm

pear.php.net 3.2.5stable 3.2.4pl1stable 3.2.4stable 3.2.3stable 3.2.2stable 3.2.1stable 3.2stable 3.1.1stable 3.1stable 3.0stable 3.0RC1beta 3.0Beta2beta 3.0Beta1beta 2.10stable 2.9stable 2.8stable 2.7stable 2.6stable 2.5stable 2.4stable 2.3stable 2.2stable 2.1stable 2.0stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/html_quickform/deps.3.2.5.txt", 'a:2:{i:1;a:3:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:3:"4.2";}i:2;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.2.1";s:4:"name";s:11:"HTML_Common";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/html_quickform_advmultiselect/info.xml", '

HTML_QuickForm_advmultiselect pear.php.net HTML PHP License 3.0 Element for HTML_QuickForm that emulate a multi-select. The HTML_QuickForm_advmultiselect package adds an element to the HTML_QuickForm package that is two select boxes next to each other emulating a multi-select.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/html_quickform_advmultiselect/allreleases.xml", '

HTML_QuickForm_advmultiselect

pear.php.net 1.0.0stable 0.5.1beta 0.5.0beta 0.4.0beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/html_quickform_advmultiselect/deps.1.0.0.txt", 'a:4:{i:1;a:4:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"4.2.0";s:8:"optional";s:2:"no";}i:2;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:2:"no";s:4:"name";s:4:"PEAR";}i:3;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.2.1";s:8:"optional";s:2:"no";s:4:"name";s:11:"HTML_Common";}i:4;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"gt";s:7:"version";s:5:"3.2.4";s:8:"optional";s:2:"no";s:4:"name";s:14:"HTML_QuickForm";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/html_quickform_controller/info.xml", '

HTML_QuickForm_Controller pear.php.net HTML PHP License The add-on to HTML_QuickForm package that allows building of multipage forms The package is essentially an implementation of a PageController pattern. Architecture: * Controller class that examines HTTP requests and manages form values persistence across requests. * Page class (subclass of QuickForm) representing a single page of the form. * Business logic is contained in subclasses of Action class. Cool features: * Includes several default Actions that allow easy building of multipage forms. * Includes usage examples for common usage cases (single-page form, wizard, tabbed form).

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/html_quickform_controller/allreleases.xml", '

HTML_QuickForm_Controller

pear.php.net 1.0.4stable 1.0.3stable 1.0.2stable 1.0.1stable 1.0stable 0.9.3beta 0.9.2beta 0.9.1beta 0.9beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/html_quickform_controller/deps.1.0.4.txt", 'a:1:{i:1;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"3.2.2";s:4:"name";s:14:"HTML_QuickForm";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/html_quickform_selectfilter/info.xml", '

HTML_QuickForm_SelectFilter pear.php.net HTML PHP License Element for PEAR::HTML_QuickForm that defines dynamic filters on the client side for select elements. The PEAR::HTML_QuickForm_SelectFilter package adds an element to the PEAR::HTML_QuickForm package that is used to define dynamic filters on the client side for select elements.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/html_quickform_selectfilter/allreleases.xml", '

HTML_QuickForm_SelectFilter

pear.php.net 1.0.0RC1beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/html_quickform_selectfilter/deps.1.0.0RC1.txt", 'a:1:{i:1;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"3.2.3";s:4:"name";s:14:"HTML_QuickForm";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/html_safe/info.xml", '

HTML_Safe pear.php.net HTML BSD (3 Clause) This parser strips down all potentially dangerous content within HTML This parser strips down all potentially dangerous content within HTML

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/html_safe/allreleases.xml", '

HTML_Safe

pear.php.net 0.9.0alpha1alpha 0.3.5alpha
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/html_safe/deps.0.9.0alpha1.txt", 'a:1:{s:8:"required";a:3:{s:3:"php";a:1:{s:3:"min";s:5:"4.1.0";}s:13:"pearinstaller";a:1:{s:3:"min";s:7:"1.4.0b1";}s:7:"package";a:3:{s:4:"name";s:12:"XML_HTMLSax3";s:7:"channel";s:12:"pear.php.net";s:3:"min";s:8:"3.0.0RC1";}}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/html_select/info.xml", '

HTML_Select pear.php.net HTML PHP License HTML_Select is a class for generating HTML form select elements. HTML_Select provides an OOP way of generating HTML form select elements.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/html_select/allreleases.xml", '

HTML_Select

pear.php.net 1.2.1beta 1.2beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/html_select/deps.1.2.1.txt", 'a:1:{i:1;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:3:"1.1";s:4:"name";s:11:"HTML_Common";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/html_select_common/info.xml", '

HTML_Select_Common pear.php.net HTML BSD Some small classes to handle common &lt;select&gt; lists Provides &lt;select&gt; lists for: o Country o UK counties o US States o FR Departements

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/html_select_common/allreleases.xml", '

HTML_Select_Common

pear.php.net 1.1stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/html_select_common/deps.1.1.txt", 'a:1:{i:1;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:3:"0.8";s:4:"name";s:4:"I18N";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/html_table/info.xml", '

HTML_Table pear.php.net HTML PHP License PEAR::HTML_Table makes the design of HTML tables easy, flexible, reusable and efficient. The PEAR::HTML_Table package provides methods for easy and efficient design of HTML tables. * Lots of customization options. * Tables can be modified at any time. * The logic is the same as standard HTML editors. * Handles col and rowspans. * PHP code is shorter, easier to read and to maintain. * Tables options can be reused. For auto filling of data and such then check out http://pear.php.net/package/HTML_Table_Matrix

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/html_table/allreleases.xml", '

HTML_Table

pear.php.net 1.5stable 1.4stable 1.3stable 1.2stable 1.1stable 1.0stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/html_table/deps.1.5.txt", 'a:1:{i:1;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:3:"1.2";s:4:"name";s:11:"HTML_Common";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/html_table_matrix/info.xml", '

HTML_Table_Matrix pear.php.net HTML PHP License v3.0 Autofill a table with data HTML_Table_Matrix is an extension to HTML_Table which allows you to easily fill up a table with data. Features: - It uses Filler classes to determine how the data gets filled in the table. With a custom Filler, you can fill data in up, down, forwards, backwards, diagonally, randomly or any other way you like. - Comes with Fillers to fill left-to-right-top-to-bottom and right-to-left-top-to-bottom. - Abstract Filler methods keep the code clean & easy to understand. - Table height or width may be omitted, and it will figure out the correct table size based on the data you provide. - It integrates handily with Pager to create pleasant pageable table layouts, such as for an image gallery. Just specify a height or width, Filler, and feed it the data returned from Pager. - Table may be constrained to a specific height or width, and excess data will be ignored. - Fill offset may be specified, to leave room for a table header, or other elements in the table. - Fully documented with PHPDoc. - Includes fully functional example code.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/html_table_matrix/allreleases.xml", '

HTML_Table_Matrix

pear.php.net 1.0.8stable 1.0.7stable 1.0.6stable 1.0.5stable 1.0.4stable 1.0.3stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/html_table_matrix/deps.1.0.8.txt", 'a:2:{i:1;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:2:"no";s:4:"name";s:10:"HTML_Table";}i:2;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:3:"yes";s:4:"name";s:13:"Numbers_Words";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/html_template_flexy/info.xml", '

HTML_Template_Flexy pear.php.net HTML PHP License An extremely powerful Tokenizer driven Template engine HTML_Template_Flexy started it\'s life as a simplification of HTML_Template_Xipe, however in Version 0.2, It became one of the first template engine to use a real Lexer, rather than regex\'es, making it possible to do things like ASP.net or Cold Fusion tags. However, it still has a very simple set of goals. - Very Simple API, o easy to learn... o prevents to much logic going in templates - Easy to write document\'able code o By using object vars for a template rather than \'assign\', you can use phpdoc comments to list what variable you use. - Editable in WYSIWYG editors o you can create full featured templates, that doesnt get broken every time you edit with Dreamweaver(tm) or Mozilla editor o Uses namespaced attributes to add looping/conditionals - Extremely Fast, o runtime is at least 4 time smaller than most other template engines (eg. Smarty) o uses compiled templates, as a result it is many times faster on blocks and loops than than Regex templates (eg. IT/phplib) - Safer (for cross site scripting attacks) o All variables default to be output as HTML escaped (overridden with the :h modifier) - Multilanguage support o Parses strings out of template, so you can build translation tools o Compiles language specific templates (so translation is only done once, not on every request) - Full dynamic element support (like ASP.NET), so you can pick elements to replace at runtime Features: - {variable} to echo $object->variable - {method()} to echo $object->method(); - {foreach:var,key,value} to PHP foreach loops - tag attributes FLEXY:FOREACH, FLEXY:IF for looping and conditional HTML inclusion - {if:variable} to PHP If statement - {if:method()} to PHP If statement - {else:} and {end:} to close or alternate If statements - FORM to HTML_Template_Flexy_Element\'s - replacement of INPUT, TEXTAREA and SELECT tags with HTML_Template_Flexy_Element code use FLEXY:IGNORE (inherited) and FLEXY:IGNOREONLY (single) to prevent replacements - FLEXY:START/FLEXY:STARTCHILDREN tags to define where template starts/finishes - support for urlencoded braces {} in HTML attributes. - documentation in the pear manual - examples at http://cvs.php.net/cvs.php/pear/HTML_Template_Flexy/tests/ ** The long term plan for Flexy is to be integrated as a backend for the Future Template Package (A BC wrapper will be made available - as I need to use it too!)

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/html_template_flexy/allreleases.xml", '

HTML_Template_Flexy

pear.php.net 1.2.2stable 1.2.1stable 1.2.0stable 1.1.2stable 1.1.1stable 1.1.0stable 1.0.1stable 1.0.0stable 0.9.2beta 0.9.1beta 0.8.2beta 0.8.1beta 0.8.0beta 0.7.1beta 0.7beta 0.6.3beta 0.6.2beta 0.6.1beta 0.6beta 0.5.1beta 0.5beta 0.4.2beta 0.4.1beta 0.4beta 0.3beta 0.2beta 0.1beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/html_template_flexy/deps.1.2.2.txt", 'a:4:{i:1;a:3:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:3:"4.3";}i:2;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.1.0";s:8:"optional";s:3:"yes";s:4:"name";s:15:"HTML_Javascript";}i:3;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"0.2.0";s:8:"optional";s:3:"yes";s:4:"name";s:12:"File_Gettext";}i:4;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"0.0.1";s:8:"optional";s:3:"yes";s:4:"name";s:12:"Translation2";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/html_template_it/info.xml", '

HTML_Template_IT pear.php.net HTML PHP License Integrated Templates HTML_Template_IT: Simple template API. The Isotemplate API is somewhat tricky for a beginner although it is the best one you can build. template::parse() [phplib template = Isotemplate] requests you to name a source and a target where the current block gets parsed into. Source and target can be block names or even handler names. This API gives you a maximum of fexibility but you always have to know what you do which is quite unusual for php skripter like me. I noticed that I do not any control on which block gets parsed into which one. If all blocks are within one file, the script knows how they are nested and in which way you have to parse them. IT knows that inner1 is a child of block2, there\'s no need to tell him about this. Features : * Nested blocks * Include external file * Custom tags format (default {mytag}) HTML_Template_ITX : With this class you get the full power of the phplib template class. You may have one file with blocks in it but you have as well one main file and multiple files one for each block. This is quite usefull when you have user configurable websites. Using blocks not in the main template allows you to modify some parts of your layout easily.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/html_template_it/allreleases.xml", '

HTML_Template_IT

pear.php.net 1.1.1stable 1.1stable 1.0.0stable 1.0beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/html_template_it/deps.1.1.1.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/html_template_phplib/info.xml", '

HTML_Template_PHPLIB pear.php.net HTML LGPL preg_* based template system. The popular Template system from PHPLIB ported to PEAR. It has some features that can\'t be found currently in the original version like fallback paths. It has minor improvements and cleanup in the code as well as some speed improvements.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/html_template_phplib/allreleases.xml", '

HTML_Template_PHPLIB

pear.php.net 1.3.1stable 1.3stable 1.2stable 1.1.1stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/html_template_phplib/deps.1.3.1.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/html_template_sigma/info.xml", '

HTML_Template_Sigma pear.php.net HTML PHP License An implementation of Integrated Templates API with template \'compilation\' added HTML_Template_Sigma implements Integrated Templates API designed by Ulf Wendel. Features: * Nested blocks. Nesting is controlled by the engine. * Ability to include files from within template: &lt;!-- INCLUDE --&gt; * Automatic removal of empty blocks and unknown variables (methods to manually tweak/override this are also available) * Methods for runtime addition and replacement of blocks in templates * Ability to insert simple function calls into templates: func_uppercase(\'Hello world!\') and to define callback functions for these * \'Compiled\' templates: the engine has to parse a template file using regular expressions to find all the blocks and variable placeholders. This is a very "expensive" operation and is an overkill to do on every page request: templates seldom change on production websites. Thus this feature: an internal representation of the template structure is saved into a file and this file gets loaded instead of the source one on subsequent requests (unless the source changes) * PHPUnit-based tests to define correct behaviour * Usage examples for most of the features are available, look in the docs/ directory

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/html_template_sigma/allreleases.xml", '

HTML_Template_Sigma

pear.php.net 1.1.3stable 1.1.2stable 1.1.1stable 1.1.0stable 1.0.2stable 1.0.1stable 1.0stable 0.9.2stable 0.9.1stable 0.9stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/html_template_sigma/deps.1.1.3.txt", 'a:1:{i:1;a:3:{s:4:"type";s:3:"ext";s:3:"rel";s:3:"has";s:4:"name";s:5:"ctype";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/html_template_xipe/info.xml", '

HTML_Template_Xipe pear.php.net HTML PHP License A simple, fast and powerful template engine. The template engine is a compiling engine, all templates are compiled into PHP-files. This will make the delivery of the files faster on the next request, since the template doesn\'t need to be compiled again. If the template changes it will be recompiled. There is no new template language to learn. Beside the default mode, there is a set of constructs since version 1.6 which allow you to edit your templates with WYSIWYG editors. By default the template engine uses indention for building blocks (you can turn that off). This feature was inspired by Python and by the need I felt to force myself to write proper HTML-code, using proper indentions, to make the code better readable. Every template is customizable in multiple ways. You can configure each template or an entire directory to use different delimiters, caching parameters, etc. via either an XML-file or a XML-chunk which you simply write anywhere inside the tpl-code. Using the Cache the final file can also be cached (i.e. a resulting HTML-file). The caching options can be customized as needed. The cache can reduce the server load by very much, since the entire php-file doesn\'t need to be processed again, the resulting client-readable data are simply delivered right from the cache (the data are saved using php\'s output buffering). The template engine is prepared to be used for multi-language applications too. If you i.e. use the PEAR::I18N for translating the template, the compiled templates need to be saved under a different name for each language. The template engine is prepared for that too, it saves the compiled template including the language code if required (i.e. a compiled index.tpl which is saved for english gets the filename index.tpl.en.php).

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/html_template_xipe/allreleases.xml", '

HTML_Template_Xipe

pear.php.net 1.7.6stable 1.7.5stable 1.7.4stable 1.7.3stable 1.7.2stable 1.7.1stable 1.7stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/html_template_xipe/deps.1.7.6.txt", 'a:2:{i:1;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:3:"0.2";s:4:"name";s:4:"Tree";}i:2;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:3:"1.8";s:4:"name";s:3:"Log";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/html_treemenu/info.xml", '

HTML_TreeMenu pear.php.net HTML BSD Provides an api to create a HTML tree PHP Based api creates a tree structure using a couple of small PHP classes. This can then be converted to javascript using the printMenu() method. The tree is dynamic in IE 4 or higher, NN6/Mozilla and Opera 7, and maintains state (the collapsed/expanded status of the branches) by using cookies. Other browsers display the tree fully expanded. Each node can have an optional link and icon. New API in 1.1 with many changes (see CVS for changelog) and new features, of which most came from Chip Chapin (http://www.chipchapin.com).

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/html_treemenu/allreleases.xml", '

HTML_TreeMenu

pear.php.net 1.2.0stable 1.1.9stable 1.1.8stable 1.1.7stable 1.1.6stable 1.1.5stable 1.1.4stable 1.1.3stable 1.1.2stable 1.1.1stable 1.1.0stable 1.0.4stable 1.0.3stable 1.0.2stable 1.0.1stable 1.0stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/html_treemenu/deps.1.2.0.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/http/info.xml", '

HTTP pear.php.net HTTP PHP License Miscellaneous HTTP utilities The HTTP class is a class with static methods for doing miscellaneous HTTP related stuff like date formatting, language negotiation or HTTP redirection.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/http/allreleases.xml", '

HTTP

pear.php.net 1.3.6stable 1.3.5stable 1.3.4stable 1.3.3stable 1.3.2stable 1.3.1stable 1.3.0stable 1.3.0RC2beta 1.3.0RC1beta 1.2.3stable 1.2.2stable 1.2.1stable 1.2stable 1.1stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/http/deps.1.3.6.txt", 'a:3:{i:1;a:3:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:4:"name";s:4:"PEAR";}i:2;a:3:{s:4:"type";s:3:"ext";s:3:"rel";s:3:"has";s:4:"name";s:4:"pcre";}i:3;a:3:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"4.0.6";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/http_client/info.xml", '

HTTP_Client pear.php.net HTTP PHP License Easy way to perform multiple HTTP requests and process their results The HTTP_Client class wraps around HTTP_Request and provides a higher level interface for performing multiple HTTP requests. Features: * Manages cookies and referrers between requests * Handles HTTP redirection * Has methods to set default headers and request parameters * Implements the Subject-Observer design pattern: the base class sends events to listeners that do the response processing.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/http_client/allreleases.xml", '

HTTP_Client

pear.php.net 1.0.0stable 1.0.0beta1beta 0.2beta 0.1beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/http_client/deps.1.0.0.txt", 'a:1:{i:1;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:3:"1.2";s:4:"name";s:12:"HTTP_Request";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/http_download/info.xml", '

HTTP_Download pear.php.net HTTP PHP Send HTTP Downloads Provides an interface to easily send hidden files or any arbitrary data to HTTP clients. HTTP_Download can gain its data from variables, files or stream resources. It features: - Basic caching capabilities - Basic throttling mechanism - On-the-fly gzip-compression - Ranges (partial downloads and resuming) - Delivery of on-the-fly generated archives through Archive_Tar and Archive_Zip - Sending of PgSQL LOBs without the need to read all data in prior to sending

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/http_download/allreleases.xml", '

HTTP_Download

pear.php.net 1.1.0RC3beta 1.1.0RC2beta 1.1.0RC1beta 1.0.0stable 1.0.0RC6beta 1.0.0RC5beta 1.0.0RC4beta 1.0.0RC3beta 1.0.0RC2beta 1.0.0RC1beta 0.10.0beta 0.9.0beta 0.8.1beta 0.8.0beta 0.7.0beta 0.6.2beta 0.6.1beta 0.6.0beta 0.5.2beta 0.5.1beta 0.5beta 0.4beta 0.3beta 0.2alpha 0.1alpha
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/http_download/deps.1.1.0RC3.txt", 'a:10:{i:1;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:2:"no";s:4:"name";s:4:"PEAR";}i:2;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:2:"no";s:4:"name";s:11:"HTTP_Header";}i:3;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:3:"yes";s:4:"name";s:11:"Archive_Tar";}i:4;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:3:"yes";s:4:"name";s:11:"Archive_Zip";}i:5;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:3:"yes";s:4:"name";s:9:"MIME_Type";}i:6;a:4:{s:4:"type";s:3:"ext";s:3:"rel";s:3:"has";s:8:"optional";s:2:"no";s:4:"name";s:4:"pcre";}i:7;a:4:{s:4:"type";s:3:"ext";s:3:"rel";s:3:"has";s:8:"optional";s:3:"yes";s:4:"name";s:10:"mime_magic";}i:8;a:4:{s:4:"type";s:3:"ext";s:3:"rel";s:3:"has";s:8:"optional";s:3:"yes";s:4:"name";s:5:"pgsql";}i:9;a:4:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"4.3.0";s:8:"optional";s:3:"yes";}i:10;a:4:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"4.2.0";s:8:"optional";s:2:"no";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/http_header/info.xml", '

HTTP_Header pear.php.net HTTP PHP License OO interface to modify and handle HTTP headers and status codes. This class provides methods to set/modify HTTP headers and status codes including an HTTP caching facility. It also provides methods for checking Status types.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/http_header/allreleases.xml", '

HTTP_Header

pear.php.net 1.1.2stable 1.1.2RC1beta 1.1.1stable 1.1.0stable 1.0.2stable 1.0.1stable 1.0.0stable 1.0.0RC1beta 0.3.0beta 0.2.0beta 0.1.6beta 0.1.5beta 0.1.4beta 0.1.3beta 0.1.2beta 0.1.1alpha 0.1alpha
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/http_header/deps.1.1.2.txt", 'a:3:{i:1;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.3.1";s:4:"name";s:4:"HTTP";}i:2;a:3:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:4:"name";s:4:"PEAR";}i:3;a:3:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"4.2.0";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/http_request/info.xml", '

HTTP_Request pear.php.net HTTP BSD Provides an easy way to perform HTTP requests Supports GET/POST/HEAD/TRACE/PUT/DELETE, Basic authentication, Proxy, Proxy Authentication, SSL, file uploads etc.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/http_request/allreleases.xml", '

HTTP_Request

pear.php.net 1.2.4stable 1.2.3stable 1.2.2stable 1.2.1stable 1.2stable 1.1.1stable 1.1.0stable 1.0.2stable 1.0.1stable 1.0stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/http_request/deps.1.2.4.txt", 'a:2:{i:1;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:6:"1.0.12";s:4:"name";s:7:"Net_URL";}i:2;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.0.2";s:4:"name";s:10:"Net_Socket";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/http_server/info.xml", '

HTTP_Server pear.php.net HTTP PHP License HTTP server class. HTTP server class that allows you to easily implement HTTP servers by supplying callbacks. The base class will parse the request, call the appropriate callback and build a repsonse based on an array that the callbacks have to return.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/http_server/allreleases.xml", '

HTTP_Server

pear.php.net 0.4.0alpha 0.3alpha
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/http_server/deps.0.4.0.txt", 'a:4:{i:1;a:4:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"4.2.0";s:8:"optional";s:2:"no";}i:2;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:2:"no";s:4:"name";s:4:"HTTP";}i:3;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:6:"0.12.0";s:8:"optional";s:2:"no";s:4:"name";s:10:"Net_Server";}i:4;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:2:"no";s:4:"name";s:4:"PEAR";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/http_session/info.xml", '

HTTP_Session pear.php.net HTTP PHP License Object-oriented interface to the session_* family functions Object-oriented interface to the session_* family functions. It provides extra features such as database storage for session data using the DB, MDB and MDB2 package. It introduces new methods like isNew(), useCookies(), setExpire(), setIdle(), isExpired(), isIdled() and others.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/http_session/allreleases.xml", '

HTTP_Session

pear.php.net 0.5.1beta 0.5.0beta 0.4beta 0.3beta 0.2beta 0.1beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/http_session/deps.0.5.1.txt", 'a:5:{i:1;a:4:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"4.2.0";s:8:"optional";s:2:"no";}i:2;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.3.3";s:8:"optional";s:2:"no";s:4:"name";s:4:"PEAR";}i:3;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.7.6";s:8:"optional";s:3:"yes";s:4:"name";s:2:"DB";}i:4;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.1.4";s:8:"optional";s:3:"yes";s:4:"name";s:3:"MDB";}i:5;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:10:"2.0.0beta4";s:8:"optional";s:3:"yes";s:4:"name";s:4:"MDB2";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/http_session2/info.xml", '

HTTP_Session2 pear.php.net HTTP PHP License PHP5 Session Handler PHP5 Object-oriented interface to the session_* family functions it provides extra features such as database storage for session data using DB package. Supported containers are Creole, PEAR::DB and PEAR::MDB. It introduces new methods like isNew(), useCookies(), setExpire(), setIdle(), isExpired(), isIdled() and others.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/http_session2/allreleases.xml", '

HTTP_Session2

pear.php.net 0.2.0alpha 0.1.0alpha
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/http_session2/deps.0.2.0.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/http_sessionserver/info.xml", '

HTTP_SessionServer pear.php.net HTTP PHP License Daemon to store session data that can be accessed via a simple protocol. HTTP_SessionServer is a simple PHP based daemon that helps you maintaining state between physically different hosts. HTTP_SessionServer implements a very simple protocol to store and retrieve data on the server. The storage backend is driver based and supports your local filesystem as well as PEAR::DB as a container. HTTP_SessionServer comes with a matching client implementation using Net_Socket as well as a session save handler.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/http_sessionserver/allreleases.xml", '

HTTP_SessionServer

pear.php.net 0.4.0alpha 0.3.0alpha
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/http_sessionserver/deps.0.4.0.txt", 'a:6:{i:1;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:2:"no";s:4:"name";s:4:"PEAR";}i:2;a:4:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"4.3.0";s:8:"optional";s:2:"no";}i:3;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:6:"0.12.0";s:8:"optional";s:2:"no";s:4:"name";s:10:"Net_Server";}i:4;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:2:"no";s:4:"name";s:10:"Net_Socket";}i:5;a:4:{s:4:"type";s:3:"ext";s:3:"rel";s:3:"has";s:8:"optional";s:2:"no";s:4:"name";s:5:"pcntl";}i:6;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:3:"yes";s:4:"name";s:2:"DB";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/http_upload/info.xml", '

HTTP_Upload pear.php.net HTTP LGPL Easy and secure managment of files submitted via HTML Forms This class provides an advanced file uploader system for file uploads made from html forms. Features: * Can handle from one file to multiple files. * Safe file copying from tmp dir. * Easy detecting mechanism of valid upload, missing upload or error. * Gives extensive information about the uploaded file. * Rename uploaded files in different ways: as it is, safe or unique * Validate allowed file extensions * Multiple languages error messages support (es, en, de, fr, it, nl, pt_BR)

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/http_upload/allreleases.xml", '

HTTP_Upload

pear.php.net 0.9.1stable 0.9.0stable 0.8.1stable 0.8stable 0.7stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/http_upload/deps.0.9.1.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/http_webdav_client/info.xml", '

HTTP_WebDAV_Client pear.php.net HTTP PHP WebDAV stream wrapper class RFC2518 compliant stream wrapper that allows to use WebDAV server resources like a regular file system from within PHP.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/http_webdav_client/allreleases.xml", '

HTTP_WebDAV_Client

pear.php.net 0.9.7beta 0.9.6beta 0.9.5beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/http_webdav_client/deps.0.9.7.txt", 'a:2:{i:1;a:3:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:3:"4.3";}i:2;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:3:"1.0";s:4:"name";s:12:"HTTP_Request";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/http_webdav_server/info.xml", '

HTTP_WebDAV_Server pear.php.net HTTP PHP WebDAV Server Baseclass. RFC2518 compliant helper class for WebDAV server implementation.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/http_webdav_server/allreleases.xml", '

HTTP_WebDAV_Server

pear.php.net 1.0.0rc1beta 0.99.1beta 0.99beta 0.9alpha
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/http_webdav_server/deps.1.0.0rc1.txt", 'a:1:{i:1;a:3:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:3:"4.3";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/i18n/info.xml", '

I18N pear.php.net Internationalization PHP Internationalization package This package supports you to localize your applications. Multiple ways of supporting translation are implemented and methods to determine the current users (browser-)language. Localizing Numbers, DateTime and currency is also implemented.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/i18n/allreleases.xml", '

I18N

pear.php.net 0.8.6beta 0.8.5beta 0.8.4beta 0.8.3beta 0.8.2b1beta 0.8devel
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/i18n/deps.0.8.6.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/i18nv2/info.xml", '

I18Nv2 pear.php.net Internationalization PHP Internationalization This package provides basic support to localize your application, like locale based formatting of dates, numbers and currencies. Beside that it attempts to provide an OS independent way to setlocale() and aims to provide language, country and currency names translated into many languages. Short descriptions of provided classes: ======================================= - I18Nv2 OS independent (Linux/Win32) setlocale(), other utils - I18Nv2_Locale locale based formatter - I18Nv2_Negotiator HTTP negiotiation of preferred language and charset - I18Nv2_Country multilingual list of country names - I18Nv2_Language multilingual list of language names - I18Nv2_Currency multilingual list of currency names - I18Nv2_Encoding list of common and not so common charsets and aliases - I18Nv2_AreaCode list of international area codes (phone) Decorators for lists like I18Nv2_Country and I18Nv2_Language: ============================================================= - HtmlEntities transparently encode displayed names with HTML entities - HtmlSpecialchars transparently encode special XML chars in displayed names - HtmlSelect ready to use HTML select element facility - Filter exclude or include elements of a list Translations of language, country and currency names are more or less completely available in the following languages: ============================================================= Afar, Afrikaans, Albanian, Amharic, Arabic, Armenian, Assamese, Azerbaijani, Basque, Belarusian, Bengali, Bulgarian, Catalan, Chinese, Cornish, Croatian, Czech, Danish, Divehi, Dutch, Dzongkha, English, Esperanto, Estonian, Faroese, Finnish, French, Gallegan, Georgian, German, Greek, Gujarati, Hebrew, Hindi, Hungarian, Icelandic, Indonesian, Inuktitut, Irish, Italian, Japanese, Kalaallisut, Kannada, Kazakh, Khmer, Kirghiz, Korean, Lao, Latvian, Lithuanian, Macedonian, Malay, Malayalam, Maltese, Manx, Marathi, Mongolian, Norwegian Bokmal, Norwegian Nynorsk, Oriya, Oromo, Pashto (Pushto), Persian, Polish, Portuguese, Punjabi, Romanian, Russian, Sanskrit, Serbian, Serbo-Croatian, Slovak, Slovenian, Somali, Spanish, Swahili, Swedish, Tamil, Tatar, Telugu, Thai, Tigrinya, Turkish, Ukrainian, Urdu, Uzbek, Vietnamese and Welsh FINAL NOTE: =========== Contributions are very welcome!

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/i18nv2/allreleases.xml", '

I18Nv2

pear.php.net 0.11.3beta 0.11.2beta 0.11.1beta 0.11.0beta 0.10.0alpha 0.9.3alpha 0.9.2alpha 0.9.1alpha 0.9.0alpha 0.8.0alpha 0.7.1alpha 0.7.0alpha 0.6.0alpha 0.5.0alpha 0.4.0alpha 0.3.0alpha 0.2.0alpha 0.1.0alpha
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/i18nv2/deps.0.11.3.txt", 'a:4:{i:1;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:2:"no";s:4:"name";s:4:"PEAR";}i:2;a:4:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"4.0.6";s:8:"optional";s:2:"no";}i:3;a:4:{s:4:"type";s:3:"ext";s:3:"rel";s:3:"has";s:8:"optional";s:2:"no";s:4:"name";s:4:"pcre";}i:4;a:4:{s:4:"type";s:3:"ext";s:3:"rel";s:3:"has";s:8:"optional";s:2:"no";s:4:"name";s:5:"iconv";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/i18n_unicodestring/info.xml", '

I18N_UnicodeString pear.php.net Internationalization BSD Provides a way to work with self contained multibyte strings Provides a method of storing and manipulating multibyte strings in PHP without using ext/mbstring. Also allows conversion between various methods of storing Unicode in 8 byte strings like UTF-8 and HTML entities.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/i18n_unicodestring/allreleases.xml", '

I18N_UnicodeString

pear.php.net 0.1.0beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/i18n_unicodestring/deps.0.1.0.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/image_3d/info.xml", '

Image_3D pear.php.net Images LGPL This class allows the rendering of 3 dimensional images using PHP and ext/GD. Image_3D is a highly object oriented PHP5 package that allows the creation of 3 dimensional images using PHP and the GD extension, which is bundled with PHP. Image_3D currently supports: * Creation of 3D objects like cubes, spheres, maps, text,... * Own object definitions possible * Own material definitions * Import of 3DSMax files * Unlimited number of light sources * Saving all output formats supported by GD

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/image_3d/allreleases.xml", '

Image_3D

pear.php.net 0.2.1alpha
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/image_3d/deps.0.2.1.txt", 'a:1:{s:8:"required";a:3:{s:3:"php";a:1:{s:3:"min";s:5:"5.0.0";}s:13:"pearinstaller";a:1:{s:3:"min";s:7:"1.4.0a1";}s:9:"extension";a:1:{s:4:"name";s:2:"gd";}}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/image_barcode/info.xml", '

Image_Barcode pear.php.net Images PHP License Barcode generation With PEAR::Image_Barcode class you can create a barcode representation of a given string. This class uses GD function because of this the generated graphic can be any of GD supported supported image types.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/image_barcode/allreleases.xml", '

Image_Barcode

pear.php.net 1.0.4stable 1.0.3stable 1.0.2stable 1.0.1stable 1.0.0stable 0.5stable 0.4beta 0.3alpha
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/image_barcode/deps.1.0.4.txt", 'a:2:{i:1;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:3:"yes";s:4:"name";s:10:"PHP_Compat";}i:2;a:3:{s:4:"type";s:3:"ext";s:3:"rel";s:3:"has";s:4:"name";s:2:"gd";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/image_canvas/info.xml", '

Image_Canvas pear.php.net Images LGPL A package providing a common interface to image drawing, making image source code independent on the library used. A package providing a common interface to image drawing, making image source code independent on the library used.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/image_canvas/allreleases.xml", '

Image_Canvas

pear.php.net 0.2.1alpha 0.2.0alpha
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/image_canvas/deps.0.2.1.txt", 'a:2:{i:1;a:4:{s:4:"type";s:3:"ext";s:3:"rel";s:3:"has";s:8:"optional";s:2:"no";s:4:"name";s:2:"gd";}i:2;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.0.0";s:8:"optional";s:2:"no";s:4:"name";s:11:"Image_Color";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/image_color/info.xml", '

Image_Color pear.php.net Images PHP License Manage and handles color data and conversions. Manage and handles color data and conversions.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/image_color/allreleases.xml", '

Image_Color

pear.php.net 1.0.2stable 1.0.1stable 1.0.0stable 0.4stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/image_color/deps.1.0.2.txt", 'a:1:{i:1;a:3:{s:4:"type";s:3:"ext";s:3:"rel";s:3:"has";s:4:"name";s:2:"gd";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/image_gis/info.xml", '

Image_GIS pear.php.net Images PHP License Visualization of GIS data. Generating maps on demand can be a hard job as most often you don\'t have the maps you need in digital form. But you can generate your own maps based on raw, digital data files which are available for free on the net. This package provides a parser for the most common format for geographical data, the Arcinfo/E00 format as well as renderers to produce images using GD or Scalable Vector Graphics (SVG).

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/image_gis/allreleases.xml", '

Image_GIS

pear.php.net 1.1.1stable 1.1.0stable 1.0.0stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/image_gis/deps.1.1.1.txt", 'a:4:{i:1;a:3:{s:4:"type";s:3:"ext";s:3:"rel";s:3:"has";s:4:"name";s:2:"gd";}i:2;a:3:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:4:"name";s:10:"Cache_Lite";}i:3;a:3:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:4:"name";s:11:"Image_Color";}i:4;a:3:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:4:"name";s:7:"XML_SVG";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/image_graph/info.xml", '

Image_Graph pear.php.net Images LGPL A package for displaying (numerical) data as a graph/chart/plot. Image_Graph provides a set of classes that creates graphs/plots/charts based on (numerical) data. Many different plot types are supported: Bar, line, area, step, impulse, scatter, radar, pie, map, candlestick, band, box & whisker and smoothed line, area and radar plots. The graph is highly customizable, making it possible to get the exact look and feel that is required. The output is controlled by a Image_Canvas, which facilitates easy output to many different output formats, amongst others, GD (PNG, JPEG, GIF, WBMP), PDF (using PDFLib), Scalable Vector Graphics (SVG). Image_Graph is compatible with both PHP4 and PHP5.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/image_graph/allreleases.xml", '

Image_Graph

pear.php.net 0.6.0alpha 0.5.0alpha 0.4.0alpha 0.3.0alpha 0.3.0dev4devel 0.3.0dev3devel 0.3.0dev2devel 0.3.0dev1devel 0.2.1alpha 0.2.0RC1alpha 0.1.1alpha 0.1alpha
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/image_graph/deps.0.6.0.txt", 'a:4:{i:1;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.3.1";s:8:"optional";s:2:"no";s:4:"name";s:4:"PEAR";}i:2;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"0.2.1";s:8:"optional";s:2:"no";s:4:"name";s:12:"Image_Canvas";}i:3;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:3:"yes";s:4:"name";s:13:"Numbers_Roman";}i:4;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:3:"yes";s:4:"name";s:13:"Numbers_Words";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/image_graphviz/info.xml", '

Image_GraphViz pear.php.net Images PHP License Interface to AT&T\'s GraphViz tools The GraphViz class allows for the creation of and the work with directed and undirected graphs and their visualization with AT&T\'s GraphViz tools.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/image_graphviz/allreleases.xml", '

Image_GraphViz

pear.php.net 1.1.0stable 1.1.0beta1beta 1.0.3stable 1.0.2stable 1.0.1stable 1.0stable 0.4stable 0.3stable 0.2
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/image_graphviz/deps.1.1.0.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/image_iptc/info.xml", '

Image_IPTC pear.php.net Images PHP License Extract, modify, and save IPTC data This package provides a mechanism for modifying IPTC header information. The class abstracts the functionality of iptcembed() and iptcparse() in addition to providing methods that properly handle replacing IPTC header fields back into image files.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/image_iptc/allreleases.xml", '

Image_IPTC

pear.php.net 1.0.2stable 1.0.1stable 1.0.0stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/image_iptc/deps.1.0.2.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/image_remote/info.xml", '

Image_Remote pear.php.net Images PHP Retrieve information on remote image files. This class can be used for retrieving size information of remote image files via http without downloading the whole image.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/image_remote/allreleases.xml", '

Image_Remote

pear.php.net 1.0beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/image_remote/deps.1.0.txt", false, false); $pearweb->addRESTConfig("http://pear.php.net/rest/p/image_text/info.xml", '

Image_Text pear.php.net Images PHP License Image_Text - Advanced text manipulations in images. Image_Text provides a comfortable interface to text manipulations in GD images. Beside common Freetype2 functionality it offers to handle texts in a graphic- or office-tool like way. For example it allows alignment of texts inside a text box, rotation (around the top left corner of a text box or it\'s center point) and the automatic measurizement of the optimal font size for a given text box.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/image_text/allreleases.xml", '

Image_Text

pear.php.net 0.5.2beta2beta 0.5.2beta1beta 0.5.1betabeta 0.5.0beta 0.4pl1alpha 0.4alpha 0.3pl1alpha 0.3alpha 0.2alpha 0.1alpha
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/image_text/deps.0.5.2beta2.txt", 'a:1:{i:1;a:4:{s:4:"type";s:3:"ext";s:3:"rel";s:3:"has";s:8:"optional";s:2:"no";s:4:"name";s:2:"gd";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/image_tools/info.xml", '

Image_Tools pear.php.net Images PHP License Tool collection for images. A collection of common image manipulations.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/image_tools/allreleases.xml", '

Image_Tools

pear.php.net 0.2alpha 0.1alpha
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/image_tools/deps.0.2.txt", 'a:1:{i:1;a:4:{s:4:"type";s:3:"ext";s:3:"rel";s:3:"has";s:7:"version";s:1:"2";s:4:"name";s:2:"gd";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/image_transform/info.xml", '

Image_Transform pear.php.net Images PHP License Provides a standard interface to manipulate images using different libraries This package was written to provide a simpler and cross-library interface to doing image transformations and manipulations. It provides : * support for GD, ImageMagick, Imagick and NetPBM * files related functions * addText * Scale (by length, percentage, maximum X/Y) * Resize * Rotate (custom angle) * Crop * Mirror (Most drivers) * Flip (Most drivers) * Add border (soon) * Add shadow (soon)

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/image_transform/allreleases.xml", '

Image_Transform

pear.php.net 0.9.0alpha 0.8alpha 0.2beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/image_transform/deps.0.9.0.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/image_xbm/info.xml", '

Image_XBM pear.php.net Images PHP License Manipulate XBM images Package for manipulate XBM images

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/image_xbm/allreleases.xml", '

Image_XBM

pear.php.net 0.2.0beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/image_xbm/deps.0.2.0.txt", 'a:2:{i:1;a:3:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"4.0.4";}i:2;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:3:"0.8";s:8:"optional";s:3:"yes";s:4:"name";s:11:"Text_Figlet";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/inline_c/info.xml", '

Inline_C pear.php.net PHP PHP License Allows inline inclusion of function definitions in C The Inline_C class allows for inline inclusion of C code. This code can be compiled and loaded automatically. Resulting extensions are cached to speed future loads.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/inline_c/allreleases.xml", '

Inline_C

pear.php.net 0.1alpha
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/inline_c/deps.0.1.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/liveuser/info.xml", '

LiveUser pear.php.net Authentication LGPL User authentication and permission management framework LiveUser is a set of classes for dealing with user authentication and permission management. Basically, there are three main elements that make up this package: * The LiveUser class * The Auth containers * The Perm containers The LiveUser class takes care of the login process and can be configured to use a certain permission container and one or more different auth containers. That means, you can have your users\' data scattered amongst many data containers and have the LiveUser class try each defined container until the user is found. For example, you can have all website users who can apply for a new account online on the webserver\'s local database. Also, you want to enable all your company\'s employees to login to the site without the need to create new accounts for all of them. To achieve that, a second container can be defined to be used by the LiveUser class. You can also define a permission container of your choice that will manage the rights for each user. Depending on the container, you can implement any kind of permission schemes for your application while having one consistent API. Using different permission and auth containers, it\'s easily possible to integrate newly written applications with older ones that have their own ways of storing permissions and user data. Just make a new container type and you\'re ready to go! Currently available are containers using: PEAR::DB, PEAR::MDB, PEAR::MDB2, PEAR::XML_Tree and PEAR::Auth.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/liveuser/allreleases.xml", '

LiveUser

pear.php.net 0.16.6beta 0.16.5beta 0.16.4beta 0.16.3beta 0.16.2beta 0.16.1beta 0.16.0beta 0.15.1beta 0.15.0beta 0.14.0beta 0.13.3beta 0.13.2beta 0.13.1beta 0.13.0beta 0.12.0beta 0.11.1beta 0.11.0beta 0.10.0beta 0.9beta 0.8.1beta 0.8beta 0.7alpha 0.6.1alpha 0.6alpha 0.5.1alpha 0.5alpha 0.3alpha
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/liveuser/deps.0.16.6.txt", 'a:10:{i:1;a:4:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"4.2.0";s:8:"optional";s:2:"no";}i:2;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.3.3";s:8:"optional";s:2:"no";s:4:"name";s:4:"PEAR";}i:3;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:2:"no";s:4:"name";s:16:"Event_Dispatcher";}i:4;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.7.0";s:8:"optional";s:3:"yes";s:4:"name";s:3:"Log";}i:5;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.6.0";s:8:"optional";s:3:"yes";s:4:"name";s:2:"DB";}i:6;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.1.4";s:8:"optional";s:3:"yes";s:4:"name";s:3:"MDB";}i:7;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:10:"2.0.0beta4";s:8:"optional";s:3:"yes";s:4:"name";s:4:"MDB2";}i:8;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:3:"yes";s:4:"name";s:11:"MDB2_Schema";}i:9;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:3:"yes";s:4:"name";s:8:"XML_Tree";}i:10;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:3:"yes";s:4:"name";s:9:"Crypt_RC4";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/liveuser_admin/info.xml", '

LiveUser_Admin pear.php.net Authentication LGPL User authentication and permission management framework LiveUser_Admin is meant to be used with the LiveUser package. It is composed of all the classes necessary to administrate data used by LiveUser. You\'ll be able to add/edit/delete/get things like: * Rights * Users * Groups * Areas * Applications * Subgroups * ImpliedRights And all other entities within LiveUser. At the moment we support the following storage containers: * DB * MDB * MDB2 But it takes no time to write up your own storage container, so if you like to use native mysql functions straight, then it\'s possible to do so in under a hour!

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/liveuser_admin/allreleases.xml", '

LiveUser_Admin

pear.php.net 0.3.4beta 0.3.3beta 0.3.2beta 0.3.1beta 0.3.0beta 0.2.1beta 0.2.0beta 0.1.0beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/liveuser_admin/deps.0.3.4.txt", 'a:9:{i:1;a:4:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"4.2.0";s:8:"optional";s:2:"no";}i:2;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.3.1";s:8:"optional";s:2:"no";s:4:"name";s:4:"PEAR";}i:3;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:6:"0.16.0";s:8:"optional";s:2:"no";s:4:"name";s:8:"LiveUser";}i:4;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.7.0";s:8:"optional";s:3:"yes";s:4:"name";s:3:"Log";}i:5;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.6.0";s:8:"optional";s:3:"yes";s:4:"name";s:2:"DB";}i:6;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.1.4";s:8:"optional";s:3:"yes";s:4:"name";s:3:"MDB";}i:7;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:10:"2.0.0beta4";s:8:"optional";s:3:"yes";s:4:"name";s:4:"MDB2";}i:8;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:3:"yes";s:4:"name";s:8:"XML_Tree";}i:9;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:3:"yes";s:4:"name";s:9:"Crypt_RC4";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/log/info.xml", '

Log pear.php.net Logging PHP License Logging utilities The Log framework provides an abstracted logging system. It supports logging to console, file, syslog, SQL, Sqlite, mail and mcal targets. It also provides a subject - observer mechanism.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/log/allreleases.xml", '

Log

pear.php.net 1.8.7stable 1.8.6stable 1.8.5stable 1.8.4stable 1.8.3stable 1.8.2stable 1.8.1stable 1.8.0stable 1.7.1stable 1.7.0stable 1.6.7stable 1.6.6stable 1.6.5stable 1.6.4stable 1.6.3stable 1.6.2stable 1.6.1stable 1.6.0stable 1.5.3stable 1.5.2stable 1.5.1stable 1.5stable 1.4stable 1.3stable 1.2stable 1.1stable 1.0
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/log/deps.1.8.7.txt", 'a:3:{i:1;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:3:"yes";s:4:"name";s:2:"DB";}i:2;a:4:{s:4:"type";s:3:"ext";s:3:"rel";s:3:"has";s:8:"optional";s:3:"yes";s:4:"name";s:6:"sqlite";}i:3;a:4:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"4.3.0";s:8:"optional";s:2:"no";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/mail/info.xml", '

Mail pear.php.net Mail PHP/BSD Class that provides multiple interfaces for sending emails PEAR\'s Mail package defines an interface for implementing mailers under the PEAR hierarchy. It also provides supporting functions useful to multiple mailer backends. Currently supported backends include: PHP\'s native mail() function, sendmail, and SMTP. This package also provides a RFC822 email address list validation utility class.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/mail/allreleases.xml", '

Mail

pear.php.net 1.1.9stable 1.1.8stable 1.1.7stable 1.1.6stable 1.1.5stable 1.1.4stable 1.1.3stable 1.1.2stable 1.1.1stable 1.1.0stable 1.0.2stable 1.0.1stable 1.0stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/mail/deps.1.1.9.txt", 'a:1:{i:1;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.1.0";s:8:"optional";s:3:"yes";s:4:"name";s:8:"Net_SMTP";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/mail_imap/info.xml", '

Mail_IMAP pear.php.net Mail PHP Provides a c-client backend for webmail. Mail_IMAP provides a flexible API for connecting to and retrieving mail from mailboxes using the IMAP, POP3 or NNTP mail protocols. Connection to a mailbox is acheived through the c-client extension to PHP (http://www.php.net/imap). Meaning installation of the c-client extension is required to use Mail_IMAP. Mail_IMAP can be used to retrieve the contents of a mailbox, whereas it may serve as the backend for a webmail application or mailing list manager. Since Mail_IMAP is an abstracted object, it allows for complete customization of the UI for any application. ***NOTE*** Mail_IMAPv2 is currently available. Mail_IMAPv2 is far more extensible, has far fewer bugs than Mail_IMAP 1, and is *not* backward compatible with Mail_IMAP 1. Any new developement should use Mail_IMAPv2.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/mail_imap/allreleases.xml", '

Mail_IMAP

pear.php.net 1.1.0RC2beta 1.1.0RC1beta 1.0.0RC4beta 1.0.0RC3beta 1.0.0RC2beta 1.0.0RC1beta 0.3.0Aalpha 0.2.0Aalpha 0.1.7Aalpha 0.1.6Aalpha
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/mail_imap/deps.1.1.0RC2.txt", 'a:2:{i:1;a:3:{s:4:"type";s:3:"ext";s:3:"rel";s:3:"has";s:4:"name";s:4:"imap";}i:2;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:3:"yes";s:4:"name";s:7:"Net_URL";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/mail_imapv2/info.xml", '

Mail_IMAPv2 pear.php.net Mail PHP Provides a c-client backend for webmail. Mail_IMAPv2 provides a simplified backend for working with the c-client (IMAP) extension. It serves as an OO wrapper for commonly used c-client functions. It provides structure and header parsing as well as body retrieval. Mail_IMAPv2 provides a simple inbox example that demonstrates its ability to parse and view simple and multipart email messages. Mail_IMAPv2 also provides a connection wizard to determine the correct protocol and port settings for a remote mail server, all you need to provide is a server, a username and a password. Mail_IMAPv2 may be used as a webmail backend or as a component in a mailing list manager. This package requires the c-client extension. To download the latest version of the c-client extension goto: http://www.php.net/imap.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/mail_imapv2/allreleases.xml", '

Mail_IMAPv2

pear.php.net 0.2.0beta 0.1.0beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/mail_imapv2/deps.0.2.0.txt", 'a:2:{i:1;a:3:{s:4:"type";s:3:"ext";s:3:"rel";s:3:"has";s:4:"name";s:4:"imap";}i:2;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:3:"yes";s:4:"name";s:7:"Net_URL";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/mail_mbox/info.xml", '

Mail_Mbox pear.php.net Mail PHP Mbox PHP class to Unix MBOX parsing and using. It can split messages inside a Mbox, return the number of messages, return, update or remove an specific message or add a message on the Mbox.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/mail_mbox/allreleases.xml", '

Mail_Mbox

pear.php.net 0.3.0beta 0.2.0alpha 0.1.5alpha 0.1.4alpha 0.1.3alpha
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/mail_mbox/deps.0.3.0.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/mail_mime/info.xml", '

Mail_Mime pear.php.net Mail PHP Provides classes to create and decode mime messages. Provides classes to deal with creation and manipulation of mime messages.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/mail_mime/allreleases.xml", '

Mail_Mime

pear.php.net 1.3.1stable 1.3.0stable 1.3.0RC1beta 1.2.1stable 1.2stable 1.1stable 1.0stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/mail_mime/deps.1.3.1.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/mail_queue/info.xml", '

Mail_Queue pear.php.net Mail PHP Class for put mails in queue and send them later in background. Class to handle mail queue managment. Wrapper for PEAR::Mail and PEAR::DB (or PEAR::MDB/MDB2). It can load, save and send saved mails in background and also backup some mails. The Mail_Queue class puts mails in a temporary container, waiting to be fed to the MTA (Mail Transport Agent), and sends them later (e.g. a certain amount of mails every few minutes) by crontab or in other way.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/mail_queue/allreleases.xml", '

Mail_Queue

pear.php.net 1.1.3stable 1.1.2stable 1.1.1stable 1.1stable 1.0stable 0.9beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/mail_queue/deps.1.1.3.txt", 'a:1:{i:1;a:3:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:4:"name";s:4:"Mail";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/math_basex/info.xml", '

Math_Basex pear.php.net Math PHP Simple class for converting base set of numbers with a customizable character base set. Base X conversion class

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/math_basex/allreleases.xml", '

Math_Basex

pear.php.net 0.3stable 0.2stable 0.1stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/math_basex/deps.0.3.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/math_binaryutils/info.xml", '

Math_BinaryUtils pear.php.net Math LGPL Collection of helper methods for easy handling of binary data. Collection of helper methods for dealing with binary data (add, subtract, converting functions, endianess functions etc.).

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/math_binaryutils/allreleases.xml", '

Math_BinaryUtils

pear.php.net 0.3.0alpha 0.2.0alpha
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/math_binaryutils/deps.0.3.0.txt", 'a:1:{i:1;a:4:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:3:"4.3";s:8:"optional";s:2:"no";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/math_complex/info.xml", '

Math_Complex pear.php.net Math PHP Classes that define complex numbers and their operations Classes that represent and manipulate complex numbers. Contain definitions for basic arithmetic functions, as well as trigonometric, inverse trigonometric, hyperbolic, inverse hyperbolic, exponential and logarithms of complex numbers.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/math_complex/allreleases.xml", '

Math_Complex

pear.php.net 0.8.5beta 0.8beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/math_complex/deps.0.8.5.txt", 'a:1:{i:1;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:3:"1.0";s:4:"name";s:11:"Math_TrigOp";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/math_fibonacci/info.xml", '

Math_Fibonacci pear.php.net Math PHP Package to calculate and manipulate Fibonacci numbers The Fibonacci series is constructed using the formula: F(n) = F(n - 1) + F (n - 2), By convention F(0) = 0, and F(1) = 1. An alternative formula that uses the Golden Ratio can also be used: F(n) = (PHI^n - phi^n)/sqrt(5) [Lucas\' formula], where PHI = (1 + sqrt(5))/2 is the Golden Ratio, and phi = (1 - sqrt(5))/2 is its reciprocal Requires Math_Integer, and can be used with big integers if the GMP or the BCMATH libraries are present.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/math_fibonacci/allreleases.xml", '

Math_Fibonacci

pear.php.net 0.8stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/math_fibonacci/deps.0.8.txt", 'a:1:{i:1;a:3:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:4:"name";s:12:"Math_Integer";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/math_finance/info.xml", '

Math_Finance pear.php.net Math PHP License Financial functions Collection of financial functions for time value of money (annuities), cash flow, interest rate conversions, bonds and depreciation calculations.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/math_finance/allreleases.xml", '

Math_Finance

pear.php.net 0.5.0beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/math_finance/deps.0.5.0.txt", 'a:1:{i:1;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"0.3.0";s:4:"name";s:26:"Math_Numerical_RootFinding";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/math_fraction/info.xml", '

Math_Fraction pear.php.net Math PHP Classes that represent and manipulate fractions. Classes that represent and manipulate fractions (x = a/b). The Math_FractionOp static class contains definitions for: - basic arithmetic operations - comparing fractions - greatest common divisor (gcd) and least common multiple (lcm) of two integers - simplifying (reducing) and getting the reciprocal of a fraction - converting a float to fraction.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/math_fraction/allreleases.xml", '

Math_Fraction

pear.php.net 0.4.0beta 0.3.0alpha
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/math_fraction/deps.0.4.0.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/math_histogram/info.xml", '

Math_Histogram pear.php.net Math PHP Classes to calculate histogram distributions Classes to calculate histogram distributions and associated statistics. Supports simple and cummulative histograms. You can generate regular (2D) histograms, 3D, or 4D histograms Data must not have nulls. Requires Math_Stats.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/math_histogram/allreleases.xml", '

Math_Histogram

pear.php.net 0.9.0beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/math_histogram/deps.0.9.0.txt", 'a:2:{i:1;a:3:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:3:"4.1";}i:2;a:3:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:4:"name";s:10:"Math_Stats";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/math_integer/info.xml", '

Math_Integer pear.php.net Math PHP Package to represent and manipulate integers The class Math_Integer can represent integers bigger than the signed longs that are the default of PHP, if either the GMP or the BCMATH (bundled with PHP) are present. Otherwise it will fall back to the internal integer representation. The Math_IntegerOp class defines operations on Math_Integer objects.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/math_integer/allreleases.xml", '

Math_Integer

pear.php.net 0.8stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/math_integer/deps.0.8.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/math_matrix/info.xml", '

Math_Matrix pear.php.net Math PHP Class to represent matrices and matrix operations Matrices are represented as 2 dimensional arrays of numbers. This class defines methods for matrix objects, as well as static methods to read, write and manipulate matrices, including methods to solve systems of linear equations (with and without iterative error correction). Requires the Math_Vector package. For running the unit tests you will need PHPUnit version 0.6.2 or older.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/math_matrix/allreleases.xml", '

Math_Matrix

pear.php.net 0.8.5beta 0.8.0stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/math_matrix/deps.0.8.5.txt", 'a:2:{i:1;a:3:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:4:"name";s:11:"Math_Vector";}i:2;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"le";s:7:"version";s:5:"0.6.2";s:8:"optional";s:3:"yes";s:4:"name";s:7:"PHPUnit";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/math_numerical_rootfinding/info.xml", '

Math_Numerical_RootFinding pear.php.net Math BSD License Numerical Methods Root-Finding functions package Math_Numerical_RootFinding is the package provide various Numerical Methods Root-Finding functions implemented in PHP, e.g Bisection, Newton-Raphson, Fixed Point, Secant etc.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/math_numerical_rootfinding/allreleases.xml", '

Math_Numerical_RootFinding

pear.php.net 0.3.0alpha 0.2.0alpha 0.1.0alpha
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/math_numerical_rootfinding/deps.0.3.0.txt", 'a:1:{i:1;a:4:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"4.2.0";s:8:"optional";s:2:"no";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/math_quaternion/info.xml", '

Math_Quaternion pear.php.net Math PHP Classes that define Quaternions and their operations Classes that represent and manipulate quaternions. Contain definitions for basic arithmetic functions in a static class. Quaternions are an extension of the idea of complex numbers, and a quaternion is defined as: q = a + b*i + c*j + d*k In 1844 Hamilton described a system in which numbers were composed of a real part and 3 imaginary and independent parts (i,j,k), such that: i^2 = j^2 = k^2 = -1 and ij = k, jk = i, ki = j and ji = -k, kj = -i, ik = -j The above are known as "Hamilton\'s rules"

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/math_quaternion/allreleases.xml", '

Math_Quaternion

pear.php.net 0.7.1beta 0.7beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/math_quaternion/deps.0.7.1.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/math_rpn/info.xml", '

Math_RPN pear.php.net Math PHP License Reverse Polish Notation. Change Expression To RPN (Reverse Polish Notation) and evaluate it.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/math_rpn/allreleases.xml", '

Math_RPN

pear.php.net 1.1.1stable 1.1stable 1.0stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/math_rpn/deps.1.1.1.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/math_stats/info.xml", '

Math_Stats pear.php.net Math PHP Classes to calculate statistical parameters Package to calculate statistical parameters of numerical arrays of data. The data can be in a simple numerical array, or in a cummulative numerical array. A cummulative array, has the value as the index and the number of repeats as the value for the array item, e.g. $data = array(3=>4, 2.3=>5, 1.25=>6, 0.5=>3). Nulls can be rejected, ignored or handled as zero values. Note: You should be using the latest release (0.9.0beta3 currently), as it fixes problems with the calculations of several of the statistics that exist in the stable release.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/math_stats/allreleases.xml", '

Math_Stats

pear.php.net 0.9.0beta3beta 0.9.0beta2beta 0.9.0beta1beta 0.8.5stable 0.8.4stable 0.8.3beta 0.8.1beta 0.8.0beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/math_stats/deps.0.9.0beta3.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/math_trigop/info.xml", '

Math_TrigOp pear.php.net Math PHP Supplementary trigonometric functions Static class with methods that implement supplementary trigonometric, inverse trigonometric, hyperbolic, and inverse hyperbolic functions.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/math_trigop/allreleases.xml", '

Math_TrigOp

pear.php.net 1.0stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/math_trigop/deps.1.0.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/math_vector/info.xml", '

Math_Vector pear.php.net Math PHP Vector and vector operation classes Classes to represent Tuples, general Vectors, and 2D-/3D-vectors, as well as a static class for vector operations.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/math_vector/allreleases.xml", '

Math_Vector

pear.php.net 0.6.2beta 0.6.0beta 0.5.1beta 0.5.0beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/math_vector/deps.0.6.2.txt", 'a:1:{i:1;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"le";s:7:"version";s:5:"0.6.2";s:8:"optional";s:3:"yes";s:4:"name";s:7:"PHPUnit";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/mdb/info.xml", '

MDB pear.php.net Database BSD style database abstraction layer PEAR MDB is a merge of the PEAR DB and Metabase php database abstraction layers. It provides a common API for all support RDBMS. The main difference to most other DB abstraction packages is that MDB goes much further to ensure portability. Among other things MDB features: * An OO-style query API * A DSN (data source name) or array format for specifying database servers * Datatype abstraction and on demand datatype conversion * Portable error codes * Sequential and non sequential row fetching as well as bulk fetching * Ordered array and associative array for the fetched rows * Prepare/execute (bind) emulation * Sequence emulation * Replace emulation * Limited Subselect emulation * Row limit support * Transactions support * Large Object support * Index/Unique support * Module Framework to load advanced functionality on demand * Table information interface * RDBMS management methods (creating, dropping, altering) * RDBMS independent xml based schema definition management * Altering of a DB from a changed xml schema * Reverse engineering of xml schemas from an existing DB (currently only MySQL) * Full integration into the PEAR Framework * Wrappers for the PEAR DB and Metabase APIs * PHPDoc API documentation Currently supported RDBMS: MySQL PostGreSQL Oracle Frontbase Querysim Interbase/Firebird MSSQL

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/mdb/allreleases.xml", '

MDB

pear.php.net 1.3.0stable 1.2stable 1.1.4stable 1.1.4RC6devel 1.1.4RC5devel 1.1.4RC4devel 1.1.4RC3devel 1.1.4RC2devel 1.1.4-RC1devel 1.1.3stable 1.1.3-RC2devel 1.1.3-RC1devel 1.1.2stable 1.1.2-RC2devel 1.1.2-RC1devel 1.1.1stable 1.1.0pl1devel 1.1.0devel 1.0.1RC1devel 1.0stable 1.0_RC4devel 1.0_RC3devel 1.0_RC2devel 1.0_RC1devel 0.9.11devel 0.9.10devel 0.9.9beta 0.9.8beta 0.9.7.1beta 0.9.7beta 0.9.6beta 0.9.5beta 0.9.4beta 0.9.3beta 0.9.2beta 0.9.1beta 0.9beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/mdb/deps.1.3.0.txt", 'a:3:{i:1;a:3:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"4.2.0";}i:2;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.0b1";s:4:"name";s:4:"PEAR";}i:3;a:3:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:4:"name";s:10:"XML_Parser";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/mdb2/info.xml", '

MDB2 pear.php.net Database BSD License database abstraction layer PEAR MDB2 is a merge of the PEAR DB and Metabase php database abstraction layers. Note that the API will be adapted to better fit with the new php5 only PDO before the first stable release. It provides a common API for all support RDBMS. The main difference to most other DB abstraction packages is that MDB2 goes much further to ensure portability. Among other things MDB2 features: * An OO-style query API * A DSN (data source name) or array format for specifying database servers * Datatype abstraction and on demand datatype conversion * Portable error codes * Sequential and non sequential row fetching as well as bulk fetching * Ability to make buffered and unbuffered queries * Ordered array and associative array for the fetched rows * Prepare/execute (bind) emulation * Sequence emulation * Replace emulation * Limited Subselect emulation * Row limit support * Transactions support * Large Object support * Index/Unique support * Module Framework to load advanced functionality on demand * Table information interface * RDBMS management methods (creating, dropping, altering) * RDBMS independent xml based schema definition management * Reverse engineering schemas from an existing DB * Full integration into the PEAR Framework * PHPDoc API documentation

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/mdb2/allreleases.xml", '

MDB2

pear.php.net 2.0.0beta5beta 2.0.0beta4beta 2.0.0beta3beta 2.0.0beta2beta 2.0.0beta1alpha 2.0.0alpha1alpha
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/mdb2/deps.2.0.0beta5.txt", 'a:2:{i:1;a:4:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"4.2.0";s:8:"optional";s:2:"no";}i:2;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.0b1";s:8:"optional";s:2:"no";s:4:"name";s:4:"PEAR";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/mdb2_driver_fbsql/info.xml", '

MDB2_Driver_fbsql pear.php.net Database BSD License fbsql MDB2 driver This is the Frontbase SQL MDB2 driver.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/mdb2_driver_fbsql/allreleases.xml", '

MDB2_Driver_fbsql

pear.php.net 0.1.0alpha
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/mdb2_driver_fbsql/deps.0.1.0.txt", 'a:4:{i:1;a:4:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"4.2.0";s:8:"optional";s:2:"no";}i:2;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.0b1";s:8:"optional";s:2:"no";s:4:"name";s:4:"PEAR";}i:3;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:10:"2.0.0beta5";s:8:"optional";s:2:"no";s:4:"name";s:4:"MDB2";}i:4;a:4:{s:4:"type";s:3:"ext";s:3:"rel";s:3:"has";s:8:"optional";s:2:"no";s:4:"name";s:5:"fbsql";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/mdb2_driver_ibase/info.xml", '

MDB2_Driver_ibase pear.php.net Database BSD License ibase MDB2 driver This is the Firebird/Interbase MDB2 driver.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/mdb2_driver_ibase/allreleases.xml", '

MDB2_Driver_ibase

pear.php.net 0.1.1beta 0.1.0alpha
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/mdb2_driver_ibase/deps.0.1.1.txt", 'a:4:{i:1;a:4:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"5.0.4";s:8:"optional";s:2:"no";}i:2;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.0b1";s:8:"optional";s:2:"no";s:4:"name";s:4:"PEAR";}i:3;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:10:"2.0.0beta5";s:8:"optional";s:2:"no";s:4:"name";s:4:"MDB2";}i:4;a:4:{s:4:"type";s:3:"ext";s:3:"rel";s:3:"has";s:8:"optional";s:2:"no";s:4:"name";s:9:"interbase";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/mdb2_driver_mssql/info.xml", '

MDB2_Driver_mssql pear.php.net Database BSD License mssql MDB2 driver This is the Microsoft SQL Server MDB2 driver.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/mdb2_driver_mssql/allreleases.xml", '

MDB2_Driver_mssql

pear.php.net 0.1.0alpha
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/mdb2_driver_mssql/deps.0.1.0.txt", 'a:4:{i:1;a:4:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"4.2.0";s:8:"optional";s:2:"no";}i:2;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.0b1";s:8:"optional";s:2:"no";s:4:"name";s:4:"PEAR";}i:3;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:10:"2.0.0beta5";s:8:"optional";s:2:"no";s:4:"name";s:4:"MDB2";}i:4;a:4:{s:4:"type";s:3:"ext";s:3:"rel";s:3:"has";s:8:"optional";s:2:"no";s:4:"name";s:5:"mssql";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/mdb2_driver_mysql/info.xml", '

MDB2_Driver_mysql pear.php.net Database BSD License mysql MDB2 driver This is the MySQL MDB2 driver.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/mdb2_driver_mysql/allreleases.xml", '

MDB2_Driver_mysql

pear.php.net 0.1.0beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/mdb2_driver_mysql/deps.0.1.0.txt", 'a:4:{i:1;a:4:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"4.2.0";s:8:"optional";s:2:"no";}i:2;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.0b1";s:8:"optional";s:2:"no";s:4:"name";s:4:"PEAR";}i:3;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:10:"2.0.0beta5";s:8:"optional";s:2:"no";s:4:"name";s:4:"MDB2";}i:4;a:4:{s:4:"type";s:3:"ext";s:3:"rel";s:3:"has";s:8:"optional";s:2:"no";s:4:"name";s:5:"mysql";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/mdb2_driver_mysqli/info.xml", '

MDB2_Driver_mysqli pear.php.net Database BSD License mysqli MDB2 driver This is the MySQLi MDB2 driver.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/mdb2_driver_mysqli/allreleases.xml", '

MDB2_Driver_mysqli

pear.php.net 0.1.0alpha
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/mdb2_driver_mysqli/deps.0.1.0.txt", 'a:4:{i:1;a:4:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"5.0.0";s:8:"optional";s:2:"no";}i:2;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.0b1";s:8:"optional";s:2:"no";s:4:"name";s:4:"PEAR";}i:3;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:10:"2.0.0beta5";s:8:"optional";s:2:"no";s:4:"name";s:4:"MDB2";}i:4;a:4:{s:4:"type";s:3:"ext";s:3:"rel";s:3:"has";s:8:"optional";s:2:"no";s:4:"name";s:6:"mysqli";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/mdb2_driver_oci8/info.xml", '

MDB2_Driver_oci8 pear.php.net Database BSD License oci8 MDB2 driver This is the Oracle OCI8 MDB2 driver.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/mdb2_driver_oci8/allreleases.xml", '

MDB2_Driver_oci8

pear.php.net 0.1.1alpha 0.1.0alpha
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/mdb2_driver_oci8/deps.0.1.1.txt", 'a:4:{i:1;a:4:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"4.3.0";s:8:"optional";s:2:"no";}i:2;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.0b1";s:8:"optional";s:2:"no";s:4:"name";s:4:"PEAR";}i:3;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:10:"2.0.0beta5";s:8:"optional";s:2:"no";s:4:"name";s:4:"MDB2";}i:4;a:4:{s:4:"type";s:3:"ext";s:3:"rel";s:3:"has";s:8:"optional";s:2:"no";s:4:"name";s:4:"oci8";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/mdb2_driver_pgsql/info.xml", '

MDB2_Driver_pgsql pear.php.net Database BSD License pgsql MDB2 driver This is the PostGreSQL MDB2 driver.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/mdb2_driver_pgsql/allreleases.xml", '

MDB2_Driver_pgsql

pear.php.net 0.1.0beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/mdb2_driver_pgsql/deps.0.1.0.txt", 'a:4:{i:1;a:4:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"4.2.0";s:8:"optional";s:2:"no";}i:2;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.0b1";s:8:"optional";s:2:"no";s:4:"name";s:4:"PEAR";}i:3;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:10:"2.0.0beta5";s:8:"optional";s:2:"no";s:4:"name";s:4:"MDB2";}i:4;a:4:{s:4:"type";s:3:"ext";s:3:"rel";s:3:"has";s:8:"optional";s:2:"no";s:4:"name";s:5:"pgsql";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/mdb2_driver_querysim/info.xml", '

MDB2_Driver_querysim pear.php.net Database BSD License querysim MDB2 driver This is the Querysim MDB2 driver.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/mdb2_driver_querysim/allreleases.xml", '

MDB2_Driver_querysim

pear.php.net 0.1.0alpha
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/mdb2_driver_querysim/deps.0.1.0.txt", 'a:3:{i:1;a:4:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"4.2.0";s:8:"optional";s:2:"no";}i:2;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.0b1";s:8:"optional";s:2:"no";s:4:"name";s:4:"PEAR";}i:3;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:10:"2.0.0beta5";s:8:"optional";s:2:"no";s:4:"name";s:4:"MDB2";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/mdb2_driver_sqlite/info.xml", '

MDB2_Driver_sqlite pear.php.net Database BSD License sqlite MDB2 driver This is the SQLite MDB2 driver.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/mdb2_driver_sqlite/allreleases.xml", '

MDB2_Driver_sqlite

pear.php.net 0.1.0beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/mdb2_driver_sqlite/deps.0.1.0.txt", 'a:4:{i:1;a:4:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"4.2.0";s:8:"optional";s:2:"no";}i:2;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.0b1";s:8:"optional";s:2:"no";s:4:"name";s:4:"PEAR";}i:3;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:10:"2.0.0beta5";s:8:"optional";s:2:"no";s:4:"name";s:4:"MDB2";}i:4;a:4:{s:4:"type";s:3:"ext";s:3:"rel";s:3:"has";s:8:"optional";s:2:"no";s:4:"name";s:6:"sqlite";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/mdb2_schema/info.xml", '

MDB2_Schema pear.php.net Database BSD License XML based database schema manager PEAR::MDB2_Schema enables users to maintain RDBMS independent schema files in XML that can be used to create, alter and drop database entities and insert data into a database. Reverse engineering database schemas from existing databases is also supported. The format is compatible with both PEAR::MDB and Metabase.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/mdb2_schema/allreleases.xml", '

MDB2_Schema

pear.php.net 0.2.0beta 0.1.0beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/mdb2_schema/deps.0.2.0.txt", 'a:5:{i:1;a:4:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"4.2.0";s:8:"optional";s:2:"no";}i:2;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.0b1";s:8:"optional";s:2:"no";s:4:"name";s:4:"PEAR";}i:3;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:2:"no";s:4:"name";s:10:"XML_Parser";}i:4;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:10:"2.0.0beta4";s:8:"optional";s:2:"no";s:4:"name";s:4:"MDB2";}i:5;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:3:"yes";s:4:"name";s:7:"XML_DTD";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/mdb_querytool/info.xml", '

MDB_QueryTool pear.php.net Database PHP An OO-interface for easily retrieving and modifying data in a DB. This package is an OO-abstraction to the SQL-Query language, it provides methods such as setWhere, setOrder, setGroup, setJoin, etc. to easily build queries. It also provides an easy to learn interface that interacts nicely with HTML-forms using arrays that contain the column data, that shall be updated/added in a DB. This package bases on an SQL-Builder which lets you easily build SQL-Statements and execute them. NB: this is a PEAR::MDB porting from the original DB_QueryTool written by Wolfram Kriesing and Paolo Panto (vision:produktion, wk@visionp.de).

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/mdb_querytool/allreleases.xml", '

MDB_QueryTool

pear.php.net 1.0.1stable 1.0.0stable 0.11.1stable 0.10.1stable 0.9.7stable 0.9.6stable 0.9.5-pl1stable 0.9.5stable 0.9.4stable 0.9.4-RC1beta 0.9.3beta 0.9.2beta 0.9beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/mdb_querytool/deps.1.0.1.txt", 'a:3:{i:1;a:3:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:3:"4.1";}i:2;a:3:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:4:"name";s:3:"MDB";}i:3;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:3:"1.7";s:4:"name";s:3:"Log";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/message/info.xml", '

Message pear.php.net Encryption PHP Message hash and digest (HMAC) generation methods and classes Classes for message hashing and HMAC signature generation using the mhash functions.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/message/allreleases.xml", '

Message

pear.php.net 0.6beta 0.5beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/message/deps.0.6.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/mime_type/info.xml", '

MIME_Type pear.php.net Tools and Utilities PHP License 3.0 Utility class for dealing with MIME types Provide functionality for dealing with MIME types. * Parse MIME type. * Supports full RFC2045 specification. * Many utility functions for working with and determining info about types. * Most functions can be called statically. * Autodetect a file\'s mime-type, either with mime_content_type() or the \'file\' command.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/mime_type/allreleases.xml", '

MIME_Type

pear.php.net 1.0.0stable 1.0.0beta3beta 1.0.0beta2beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/mime_type/deps.1.0.0.txt", 'a:2:{i:1;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.2.1";s:4:"name";s:4:"PEAR";}i:2;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:3:"yes";s:4:"name";s:14:"System_Command";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/mp3_id/info.xml", '

MP3_ID pear.php.net File Formats LGPL Read/Write MP3-Tags The class offers methods for reading and writing information tags (version 1) in MP3 files.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/mp3_id/allreleases.xml", '

MP3_ID

pear.php.net 1.2.0RC2beta 1.2.0RC1beta 1.1.4stable 1.1.3stable 1.1.2stable 1.1.1stable 1.1stable 1.0stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/mp3_id/deps.1.2.0RC2.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/mp3_playlist/info.xml", '

MP3_Playlist pear.php.net File Formats PHP License Library to create MP3 playlists on the fly, several formats supported including XML, RSS and XHTML MP3_Playlist is a php library to facilitate the creation and to some extend the rendering of MP3 playlists. It scans a local folder with all the MP3 files and outputs the playlist in several formats including M3U, SMIL, XML, XHTML with the possibility to backup the lists on the fly with an SQLite DB.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/mp3_playlist/allreleases.xml", '

MP3_Playlist

pear.php.net 0.5.0alpha1alpha
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/mp3_playlist/deps.0.5.0alpha1.txt", 'a:4:{i:1;a:4:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"5.0.0";s:8:"optional";s:2:"no";}i:2;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.3.0";s:8:"optional";s:2:"no";s:4:"name";s:4:"PEAR";}i:3;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:6:"1.0.14";s:8:"optional";s:2:"no";s:4:"name";s:7:"Net_URL";}i:4;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.1.4";s:8:"optional";s:2:"no";s:4:"name";s:6:"MP3_Id";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/net_checkip/info.xml", '

Net_CheckIP pear.php.net Networking PHP License Check the syntax of IPv4 addresses This package validates IPv4 addresses.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_checkip/allreleases.xml", '

Net_CheckIP

pear.php.net 1.1stable 1.0.1stable 1.0stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_checkip/deps.1.1.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/net_curl/info.xml", '

Net_Curl pear.php.net Networking PHP Net_Curl provides an OO interface to PHP\'s cURL extension Provides an OO interface to PHP\'s curl extension

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_curl/allreleases.xml", '

Net_Curl

pear.php.net 1.2.2stable 1.2.1stable 1.2.0stable 1.0.1betabeta 0.2stable 0.1stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_curl/deps.1.2.2.txt", 'a:2:{i:1;a:3:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"4.2.0";}i:2;a:3:{s:4:"type";s:3:"ext";s:3:"rel";s:3:"has";s:4:"name";s:4:"curl";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/net_cyrus/info.xml", '

Net_Cyrus pear.php.net Networking PHP License provides an API for the administration of Cyrus IMAP servers. API for the administration of Cyrus IMAP servers. It can be used to create,delete and modify users and it\'s properties (Quota and ACL)

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_cyrus/allreleases.xml", '

Net_Cyrus

pear.php.net 0.3.1beta 0.3.0beta 0.2.0beta 0.1.0beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_cyrus/deps.0.3.1.txt", 'a:2:{i:1;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:3:"1.0";s:4:"name";s:10:"Net_Socket";}i:2;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:3:"1.0";s:4:"name";s:8:"Net_IMAP";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/net_dict/info.xml", '

Net_Dict pear.php.net Networking PHP Interface to the DICT Protocol This class provides a simple API to the DICT Protocol handling all the network related issues and providing DICT responses in PHP datatypes to make it easy for a developer to use DICT servers in their programs.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_dict/allreleases.xml", '

Net_Dict

pear.php.net 1.0.3stable 1.0.2stable 1.0.1stable 1.0stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_dict/deps.1.0.3.txt", 'a:2:{i:1;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:3:"1.0";s:4:"name";s:10:"Net_Socket";}i:2;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.5.2";s:4:"name";s:5:"Cache";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/net_dig/info.xml", '

Net_Dig pear.php.net Networking PHP 2.02 The PEAR::Net_Dig class should be a nice, friendly OO interface to the dig command Net_Dig class is no longer being maintained. Use of Net_DNS is recommended instead. A brief tutorial on how to migrate to Net_DNS is listed below.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_dig/allreleases.xml", '

Net_Dig

pear.php.net 0.1stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_dig/deps.0.1.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/net_dime/info.xml", '

Net_DIME pear.php.net Networking PHP License The PEAR::Net_DIME class implements DIME encoding This is the initial independent release of the Net_DIME package. Provides an implementation of DIME as defined at http://search.ietf.org/internet-drafts/draft-nielsen-dime-02.txt

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_dime/allreleases.xml", '

Net_DIME

pear.php.net 0.3beta 0.2beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_dime/deps.0.3.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/net_dns/info.xml", '

Net_DNS pear.php.net Networking LGPL 2.1 Resolver library used to communicate with a DNS server A resolver library used to communicate with a name server to perform DNS queries, zone transfers, dynamic DNS updates, etc. Creates an object hierarchy from a DNS server\'s response, which allows you to view all of the information given by the DNS server. It bypasses the system\'s resolver library and communicates directly with the server.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_dns/allreleases.xml", '

Net_DNS

pear.php.net 1.0.0rc1beta 1.0.0b3beta 1.00b2beta 1.00b1beta 0.03stable 0.02alpha 0.01devel
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_dns/deps.1.0.0rc1.txt", 'a:2:{i:1;a:3:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:3:"4.2";}i:2;a:3:{s:4:"type";s:3:"ext";s:3:"rel";s:3:"has";s:4:"name";s:5:"mhash";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/net_dnsbl/info.xml", '

Net_DNSBL pear.php.net Networking PHP License DNSBL Checker Checks if a given Host or URL is listed on an DNSBL or SURBL

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_dnsbl/allreleases.xml", '

Net_DNSBL

pear.php.net 1.0.0stable 0.5.4beta 0.5.3beta 0.5.2beta 0.5.1beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_dnsbl/deps.1.0.0.txt", 'a:4:{i:1;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.3.1";s:4:"name";s:10:"Cache_Lite";}i:2;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:3:"1.1";s:4:"name";s:11:"Net_CheckIP";}i:3;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.2.3";s:4:"name";s:12:"HTTP_Request";}i:4;a:3:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"4.3.6";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/net_finger/info.xml", '

Net_Finger pear.php.net Networking PHP License The PEAR::Net_Finger class provides a tool for querying Finger Servers Wrapper class for finger calls.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_finger/allreleases.xml", '

Net_Finger

pear.php.net 1.0.0stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_finger/deps.1.0.0.txt", 'a:1:{i:1;a:3:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:4:"name";s:10:"Net_Socket";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/net_ftp/info.xml", '

Net_FTP pear.php.net Networking PHP License Net_FTP provides an OO interface to the PHP FTP functions and some more advanced features in addition. Net_FTP allows you to communicate with FTP servers in a more comfortable way than the native FTP functions of PHP do. The class implements everything nativly supported by PHP and additionally features like recursive up- and downloading, dircreation and chmodding. It although implements an observer pattern to allow for example the view of a progress bar.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_ftp/allreleases.xml", '

Net_FTP

pear.php.net 1.3.1stable 1.3.0stable 1.3.0RC2beta 1.3.0RC1stable 1.3.0beta4beta 1.3.0beta3beta 1.3.0beta2beta 1.3.0beta1beta 1.2stable 1.1stable 1.0stable 0.9beta 0.5alpha
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_ftp/deps.1.3.1.txt", 'a:1:{s:8:"required";a:3:{s:3:"php";a:2:{s:3:"min";s:5:"4.2.0";s:3:"max";s:5:"6.0.0";}s:13:"pearinstaller";a:1:{s:3:"min";s:7:"1.4.0a1";}s:9:"extension";a:1:{s:4:"name";s:3:"ftp";}}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/net_ftp2/info.xml", '

Net_FTP2 pear.php.net Networking PHP 3.0 Net_FTP2 provides an OO interface for communication with FTP servers. Net_FTP2 is the successor of Net_FTP2. It offers comfortable communication with FTP servers based on a driver based architecture, allowing you to talk FTP even if ext/FTP is not installed. A new, flexible API allows you to only load needed functionality.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_ftp2/allreleases.xml", false, false); $pearweb->addRESTConfig("http://pear.php.net/rest/p/net_gameserverquery/info.xml", '

Net_GameServerQuery pear.php.net Networking PHP License An interface to query and return information from a game server Net_GameServerQuery provides an interface for querying game servers

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_gameserverquery/allreleases.xml", '

Net_GameServerQuery

pear.php.net 0.2.0alpha 0.1alpha
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_gameserverquery/deps.0.2.0.txt", 'a:1:{i:1;a:3:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"5.0.0";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/net_geo/info.xml", '

Net_Geo pear.php.net Networking PHP Geographical locations based on Internet address Obtains geogrphical information based on IP number, domain name, or AS number. Makes use of CAIDA Net_Geo lookup or locaizer extension.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_geo/allreleases.xml", '

Net_Geo

pear.php.net 1.0stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_geo/deps.1.0.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/net_geoip/info.xml", '

Net_GeoIP pear.php.net Networking LGPL 2.1 Library to perform geo-location lookups of IP addresses. A library that uses Maxmind\'s GeoIP databases to accurately determine geographic location of an IP address.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_geoip/allreleases.xml", '

Net_GeoIP

pear.php.net 0.9.0alpha1alpha
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_geoip/deps.0.9.0alpha1.txt", 'a:1:{i:1;a:3:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"5.0.0";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/net_hl7/info.xml", '

Net_HL7 pear.php.net Networking PHP License HL7 messaging API. This package provides an HL7 API for creating, sending and manipulating HL7 messages. HL7 is a protocol on the 7th OSI layer (hence the \'7\' in HL7) for messaging in Health Care environments. HL7 means \'Health Level 7\'. HL7 is a protocol with a wealth of semantics that defines hundreds of different messages and their meaning, but also defines the syntactics of composing and sending messages. The API is focused on the syntactic level of HL7, so as to remain as flexible as possible. The package is a translation of the Perl HL7 Toolkit and will be kept in sync with this initiative.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_hl7/allreleases.xml", '

Net_HL7

pear.php.net 0.1.0alpha
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_hl7/deps.0.1.0.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/net_ident/info.xml", '

Net_Ident pear.php.net Networking PHP Identification Protocol implementation The PEAR::Net_Ident implements Identification Protocol according to RFC 1413. The Identification Protocol (a.k.a., "ident", a.k.a., "the Ident Protocol") provides a means to determine the identity of a user of a particular TCP connection. Given a TCP port number pair, it returns a character string which identifies the owner of that connection on the server\'s system.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_ident/allreleases.xml", '

Net_Ident

pear.php.net 1.1.0stable 1.0stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_ident/deps.1.1.0.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/net_idna/info.xml", '

Net_IDNA pear.php.net Networking LGPL Punycode encoding and decoding. This package helps you to encode and decode punycode strings easily.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_idna/allreleases.xml", '

Net_IDNA

pear.php.net 0.7.1beta 0.7.0beta 0.6.0beta 0.5.0beta 0.4.0beta 0.3.0beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_idna/deps.0.7.1.txt", 'a:2:{i:1;a:4:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"4.3.0";s:8:"optional";s:2:"no";}i:2;a:4:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:8:"5.0.0RC1";s:8:"optional";s:3:"yes";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/net_imap/info.xml", '

Net_IMAP pear.php.net Networking PHP License Provides an implementation of the IMAP protocol Provides an implementation of the IMAP4Rev1 protocol using PEAR\'s Net_Socket and the optional Auth_SASL class.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_imap/allreleases.xml", '

Net_IMAP

pear.php.net 1.0.3stable 1.0.2stable 1.0.1stable 1.0.0stable 0.7.1beta 0.7beta 0.6beta 0.5.1beta 0.5beta 0.4beta 0.3beta 0.2beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_imap/deps.1.0.3.txt", 'a:1:{i:1;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:3:"1.0";s:4:"name";s:10:"Net_Socket";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/net_ipv4/info.xml", '

Net_IPv4 pear.php.net Networking PHP 2.0 IPv4 network calculations and validation Class used for calculating IPv4 (AF_INET family) address information such as network as network address, broadcast address, and IP address validity.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_ipv4/allreleases.xml", '

Net_IPv4

pear.php.net 1.2stable 1.1stable 1.0stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_ipv4/deps.1.2.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/net_ipv6/info.xml", '

Net_IPv6 pear.php.net Networking PHP License Check and validate IPv6 addresses The class allows you to: * check if an address is an IPv6 address * compress/uncompress IPv6 addresses * check for an IPv4 compatible ending in an IPv6 adresse

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_ipv6/allreleases.xml", '

Net_IPv6

pear.php.net 1.0.5stable 1.0.4stable 1.0.3stable 1.0.2stable 1.0.1stable 1.0stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_ipv6/deps.1.0.5.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/net_irc/info.xml", '

Net_IRC pear.php.net Networking PHP License IRC Client Class IRC Client Class suitable for both client or bots applications. Features are: - Supprts Multiple Server connections - Non-blocking sockets - Runs on Standard PHP installation without any Extensions - Server messages handled by a callback system - Full logging capabilities - Full statistic collector Note: Net_IRC is no longer actively maintained. Please see Net_SmartIRC (http://pear.php.net/Net_SmartIRC)

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_irc/allreleases.xml", '

Net_IRC

pear.php.net 0.0.7beta 0.0.6alpha 0.0.3alpha
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_irc/deps.0.0.7.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/net_ldap/info.xml", '

Net_LDAP pear.php.net Networking LGPL OO interface for searching and manipulating LDAP-entries Net Ldap is a clone of Perls Net::LDAP object interface to ldapservers. It does not contain all of Net::LDAPs features, but has: * A simple OO-interface to connections, searches and entries. * Support for tls and ldap v3. * Simple modification, deletion and creation of ldapentries. * Support for schema handling. Net_LDAP layers itself on top of PHP\'s existing ldap extensions.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_ldap/allreleases.xml", '

Net_LDAP

pear.php.net 0.6.6beta 0.6.5beta 0.6.4beta 0.6.3beta 0.6.2beta 0.5beta 0.4beta 0.3beta 0.2beta 0.1beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_ldap/deps.0.6.6.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/net_lmtp/info.xml", '

Net_LMTP pear.php.net Networking PHP License Provides an implementation of the RFC2033 LMTP protocol Provides an implementation of the RFC2033 LMTP using PEAR\'s Net_Socket and Auth_SASL class.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_lmtp/allreleases.xml", '

Net_LMTP

pear.php.net 1.0.1stable 0.7.0stable 0.6beta 0.5beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_lmtp/deps.1.0.1.txt", 'a:1:{i:1;a:3:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:4:"name";s:10:"Net_Socket";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/net_monitor/info.xml", '

Net_Monitor pear.php.net Networking PHP License Remote Service Monitor A unified interface for checking the availability services on external servers and sending meaningful alerts through a variety of media if a service becomes unavailable.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_monitor/allreleases.xml", '

Net_Monitor

pear.php.net 0.2.3beta 0.2.2beta 0.2.1beta 0.2.0beta 0.1.0beta 0.0.8beta 0.0.7beta 0.0.6beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_monitor/deps.0.2.3.txt", 'a:7:{i:1;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.0.0";s:8:"optional";s:2:"no";s:4:"name";s:4:"PEAR";}i:2;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.0.0";s:8:"optional";s:3:"yes";s:4:"name";s:4:"Mail";}i:3;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"0.0.1";s:8:"optional";s:3:"yes";s:4:"name";s:7:"Net_SMS";}i:4;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.2.2";s:8:"optional";s:3:"yes";s:4:"name";s:8:"Net_SMTP";}i:5;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.2.4";s:8:"optional";s:3:"yes";s:4:"name";s:12:"HTTP_Request";}i:6;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:8:"1.3.0RC1";s:8:"optional";s:3:"yes";s:4:"name";s:7:"Net_FTP";}i:7;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"0.0.3";s:8:"optional";s:3:"yes";s:4:"name";s:7:"Net_DNS";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/net_nntp/info.xml", '

Net_NNTP pear.php.net Networking W3C Implementation of the NNTP protocol Package for communicating with NNTP/Usenet servers ----------------------------- This package uses a rather conservative release cycle: New features won\'t go beta until they are truly ready for use in a production environment. ----------------------------- The following branches is being actively maintained, each having different states: STABLE (v1.0) - Download: http://pear.php.net/get/Net_NNTP - Backward compatibility with the v0.2 releases. - Implementation of every standard/base NNTP command. - The Net_NNTP_Protocol_Client class is considered internal and subject to changes, since it\'s currently incomplete but very functional and well tested. BETA (v1.1) - Download: http://pear.php.net/get/Net_NNTP-beta - Includes a few experimental features from v0.11, which is not included in the v1.0 release, since they are not considered fully mature yet. - Road-map: Parsing of message data via external classes (stripped down versions of methods from the v1.2 API). ALPHA (v1.2) - Download: http://pear.php.net/get/Net_NNTP-alpha - Includes the classes Net_NNTP_Message and Net_NNTP_Header (which has been stable for quite some, but still considered experimental, since a possible minor BC-break would result in a Net_NNTP2). - Road-map: Own MIME implementation. DEVEL (v1.3) - Road-map: Possibly a NNTP-server, but honestly no current plans. ----------------------------- NOTE: New minor features, which are not mentioned in the road-map, and which has been tested in the alpha releases, might also become part of the stable or the beta releases. NOTE: The Protocol implementation (Net_NNTP_Protocol_Client) is identical in current releases (v1.0, v1.1 and v1.2). The difference between these releases is additional fetures in the the pulbic API (Net_NNTP_Client). Modifications to Net_NNTP_Protocol_Client in v1.2 is most likeley to be copied to both v1.1 and v1.0 when they have been well tested... ----------------------------- Note: A PHP5-only version of Net_NNTP has been under development and functional since PHP5 beta3 (fall 2003), but due to lack of time etc. this project is currently unpublished...

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_nntp/allreleases.xml", '

Net_NNTP

pear.php.net 1.1.2beta 1.2.3alpha 1.2.2alpha 1.1.1beta 1.0.1stable 1.2.1alpha 1.0.0stable 1.2.0alpha 1.1.0beta 1.0.0RC1beta 0.11.3beta 0.11.2alpha 0.11.1devel 0.11.0devel 0.2.5stable 0.10.3alpha 0.10.2alpha 0.10.1alpha 0.10.0alpha 0.2.3stable 0.1stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_nntp/deps.1.1.2.txt", 'a:1:{i:1;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.0.3";s:4:"name";s:10:"Net_Socket";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/net_ping/info.xml", '

Net_Ping pear.php.net Networking PHP License Execute ping OS independet wrapper class for executing ping calls

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_ping/allreleases.xml", '

Net_Ping

pear.php.net 2.4stable 2.3stable 2.2stable 2.1stable 1.0.1stable 1.0stable 0.1alpha
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_ping/deps.2.4.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/net_pop3/info.xml", '

Net_POP3 pear.php.net Networking BSD Provides a POP3 class to access POP3 server. Provides a POP3 class to access POP3 server. Support all POP3 commands including UIDL listings, APOP authentication,DIGEST-MD5 and CRAM-MD5 using optional Auth_SASL package

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_pop3/allreleases.xml", '

Net_POP3

pear.php.net 1.3.6stable 1.3.5stable 1.3.4beta 1.3.3stable 1.3.2stable 1.3.1stable 1.3stable 1.2stable 1.1stable 1.0stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_pop3/deps.1.3.6.txt", 'a:1:{i:1;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:3:"1.0";s:4:"name";s:10:"Net_Socket";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/net_portscan/info.xml", '

Net_Portscan pear.php.net Networking PHP 2.02 Portscanner utilities. The Net_Portscan package allows one to perform basic portscanning functions with PHP. It supports checking an individual port or checking a whole range of ports on a machine.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_portscan/allreleases.xml", '

Net_Portscan

pear.php.net 1.0.2stable 1.0.1stable 1.0stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_portscan/deps.1.0.2.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/net_server/info.xml", '

Net_Server pear.php.net Networking PHP License Generic server class Generic server class based on ext/sockets, used to develop any kind of server.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_server/allreleases.xml", '

Net_Server

pear.php.net 0.12.0alpha 0.11.5alpha 0.11.4alpha 0.11.3alpha 0.11.2alpha 0.11alpha 0.10alpha
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_server/deps.0.12.0.txt", 'a:4:{i:1;a:4:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"4.2.0";s:8:"optional";s:2:"no";}i:2;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:2:"no";s:4:"name";s:4:"PEAR";}i:3;a:4:{s:4:"type";s:3:"ext";s:3:"rel";s:3:"has";s:8:"optional";s:2:"no";s:4:"name";s:7:"sockets";}i:4;a:4:{s:4:"type";s:3:"ext";s:3:"rel";s:3:"has";s:8:"optional";s:3:"yes";s:4:"name";s:5:"pcntl";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/net_sieve/info.xml", '

Net_Sieve pear.php.net Networking BSD Handles talking to timsieved Provides an API to talk to the timsieved server that comes with Cyrus IMAPd. Can be used to install, remove, mark active etc sieve scripts.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_sieve/allreleases.xml", '

Net_Sieve

pear.php.net 1.1.1stable 1.1.0stable 1.0.1stable 1.0.0stable 0.9.2stable 0.9.1stable 0.9.0stable 0.8.1stable 0.8stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_sieve/deps.1.1.1.txt", 'a:1:{i:1;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:3:"1.0";s:4:"name";s:10:"Net_Socket";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/net_smartirc/info.xml", '

Net_SmartIRC pear.php.net Networking LGPL Net_SmartIRC is a PHP class for communication with IRC networks Net_SmartIRC is a PHP class for communication with IRC networks, which conforms to the RFC 2812 (IRC protocol). It\'s an API that handles all IRC protocol messages. This class is designed for creating IRC bots, chats and show irc related info on webpages. Full featurelist of Net_SmartIRC ------------------------------------- - full object oriented programmed - every received IRC message is parsed into an ircdata object (it contains following info: from, nick, ident, host, channel, message, type, rawmessage) - actionhandler for the API on different types of messages (channel/notice/query/kick/join..) callbacks can be registered - messagehandler for the API class based messagehandling, using IRC reply codes - time events callbacks to methods in intervals - send/receive floodprotection - detects and changes nickname on nickname collisions - autoreconnect, if connection is lost - autoretry for connecting to IRC servers - debugging/logging system with log levels (destination can be file, stdout, syslog or browserout) - supports fsocks and PHP socket extension - supports PHP 4.1.x to 4.3.2 (also PHP 5.0.0b1) - sendbuffer with a queue that has 3 priority levels (high, medium, low) plus a bypass level (critical) - channel syncing (tracking of users/modes/topic etc in objects) - user syncing (tracking the user in channels, nick/ident/host/realname/server/hopcount in objects) - when channel syncing is acticated the following functions are available: isJoined isOpped isVoiced isBanned - on reconnect all joined channels will be rejoined, also when keys are used - own CTCP version reply can be set - IRC commands: pass op deop voice devoice ban unban join part action message notice query ctcp mode topic nick invite list names kick who whois whowas quit

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_smartirc/allreleases.xml", '

Net_SmartIRC

pear.php.net 1.0.0stable 0.5.5p1stable 0.5.5stable 0.5.1stable 0.5.0beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_smartirc/deps.1.0.0.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/net_smpp/info.xml", '

Net_SMPP pear.php.net Networking PHP License v3.0 SMPP v3.4 protocol implementation Net_SMPP is an implementation of the SMPP (Short Message Peer-to-Peer) v3.4 protocol. SMPP is an open protocol used in the wireless industry to send and receive SMS messages. Net_SMPP does not provide a SMPP client or server, but they can easily be built with it.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_smpp/allreleases.xml", '

Net_SMPP

pear.php.net 0.4.4beta 0.4.3beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_smpp/deps.0.4.4.txt", 'a:2:{i:1;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:3:"1.3";s:4:"name";s:4:"PEAR";}i:2;a:3:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"4.1.0";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/net_smpp_client/info.xml", '

Net_SMPP_Client pear.php.net Networking PHP License v3.0 SMPP v3.4 client Net_SMPP_Client is a package for communicating with SMPP servers, built with Net_SMPP. It can be used to send SMS messages, among other things. Features: - PDU stack keeps track of which PDUs have crossed the wire - Keeps track of the connection state, and won\'t let you send PDUs if the state is incorrect. - Supports SMPP vendor extensions.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_smpp_client/allreleases.xml", '

Net_SMPP_Client

pear.php.net 0.3.2devel
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_smpp_client/deps.0.3.2.txt", 'a:4:{i:1;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:3:"1.3";s:4:"name";s:4:"PEAR";}i:2;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.0.0";s:4:"name";s:10:"Net_Socket";}i:3;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"0.4.1";s:4:"name";s:8:"Net_SMPP";}i:4;a:3:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"4.1.0";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/net_sms/info.xml", '

Net_SMS pear.php.net Networking LGPL SMS functionality. This package provides SMS functionality and access to SMS gateways.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_sms/allreleases.xml", '

Net_SMS

pear.php.net 0.0.2beta 0.0.1beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_sms/deps.0.0.2.txt", 'a:4:{i:1;a:3:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"4.2.0";}i:2;a:3:{s:4:"type";s:3:"ext";s:3:"rel";s:3:"has";s:4:"name";s:7:"gettext";}i:3;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:3:"yes";s:4:"name";s:12:"HTTP_Request";}i:4;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:3:"yes";s:4:"name";s:4:"Mail";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/net_smtp/info.xml", '

Net_SMTP pear.php.net Networking PHP License Provides an implementation of the SMTP protocol Provides an implementation of the SMTP protocol using PEAR\'s Net_Socket class.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_smtp/allreleases.xml", '

Net_SMTP

pear.php.net 1.2.7stable 1.2.6stable 1.2.5stable 1.2.3stable 1.2.2stable 1.2.1stable 1.2.0stable 1.1.2stable 1.1.1stable 1.1.0stable 1.0.1stable 1.0stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_smtp/deps.1.2.7.txt", 'a:2:{i:1;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:2:"no";s:4:"name";s:10:"Net_Socket";}i:2;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:3:"yes";s:4:"name";s:9:"Auth_SASL";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/net_socket/info.xml", '

Net_Socket pear.php.net Networking PHP License Network Socket Interface Net_Socket is a class interface to TCP sockets. It provides blocking and non-blocking operation, with different reading and writing modes (byte-wise, block-wise, line-wise and special formats like network byte-order ip addresses).

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_socket/allreleases.xml", '

Net_Socket

pear.php.net 1.0.5stable 1.0.4stable 1.0.3stable 1.0.2stable 1.0.1stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_socket/deps.1.0.6.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/net_traceroute/info.xml", '

Net_Traceroute pear.php.net Networking PHP License Execute traceroute OS independet wrapper class for executing traceroute calls

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_traceroute/allreleases.xml", '

Net_Traceroute

pear.php.net 0.21alpha 0.20alpha 0.11alpha
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_traceroute/deps.0.21.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/net_url/info.xml", '

Net_URL pear.php.net Networking BSD Easy parsing of Urls Provides easy parsing of URLs and their constituent parts.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_url/allreleases.xml", '

Net_URL

pear.php.net 1.0.14stable 1.0.13stable 1.0.12stable 1.0.11stable 1.0.10stable 1.0.9stable 1.0.8stable 1.0.7stable 1.0.6stable 1.0.5stable 1.0.4stable 1.0.3stable 1.0.2stable 1.0.1stable 1.0stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_url/deps.1.0.14.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/net_useragent_detect/info.xml", '

Net_UserAgent_Detect pear.php.net Networking PHP License Net_UserAgent_Detect determines the Web browser, version, and platform from an HTTP user agent string The Net_UserAgent object does a number of tests on an HTTP user agent string. The results of these tests are available via methods of the object. This module is based upon the JavaScript browser detection code available at http://www.mozilla.org/docs/web-developer/sniffer/browser_type.html. This module had many influences from the lib/Browser.php code in version 1.3 of Horde.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_useragent_detect/allreleases.xml", '

Net_UserAgent_Detect

pear.php.net 2.1.0stable 2.0.1stable 1.0stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_useragent_detect/deps.2.1.0.txt", 'a:1:{i:1;a:3:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"4.1.0";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/net_useragent_mobile/info.xml", '

Net_UserAgent_Mobile pear.php.net Networking PHP License HTTP mobile user agent string parser Net_UserAgent_Mobile parses HTTP_USER_AGENT strings of (mainly Japanese) mobile HTTP user agents. It\'ll be useful in page dispatching by user agents. This package was ported from Perl\'s HTTP::MobileAgent. See http://search.cpan.org/search?mode=module&query=HTTP-MobileAgent The author of the HTTP::MobileAgent module is Tatsuhiko Miyagawa <miyagawa@bulknews.net>

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_useragent_mobile/allreleases.xml", '

Net_UserAgent_Mobile

pear.php.net 0.25.0beta 0.24.0beta 0.23.0beta 0.22.0beta 0.21.0beta 0.20.0beta 0.19beta 0.18beta 0.17beta 0.16beta 0.15beta 0.14.1beta 0.14beta 0.13beta 0.12beta 0.11beta 0.10beta 0.9beta 0.8beta 0.7beta 0.6beta 0.5beta 0.4beta 0.3beta 0.2beta 0.1beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_useragent_mobile/deps.0.25.0.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/net_whois/info.xml", '

Net_Whois pear.php.net Networking PHP The PEAR::Net_Whois class provides a tool to query internet domain name and network number directory services The PEAR::Net_Whois looks up records in the databases maintained by several Network Information Centers (NICs).

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_whois/allreleases.xml", '

Net_Whois

pear.php.net 1.0stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_whois/deps.1.0.txt", 'a:1:{i:1;a:3:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:4:"name";s:10:"Net_Socket";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/net_wifi/info.xml", '

Net_Wifi pear.php.net Networking PHP License Scans for wireless networks Net_Wifi utilizes the command line tools "iwconfig" and "iwlist" to get information about wireless lan interfaces on the system and the current configuration. The class enables you to scan for wireless networks and get a bunch of information about them.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_wifi/allreleases.xml", '

Net_Wifi

pear.php.net 0.1.0beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_wifi/deps.0.1.0.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/numbers_roman/info.xml", '

Numbers_Roman pear.php.net Numbers PHP Provides methods for converting to and from Roman Numerals. Numbers_Roman provides static methods for converting to and from Roman numerals. It supports Roman numerals in both uppercase and lowercase styles and conversion for and to numbers up to 5 999 999

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/numbers_roman/allreleases.xml", '

Numbers_Roman

pear.php.net 1.0.1beta 0.2.0stable 0.1.1stable 0.1stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/numbers_roman/deps.1.0.1.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/numbers_words/info.xml", '

Numbers_Words pear.php.net Numbers PHP License The PEAR Numbers_Words package provides methods for spelling numerals in words. With Numbers_Words class you can convert numbers written in arabic digits to words in several languages. You can convert an integer between -infinity and infinity. If your system does not support such long numbers you can call Numbers_Words::toWords() with just a string. With the Numbers_Words::toCurrency($num, $locale, \'USD\') method you can convert a number (decimal and fraction part) to words with currency name. The following languages are supported: * bg (Bulgarian) by Kouber Saparev * cs (Czech) by Petr \'PePa\' Pavel * de (German) by me * dk (Danish) by Jesper Veggerby * ee (Estonian) by Erkki Saarniit * en_100 (Donald Knuth system, English) by me * en_GB (British English) by me * en_US (American English) by me * es (Spanish Castellano) by Xavier Noguer * es_AR (Argentinian Spanish) by Martin Marrese * fr (French) by Kouber Saparev * fr_BE (French Belgium) by Kouber Saparev and Philippe Bajoit * he (Hebrew) by Hadar Porat * hu_HU (Hungarian) by Nils Homp * id (Indonesian) by Ernas M. Jamil and Arif Rifai Dwiyanto * it_IT (Italian) by Filippo Beltramini and Davide Caironi * lt (Lithuanian) by Laurynas Butkus * pl (Polish) by me * pt_BR (Brazilian Portuguese) by Marcelo Subtil Marcal and Mario H.C.T. * ru (Russian) by Andrey Demenev * sv (Swedish) by Robin Ericsson

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/numbers_words/allreleases.xml", '

Numbers_Words

pear.php.net 0.14.0beta 0.13.1beta 0.13.0beta 0.12.0beta 0.11.0beta 0.10.1beta 0.10.0beta 0.9.0beta 0.8.1beta 0.8beta 0.7.1beta 0.7beta 0.6beta 0.5.1beta 0.5beta 0.4beta 0.3.1beta 0.3beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/numbers_words/deps.0.14.0.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/ole/info.xml", '

OLE pear.php.net Structures PHP Package for reading and writing OLE containers This package allows reading and writing of OLE (Object Linking and Embedding) files, the format used as container for Excel, Word and other MS file formats. Documentation for the OLE format can be found at: http://user.cs.tu-berlin.de/~schwartz/pmh/guide.html

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/ole/allreleases.xml", '

OLE

pear.php.net 0.5beta 0.4beta 0.3beta 0.2.1alpha 0.2alpha
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/ole/deps.0.5.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/pager/info.xml", '

Pager pear.php.net HTML PHP License Data paging class It takes an array of data as input and pages it according to various parameters. It also builds links within a specified range, and allows complete customization of the output (it even works with front controllers and mod_rewrite). Two operating modes available: "Jumping" and "Sliding" window style.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/pager/allreleases.xml", '

Pager

pear.php.net 2.3.3stable 2.3.2stable 2.3.1stable 2.3.0stable 2.3.0RC2beta 2.3.0RC1beta 2.2.7stable 2.2.6stable 2.2.5stable 2.2.4stable 2.2.3stable 2.2.2stable 2.2.1stable 2.2.0stable 2.1.0stable 2.0stable 1.0.8stable 1.0.7stable 1.0.6stable 1.0.5stable 1.0.4stable 1.0.3stable 1.0.2stable 1.0.1stable 1.0stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/pager/deps.2.3.3.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/pager_sliding/info.xml", '

Pager_Sliding pear.php.net HTML PHP License Sliding Window Pager. It takes an array of data as input and page it according to various parameters. It also builds links within a specified range, and allows complete customization of the output (it even works with mod_rewrite). It is compatible with PEAR::Pager\'s API. [Deprecated]Use PEAR::Pager v2.x with $mode = \'Sliding\' instead

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/pager_sliding/allreleases.xml", '

Pager_Sliding

pear.php.net 1.6stable 1.5stable 1.4stable 1.3stable 1.1.6stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/pager_sliding/deps.1.6.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/payment_clieop/info.xml", '

Payment_Clieop pear.php.net Payment PHP These classes can create a clieop03 file for you which you can send to a Dutch Bank. Ofcourse you need also a Dutch bank account. Clieop03 generation classes

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/payment_clieop/allreleases.xml", '

Payment_Clieop

pear.php.net 0.1.1stable 0.1stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/payment_clieop/deps.0.1.1.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/payment_dta/info.xml", '

Payment_DTA pear.php.net Payment BSD style Creates DTA files containing money transaction data (Germany). Payment_DTA provides functions to create DTA files used in Germany to exchange informations about money transactions with banks or online banking programs.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/payment_dta/allreleases.xml", '

Payment_DTA

pear.php.net 1.2.0stable 1.1.0stable 1.00stable 0.81beta 0.8beta 0.71beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/payment_dta/deps.1.2.0.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/payment_process/info.xml", '

Payment_Process pear.php.net Payment PHP License, v3.0 Unified payment processor Payment_Process is a gateway-independent framework for processing credit cards, e-checks and eventually other forms of payments as well.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/payment_process/allreleases.xml", '

Payment_Process

pear.php.net 0.6.2beta 0.6.1beta 0.6.0beta 0.5.8beta 0.5.7beta 0.5.6beta 0.5.5beta 0.5.2beta 0.5.1beta 0.5beta 0.2beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/payment_process/deps.0.6.2.txt", 'a:5:{i:1;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.2.6";s:8:"optional";s:3:"yes";s:4:"name";s:10:"XML_Parser";}i:2;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.2.0";s:8:"optional";s:3:"yes";s:4:"name";s:8:"Net_Curl";}i:3;a:4:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"4.2.0";s:8:"optional";s:2:"no";}i:4;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"0.5.0";s:8:"optional";s:2:"no";s:4:"name";s:8:"Validate";}i:5;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"0.5.0";s:8:"optional";s:2:"no";s:4:"name";s:27:"Validate_Finance_CreditCard";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/pear/info.xml", '

PEAR pear.php.net PEAR PHP License PEAR Base System The PEAR package contains: * the PEAR installer, for creating, distributing and installing packages * the beta-quality PEAR_Exception PHP5 error handling mechanism * the beta-quality PEAR_ErrorStack advanced error handling class * 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 of common operations with files and directories * the PEAR base class

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/pear/allreleases.xml", '

PEAR

pear.php.net 1.3.4stable 1.3.3.1stable 1.3.3stable 1.3.1stable 1.3stable 1.3b6beta 1.3b5beta 1.3b3beta 1.3b2beta 1.3b1beta 1.2.1stable 1.2stable 1.2b5beta 1.2b4beta 1.2b3beta 1.2b2beta 1.2b1beta 1.1stable 1.0.1stable 1.0stable 1.0b3stable 1.0b2stable 1.0b1stable 0.90beta 0.11beta 0.10beta 0.9stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/pear/deps.1.4.0.txt", 'a:2:{s:8:"required";a:4:{s:3:"php";a:1:{s:3:"min";s:3:"4.2";}s:13:"pearinstaller";a:1:{s:3:"min";s:8:"1.4.0a12";}s:7:"package";a:5:{i:0;a:5:{s:4:"name";s:11:"Archive_Tar";s:7:"channel";s:12:"pear.php.net";s:3:"min";s:3:"1.1";s:11:"recommended";s:5:"1.3.1";s:7:"exclude";s:5:"1.3.0";}i:1;a:4:{s:4:"name";s:14:"Console_Getopt";s:7:"channel";s:12:"pear.php.net";s:3:"min";s:3:"1.2";s:11:"recommended";s:3:"1.2";}i:2;a:4:{s:4:"name";s:7:"XML_RPC";s:7:"channel";s:12:"pear.php.net";s:3:"min";s:5:"1.4.0";s:11:"recommended";s:5:"1.4.1";}i:3;a:5:{s:4:"name";s:17:"PEAR_Frontend_Web";s:7:"channel";s:12:"pear.php.net";s:3:"max";s:5:"0.5.0";s:7:"exclude";s:5:"0.5.0";s:9:"conflicts";s:0:"";}i:4;a:5:{s:4:"name";s:17:"PEAR_Frontend_Gtk";s:7:"channel";s:12:"pear.php.net";s:3:"max";s:5:"0.4.0";s:7:"exclude";s:5:"0.4.0";s:9:"conflicts";s:0:"";}}s:9:"extension";a:2:{i:0;a:1:{s:4:"name";s:3:"xml";}i:1;a:1:{s:4:"name";s:4:"pcre";}}}s:5:"group";a:2:{i:0;a:2:{s:7:"attribs";a:2:{s:4:"hint";s:26:"PEAR\'s web-based installer";s:4:"name";s:12:"webinstaller";}s:7:"package";a:3:{s:4:"name";s:17:"PEAR_Frontend_Web";s:7:"channel";s:12:"pear.php.net";s:3:"min";s:5:"0.5.0";}}i:1;a:2:{s:7:"attribs";a:2:{s:4:"hint";s:30:"PEAR\'s PHP-GTK-based installer";s:4:"name";s:12:"gtkinstaller";}s:7:"package";a:3:{s:4:"name";s:17:"PEAR_Frontend_Gtk";s:7:"channel";s:12:"pear.php.net";s:3:"min";s:5:"0.4.0";}}}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/pear_delegator/info.xml", '

PEAR_Delegator pear.php.net PEAR PHP License Delegation for PHP This package implements traditional and unorthodox delegation in PHP. This allows for pseudo multiple inheritance and other interesting design paradigms.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/pear_delegator/allreleases.xml", '

PEAR_Delegator

pear.php.net 0.1.0alpha
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/pear_delegator/deps.0.1.0.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/pear_errorstack/info.xml", '

PEAR_ErrorStack pear.php.net PEAR PHP License Advanced successor to PEAR_Error PEAR_ErrorStack provides a stack-based approach to error raising and also seeks to unify diverse error raising solutions into one location in order to link unrelated projects into a single application

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/pear_errorstack/allreleases.xml", false, false); $pearweb->addRESTConfig("http://pear.php.net/rest/p/pear_frontend_gtk/info.xml", '

PEAR_Frontend_Gtk pear.php.net PEAR PHP License Gtk (Desktop) PEAR Package Manager Desktop Interface to the PEAR Package Manager, Requires PHP-GTK

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/pear_frontend_gtk/allreleases.xml", '

PEAR_Frontend_Gtk

pear.php.net 0.4.0beta 0.3beta 0.2snapshot 0.1snapshot
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/pear_frontend_gtk/deps.0.4.0.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/pear_frontend_web/info.xml", '

PEAR_Frontend_Web pear.php.net PEAR PHP License HTML (Web) PEAR Package Manager Web Interface to the PEAR Package Manager

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/pear_frontend_web/allreleases.xml", '

PEAR_Frontend_Web

pear.php.net 0.4beta 0.3beta 0.2.2beta 0.2.1beta 0.2beta 0.1beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/pear_frontend_web/deps.0.4.txt", 'a:2:{i:1;a:3:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:4:"name";s:20:"Net_UserAgent_Detect";}i:2;a:3:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:4:"name";s:16:"HTML_Template_IT";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/pear_info/info.xml", '

PEAR_Info pear.php.net PEAR PHP License Show Information about your PEAR install and its packages This package generates a comprehensive information page for your current PEAR install. * The format for the page is similar to that for phpinfo() except using PEAR colors. * Has complete PEAR Credits (based on the packages you have installed). * Will show if there is a newer version than the one presently installed (and what its state is) * Each package has an anchor in the form pkg_PackageName - where PackageName is a case-sensitive PEAR package name

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/pear_info/allreleases.xml", '

PEAR_Info

pear.php.net 1.6.0stable 1.5.2stable 1.5.1stable 1.5stable 1.0.6stable 1.0.5stable 1.0.4stable 1.0.3stable 1.0.2stable 1.0.1stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/pear_info/deps.1.6.0.txt", 'a:2:{i:1;a:3:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"4.1.0";}i:2;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.3.2";s:4:"name";s:4:"PEAR";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/pear_packagefilemanager/info.xml", '

PEAR_PackageFileManager pear.php.net PEAR PHP License PEAR_PackageFileManager takes an existing package.xml file and updates it with a new filelist and changelog This package revolutionizes the maintenance of PEAR packages. With a few parameters, the entire package.xml is automatically updated with a listing of all files in a package. Features include - manages the new package.xml 2.0 format in PEAR 1.4.0 - can detect PHP and extension dependencies using PHP_CompatInfo - reads in an existing package.xml file, and only changes the release/changelog - a plugin system for retrieving files in a directory. Currently two plugins exist, one for standard recursive directory content listing, and one that reads the CVS/Entries files and generates a file listing based on the contents of a checked out CVS repository - incredibly flexible options for assigning install roles to files/directories - ability to ignore any file based on a * ? wildcard-enabled string(s) - ability to include only files that match a * ? wildcard-enabled string(s) - ability to manage dependencies - can output the package.xml in any directory, and read in the package.xml file from any directory. - can specify a different name for the package.xml file PEAR_PackageFileManager is fully unit tested. The new PEAR_PackageFileManager2 class is not.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/pear_packagefilemanager/allreleases.xml", '

PEAR_PackageFileManager

pear.php.net 1.6.0a3alpha 1.6.0a2alpha 1.6.0a1alpha 1.5.2stable 1.5.1stable 1.5.0stable 1.4.0stable 1.3.0stable 1.2.1stable 1.2.0stable 1.1.0stable 1.0stable 0.15beta 0.14beta 0.13beta 0.12beta 0.11beta 0.10beta 0.9alpha 0.8alpha 0.7alpha 0.6alpha 0.5alpha 0.4alpha 0.3alpha 0.2alpha 0.1alpha
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/pear_packagefilemanager/deps.1.6.0a3.txt", 'a:1:{s:8:"required";a:2:{s:3:"php";a:1:{s:3:"min";s:5:"4.2.0";}s:13:"pearinstaller";a:1:{s:3:"min";s:7:"1.4.0b1";}}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/pear_packagefilemanager_gui_gtk/info.xml", '

PEAR_PackageFileManager_GUI_Gtk pear.php.net PEAR PHP License A PHP-GTK frontend for the PEAR_PackageFileManager class. A PHP-GTK 1 frontend for the PEAR_PackageFileManager class. It makes it easier for developers to create and maintain PEAR package.xml files. Features: * Update existing package files or create new ones * Import values from an existing package file * Drag-n-Drop package directory into the application for easy loading * Set package level information (package name, description, etc.) * Set release level information (version, release notes, etc.) * Easily add maintainers * Browse package files as a tree and click to add a dependency * Add install time global and file replacements * Package file preview window * Package the package using the new package file

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/pear_packagefilemanager_gui_gtk/allreleases.xml", '

PEAR_PackageFileManager_GUI_Gtk

pear.php.net 1.0.1stable 1.0.0stable 1.0.0rc1beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/pear_packagefilemanager_gui_gtk/deps.1.0.1.txt", 'a:3:{i:1;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.5.1";s:4:"name";s:23:"PEAR_PackageFileManager";}i:2;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.3.5";s:4:"name";s:4:"PEAR";}i:3;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"0.1.0";s:4:"name";s:12:"Gtk_FileDrop";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/pear_remoteinstaller/info.xml", '

PEAR_RemoteInstaller pear.php.net PEAR PHP License PEAR Remote installation plugin through FTP Originally part of the 1.4.0 new features, remote installation through FTP is now its own package. This package adds the commands "remote-install" "remote-upgrade" "remote-uninstall" and "remote-upgrade-all" to the PEAR core. To take advantage, you must have a config file on the remote ftp server and full access to the server to create and remove files. The config-create command can be used to get started, and the remote_config configuration variable is set to the full URL as in "ftp://ftp.example.com/path/to/pear.ini" After this is done, install/upgrade as normal using the remote* commands as if they were local.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/pear_remoteinstaller/allreleases.xml", '

PEAR_RemoteInstaller

pear.php.net 0.1.0alpha
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/pear_remoteinstaller/deps.0.1.0.txt", 'a:1:{s:8:"required";a:3:{s:3:"php";a:1:{s:3:"min";s:3:"4.2";}s:13:"pearinstaller";a:1:{s:3:"min";s:8:"1.4.0a12";}s:7:"package";a:2:{i:0;a:3:{s:4:"name";s:4:"PEAR";s:7:"channel";s:12:"pear.php.net";s:3:"min";s:7:"1.4.0b1";}i:1;a:4:{s:4:"name";s:7:"Net_FTP";s:7:"channel";s:12:"pear.php.net";s:3:"min";s:8:"1.3.0RC1";s:11:"recommended";s:5:"1.3.1";}}}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/phpdoc/info.xml", '

PHPDoc pear.php.net PHP PHP Tool to generate documentation from the source PHPDoc is an attemt to adopt Javadoc to the PHP world.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/phpdoc/allreleases.xml", '

PHPDoc

pear.php.net 0.1.0beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/phpdoc/deps.0.1.0.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/phpdocumentor/info.xml", '

PhpDocumentor pear.php.net Tools and Utilities PHP License The phpDocumentor package provides automatic documenting of php api directly from the source. The phpDocumentor tool is a standalone auto-documentor similar to JavaDoc written in PHP. It differs from PHPDoc in that it is MUCH faster, parses a much wider range of php files, and comes with many customizations including 11 HTML templates, windows help file CHM output, PDF output, and XML DocBook peardoc2 output for use with documenting PEAR. In addition, it can do PHPXref source code highlighting and linking. Features (short list): -output in HTML, PDF (directly), CHM (with windows help compiler), XML DocBook -very fast -web and command-line interface -fully customizable output with Smarty-based templates -recognizes JavaDoc-style documentation with special tags customized for PHP 4 -automatic linking, class inheritance diagrams and intelligent override -customizable source code highlighting, with phpxref-style cross-referencing -parses standard README/CHANGELOG/INSTALL/FAQ files and includes them directly in documentation -generates a todo list from @todo tags in source -generates multiple documentation sets based on @access private, @internal and {@internal} tags -example php files can be placed directly in documentation with highlighting and phpxref linking using the @example tag -linking between external manual and API documentation is possible at the sub-section level in all output formats -easily extended for specific documentation needs with Converter -full documentation of every feature, manual can be generated directly from the source code with "phpdoc -c makedocs" in any format desired. -current manual always available at http://www.phpdoc.org/manual.php -user .ini files can be used to control output, multiple outputs can be generated at once **WARNING**: To use the web interface, you must set PEAR\'s data_dir to a subdirectory of document root. If browsing to http://localhost/index.php displays /path/to/htdocs/index.php, set data_dir to a subdirectory of /path/to/htdocs: $ pear config-set data_dir /path/to/htdocs/pear $ pear install PhpDocumentor http://localhost/pear/PhpDocumentor is the web interface

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/phpdocumentor/allreleases.xml", '

PhpDocumentor

pear.php.net 1.3.0RC3beta 1.3.0RC2beta 1.3.0RC1beta 1.2.3stable 1.2.2.1stable 1.2.1stable 1.2.0astable 1.2.0stable 1.2.0beta3beta 1.2.0beta2beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/phpdocumentor/deps.1.3.0RC3.txt", 'a:3:{i:1;a:4:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"4.1.0";s:8:"optional";s:2:"no";}i:2;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:3:"1.1";s:8:"optional";s:2:"no";s:4:"name";s:11:"Archive_Tar";}i:3;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:3:"1.1";s:8:"optional";s:3:"yes";s:4:"name";s:14:"XML_Beautifier";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/phpunit/info.xml", '

PHPUnit pear.php.net Testing PHP License Regression testing framework for unit tests. PHPUnit is a regression testing framework used by the developer who implements unit tests in PHP. This is the version to be used with PHP 4.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/phpunit/allreleases.xml", '

PHPUnit

pear.php.net 1.3.1stable 1.3.0stable 1.2.3stable 1.2.2stable 1.2.1stable 1.2.0stable 1.2.0beta1beta 1.1.1stable 1.1.0stable 1.0.2stable 1.0.1stable 1.0.0stable 0.6.2stable 0.6.1stable 0.6stable 0.5stable 0.4stable 0.3stable 0.2stable 0.1
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/phpunit/deps.1.3.1.txt", 'a:3:{i:1;a:3:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"4.1.0";}i:2;a:4:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"4.3.0";s:8:"optional";s:3:"yes";}i:3;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:3:"yes";s:4:"name";s:10:"PHP_Compat";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/phpunit2/info.xml", '

PHPUnit2 pear.php.net Testing PHP License Regression testing framework for unit tests. PHPUnit is a regression testing framework used by the developer who implements unit tests in PHP. This is the version to be used with PHP 5.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/phpunit2/allreleases.xml", '

PHPUnit2

pear.php.net 2.3.0beta5beta 2.3.0beta4beta 2.3.0beta3beta 2.3.0beta2beta 2.3.0beta1beta 2.2.1stable 2.2.0stable 2.2.0beta7beta 2.2.0beta6beta 2.1.6stable 2.2.0beta5beta 2.1.5stable 2.2.0beta4beta 2.2.0beta3beta 2.2.0beta2beta 2.2.0beta1beta 2.1.4stable 2.1.3stable 2.1.2stable 2.1.1stable 2.1.0stable 2.0.3stable 2.0.2stable 2.0.1stable 2.0.0stable 2.0.0beta2beta 2.0.0beta1beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/phpunit2/deps.2.3.0beta5.txt", 'a:7:{i:1;a:3:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:7:"5.1.0b1";}i:2;a:3:{s:4:"type";s:3:"ext";s:3:"rel";s:3:"has";s:4:"name";s:3:"dom";}i:3;a:3:{s:4:"type";s:3:"ext";s:3:"rel";s:3:"has";s:4:"name";s:4:"pcre";}i:4;a:3:{s:4:"type";s:3:"ext";s:3:"rel";s:3:"has";s:4:"name";s:3:"spl";}i:5;a:5:{s:4:"type";s:3:"ext";s:3:"rel";s:2:"ge";s:7:"version";s:10:"2.0.0beta2";s:8:"optional";s:3:"yes";s:4:"name";s:6:"xdebug";}i:6;a:3:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:4:"name";s:9:"Benchmark";}i:7;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:3:"yes";s:4:"name";s:3:"Log";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/php_archive/info.xml", '

PHP_Archive pear.php.net PHP PHP License Create and Use PHP Archive files PHP_Archive allows you to create a single .phar file containing an entire application.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/php_archive/allreleases.xml", '

PHP_Archive

pear.php.net 0.6.1alpha 0.6.0alpha 0.5.0alpha
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/php_archive/deps.0.6.1.txt", 'a:1:{s:8:"required";a:3:{s:3:"php";a:1:{s:3:"min";s:7:"5.1.0b1";}s:13:"pearinstaller";a:1:{s:3:"min";s:7:"1.4.0b1";}s:7:"package";a:2:{i:0;a:3:{s:4:"name";s:11:"Archive_Tar";s:7:"channel";s:12:"pear.php.net";s:3:"min";s:5:"1.3.1";}i:1;a:3:{s:4:"name";s:4:"PEAR";s:7:"channel";s:12:"pear.php.net";s:3:"min";s:5:"1.3.5";}}}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/php_beautifier/info.xml", '

PHP_Beautifier pear.php.net PHP PHP License Beautifier for Php This program reformat and beautify PHP 4 and PHP 5 source code files automatically. The program is Open Source and distributed under the terms of PHP Licence. It is written in PHP 5 and has a command line tool.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/php_beautifier/allreleases.xml", '

PHP_Beautifier

pear.php.net 0.1.7beta 0.1.6beta 0.1.5beta 0.1.4beta 0.1.3beta 0.1.2beta 0.1.1beta 0.1.0beta 0.0.9devel 0.0.8devel 0.0.7devel 0.0.6.1devel 0.0.6devel 0.0.5devel
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/php_beautifier/deps.0.1.7.txt", 'a:6:{i:1;a:3:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:1:"5";}i:2;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:3:"1.8";s:8:"optional";s:2:"no";s:4:"name";s:3:"Log";}i:3;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"gt";s:7:"version";s:1:"1";s:8:"optional";s:3:"yes";s:4:"name";s:14:"Console_Getopt";}i:4;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:3:"1.2";s:8:"optional";s:3:"yes";s:4:"name";s:11:"Archive_Tar";}i:5;a:5:{s:4:"type";s:3:"ext";s:3:"rel";s:3:"has";s:7:"version";s:1:"0";s:8:"optional";s:2:"no";s:4:"name";s:9:"tokenizer";}i:6;a:5:{s:4:"type";s:3:"ext";s:3:"rel";s:3:"has";s:7:"version";s:1:"0";s:8:"optional";s:3:"yes";s:4:"name";s:3:"bz2";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/php_compat/info.xml", '

PHP_Compat pear.php.net PHP PHP License Provides missing functionality for older versions of PHP PHP_Compat provides missing functionality in the form of constants and functions for older versions of PHP. Note: PHP_Compat can be used without installing PEAR. 1) Download the package by clicking the "Download" link. 2) Find the file you need. Each function is in its own file, e.g. array_walk_recursive.php. 3) Place this file somewhere in your include_path. 4) Include it, e.g. <?php require_once \'array_walk_recursive.php\';?> The function is now ready to be used.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/php_compat/allreleases.xml", '

PHP_Compat

pear.php.net 1.4.1stable 1.4.0stable 1.3.1stable 1.3.0stable 1.2.0stable 1.1.0stable 1.0.0stable 1.0.0RC2beta 1.0.0RC1beta 0.2beta 0.1beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/php_compat/deps.1.4.1.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/php_compatinfo/info.xml", '

PHP_CompatInfo pear.php.net PHP PHP License Find out the minimum version and the extensions required for a piece of code to run PHP_CompatInfo will parse a file/folder/script/array to find out the minimum version and extensions required for it to run. Features advanced debug output which shows which functions require which version and CLI output script

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/php_compatinfo/allreleases.xml", '

PHP_CompatInfo

pear.php.net 1.0.0stable 1.0.0RC5beta 1.0.0RC4beta 1.0.0RC3beta 1.0.0RC2beta 1.0.0RC1beta 0.8.4alpha 0.8.3alpha 0.8.2alpha 0.8.1alpha 0.8.0alpha 0.7.0alpha
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/php_compatinfo/deps.1.0.0.txt", 'a:2:{s:8:"required";a:3:{s:3:"php";a:2:{s:3:"min";s:5:"4.3.0";s:3:"max";s:5:"6.0.0";}s:13:"pearinstaller";a:1:{s:3:"min";s:7:"1.4.0a1";}s:9:"extension";a:1:{s:4:"name";s:9:"tokenizer";}}s:8:"optional";a:1:{s:7:"package";a:2:{i:0;a:3:{s:4:"name";s:13:"Console_Table";s:7:"channel";s:12:"pear.php.net";s:3:"min";s:5:"1.0.1";}i:1;a:3:{s:4:"name";s:14:"Console_Getopt";s:7:"channel";s:12:"pear.php.net";s:3:"min";s:3:"1.2";}}}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/php_fork/info.xml", '

PHP_Fork pear.php.net PHP PHP License PHP_Fork class. Wrapper around the pcntl_fork() stuff with a API set like Java language PHP_Fork class. Wrapper around the pcntl_fork() stuff with a API set like Java language. Practical usage is done by extending this class, and re-defining the run() method. [see basic example] This way PHP developers can enclose logic into a class that extends PHP_Fork, then execute the start() method that forks a child process. Communications with the forked process is ensured by using a Shared Memory Segment; by using a user-defined signal and this shared memory developers can access to child process methods that returns a serializable variable. The shared variable space can be accessed with the tho methods: o void setVariable($name, $value) o mixed getVariable($name) $name must be a valid PHP variable name; $value must be a variable or a serializable object. Resources (db connections, streams, etc.) cannot be serialized and so they\'re not correctly handled. Requires PHP build with --enable-cli --with-pcntl --enable-shmop. Only runs on *NIX systems, because Windows lacks of the pcntl ext. @example browser_pool.php an interactive tool to perform multiple cuncurrent request over an URL. @example simple_controller.php shows how to attach a controller to started pseudo-threads. @example exec_methods.php shows a workaround to execute methods into the child process. @example passing_vars.php shows variable exchange between the parent process and started pseudo-threads. @example basic.php a basic example, only two pseudo-threads that increment a counter simultaneously.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/php_fork/allreleases.xml", '

PHP_Fork

pear.php.net 0.3.0beta 0.2.0beta 0.1beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/php_fork/deps.0.3.0.txt", 'a:4:{i:1;a:3:{s:4:"type";s:3:"ext";s:3:"rel";s:3:"has";s:4:"name";s:5:"pcntl";}i:2;a:3:{s:4:"type";s:3:"ext";s:3:"rel";s:3:"has";s:4:"name";s:5:"shmop";}i:3;a:3:{s:4:"type";s:3:"ext";s:3:"rel";s:3:"has";s:4:"name";s:5:"posix";}i:4;a:3:{s:4:"type";s:4:"sapi";s:3:"rel";s:3:"has";s:4:"name";s:3:"cli";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/php_parser/info.xml", '

PHP_Parser pear.php.net PHP PHP License A PHP Grammar Parser PHP_Parser is a source code analysis tool based around a real Parser generated by phpJay. The parser uses the same EBNF source that PHP uses to parse itself, and it therefore as robust as PHP itself. This version has full support for parsing out every re-usable element in PHP 5 as of beta 1: - classes - abstract classes - inheritance, implements - interfaces - methods - exception parsing directly from source - static variables declared - global and superglobal ($_GET) variables used and declared - variables - constants - functions (same information as methods) - defines - global variables (with help of the Tokenizer Lexer) - superglobal variables used in global code - include statements The output can be customized to return an array, return objects of user-specified classes, and can also be customized to publish each element as it is parsed, allowing hooks into parsing to catch information.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/php_parser/allreleases.xml", '

PHP_Parser

pear.php.net 0.1devel
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/php_parser/deps.0.1.txt", 'a:1:{i:1;a:4:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"4.3.0";s:8:"optional";s:2:"no";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/rdf/info.xml", '

RDF pear.php.net Semantic Web LGPL Port of the core RAP API This package is a port of the core components of the RDF API for PHP (aka RAP): http://www.wiwiss.fu-berlin.de/suhl/bizer/rdfapi/.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/rdf/allreleases.xml", '

RDF

pear.php.net 0.1.0alpha1alpha
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/rdf/deps.0.1.0alpha1.txt", 'a:3:{i:1;a:4:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"4.2.0";s:8:"optional";s:2:"no";}i:2;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.0b1";s:8:"optional";s:2:"no";s:4:"name";s:4:"PEAR";}i:3;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:3:"yes";s:4:"name";s:3:"MDB";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/rdf_n3/info.xml", '

RDF_N3 pear.php.net Semantic Web LGPL Port of the RAP N3 parser/serializer This package is a port of the N3 parser and serializer of the RDF API for PHP (aka RAP): http://www.wiwiss.fu-berlin.de/suhl/bizer/rdfapi/.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/rdf_n3/allreleases.xml", '

RDF_N3

pear.php.net 0.1.0alpha1alpha
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/rdf_n3/deps.0.1.0alpha1.txt", 'a:4:{i:1;a:4:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"4.2.0";s:8:"optional";s:2:"no";}i:2;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.0b1";s:8:"optional";s:2:"no";s:4:"name";s:4:"PEAR";}i:3;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:3:"yes";s:4:"name";s:3:"MDB";}i:4;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:2:"no";s:4:"name";s:3:"RDF";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/rdf_ntriple/info.xml", '

RDF_NTriple pear.php.net Semantic Web LGPL Port of the RAP NTriple serializer This package is a port of the NTriple serializer of the RDF API for PHP (aka RAP): http://www.wiwiss.fu-berlin.de/suhl/bizer/rdfapi/.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/rdf_ntriple/allreleases.xml", '

RDF_NTriple

pear.php.net 0.1.0alpha1alpha
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/rdf_ntriple/deps.0.1.0alpha1.txt", 'a:4:{i:1;a:4:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"4.2.0";s:8:"optional";s:2:"no";}i:2;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.0b1";s:8:"optional";s:2:"no";s:4:"name";s:4:"PEAR";}i:3;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:3:"yes";s:4:"name";s:3:"MDB";}i:4;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:2:"no";s:4:"name";s:3:"RDF";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/rdf_rdql/info.xml", '

RDF_RDQL pear.php.net Semantic Web LGPL Port of the RAP RDQL API This package is a port of the RDQL part of the RDF API for PHP (aka RAP): http://www.wiwiss.fu-berlin.de/suhl/bizer/rdfapi/.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/rdf_rdql/allreleases.xml", '

RDF_RDQL

pear.php.net 0.1.0alpha1alpha
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/rdf_rdql/deps.0.1.0alpha1.txt", 'a:4:{i:1;a:4:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"4.2.0";s:8:"optional";s:2:"no";}i:2;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.0b1";s:8:"optional";s:2:"no";s:4:"name";s:4:"PEAR";}i:3;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:3:"yes";s:4:"name";s:3:"MDB";}i:4;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:2:"no";s:4:"name";s:3:"RDF";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/science_chemistry/info.xml", '

Science_Chemistry pear.php.net Science PHP License Classes to manipulate chemical objects: atoms, molecules, etc. General classes to represent Atoms, Molecules and Macromolecules. Also parsing code for PDB, CML and XYZ file formats. Examples of parsing and conversion to/from chemical structure formats. Includes a utility class with information on the Elements in the Periodic Table.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/science_chemistry/allreleases.xml", '

Science_Chemistry

pear.php.net 1.1.0stable 1.0.3stable 1.0.2stable 1.0.1stable 1.0stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/science_chemistry/deps.1.1.0.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/scriptreorganizer/info.xml", '

ScriptReorganizer pear.php.net Tools and Utilities LGPL Library/Tool focusing exclusively on the file size aspect of PHP script optimization. ScriptReorganizer has the ability to reorganize source code in different (incremental) ways: - File: one-to-one (Script) or many-to-one (Library) optimization. - Source: EOL (Route), comment (Quiet) and whitespace (Pack) optimization. Plugin functionality is available by means of the Decorator Pattern. It is highly recommended to follow the best practice detailed out below, when using this package: 1. Running of all tests before building releases to deploy. 2. Reorganization of the source code file(s) with ScriptReorganizer. 3. Running of all tests - not only unit tests! 4. Final building of the release to deploy. If the advanced pack mode strategy is used for packaging, a non-ScriptReorganized source code tree should be shipped together with the optimized one, to enable third parties to track down undiscovered bugs. Same applies for (complex) applications that are pharized, i.e. optimized and packaged with PHP_Archive, as well as for bcompiled scripts. ANN: Currently only "pure" PHP code can be reorganized.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/scriptreorganizer/allreleases.xml", false, false); $pearweb->addRESTConfig("http://pear.php.net/rest/p/search_mnogosearch/info.xml", '

Search_Mnogosearch pear.php.net Tools and Utilities PHP License 2.02 Wrapper classes for the mnoGoSearch extension This package provides wrapper classes for the mnoGoSearch search engine. The package has two central classes "Search_Mnogosearch" and "Search_Mnogosearch_Result". The class "Search_Mnogosearch" gives an object that represents the search and the "Search_Mnogosearch_Result" the result. The usage is just like the usage in the "DB" and "DB_result" classes.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/search_mnogosearch/allreleases.xml", '

Search_Mnogosearch

pear.php.net 0.1.1alpha 0.1.0alpha
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/search_mnogosearch/deps.0.1.1.txt", 'a:5:{i:1;a:3:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"5.0.0";}i:2;a:3:{s:4:"type";s:3:"ext";s:3:"rel";s:3:"has";s:4:"name";s:11:"mnogosearch";}i:3;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"3.2.3";s:8:"optional";s:3:"yes";s:4:"name";s:14:"HTML_QuickForm";}i:4;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.1.1";s:8:"optional";s:3:"yes";s:4:"name";s:19:"HTML_Template_Sigma";}i:5;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"2.2.3";s:8:"optional";s:3:"yes";s:4:"name";s:5:"Pager";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/services_amazon/info.xml", '

Services_Amazon pear.php.net Web Services BSD Provides access to Amazon.com\'s retail and associate web services Services_Amazon uses Amazon.com?s web services to allow developers to search and provide associate links for specific ISBN numbers, authors, artist, directors, and publishers among other things.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/services_amazon/allreleases.xml", '

Services_Amazon

pear.php.net 0.2.0beta 0.1.0beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/services_amazon/deps.0.2.0.txt", 'a:2:{i:1;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:2:"no";s:4:"name";s:11:"HTTP_Client";}i:2;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:2:"no";s:4:"name";s:14:"XML_Serializer";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/services_delicious/info.xml", '

Services_Delicious pear.php.net Web Services PHP License Client for the del.icio.us web service. Services_Delicious is a client for the REST-based web service of del.icio.us. del.icio.us is a social bookmarks manager. It allows you to easily add sites you like to your personal collection of links, to categorize those sites with keywords, and to share your collection not only between your own browsers and machines, but also with others. Services_Delicious allows you to select, add and delete your bookmarks from any PHP script.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/services_delicious/allreleases.xml", '

Services_Delicious

pear.php.net 0.2.0betabeta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/services_delicious/deps.0.2.0beta.txt", 'a:3:{i:1;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:2:"no";s:4:"name";s:4:"PEAR";}i:2;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:2:"no";s:4:"name";s:12:"HTTP_Request";}i:3;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:6:"0.12.0";s:8:"optional";s:2:"no";s:4:"name";s:14:"XML_Serializer";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/services_dyndns/info.xml", '

Services_DynDNS pear.php.net Web Services PHP License Provides access to the DynDNS web service Services_DynDNS provides object-oriented interfaces to the DynDNS REST API.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/services_dyndns/allreleases.xml", '

Services_DynDNS

pear.php.net 0.3.1alpha 0.3.0alpha
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/services_dyndns/deps.0.3.1.txt", 'a:2:{i:1;a:4:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"4.1.0";s:8:"optional";s:2:"no";}i:2;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:2:"no";s:4:"name";s:12:"HTTP_Request";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/services_ebay/info.xml", '

Services_Ebay pear.php.net Web Services PHP License Interface to eBay\'s XML-API. Interface to eBay\'s XML-API. It provides objects that are able to communicate with eBay as well as models that help you working with the return values like User or Item models. The Services_Ebay class provides a unified method to use all objects.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/services_ebay/allreleases.xml", '

Services_Ebay

pear.php.net 0.12.0alpha 0.11.0alpha 0.10.1alphaalpha 0.10.0alphaalpha 0.8.0alphaalpha 0.7.0devel 0.6.1devel 0.6.0devel
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/services_ebay/deps.0.12.0.txt", 'a:4:{i:1;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.3.2";s:8:"optional";s:2:"no";s:4:"name";s:4:"PEAR";}i:2;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:6:"0.16.0";s:8:"optional";s:2:"no";s:4:"name";s:14:"XML_Serializer";}i:3;a:4:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"5.0.0";s:8:"optional";s:2:"no";}i:4;a:4:{s:4:"type";s:3:"ext";s:3:"rel";s:3:"has";s:8:"optional";s:2:"no";s:4:"name";s:4:"curl";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/services_exchangerates/info.xml", '

Services_ExchangeRates pear.php.net Web Services PHP License Performs currency conversion Extendable to work with any source that provides exchange rate data, this class downloads exchange rates and the name of each currency (US Dollar, Euro, Maltese Lira, etc.) and converts between any two of the available currencies (the actual number of currencies supported depends on the exchange rate feed used).

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/services_exchangerates/allreleases.xml", '

Services_ExchangeRates

pear.php.net 0.5.2beta 0.5.0beta 0.4.1alpha 0.4alpha
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/services_exchangerates/deps.0.5.2.txt", 'a:3:{i:1;a:3:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:4:"name";s:12:"HTTP_Request";}i:2;a:3:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:4:"name";s:10:"Cache_Lite";}i:3;a:3:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:4:"name";s:8:"XML_Tree";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/services_google/info.xml", '

Services_Google pear.php.net Web Services PHP License Provides access to the Google Web APIs Allows easy access to the Google Web APIs for the search engine, spelling suggestions, and cache. To use the package you\'ll need an API key from http://www.google.com/apis/.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/services_google/allreleases.xml", '

Services_Google

pear.php.net 0.1.1alpha 0.1.0alpha
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/services_google/deps.0.1.1.txt", 'a:2:{i:1;a:4:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"5.0.0";s:8:"optional";s:2:"no";}i:2;a:4:{s:4:"type";s:3:"ext";s:3:"rel";s:3:"has";s:8:"optional";s:2:"no";s:4:"name";s:4:"soap";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/services_pingback/info.xml", '

Services_Pingback pear.php.net Web Services BSD License A Pingback User-Agent class. A Pingback package implemented in PHP, able to send and receive a pingback.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/services_pingback/allreleases.xml", '

Services_Pingback

pear.php.net 0.2.0dev2devel
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/services_pingback/deps.0.2.0dev2.txt", 'a:1:{s:8:"required";a:3:{s:3:"php";a:1:{s:3:"min";s:5:"4.3.0";}s:13:"pearinstaller";a:1:{s:3:"min";s:7:"1.4.0a1";}s:7:"package";a:3:{i:0;a:3:{s:4:"name";s:7:"XML_RPC";s:7:"channel";s:12:"pear.php.net";s:3:"min";s:8:"1.0.3RC1";}i:1;a:3:{s:4:"name";s:7:"Net_URL";s:7:"channel";s:12:"pear.php.net";s:3:"min";s:6:"1.0.14";}i:2;a:3:{s:4:"name";s:12:"HTTP_Request";s:7:"channel";s:12:"pear.php.net";s:3:"min";s:5:"1.2.4";}}}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/services_technorati/info.xml", '

Services_Technorati pear.php.net Web Services PHP License A class for interacting with the Technorati API Services_Technorati is a wrapper for the REST-based Technorati webservices API. Technorati is a blog search engine that provides a number of interfaces for interacting with recent blog entries, such as searching for entries that link to a certain URL, are linked from a certain URL, or have been given certain tags. Services_Technorati provides an interface to all of the query types in Technorati API version 1.0, and supports filesystem caching of query data using Cache_Lite compatible cache objects.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/services_technorati/allreleases.xml", '

Services_Technorati

pear.php.net 0.6.5betabeta 0.6.4betabeta 0.6.3alphaalpha 0.6.2alphaalpha 0.6.1alphaalpha 0.6.0alphaalpha 0.5.6devel 0.5.5devel
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/services_technorati/deps.0.6.5beta.txt", 'a:3:{i:1;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:3:"yes";s:4:"name";s:10:"Cache_Lite";}i:2;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:2:"no";s:4:"name";s:14:"XML_Serializer";}i:3;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:2:"no";s:4:"name";s:12:"HTTP_Request";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/services_trackback/info.xml", '

Services_Trackback pear.php.net Web Services PHP License Trackback - A generic class for sending and receiving trackbacks. A generic class for sending and receiving trackbacks.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/services_trackback/allreleases.xml", '

Services_Trackback

pear.php.net 0.5.0alpha 0.4.0alpha
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/services_trackback/deps.0.5.0.txt", 'a:2:{s:8:"required";a:2:{s:3:"php";a:1:{s:3:"min";s:5:"4.3.0";}s:13:"pearinstaller";a:1:{s:3:"min";s:5:"1.3.0";}}s:5:"group";a:2:{i:0;a:2:{s:7:"attribs";a:2:{s:4:"hint";s:43:"Usage of Services_Trackback::autodiscover()";s:4:"name";s:12:"autodiscover";}s:7:"package";a:2:{s:4:"name";s:12:"HTTP_Request";s:7:"channel";s:12:"pear.php.net";}}i:1;a:2:{s:7:"attribs";a:2:{s:4:"hint";s:23:"DNSBL/SURBL spam checks";s:4:"name";s:5:"dnsbl";}s:7:"package";a:2:{s:4:"name";s:9:"Net_DNSBL";s:7:"channel";s:12:"pear.php.net";}}}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/services_weather/info.xml", '

Services_Weather pear.php.net Web Services PHP License This class acts as an interface to various online weather-services. Services_Weather searches for given locations and retrieves current weather data and, dependent on the used service, also forecasts. Up to now, GlobalWeather from CapeScience, Weather XML from EJSE (US only), a XOAP service from Weather.com and METAR/TAF from NOAA are supported. Further services will get included, if they become available, have a usable API and are properly documented.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/services_weather/allreleases.xml", '

Services_Weather

pear.php.net 1.3.2stable 1.3.1stable 1.3.0stable 1.2.2stable 1.2.1stable 1.2.0stable 1.1.0stable 1.0.1stable 1.0.0stable 1.0.0RC2beta 1.0.0RC1beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/services_weather/deps.1.3.2.txt", 'a:5:{i:1;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.5.3";s:8:"optional";s:3:"yes";s:4:"name";s:5:"Cache";}i:2;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:3:"1.4";s:8:"optional";s:3:"yes";s:4:"name";s:2:"DB";}i:3;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:3:"1.2";s:8:"optional";s:3:"yes";s:4:"name";s:12:"HTTP_Request";}i:4;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"0.7.5";s:8:"optional";s:3:"yes";s:4:"name";s:4:"SOAP";}i:5;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:3:"0.8";s:8:"optional";s:3:"yes";s:4:"name";s:14:"XML_Serializer";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/services_webservice/info.xml", '

Services_Webservice pear.php.net Web Services PHP License Create webservices Easy Webservice creation

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/services_webservice/allreleases.xml", '

Services_Webservice

pear.php.net 0.4.0alpha 0.3.0alpha
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/services_webservice/deps.0.4.0.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/services_yahoo/info.xml", '

Services_Yahoo pear.php.net Web Services PHP License Provides access to the Yahoo! Web Services Services_Yahoo provides object-oriented interfaces to the web service capabilities of Yahoo.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/services_yahoo/allreleases.xml", '

Services_Yahoo

pear.php.net 0.1.0alpha
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/services_yahoo/deps.0.1.0.txt", 'a:4:{i:1;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:2:"no";s:4:"name";s:12:"HTTP_Request";}i:2;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.3.3";s:8:"optional";s:2:"no";s:4:"name";s:4:"PEAR";}i:3;a:4:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"5.0.0";s:8:"optional";s:2:"no";}i:4;a:4:{s:4:"type";s:3:"ext";s:3:"rel";s:3:"has";s:8:"optional";s:2:"no";s:4:"name";s:9:"simplexml";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/soap/info.xml", '

SOAP pear.php.net Web Services PHP License SOAP Client/Server for PHP Implementation of SOAP protocol and services

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/soap/allreleases.xml", '

SOAP

pear.php.net 0.9.1beta 0.9.0beta 0.8.1beta 0.8RC3beta 0.8RC2beta 0.8RC1beta 0.7.5beta 0.7.4beta 0.7.3beta 0.7.2beta 0.7.1beta 0.7.0beta 0.6.2beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/soap/deps.0.9.1.txt", 'a:1:{i:1;a:3:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:3:"4.1";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/soap_interop/info.xml", '

SOAP_Interop pear.php.net Web Services PHP License SOAP Interop Test Application Test harness for SOAP Builders tests. Supports Round 2 and Round 3 tests.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/soap_interop/allreleases.xml", '

SOAP_Interop

pear.php.net 0.8beta 0.7.2beta 0.7.1beta 0.7.0beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/soap_interop/deps.0.8.txt", 'a:1:{i:1;a:3:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:4:"name";s:4:"SOAP";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/spreadsheet_excel_writer/info.xml", '

Spreadsheet_Excel_Writer pear.php.net File Formats LGPL Package for generating Excel spreadsheets Spreadsheet_Excel_Writer was born as a porting of the Spreadsheet::WriteExcel Perl module to PHP. It allows writing of Excel spreadsheets without the need for COM objects. It supports formulas, images (BMP) and all kinds of formatting for text and cells. It currently supports the BIFF5 format (Excel 5.0), so functionality appeared in the latest Excel versions is not yet available.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/spreadsheet_excel_writer/allreleases.xml", '

Spreadsheet_Excel_Writer

pear.php.net 0.8beta 0.7beta 0.6beta 0.5beta 0.4beta 0.3beta 0.2beta 0.1devel
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/spreadsheet_excel_writer/deps.0.8.txt", 'a:1:{i:1;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:3:"0.5";s:4:"name";s:3:"OLE";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/sql_parser/info.xml", '

SQL_Parser pear.php.net Database LGPL An SQL parser This class is primarily an SQL parser, written with influences from a variety of sources (mSQL, CPAN\'s SQL-Statement, mySQL). It also includes a tokenizer (lexer) class and a reimplementation of the ctype extension in PHP.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/sql_parser/allreleases.xml", '

SQL_Parser

pear.php.net 0.5devel 0.4devel 0.3devel 0.2devel 0.1devel
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/sql_parser/deps.0.5.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/stream_shm/info.xml", '

Stream_SHM pear.php.net Streams PHP Shared Memory Stream The Stream_SHM package provides a class that can be registered with stream_register_wrapper() in order to have stream-based shared-memory access.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/stream_shm/allreleases.xml", '

Stream_SHM

pear.php.net 1.0.0stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/stream_shm/deps.1.0.0.txt", 'a:1:{i:1;a:3:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"4.3.0";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/stream_var/info.xml", '

Stream_Var pear.php.net Streams PHP License Allows stream based access to any variable. Stream_Var can be registered as a stream with stream_register_wrapper() and allows stream based acces to variables in any scope. Arrays are treated as directories, so it\'s possible to replace temporary directories and files in your application with variables.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/stream_var/allreleases.xml", '

Stream_Var

pear.php.net 1.0.0stable 0.2.1stable 0.2stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/stream_var/deps.1.0.0.txt", 'a:1:{i:1;a:4:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"4.3.2";s:8:"optional";s:2:"no";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/structures_datagrid/info.xml", '

Structures_DataGrid pear.php.net Structures PHP License A tabular structure that contains a record set of data for paging and sorting purposes. This package offers a toolkit to render out a datagrid in HTML format as well as many other formats such as an XML Document, an Excel Spreadsheet, an XUL Document and more. It also offers paging and sorting functionallity to limit the data that is presented and processed. This concept is based on the .NET Framework DataGrid control and works very well with database and XML result sets.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/structures_datagrid/allreleases.xml", '

Structures_DataGrid

pear.php.net 0.6.2beta 0.6.0beta 0.5.3alpha 0.5.2alpha 0.5.1alpha 0.5alpha 0.4.1alpha 0.4alpha
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/structures_datagrid/deps.0.6.2.txt", 'a:8:{i:1;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:3:"1.2";s:8:"optional";s:2:"no";s:4:"name";s:4:"PEAR";}i:2;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:3:"1.5";s:8:"optional";s:3:"yes";s:4:"name";s:10:"HTML_Table";}i:3;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:3:"2.2";s:8:"optional";s:3:"yes";s:4:"name";s:5:"Pager";}i:4;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:3:"0.6";s:8:"optional";s:3:"yes";s:4:"name";s:24:"Spreadsheet_Excel_Writer";}i:5;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"0.5.2";s:8:"optional";s:3:"yes";s:4:"name";s:8:"XML_Util";}i:6;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"0.9.2";s:8:"optional";s:3:"yes";s:4:"name";s:7:"XML_RSS";}i:7;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:6:"0.11.1";s:8:"optional";s:3:"yes";s:4:"name";s:14:"XML_Serializer";}i:8;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.0.1";s:8:"optional";s:3:"yes";s:4:"name";s:13:"Console_Table";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/structures_graph/info.xml", '

Structures_Graph pear.php.net Structures LGPL Graph datastructure manipulation library Structures_Graph is a package for creating and manipulating graph datastructures. It allows building of directed and undirected graphs, with data and metadata stored in nodes. The library provides functions for graph traversing as well as for characteristic extraction from the graph topology.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/structures_graph/allreleases.xml", '

Structures_Graph

pear.php.net 1.0.1stable 1.0stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/structures_graph/deps.1.0.1.txt", 'a:1:{i:1;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:3:"1.2";s:4:"name";s:4:"Pear";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/system_command/info.xml", '

System_Command pear.php.net Console PHP License PEAR::System_Command is a commandline execution interface. System_Command is a commandline execution interface. Running functions from the commandline can be risky if the proper precautions are not taken to escape the shell arguments and reaping the exit status properly. This class provides a formal interface to both, so that you can run a system command as comfortably as you would run a php function, with full pear error handling as results on failure. It is important to note that this class, unlike other implementations, distinguishes between output to stderr and output to stdout. It also reports the exit status of the command. So in every sense of the word, it gives php shell capabilities.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/system_command/allreleases.xml", '

System_Command

pear.php.net 1.0.2stable 1.0.1stable 1.0stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/system_command/deps.1.0.2.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/system_mount/info.xml", '

System_Mount pear.php.net System PHP License v3.0 Mount and unmount devices in fstab System_Mount provides a simple interface to deal with mounting and unmounting devices listed in the system\'s fstab. Features: * Very compact, easy-to-read code, based on File_Fstab. * Examines mount options to determine if a device can be mounted or not. * Extremely easy to use. * Fully documented with PHPDoc.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/system_mount/allreleases.xml", '

System_Mount

pear.php.net 1.0.0stable 1.0.0beta2beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/system_mount/deps.1.0.0.txt", 'a:3:{i:1;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:10:"2.0.0beta1";s:4:"name";s:10:"File_Fstab";}i:2;a:3:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:4:"name";s:14:"System_Command";}i:3;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:3:"yes";s:4:"name";s:4:"File";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/system_procwatch/info.xml", '

System_ProcWatch pear.php.net System PHP Monitor Processes With this package you can monitor running processes based upon an XML configuration file, XML string, INI file or an array where you define patterns, conditions and actions. XML::Parser must be installed to configure System::ProcWatch by XML, additionally Console::Getopt and XML::DTD must be installed if you want to use the shipped shell scripts \'procwatch\' and \'procwatch-lint\'. A simple \'ps\' fake for WinNT can be found at http://dev.iworks.at/ps/ps.zip

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/system_procwatch/allreleases.xml", '

System_ProcWatch

pear.php.net 0.4.2beta 0.4.1beta 0.4beta 0.3.1beta 0.3beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/system_procwatch/deps.0.4.2.txt", 'a:7:{i:1;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:2:"no";s:4:"name";s:4:"PEAR";}i:2;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.1.0";s:8:"optional";s:3:"yes";s:4:"name";s:10:"XML_Parser";}i:3;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:3:"yes";s:4:"name";s:7:"XML_DTD";}i:4;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:3:"yes";s:4:"name";s:14:"Console_Getopt";}i:5;a:4:{s:4:"type";s:3:"ext";s:3:"rel";s:3:"has";s:8:"optional";s:2:"no";s:4:"name";s:4:"pcre";}i:6;a:4:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"4.0.2";s:8:"optional";s:2:"no";}i:7;a:4:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"4.3.0";s:8:"optional";s:3:"yes";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/system_sharedmemory/info.xml", '

System_SharedMemory pear.php.net System PHP License common OO-style shared memory API OO-style shared memory API for next shared memory engines: Apache Note APC Eaccelerator Plain files Memcached Turck MMCache Sharedance Shmop SQLite System V

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/system_sharedmemory/allreleases.xml", '

System_SharedMemory

pear.php.net 0.1.0beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/system_sharedmemory/deps.0.1.0.txt", 'a:1:{s:8:"required";a:2:{s:3:"php";a:1:{s:3:"min";s:5:"4.0.0";}s:13:"pearinstaller";a:1:{s:3:"min";s:7:"1.4.0b1";}}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/system_socket/info.xml", '

System_Socket pear.php.net System PHP OO socket API Aims to provide a thight and robust OO API to PHPs socket extension (ext/sockets).

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/system_socket/allreleases.xml", '

System_Socket

pear.php.net 0.4.1alpha 0.4.0devel
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/system_socket/deps.0.4.1.txt", 'a:5:{i:1;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:2:"no";s:4:"name";s:4:"PEAR";}i:2;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:3:"1.2";s:8:"optional";s:3:"yes";s:4:"name";s:8:"Net_IPv4";}i:3;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:3:"yes";s:4:"name";s:3:"Log";}i:4;a:4:{s:4:"type";s:3:"ext";s:3:"rel";s:3:"has";s:8:"optional";s:2:"no";s:4:"name";s:7:"sockets";}i:5;a:4:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"4.3.0";s:8:"optional";s:2:"no";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/system_windrives/info.xml", '

System_WinDrives pear.php.net System PHP License List files drives on windows systems Provides functions to enumerate root directories ("Drives") on Windows systems by using win32 api calls.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/system_windrives/allreleases.xml", '

System_WinDrives

pear.php.net 0.1.0beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/system_windrives/deps.0.1.0.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/text_captcha/info.xml", '

Text_CAPTCHA pear.php.net Text PHP License Generation of CAPTCHA imgaes Implementation of CAPTCHA (completely automated public Turing test to tell computers and humans apart) images

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/text_captcha/allreleases.xml", '

Text_CAPTCHA

pear.php.net 0.1.4alpha 0.1.3alpha 0.1.2alpha 0.1.1alpha 0.1.0alpha
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/text_captcha/deps.0.1.4.txt", 'a:3:{i:1;a:3:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:4:"name";s:13:"Text_Password";}i:2;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:2:"no";s:4:"name";s:10:"Image_Text";}i:3;a:4:{s:4:"type";s:3:"ext";s:3:"rel";s:3:"has";s:8:"optional";s:2:"no";s:4:"name";s:2:"gd";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/text_diff/info.xml", '

Text_Diff pear.php.net Text LGPL Engine for performing and rendering text diffs This package provides a text-based diff engine and renderers for multiple diff output formats.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/text_diff/allreleases.xml", '

Text_Diff

pear.php.net 0.1.1beta 0.1.0beta 0.0.5beta 0.0.4beta 0.0.3beta 0.0.2alpha
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/text_diff/deps.0.1.1.txt", 'a:2:{i:1;a:3:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"4.2.0";}i:2;a:4:{s:4:"type";s:3:"ext";s:3:"rel";s:3:"has";s:8:"optional";s:3:"yes";s:4:"name";s:5:"xdiff";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/text_figlet/info.xml", '

Text_Figlet pear.php.net Text PHP License Render text using FIGlet fonts Engine for use FIGlet fonts to rendering text

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/text_figlet/allreleases.xml", '

Text_Figlet

pear.php.net 0.8.1beta 0.8.0beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/text_figlet/deps.0.8.1.txt", 'a:1:{i:1;a:3:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:6:"4.0.4+";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/text_highlighter/info.xml", '

Text_Highlighter pear.php.net Text PHP License Syntax highlighting Text_Highlighter is a package for syntax highlighting. It provides a base class provining all the functionality, and a descendant classes geneator class. The main idea is to simplify creation of subclasses implementing syntax highlighting for particular language. Subclasses do not implement any new functioanality, they just provide syntax highlighting rules. The rules sources are in XML format. To create a highlighter for a language, there is no need to code a new class manually. Simply describe the rules in XML file and use Text_Highlighter_Generator to create a new class.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/text_highlighter/allreleases.xml", '

Text_Highlighter

pear.php.net 0.6.2beta 0.6.1beta 0.6.0beta 0.5.1beta 0.5.0beta 0.4.1beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/text_highlighter/deps.0.6.6.txt", 'a:3:{i:1;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:3:"1.0";s:8:"optional";s:2:"no";s:4:"name";s:4:"PEAR";}i:2;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.0.1";s:8:"optional";s:2:"no";s:4:"name";s:10:"XML_Parser";}i:3;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:3:"1.0";s:8:"optional";s:2:"no";s:4:"name";s:14:"Console_Getopt";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/text_huffman/info.xml", '

Text_Huffman pear.php.net Text LGPL Huffman compression Huffman compression is a lossless compression algorithm that is ideal for compressing textual data.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/text_huffman/allreleases.xml", '

Text_Huffman

pear.php.net 0.2.0beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/text_huffman/deps.0.2.0.txt", 'a:1:{i:1;a:4:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:8:"5.0.0RC1";s:8:"optional";s:2:"no";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/text_lexer/info.xml", '

Text_Lexer pear.php.net Text PHP A base class for all types of Lexers and their implementation. Text_Lexer includes a base class for all types of Lexers and their implementation in PHP. Currently, only a regex lexer is implemented; in the future, FSM and String lexers will be added.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/text_lexer/allreleases.xml", false, false); $pearweb->addRESTConfig("http://pear.php.net/rest/p/text_password/info.xml", '

Text_Password pear.php.net Text PHP License Creating passwords with PHP. Text_Password allows one to create pronounceable and unpronounceable passwords. The full functional range is explained in the manual at http://pear.php.net/manual/.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/text_password/allreleases.xml", '

Text_Password

pear.php.net 1.1.0stable 1.0stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/text_password/deps.1.1.0.txt", 'a:1:{i:1;a:3:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"4.2.0";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/text_statistics/info.xml", '

Text_Statistics pear.php.net Structures PHP License Compute readability indexes for documents. Text_Statistics allows for computation of readability indexes for text documents.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/text_statistics/allreleases.xml", '

Text_Statistics

pear.php.net 1.0stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/text_statistics/deps.1.0.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/text_texhyphen/info.xml", '

Text_TeXHyphen pear.php.net Text PHP Automated word hyphenation with the TeX algorithm. This package implements the TeX hyphenation algorithm based on pattern. The package can support various backends for pattern retrieval. At this stage only flat files with TeX pattern were implemented. The advantage of the TeX pattern is the available multi-language support. Currently german, oxford and american english are supported. For speed purposes an interface for a cache of hyphenated words was implemented.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/text_texhyphen/allreleases.xml", '

Text_TeXHyphen

pear.php.net 0.1.0alpha
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/text_texhyphen/deps.0.1.0.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/text_wiki/info.xml", '

Text_Wiki pear.php.net Text LGPL Abstracts parsing and rendering rules for any markup as Wiki or BBCode in structured plain text. The text transformation is done in 2 steps, the parsers use rules to tokenize the content, renderers output the tokens and left text in the requested format. Used for versatile transformers as well as converters.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/text_wiki/allreleases.xml", '

Text_Wiki

pear.php.net 0.25.0beta 0.24.0beta 0.23.1alpha 0.23.0alpha 0.22.0alpha 0.21.0alpha 0.20.1alpha 0.19.7alpha 0.19.6alpha 0.19.5alpha 0.19.4alpha 0.19.3alpha 0.19.2alpha 0.19.1alpha 0.19alpha 0.17alpha 0.16alpha 0.15alpha 0.14alpha 0.12.1alpha 0.12alpha 0.11alpha 0.10.4alpha 0.10.3alpha 0.10.2alpha 0.10.1alpha 0.10alpha 0.8.3alpha 0.8.2alpha 0.8.1alpha 0.8alpha 0.7alpha 0.6alpha 0.5alpha 0.4alpha
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/text_wiki/deps.1.0.1.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/text_wiki_bbcode/info.xml", '

Text_Wiki_BBCode pear.php.net Text LGPL BBCode parser for Text_Wiki Parses BBCode mark-up to tokenize the text for Text_Wiki rendering (Xhtml, plain, Latex) or for conversions using the existing renderers (wiki).

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/text_wiki_bbcode/allreleases.xml", '

Text_Wiki_BBCode

pear.php.net 0.0.1alpha
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/text_wiki_bbcode/deps.0.0.1.txt", 'a:1:{i:1;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.0.1";s:4:"name";s:9:"Text_Wiki";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/text_wiki_cowiki/info.xml", '

Text_Wiki_Cowiki pear.php.net Text LGPL CoWiki parser and renderer for Text_Wiki A subpackage for Text_Wiki which allows parsing from and rendering to CoWiki syntax.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/text_wiki_cowiki/allreleases.xml", false, false); $pearweb->addRESTConfig("http://pear.php.net/rest/p/text_wiki_doku/info.xml", '

Text_Wiki_Doku pear.php.net Text LGPL DokuWiki parser and renderer for Text_Wiki A subpackage for Text_Wiki which allows parsing from and rendering to DokuWiki syntax.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/text_wiki_doku/allreleases.xml", false, false); $pearweb->addRESTConfig("http://pear.php.net/rest/p/text_wiki_tiki/info.xml", '

Text_Wiki_Tiki pear.php.net Text LGPL TikiWiki parser and renderer for Text_Wiki A subpackage for Text_Wiki which allows parsing from and rendering to TikiWiki syntax.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/text_wiki_tiki/allreleases.xml", false, false); $pearweb->addRESTConfig("http://pear.php.net/rest/p/translation/info.xml", '

Translation pear.php.net Internationalization PHP License Class for creating multilingual websites. Class allows storing and retrieving all the strings on multilingual site in a database. The class connects to any database using PEAR::DB extension. The object should be created for every page. While creation all the strings connected with specific page and the strings connected with all the pages on the site are loaded into variable, so access to them is quite fast and does not overload database server connection.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/translation/allreleases.xml", '

Translation

pear.php.net 1.2.6pl1stable 1.2.6stable 1.2.5stable 1.2.4stable 1.2.3stable 1.2.2stable 1.2.1beta 1.2beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/translation/deps.1.2.6pl1.txt", 'a:1:{i:1;a:3:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:4:"name";s:2:"DB";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/translation2/info.xml", '

Translation2 pear.php.net Internationalization PHP License Class for multilingual applications management. This class provides an easy way to retrieve all the strings for a multilingual site from a data source (i.e. db). The following containers are provided, more will follow: - PEAR::DB - PEAR::MDB - PEAR::MDB2 - gettext - XML - PEAR::DB_DataObject (experimental) It is designed to reduce the number of queries to the db, caching the results when possible. An Admin class is provided to easily manage translations (add/remove a language, add/remove a string). Currently, the following decorators are provided: - CacheLiteFunction (for file-based caching) - CacheMemory (for memory-based caching) - DefaultText (to replace empty strings with their keys) - ErrorText (to replace empty strings with a custom error text) - Iconv (to switch from/to different encodings) - Lang (resort to fallback languages for empty strings) - SpecialChars (replace html entities with their hex codes) - UTF-8 (to convert UTF-8 strings to ISO-8859-1)

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/translation2/allreleases.xml", '

Translation2

pear.php.net 2.0.0beta7beta 2.0.0beta6beta 2.0.0beta5beta 2.0.0beta4beta 2.0.0beta3beta 2.0.0beta2beta 2.0.0beta1beta 2.0.0alpha2alpha 0.0.1alpha
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/translation2/deps.2.0.0beta7.txt", 'a:9:{i:1;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:3:"yes";s:4:"name";s:10:"Cache_Lite";}i:2;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:3:"yes";s:4:"name";s:2:"DB";}i:3;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:3:"yes";s:4:"name";s:13:"DB_DataObject";}i:4;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:3:"yes";s:4:"name";s:3:"MDB";}i:5;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:3:"yes";s:4:"name";s:4:"MDB2";}i:6;a:4:{s:4:"type";s:3:"ext";s:3:"rel";s:3:"has";s:8:"optional";s:3:"yes";s:4:"name";s:7:"gettext";}i:7;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:3:"yes";s:4:"name";s:12:"File_Gettext";}i:8;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"0.9.1";s:8:"optional";s:3:"yes";s:4:"name";s:6:"I18Nv2";}i:9;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:6:"0.13.0";s:8:"optional";s:3:"yes";s:4:"name";s:14:"XML_Serializer";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/tree/info.xml", '

Tree pear.php.net Structures PHP License Generic tree management, currently supports DB and XML as data sources Provides methods to read and manipulate trees, which are stored in the DB or an XML file. The trees can be stored in the DB either as nested trees. Or as simple trees (\'brain dead method\'), which use parentId-like structure. Currently XML data can only be read from a file and accessed. The package offers a big number of methods to access and manipulate trees. For example methods like: getRoot, getChild[ren[Ids]], getParent[s[Ids]], getPath[ById] and many more. There are two ways of retreiving the data from the place where they are stored, one is by reading the entire tree into the memory - the Memory way. The other is reading the tree nodes as needed (very useful in combination with huge trees and the nested set model). The package is designed that way that it is possible to convert/copy tree data from either structure to another (from XML into DB).

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/tree/allreleases.xml", '

Tree

pear.php.net 0.2.4beta 0.2.3beta 0.2.2beta 0.2.1beta 0.2beta 0.1.2beta 0.1.1beta 0.1beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/tree/deps.0.2.4.txt", 'a:2:{i:1;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:3:"1.3";s:4:"name";s:2:"DB";}i:2;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:3:"1.0";s:4:"name";s:10:"XML_Parser";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/uddi/info.xml", '

UDDI pear.php.net Web Services LGPL UDDI for PHP Implementation of the Universal Description, Discovery and Integration API for locating and publishing Web Services listings in a UBR (UDDI Business Registry)

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/uddi/allreleases.xml", '

UDDI

pear.php.net 0.2.0alpha4alpha 0.2.0alpha3alpha 0.2.0alpha2alpha 0.2.0alpha1alpha 0.1.3alpha 0.1.2alpha 0.1.1alpha 0.1alpha
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/uddi/deps.0.2.0alpha4.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/validate/info.xml", '

Validate pear.php.net Validate PHP Validation class Package to validate various datas. It includes : - numbers (min/max, decimal or not) - email (syntax, domain check) - string (predifined type alpha upper and/or lowercase, numeric,...) - date (min, max) - uri (RFC2396) - possibility valid multiple data with a single method call (::multiple)

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/validate/allreleases.xml", '

Validate

pear.php.net 0.6.1beta 0.6.0beta 0.5.0alpha 0.4.1alpha 0.4.0alpha 0.3.0alpha 0.2.0alpha 0.1.2alpha 0.1.1alpha 0.1.0alpha 0.0.4alpha 0.0.3alpha 0.0.2alpha
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/validate/deps.0.6.1.txt", 'a:2:{i:1;a:3:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"4.2.0";}i:2;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:3:"yes";s:4:"name";s:4:"Date";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/validate_at/info.xml", '

Validate_AT pear.php.net Validate PHP Validation class for AT Package containes locale validation for AT such as: * SSN * Postal Code

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/validate_at/allreleases.xml", '

Validate_AT

pear.php.net 0.5.0alpha
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/validate_at/deps.0.5.0.txt", 'a:2:{i:1;a:3:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"4.2.0";}i:2;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"0.5.0";s:4:"name";s:8:"Validate";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/validate_au/info.xml", '

Validate_AU pear.php.net Validate PHP License Validation Class for AU Packages contains Australia specific validators

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/validate_au/allreleases.xml", false, false); $pearweb->addRESTConfig("http://pear.php.net/rest/p/validate_be/info.xml", '

Validate_BE pear.php.net Validate PHP Validation class for Belgium Package containes locale validation for Belgium such as: * Postal Code * Bank Account Number * Transfer message (transfer from an bank account to another) * VAT * National ID * Identity Card Number * SIS CARD ID (belgian "sécurité sociale" ID)

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/archive_tar/1.3.1.xml", '

Archive_Tar

pear.php.net 1.3.1 stable PHP License vblavet Tar file management class This class provides handling of tar files in PHP. It supports creating, listing, extracting and adding to tar files. Gzip support is available if PHP has the zlib extension built-in or loaded. Bz2 compression is also supported with the bz2 extension loaded. 2005-03-17 16:09:16 Correct Bug #3855 15102 http://pear.php.net/get/Archive_Tar-1.3.1
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/file/1.2.2.xml", '

File

pear.php.net 1.2.2 stable PHP dufuz Common file and directory routines Provides easy access to read/write to files along with some common routines to deal with paths. Also provides interface for handling CSV files. 2005-09-10 08:20:34 * Fixed bug #5071 install File throws XML error (helgi) 15796 http://pear.php.net/get/File-1.2.2
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_sieve/1.1.1.xml", '

Net_Sieve

pear.php.net 1.1.1 stable BSD damian Handles talking to timsieved Provides an API to talk to the timsieved server that comes with Cyrus IMAPd. Can be used to install, remove, mark active etc sieve scripts. 2005-02-02 09:54:38 * Fixed Bug #3242 cyrus murder referrals not followed 9750 http://pear.php.net/get/Net_Sieve-1.1.1
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_socket/1.0.6.xml", '

Net_Socket

pear.php.net 1.0.6 stable PHP License chagenbu Network Socket Interface Net_Socket is a class interface to TCP sockets. It provides blocking and non-blocking operation, with different reading and writing modes (byte-wise, block-wise, line-wise and special formats like network byte-order ip addresses). 2005-02-26 09:53:48 - Make package.xml safe for PEAR 1.4.0. - Chunk socket writes on Windows by default, or if explicitly specified (Bug #980) - Don\'t run any $addr with a \'/\' in it through gethostbyname() (Bug #3372) 4623 http://pear.php.net/get/Net_Socket-1.0.6
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/pear/1.4.0.xml", '

PEAR

pear.php.net 1.4.0 stable PHP License pajoye PEAR Base System The PEAR package contains: * the PEAR installer, for creating, distributing and installing packages * the beta-quality PEAR_Exception PHP5 error handling mechanism * the beta-quality PEAR_ErrorStack advanced error handling class * 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 of common operations with files and directories * the PEAR base class 2005-09-18 15:24:29 This is a major milestone release for PEAR. In addition to several killer features, every single element of PEAR has a regression test, and so stability is much higher than any previous PEAR release. New features in a nutshell: * full support for channels * pre-download dependency validation * new package.xml 2.0 format allows tremendous flexibility while maintaining BC * support for optional dependency groups and limited support for sub-packaging * robust dependency support * full dependency validation on uninstall * remote install for hosts with only ftp access - no more problems with restricted host installation [through PEAR_RemoteInstaller package] * full support for mirroring * support for bundling several packages into a single tarball * support for static dependencies on a uri-based package * support for custom file roles and installation tasks NOTE: users of PEAR_Frontend_Web/PEAR_Frontend_Gtk must upgrade their installations to the latest version, or PEAR will not upgrade properly 266597 http://pear.php.net/get/PEAR-1.4.0
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/text_highlighter/0.6.6.xml", '

Text_Highlighter

pear.php.net 0.6.6 beta PHP License blindman Syntax highlighting Text_Highlighter is a package for syntax highlighting. It provides a base class provining all the functionality, and a descendant classes geneator class. The main idea is to simplify creation of subclasses implementing syntax highlighting for particular language. Subclasses do not implement any new functioanality, they just provide syntax highlighting rules. The rules sources are in XML format. To create a highlighter for a language, there is no need to code a new class manually. Simply describe the rules in XML file and use Text_Highlighter_Generator to create a new class. 2005-06-24 09:04:44 + fixed bug #4606 -- span end tag at beginning of a list + fixed bug #4607 -- The span class="hl-brackets" shall not include the spaces before + fixed bug #4608 -- Tabs not expanded in list mode 118450 http://pear.php.net/get/Text_Highlighter-0.6.6
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/text_wiki/1.0.1.xml", '

Text_Wiki

pear.php.net 1.0.1 stable LGPL toggg Abstracts parsing and rendering rules for any markup as Wiki or BBCode in structured plain text. The text transformation is done in 2 steps, the parsers use rules to tokenize the content, renderers output the tokens and left text in the requested format. Used for versatile transformers as well as converters. 2005-09-12 10:48:56 This is a bug fix and security release, also preparing the introduction of new parsers/renderers * Fixed bug 3881 and 4442, UTF-8 encoding problems. There are new config options for Render_Xhtml, \'charset\' and \'quotes\', that allow you to specify the charset for translation. * Fixed bug 3959, "XHTML lists not rendered according W3C Standards" (where a line of text before a list leaves an open paragraph tag and closes it after the list) * In Parse_Xhtml_Toc, returns an extra newline before the parsed replacement text to comply with the matching regex. * In Render_Xhtml_Toc, added a \'collapse\' config key to collapse the div horizontally within a table; this is for aesthetics, nothing else. The \'collapse\' option is true by default. * Added general rules Smiley, Subscript ",,text,," and Underline "__text__" * Added rendering rules Box, Font, Page, Plugin, Preformatted, Specialchar and Titelbar for the optional extra parsers (BBCode, Cowiki, Doku, Mediawiki and Tiki) * Fixed bug 4175 "Wrong transform method" by generating PEAR_Error objects when a parse, format, or render rule cannot be found. * applied feature request 4436 "Add option to getTokens to get original token indices" -- now the return array from getTokens() is keyed to the original token index number. * Fixed Bug #4473 Undefined variables in error() * Fixed bug 4474 to silence calls to htmlentities and htmlspecialchars so that errors about charsets don\'t pop up, per counsel from Jan at Horde. * Fixed Code potential nesting * Fixed bug #4719, "In Latex, newline rule does not produce a new line" * Request #4520 Additional space confuses image tag, adapted regexp * Request #4634 Code block title/filename, uses conf css_filename * Code Xhtml: add php tags only if not there * Heading: collapsing in headers * Colortext Xhtml: don\'t add # if allready present * Anchor Xhtml htlmentify the link * Cleaned Xhtml renderers documentation headers * Added an example in doc * Rowspan and space before free format in Table renderer * Secured url linked on images 62189 http://pear.php.net/get/Text_Wiki-1.0.1
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/xml_parser/allreleases.xml", '

XML_Parser

pear.php.net 1.2.4stable 1.2.3stable 1.2.2stable 1.2.1stable 1.2.0stable 1.2.0beta3beta 1.2.0beta2beta 1.2.0beta1beta 1.1.0stable 1.1.0beta2beta 1.1.0beta1beta 1.0.1stable 1.0stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/xml_parser/1.3.2.xml", '

XML_Parser

pear.php.net 1.3.2 stable BSD License ashnazg XML parsing class based on PHP\'s bundled expat This is an XML parser based on PHPs built-in xml extension. It supports two basic modes of operation: "func" and "event". In "func" mode, it will look for a function named after each element (xmltag_ELEMENT for start tags and xmltag_ELEMENT_ for end tags), and in "event" mode it uses a set of generic callbacks. Since version 1.2.0 there\'s a new XML_Parser_Simple class that makes parsing of most XML documents easier, by automatically providing a stack for the elements. Furthermore its now possible to split the parser from the handler object, so you do not have to extend XML_Parser anymore in order to parse a document with it. 2009-01-21 19:59:04 - Fix Bug #9328: assigned by reference error in XML_RSS parse - add an AllTests.php for PHPUnit usage 16260 http://pear.php.net/get/XML_Parser-1.3.2
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/xml_rpc/allreleases.xml", '

XML_RPC

pear.php.net 1.2.0RC6beta 1.2.0RC5beta 1.2.0RC4beta 1.2.0RC3beta 1.2.0RC2beta 1.2.0RC1beta 1.1.0stable 1.0.4stable 1.0.3stable 1.0.2stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/xml_rpc/1.5.1.xml", '

XML_RPC

pear.php.net 1.5.1 stable PHP License danielc PHP implementation of the XML-RPC protocol A PEAR-ified version of Useful Inc\'s XML-RPC for PHP. It has support for HTTP/HTTPS transport, proxies and authentication. 2006-10-28 13:06:21 * Turn passing payload through mb_convert_encoding() off by default. Use new XML_RPC_Message::setConvertPayloadEncoding() and XML_RPC_Server::setConvertPayloadEncoding() to turn it on. Bug 8632. * Have XML_RPC_Value::scalarval() return FALSE if value is not a scalar. Bug 8251. 32215 http://pear.php.net/get/XML_RPC-1.5.1
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/xml_parser/info.xml", '

XML_Parser pear.php.net XML BSD License XML parsing class based on PHP\'s bundled expat This is an XML parser based on PHPs built-in xml extension. It supports two basic modes of operation: "func" and "event". In "func" mode, it will look for a function named after each element (xmltag_ELEMENT for start tags and xmltag_ELEMENT_ for end tags), and in "event" mode it uses a set of generic callbacks. Since version 1.2.0 there\'s a new XML_Parser_Simple class that makes parsing of most XML documents easier, by automatically providing a stack for the elements. Furthermore its now possible to split the parser from the handler object, so you do not have to extend XML_Parser anymore in order to parse a document with it.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/xml_parser/deps.1.3.2.txt", 'a:1:{s:8:"required";a:3:{s:3:"php";a:1:{s:3:"min";s:5:"4.2.0";}s:13:"pearinstaller";a:1:{s:3:"min";s:7:"1.4.0b1";}s:7:"package";a:2:{s:4:"name";s:4:"PEAR";s:7:"channel";s:12:"pear.php.net";}}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/xml_rpc/info.xml", '

XML_RPC pear.php.net Web Services PHP License PHP implementation of the XML-RPC protocol A PEAR-ified version of Useful Inc\'s XML-RPC for PHP. It has support for HTTP/HTTPS transport, proxies and authentication.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/xml_rpc/deps.1.5.1.txt", 'a:1:{s:8:"required";a:3:{s:3:"php";a:1:{s:3:"min";s:5:"4.2.0";}s:13:"pearinstaller";a:1:{s:3:"min";s:7:"1.4.0a1";}s:9:"extension";a:1:{s:4:"name";s:3:"xml";}}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/console_getopt/1.2.xml", '

Console_Getopt

pear.php.net 1.2 stable PHP License andrei Command-line option parser This is a PHP implementation of "getopt" supporting both short and long options. 2003-12-11 14:26:46 Fix to preserve BC with 1.0 and allow correct behaviour for new users 3370 http://pear.php.net/get/Console_Getopt-1.2
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/text_wiki/0.25.0.xml", '

Text_Wiki

pear.php.net 0.25.0 beta LGPL pmjones Abstracts parsing and rendering rules for Wiki markup in structured plain text. Abstracts parsing and rendering rules for Wiki markup in structured plain text. 2005-02-01 11:59:45 * moved all parsing rules from Text/Wiki/Parse to Text/Wiki/Parse/Default (this will help separate entire parsing rule sets, e.g. BBCode) * changed Wiki.php to use the new Parse/Default directory as the default directory * fixed interwiki regex so that page names starting with : are not honored (it was messing up wikilinks with 2 colons in the text) 46425 http://pear.php.net/get/Text_Wiki-0.25.0
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/xml_rpc/1.2.0RC6.xml", '

XML_RPC

pear.php.net 1.2.0RC6 beta PHP License danielc PHP implementation of the XML-RPC protocol A PEAR-ified version of Useful Inc\'s XML-RPC for PHP. It has support for HTTP transport, proxies and authentication. 2005-01-24 16:15:35 - Don\'t put the protocol in the Host field of the POST data. (danielc) 18691 http://pear.php.net/get/XML_RPC-1.2.0RC6
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/xml_rpc/deps.1.2.0RC6.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/text_wiki/deps.0.25.0.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/archive_tar/1.2.xml", '

Archive_Tar

pear.php.net 1.2 stable PHP License vblavet Tar file management class This class provides handling of tar files in PHP. It supports creating, listing, extracting and adding to tar files. Gzip support is available if PHP has the zlib extension built-in or loaded. Bz2 compression is also supported with the bz2 extension loaded. 2004-05-08 10:03:17 Add support for other separator than the space char and bug correction 14792 http://pear.php.net/get/Archive_Tar-1.2
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/archive_tar/deps.1.2.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_socket/1.0.5.xml", '

Net_Socket

pear.php.net 1.0.5 stable PHP License chagenbu Network Socket Interface Net_Socket is a class interface to TCP sockets. It provides blocking and non-blocking operation, with different reading and writing modes (byte-wise, block-wise, line-wise and special formats like network byte-order ip addresses). 2005-01-11 17:04:44 Don\'t rely on gethostbyname() for error checking (Bug #3100). 4208 http://pear.php.net/get/Net_Socket-1.0.5
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_socket/deps.1.0.5.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/file/1.1.0RC5.xml", '

File

pear.php.net 1.1.0RC5 beta PHP pajoye Common file and directory routines Provides easy access to read/write to files along with some common routines to deal with paths. Also provides interface for handling CSV files. 2005-02-02 17:28:28 * Bug #3364 fixed, typo 14739 http://pear.php.net/get/File-1.1.0RC5
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/text_highlighter/0.6.2.xml", '

Text_Highlighter

pear.php.net 0.6.2 beta PHP License blindman Syntax highlighting Text_Highlighter is a package for syntax highlighting. It provides a base class provining all the functionality, and a descendant classes geneator class. The main idea is to simplify creation of subclasses implementing syntax highlighting for particular language. Subclasses do not implement any new functioanality, they just provide syntax highlighting rules. The rules sources are in XML format. To create a highlighter for a language, there is no need to code a new class manually. Simply describe the rules in XML file and use Text_Highlighter_Generator to create a new class. 2005-02-04 02:13:54 - fixed Bug #3060 : Wrong render with HL_NUMBERS_TABLE option - fixed Bug #3063 : Output buffer is not cleared before rendering in HTML renderer 55103 http://pear.php.net/get/Text_Highlighter-0.6.2
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/file/deps.1.1.0RC5.txt", 'a:4:{i:1;a:4:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"4.2.0";s:8:"optional";s:2:"no";}i:2;a:4:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"4.3.0";s:8:"optional";s:3:"yes";}i:3;a:4:{s:4:"type";s:3:"ext";s:3:"rel";s:3:"has";s:8:"optional";s:2:"no";s:4:"name";s:4:"pcre";}i:4;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:2:"no";s:4:"name";s:4:"PEAR";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/text_highlighter/deps.0.6.2.txt", 'a:3:{i:1;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:3:"1.0";s:8:"optional";s:2:"no";s:4:"name";s:4:"PEAR";}i:2;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.0.1";s:8:"optional";s:2:"no";s:4:"name";s:10:"XML_Parser";}i:3;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:3:"1.0";s:8:"optional";s:2:"no";s:4:"name";s:14:"Console_Getopt";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/pear/1.3.4.xml", '

PEAR

pear.php.net 1.3.4 stable PHP License cellog PEAR Base System The PEAR package contains: * 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 2005-01-01 20:26:39 * 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 "ne" is needed, "not" 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) 107207 http://pear.php.net/get/PEAR-1.3.4
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/pear/deps.1.3.4.txt", 'a:6:{i:1;a:3:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:3:"4.2";}i:2;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:3:"1.1";s:4:"name";s:11:"Archive_Tar";}i:3;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:3:"1.2";s:4:"name";s:14:"Console_Getopt";}i:4;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.0.4";s:4:"name";s:7:"XML_RPC";}i:5;a:3:{s:4:"type";s:3:"ext";s:3:"rel";s:3:"has";s:4:"name";s:3:"xml";}i:6;a:3:{s:4:"type";s:3:"ext";s:3:"rel";s:3:"has";s:4:"name";s:4:"pcre";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/xml_parser/1.2.4.xml", '

XML_Parser

pear.php.net 1.2.4 stable PHP License schst XML parsing class based on PHP\'s bundled expat This is an XML parser based on PHPs built-in xml extension. It supports two basic modes of operation: "func" and "event". In "func" mode, it will look for a function named after each element (xmltag_ELEMENT for start tags and xmltag_ELEMENT_ for end tags), and in "event" mode it uses a set of generic callbacks. Since version 1.2.0 there\'s a new XML_Parser_Simple class that makes parsing of most XML documents easier, by automatically providing a stack for the elements. Furthermore its now possible to split the parser from the handler object, so you do not have to extend XML_Parser anymore in order to parse a document with it. 2005-01-18 15:12:51 - fixed a bug in XML_Parser_Simple when trying to register more than the default handlers and a separate callback object (schst) 10858 http://pear.php.net/get/XML_Parser-1.2.4
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/xml_parser/deps.1.2.4.txt", 'a:2:{i:1;a:4:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"4.2.0";s:8:"optional";s:2:"no";}i:2;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:2:"no";s:4:"name";s:4:"PEAR";}}', 'text/xml'); $p1 = $packageDir . 'File-1.1.0RC3.tgz'; $p2 = $packageDir . 'Net_Sieve-1.1.0.tgz'; $p3 = $packageDir . 'Text_Highlighter-0.6.1.tgz'; $p4 = $packageDir . 'Text_Wiki-0.23.1.tgz'; $p5 = $packageDir . 'XML_RPC-1.2.0RC3.tgz'; $p6 = $packageDir . 'Net_Socket-1.0.5.tgz'; $p7 = $packageDir . 'PEAR-1.3.4.tgz'; $p8 = $packageDir . 'Console_Getopt-1.2.tgz'; $p9 = $packageDir . 'XML_Parser-1.2.4.tgz'; $p10 = $packageDir . 'Archive_Tar-1.2.tgz'; for ($i = 1; $i <= 10; $i++) { $packages[] = ${"p$i"}; } $config->set('preferred_state', 'alpha'); $_test_dep->setPHPVersion('4.3.10'); $_test_dep->setExtensions(array('xml' => '1.0', 'pcre' => '1.0')); $command->run('install', array(), $packages); $phpunit->assertNoErrors('after install'); $fakelog->getLog(); $command->_reset_downloader(); $command->run('upgrade-all', array(), array()); $phpunit->assertNoErrors('after upgrade'); $log = array_slice($fakelog->getLog(), 0, 5); function poop($a, $b) {return strnatcasecmp($a['info']['data'], $b['info']['data']);} usort($log, 'poop'); $phpunit->assertEquals( array ( array ( 'info' => array ( 'data' => 'Will upgrade channel://pear.php.net/file', ), 'cmd' => 'upgrade-all', ), array ( 'info' => array ( 'data' => 'Will upgrade channel://pear.php.net/net_sieve', ), 'cmd' => 'upgrade-all', ), array ( 'info' => array ( 'data' => 'Will upgrade channel://pear.php.net/text_highlighter', ), 'cmd' => 'upgrade-all', ), array ( 'info' => array ( 'data' => 'Will upgrade channel://pear.php.net/text_wiki', ), 'cmd' => 'upgrade-all', ), array ( 'info' => array ( 'data' => 'Will upgrade channel://pear.php.net/xml_rpc', ), 'cmd' => 'upgrade-all', ), ), $log, 'same log entries'); $reg = &$config->getRegistry(); $phpunit->assertEquals('1.1.0RC5', $reg->packageInfo('File', 'version'), 'File'); $phpunit->assertEquals('1.1.1', $reg->packageInfo('Net_Sieve', 'version'), 'Net_Sieve'); $phpunit->assertEquals('0.6.2', $reg->packageInfo('Text_Highlighter', 'version'), 'Text_Highlighter'); $phpunit->assertEquals('0.25.0', $reg->packageInfo('Text_Wiki', 'version'), 'Text_Wiki'); $phpunit->assertEquals('1.2.0RC6', $reg->packageInfo('XML_RPC', 'version'), 'XML_RPC'); echo 'tests done'; ?> --CLEAN-- --EXPECT-- tests done php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Install/upgrade-all/test_bug5683.phpt000066400000000000000000000656771262614675700311370ustar00rootroot00000000000000--TEST-- upgrade-all command - real-world example from Bug #5683 --SKIPIF-- --FILE-- getChannel('pear.php.net'); $chan->setBaseURL('REST1.0', 'http://pear.php.net/rest/'); $reg->updateChannel($chan); $pearweb->addRESTConfig("http://pear.php.net/rest/r/xml_rpc/allreleases.xml", '

XML_RPC

pear.php.net 1.4.3stablepear.php.net

PEAR

1.4.0a11.4.1
1.4.2stablepear.php.net

PEAR

1.4.0a11.4.0a14
1.4.1stablepear.php.net

PEAR

1.4.0a11.4.0a14
1.4.0stablepear.php.net

PEAR

1.4.0a11.4.0a12
1.3.3stablepear.php.net

PEAR

1.4.0a11.4.0a12
1.3.2stablepear.php.net

PEAR

1.4.0a11.4.0a12
1.3.1stablepear.php.net

PEAR

1.4.0a11.4.0a12
1.3.0stablepear.php.net

PEAR

1.4.0a11.4.0a12
1.3.0RC3beta 1.3.0RC2betapear.php.net

PEAR

1.4.0a11.4.0a10
1.3.0RC1betapear.php.net

PEAR

1.4.0a11.4.0a10
1.2.2stablepear.php.net

PEAR

1.4.0a11.4.0a4
1.2.1stablepear.php.net

PEAR

1.4.0a11.4.0a2
1.2.0stablepear.php.net

PEAR

1.4.0a11.4.0a1
1.2.0RC7beta 1.2.0RC6beta 1.2.0RC5beta 1.2.0RC4beta 1.2.0RC3beta 1.2.0RC2beta 1.2.0RC1beta 1.1.0stable 1.0.4stable 1.0.3stable 1.0.2stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/xml_rpc/1.4.3.xml", '

XML_RPC

pear.php.net 1.4.3 stable PHP License danielc PHP implementation of the XML-RPC protocol A PEAR-ified version of Useful Inc\'s XML-RPC for PHP. It has support for HTTP/HTTPS transport, proxies and authentication. 2005-09-24 14:22:55 * Make XML_RPC_encode() properly handle dateTime.iso8601. Request 5117. 27198 http://pear.php.net/get/XML_RPC-1.4.3
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/xml_rpc/deps.1.4.3.txt", 'a:1:{s:8:"required";a:2:{s:3:"php";a:1:{s:3:"min";s:5:"4.2.0";}s:13:"pearinstaller";a:1:{s:3:"min";s:7:"1.4.0a1";}}}', 'text/xml'); $dir = dirname(__FILE__). DIRECTORY_SEPARATOR . 'bug5683' . DIRECTORY_SEPARATOR; $pf1 = $dir . 'PEAR-1.4.0.tgz'; $pf2 = $dir . 'Console_Getopt-1.2.tgz'; $pf3 = $dir . 'Archive_Tar-1.3.1.tgz'; $pf4 = $dir . 'XML_RPC-1.4.1.tgz'; $_test_dep->setPHPVersion('4.3.0'); $_test_dep->setPEARVersion('1.4.0'); $_test_dep->setExtensions(array('xml' => 0, 'pcre' => 1)); $command->run('install', array(), array($pf1, $pf2, $pf3, $pf4)); $phpunit->assertNoErrors('setup'); $fakelog->getLog(); $phpunit->assertEquals(4, count($reg->listPackages()), 'installed package list'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/packages.xml", ' pear.php.net

Archive_Tar

Archive_Zip

Auth

Auth_Enterprise

Auth_HTTP

Auth_PrefManager

Auth_PrefManager2

Auth_RADIUS

Auth_SASL

Benchmark

Cache

Cache_Lite

Calendar

CodeGen

CodeGen_MySQL_UDF

CodeGen_PECL

Config

Console_Color

Console_Getargs

Console_Getopt

Console_ProgressBar

Console_Table

Contact_AddressBook

Contact_Vcard_Build

Contact_Vcard_Parse

Crypt_Blowfish

Crypt_CBC

Crypt_CHAP

Crypt_HMAC

Crypt_RC4

Crypt_RSA

Crypt_Xtea

Date

Date_Holidays

DB

DBA

DBA_Relational

DB_ado

DB_DataObject

DB_DataObject_FormBuilder

DB_ldap

DB_ldap2

DB_NestedSet

DB_odbtp

DB_Pager

DB_QueryTool

DB_Sqlite_Tools

DB_Table

Event_Dispatcher

File

File_Archive

File_Bittorrent

File_DICOM

File_DNS

File_Find

File_Fortune

File_Fstab

File_Gettext

File_HtAccess

File_IMC

File_Ogg

File_Passwd

File_PDF

File_SearchReplace

File_SMBPasswd

FSM

Games_Chess

Genealogy_Gedcom

Gtk_FileDrop

Gtk_MDB_Designer

Gtk_ScrollingLabel

Gtk_Styled

Gtk_VarDump

HTML_AJAX

HTML_BBCodeParser

HTML_Common

HTML_Common2

HTML_Crypt

HTML_CSS

HTML_Form

HTML_Javascript

HTML_Menu

HTML_Page

HTML_Page2

HTML_Progress

HTML_Progress2

HTML_QuickForm

HTML_QuickForm_advmultiselect

HTML_QuickForm_Controller

HTML_QuickForm_SelectFilter

HTML_Safe

HTML_Select

HTML_Select_Common

HTML_Table

HTML_Table_Matrix

HTML_Template_Flexy

HTML_Template_IT

HTML_Template_PHPLIB

HTML_Template_Sigma

HTML_Template_Xipe

HTML_TreeMenu

HTTP

HTTP_Client

HTTP_Download

HTTP_Header

HTTP_Request

HTTP_Server

HTTP_Session

HTTP_Session2

HTTP_SessionServer

HTTP_Upload

HTTP_WebDAV_Client

HTTP_WebDAV_Server

I18N

I18Nv2

I18N_UnicodeString

Image_3D

Image_Barcode

Image_Canvas

Image_Color

Image_Color2

Image_GIS

Image_Graph

Image_GraphViz

Image_IPTC

Image_MonoBMP

Image_Remote

Image_Text

Image_Tools

Image_Transform

Image_XBM

Inline_C

LiveUser

LiveUser_Admin

Log

Mail

Mail_IMAP

Mail_IMAPv2

Mail_Mbox

Mail_Mime

Mail_Queue

Math_Basex

Math_BinaryUtils

Math_Complex

Math_Fibonacci

Math_Finance

Math_Fraction

Math_Histogram

Math_Integer

Math_Matrix

Math_Numerical_RootFinding

Math_Quaternion

Math_RPN

Math_Stats

Math_TrigOp

Math_Vector

MDB

MDB2

MDB2_Driver_fbsql

MDB2_Driver_ibase

MDB2_Driver_mssql

MDB2_Driver_mysql

MDB2_Driver_mysqli

MDB2_Driver_oci8

MDB2_Driver_pgsql

MDB2_Driver_querysim

MDB2_Driver_sqlite

MDB2_Schema

MDB_QueryTool

Message

MIME_Type

MP3_ID

MP3_Playlist

Net_CheckIP

Net_Curl

Net_Cyrus

Net_Dict

Net_Dig

Net_DIME

Net_DNS

Net_DNSBL

Net_Finger

Net_FTP

Net_FTP2

Net_GameServerQuery

Net_Geo

Net_GeoIP

Net_HL7

Net_Ident

Net_IDNA

Net_IMAP

Net_IPv4

Net_IPv6

Net_IRC

Net_LDAP

Net_LMTP

Net_Monitor

Net_NNTP

Net_Ping

Net_POP3

Net_Portscan

Net_Server

Net_Sieve

Net_SmartIRC

Net_SMPP

Net_SMPP_Client

Net_SMS

Net_SMTP

Net_Socket

Net_Traceroute

Net_URL

Net_UserAgent_Detect

Net_UserAgent_Mobile

Net_Whois

Net_Wifi

Numbers_Roman

Numbers_Words

OLE

Pager

Pager_Sliding

Payment_Clieop

Payment_DTA

Payment_Process

PEAR

PEAR_Delegator

PEAR_ErrorStack

PEAR_Frontend_Gtk

PEAR_Frontend_Web

PEAR_Info

PEAR_PackageFileManager

PEAR_PackageFileManager_GUI_Gtk

PEAR_RemoteInstaller

PHPDoc

PhpDocumentor

PHPUnit

PHPUnit2

PHP_Archive

PHP_Beautifier

PHP_Compat

PHP_CompatInfo

PHP_Fork

PHP_Parser

RDF

RDF_N3

RDF_NTriple

RDF_RDQL

Science_Chemistry

ScriptReorganizer

Search_Mnogosearch

Services_Amazon

Services_Delicious

Services_DynDNS

Services_Ebay

Services_ExchangeRates

Services_Google

Services_Pingback

Services_Technorati

Services_Trackback

Services_Weather

Services_Webservice

Services_Yahoo

SOAP

SOAP_Interop

Spreadsheet_Excel_Writer

SQL_Parser

Stream_SHM

Stream_Var

Structures_DataGrid

Structures_Graph

System_Command

System_Mount

System_ProcWatch

System_SharedMemory

System_Socket

System_WinDrives

Text_CAPTCHA

Text_Diff

Text_Figlet

Text_Highlighter

Text_Huffman

Text_Lexer

Text_Password

Text_Statistics

Text_TeXHyphen

Text_Wiki

Text_Wiki_BBCode

Text_Wiki_Cowiki

Text_Wiki_Doku

Text_Wiki_Tiki

Translation

Translation2

Tree

UDDI

Validate

Validate_AT

Validate_AU

Validate_BE

Validate_CA

Validate_CH

Validate_DE

Validate_DK

Validate_ES

Validate_Finance

Validate_Finance_CreditCard

Validate_FR

Validate_IS

Validate_ISPN

Validate_NL

Validate_PL

Validate_ptBR

Validate_UK

Validate_US

Validate_ZA

Var_Dump

VersionControl_SVN

VFS

XML_Beautifier

XML_CSSML

XML_DTD

XML_FastCreate

XML_Feed_Parser

XML_fo2pdf

XML_FOAF

XML_HTMLSax

XML_HTMLSax3

XML_image2svg

XML_Indexing

XML_MXML

XML_NITF

XML_Parser

XML_RDDL

XML_RPC

XML_RSS

XML_SaxFilters

XML_Serializer

XML_sql2xml

XML_Statistics

XML_SVG

XML_svg2image

XML_Transformer

XML_Tree

XML_Util

XML_Wddx

XML_XPath

XML_XSLT_Wrapper

XML_XUL

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/archive_tar/allreleases.xml", '

Archive_Tar

pear.php.net 1.3.1stable 1.3.0stable 1.2stable 1.1stable 1.0stable 0.10-b1beta 0.9stable 0.4stable 0.3stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/console_getopt/allreleases.xml", '

Console_Getopt

pear.php.net 1.2stable 1.0stable 0.11beta
', 'text/xml'); $pearweb->addRESTConfig("http://pecl.php.net/rest/p/packages.xml", ' pecl.php.net

APC

apd

archive

bcompiler

big_int

Bitset

BLENC

bz2

bz2_filter

classkit

clips

coin_acceptor

colorer

crack

crack_dll

cvsclient

cybercash

cybermut

cyrus

daffodildb

date_time

dazuko

DBDO

dbplus

dbx

dio

domxml

DTrace

ecasound

enchant

esmtp

event

expect

fann

ffi

Fileinfo

filter

FreeImage

fribidi

gnupg

html_parse

huffman

ibm_db2

id3

idn

imagick

imlib2

ingres

intercept

isis

kadm5

lchash

lzf

mailparse

maxdb

mcrypt_filter

mcve

mdbtools

memcache

mono

mqseries

mysql

namazu

netools

Net_Gopher

newt

notes

oci8

odbtp

oggvorbis

openal

opendirectory

Ovrimis

panda

Paradox

parsekit

pdflib

PDO

PDO_DBLIB

PDO_FIREBIRD

PDO_IDS

PDO_MYSQL

PDO_OCI

PDO_ODBC

PDO_PGSQL

PDO_SQLITE

PECL_Gen

pecl_http

perforce

perl

PHPScript

POP3

postparser

ps

python

radius

rar

rpmreader

runkit

sasl

sdo

shape

SPL

spplus

spread

SQLite

ssh2

statgrab

StreamsXml

svn

TCLink

tcpwrap

tidy

timezonedb

tk

translit

tvision

uuid

Valkyrie

vld

vpopmail

win32ps

win32ps_dll

win32std

WinBinder

xattr

Xdebug

xdiff

xmlReader

XMLRPCi

xmlwriter

xmms

yaz

zeroconf

zip

zlib_filter

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/pear/allreleases.xml", '

PEAR

pear.php.net 1.4.2stable 1.4.1stable 1.4.0stable 1.4.0RC2beta 1.4.0RC1beta 1.4.0b2beta 1.4.0b1beta 1.3.6stable 1.4.0a12alpha 1.4.0a11alpha 1.4.0a10alpha 1.4.0a9alpha 1.4.0a8alpha 1.4.0a7alpha 1.4.0a6alpha 1.4.0a5alpha 1.4.0a4alpha 1.4.0a3alpha 1.4.0a2alpha 1.4.0a1alpha 1.3.5stable 1.3.4stable 1.3.3.1stable 1.3.3stable 1.3.1stable 1.3stable 1.3b6beta 1.3b5beta 1.3b3beta 1.3b2beta 1.3b1beta 1.2.1stable 1.2stable 1.2b5beta 1.2b4beta 1.2b3beta 1.2b2beta 1.2b1beta 1.1stable 1.0.1stable 1.0stable 1.0b3stable 1.0b2stable 1.0b1stable 0.90beta 0.11beta 0.10beta 0.9stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/pear/1.4.2.xml", '

PEAR

pear.php.net 1.4.2 stable PHP License cellog PEAR Base System The PEAR package contains: * the PEAR installer, for creating, distributing and installing packages * the beta-quality PEAR_Exception PHP5 error handling mechanism * 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 of common operations with files and directories * the PEAR base class New features in a nutshell: * full support for channels * pre-download dependency validation * new package.xml 2.0 format allows tremendous flexibility while maintaining BC * support for optional dependency groups and limited support for sub-packaging * robust dependency support * full dependency validation on uninstall * remote install for hosts with only ftp access - no more problems with restricted host installation * full support for mirroring * support for bundling several packages into a single tarball * support for static dependencies on a url-based package * support for custom file roles and installation tasks NOTE: users of PEAR_Frontend_Web/PEAR_Frontend_Gtk must upgrade their installations to the latest version, or PEAR will not upgrade properly 2005-10-08 19:53:23 Minor bugfix release * fix issues with API for adding tasks to package2.xml * fix Bug #5520: pecl pickle fails on pecl pickle fails on extension/package deps * fix Bug #5523: pecl pickle misses to put configureoptions into package.xml v1 * fix Bug #5527: No need for cpp * fix Bug #5529: configure options in package.xml 2.0 will be ignored * fix Bug #5530: PEAR_PackageFile_v2->getConfigureOptions() API incompatible with v1 * fix Bug #5531: adding of installconditions/binarypackage/configure options to extsrc may fail * fix Bug #5550: PHP notices/warnings/errors are 1 file off in trace * fix Bug #5580: pear makerpm XML_sql2xml-0.3.2.tgz error * fix Bug #5619: pear makerpm produces invalid .spec dependancy code * fix Bug #5629: pear install http_download dies with bad error message 270370 http://pear.php.net/get/PEAR-1.4.2
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/pear/deps.1.4.2.txt", 'a:2:{s:8:"required";a:4:{s:3:"php";a:1:{s:3:"min";s:3:"4.2";}s:13:"pearinstaller";a:1:{s:3:"min";s:8:"1.4.0a12";}s:7:"package";a:5:{i:0;a:5:{s:4:"name";s:11:"Archive_Tar";s:7:"channel";s:12:"pear.php.net";s:3:"min";s:3:"1.1";s:11:"recommended";s:5:"1.3.1";s:7:"exclude";s:5:"1.3.0";}i:1;a:4:{s:4:"name";s:14:"Console_Getopt";s:7:"channel";s:12:"pear.php.net";s:3:"min";s:3:"1.2";s:11:"recommended";s:3:"1.2";}i:2;a:4:{s:4:"name";s:7:"XML_RPC";s:7:"channel";s:12:"pear.php.net";s:3:"min";s:5:"1.4.0";s:11:"recommended";s:5:"1.4.3";}i:3;a:5:{s:4:"name";s:17:"PEAR_Frontend_Web";s:7:"channel";s:12:"pear.php.net";s:3:"max";s:5:"0.5.0";s:7:"exclude";s:5:"0.5.0";s:9:"conflicts";s:0:"";}i:4;a:5:{s:4:"name";s:17:"PEAR_Frontend_Gtk";s:7:"channel";s:12:"pear.php.net";s:3:"max";s:5:"0.4.0";s:7:"exclude";s:5:"0.4.0";s:9:"conflicts";s:0:"";}}s:9:"extension";a:2:{i:0;a:1:{s:4:"name";s:3:"xml";}i:1;a:1:{s:4:"name";s:4:"pcre";}}}s:5:"group";a:2:{i:0;a:2:{s:7:"attribs";a:2:{s:4:"hint";s:26:"PEAR\'s web-based installer";s:4:"name";s:12:"webinstaller";}s:7:"package";a:3:{s:4:"name";s:17:"PEAR_Frontend_Web";s:7:"channel";s:12:"pear.php.net";s:3:"min";s:5:"0.5.0";}}i:1;a:2:{s:7:"attribs";a:2:{s:4:"hint";s:30:"PEAR\'s PHP-GTK-based installer";s:4:"name";s:12:"gtkinstaller";}s:7:"package";a:3:{s:4:"name";s:17:"PEAR_Frontend_Gtk";s:7:"channel";s:12:"pear.php.net";s:3:"min";s:5:"0.4.0";}}}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/xml_rpc/deps.1.4.3.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/archive_tar/1.3.1.xml", '

Archive_Tar

pear.php.net 1.3.1 stable PHP License vblavet Tar file management class This class provides handling of tar files in PHP. It supports creating, listing, extracting and adding to tar files. Gzip support is available if PHP has the zlib extension built-in or loaded. Bz2 compression is also supported with the bz2 extension loaded. 2005-03-17 16:09:16 Correct Bug #3855 15102 http://pear.php.net/get/Archive_Tar-1.3.1
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/archive_tar/deps.1.3.1.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/console_getopt/1.2.xml", '

Console_Getopt

pear.php.net 1.2 stable PHP License andrei Command-line option parser This is a PHP implementation of "getopt" supporting both short and long options. 2003-12-11 14:26:46 Fix to preserve BC with 1.0 and allow correct behaviour for new users 3370 http://pear.php.net/get/Console_Getopt-1.2
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/pear/info.xml", '

PEAR pear.php.net PEAR PHP License PEAR Base System The PEAR package contains: * the PEAR installer, for creating, distributing and installing packages * the beta-quality PEAR_Exception PHP5 error handling mechanism * 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 of common operations with files and directories * the PEAR base class New features in a nutshell: * full support for channels * pre-download dependency validation * new package.xml 2.0 format allows tremendous flexibility while maintaining BC * support for optional dependency groups and limited support for sub-packaging * robust dependency support * full dependency validation on uninstall * remote install for hosts with only ftp access - no more problems with restricted host installation * full support for mirroring * support for bundling several packages into a single tarball * support for static dependencies on a url-based package * support for custom file roles and installation tasks NOTE: users of PEAR_Frontend_Web/PEAR_Frontend_Gtk must upgrade their installations to the latest version, or PEAR will not upgrade properly

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/archive_tar/info.xml", '

Archive_Tar pear.php.net File Formats PHP License Tar file management class This class provides handling of tar files in PHP. It supports creating, listing, extracting and adding to tar files. Gzip support is available if PHP has the zlib extension built-in or loaded. Bz2 compression is also supported with the bz2 extension loaded.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/console_getopt/info.xml", '

Console_Getopt pear.php.net Console PHP License Command-line option parser This is a PHP implementation of "getopt" supporting both short and long options.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/xml_rpc/info.xml", '

XML_RPC pear.php.net Web Services PHP License PHP implementation of the XML-RPC protocol A PEAR-ified version of Useful Inc\'s XML-RPC for PHP. It has support for HTTP/HTTPS transport, proxies and authentication.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/console_getopt/deps.1.2.txt", 'b:0;', 'text/xml'); $pearweb->addHTMLConfig('http://pear.php.net/get/PEAR-1.4.2.tgz', $dir . 'PEAR-1.4.2.tgz'); $pearweb->addHTMLConfig('http://pear.php.net/get/XML_RPC-1.4.3.tgz', $dir . 'XML_RPC-1.4.3.tgz'); unset($GLOBALS['__Stupid_php4_a']); // reset downloader $command->run('upgrade-all', array(), array()); $phpunit->assertNoErrors('afterwards'); $phpunit->assertEquals('1.4.2', $reg->packageInfo('PEAR', 'version'), 'PEAR version'); $phpunit->assertEquals('1.4.3', $reg->packageInfo('XML_RPC', 'version'), 'XML_RPC version'); echo 'tests done'; ?> --CLEAN-- --EXPECT-- tests done php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Install/upgrade/000077500000000000000000000000001262614675700253055ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Install/upgrade/test_bug4060.phpt000066400000000000000000002001011262614675700303220ustar00rootroot00000000000000--TEST-- upgrade command, test for bug #4060 - install/upgrade of package with an os installcondition * fails --SKIPIF-- --FILE-- getRegistry(); $c = $reg->getChannel('pear.php.net'); $c->setBaseURL('REST1.0', 'http://pear.php.net/rest/'); $reg->updateChannel($c); $pearweb->addRESTConfig("http://pear.php.net/rest/r/file_passwd/allreleases.xml", '

File_Passwd

pear.php.net 1.1.6stable 1.1.5stable 1.1.4stable 1.1.3stable 1.1.2stable 1.1.1stable 1.1.0stable 1.0.2stable 1.0.1stable 1.0.0stable 1.0b2beta 1.0b1beta 0.9.5beta 0.9.4beta 0.9.3beta 0.9.2abeta 0.9.2beta 0.9.1beta 0.9.0beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/file_passwd/info.xml", '

File_Passwd pear.php.net File Formats PHP Manipulate many kinds of password files Provides methods to manipulate and authenticate against standard Unix, SMB server, AuthUser (.htpasswd), AuthDigest (.htdigest), CVS pserver and custom formatted password files.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/file_passwd/1.1.6.xml", '

File_Passwd

pear.php.net 1.1.6 stable PHP mike Manipulate many kinds of password files Provides methods to manipulate and authenticate against standard Unix, SMB server, AuthUser (.htpasswd), AuthDigest (.htdigest), CVS pserver and custom formatted password files. 2005-09-27 02:30:34 * Fixed bug #5532 (Authdigest: changing a password of a user removes the user from all other realms) 23832 http://pear.php.net/get/File_Passwd-1.1.6
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/file_passwd/deps.1.1.6.txt", 'a:5:{i:1;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:2:"no";s:4:"name";s:4:"PEAR";}i:2;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.0.0";s:8:"optional";s:3:"yes";s:4:"name";s:10:"Crypt_CHAP";}i:3;a:4:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"4.3.0";s:8:"optional";s:3:"yes";}i:4;a:4:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"4.0.6";s:8:"optional";s:2:"no";}i:5;a:4:{s:4:"type";s:3:"ext";s:3:"rel";s:3:"has";s:8:"optional";s:2:"no";s:4:"name";s:4:"pcre";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_pop3/allreleases.xml", '

Net_POP3

pear.php.net 1.3.6stable 1.3.5stable 1.3.4beta 1.3.3stable 1.3.2stable 1.3.1stable 1.3stable 1.2stable 1.1stable 1.0stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/net_pop3/info.xml", '

Net_POP3 pear.php.net Networking BSD Provides a POP3 class to access POP3 server. Provides a POP3 class to access POP3 server. Support all POP3 commands including UIDL listings, APOP authentication,DIGEST-MD5 and CRAM-MD5 using optional Auth_SASL package

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_pop3/1.3.6.xml", '

Net_POP3

pear.php.net 1.3.6 stable BSD damian Provides a POP3 class to access POP3 server. Provides a POP3 class to access POP3 server. Support all POP3 commands including UIDL listings, APOP authentication,DIGEST-MD5 and CRAM-MD5 using optional Auth_SASL package 2005-04-04 22:24:25 * Fixed Bug #3551 Bug #2663 not fixed yet. * Fixed Bug #3410 Error handling in _sendCmd * Fixed Bug #1942 wrong parameter-type specification in Net_POP3::login * Fixed Bug #239 Missing phpdoc tag. 10076 http://pear.php.net/get/Net_POP3-1.3.6
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/net_pop3/deps.1.3.6.txt", 'a:1:{i:1;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:3:"1.0";s:4:"name";s:10:"Net_Socket";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/db/allreleases.xml", '

DB

pear.php.net 1.7.10stable 1.7.9stable 1.7.8stable 1.7.8RC2beta 1.7.8RC1beta 1.7.7stable 1.7.6stable 1.7.5stable 1.7.4stable 1.7.3stable 1.7.2stable 1.7.1stable 1.7.0stable 1.7.0RC1beta 1.6.8stable 1.6.7stable 1.6.6stable 1.6.5stable 1.6.4stable 1.6.3stable 1.6.2stable 1.6.1stable 1.6.0stable 1.6.0RC6stable 1.6.0RC5beta 1.6.0RC4beta 1.6.0RC3beta 1.6.0RC2beta 1.6.0RC1beta 1.5.0RC2stable 1.5.0RC1stable 1.4.0stable 1.4b1beta 1.3stable 1.2stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/db/info.xml", '

DB pear.php.net Database PHP License Database Abstraction Layer DB is a database abstraction layer providing: * an OO-style query API * portability features that make programs written for one DBMS work with other DBMS\'s * a DSN (data source name) format for specifying database servers * prepare/execute (bind) emulation for databases that don\'t support it natively * a result object for each query response * portable error codes * sequence emulation * sequential and non-sequential row fetching as well as bulk fetching * formats fetched rows as associative arrays, ordered arrays or objects * row limit support * transactions support * table information interface * DocBook and phpDocumentor API documentation DB layers itself on top of PHP\'s existing database extensions. Drivers for the following extensions pass the complete test suite and provide interchangeability when all of DB\'s portability options are enabled: fbsql, ibase, informix, msql, mssql, mysql, mysqli, oci8, odbc, pgsql, sqlite and sybase. There is also a driver for the dbase extension, but it can\'t be used interchangeably because dbase doesn\'t support many standard DBMS features. DB is compatible with both PHP 4 and PHP 5. pear.php.net MDB2

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/db/1.7.10.xml", '

DB

pear.php.net 1.7.10 stable PHP License aharvey Database Abstraction Layer DB is a database abstraction layer providing: * an OO-style query API * portability features that make programs written for one DBMS work with other DBMS\'s * a DSN (data source name) format for specifying database servers * prepare/execute (bind) emulation for databases that don\'t support it natively * a result object for each query response * portable error codes * sequence emulation * sequential and non-sequential row fetching as well as bulk fetching * formats fetched rows as associative arrays, ordered arrays or objects * row limit support * transactions support * table information interface * DocBook and phpDocumentor API documentation DB layers itself on top of PHP\'s existing database extensions. Drivers for the following extensions pass the complete test suite and provide interchangeability when all of DB\'s portability options are enabled: fbsql, ibase, informix, msql, mssql, mysql, mysqli, oci8, odbc, pgsql, sqlite and sybase. There is also a driver for the dbase extension, but it can\'t be used interchangeably because dbase doesn\'t support many standard DBMS features. DB is compatible with both PHP 4 and PHP 5. 2007-03-20 05:25:28 This release of DB adds basic support for the BIT type within MySQL 5 when using the mysqli driver. mysqli: * Added a type map for BIT fields. Bug 10211. 131946 http://pear.php.net/get/DB-1.7.10
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/db/deps.1.7.10.txt", 'a:1:{s:8:"required";a:3:{s:3:"php";a:1:{s:3:"min";s:5:"4.2.0";}s:13:"pearinstaller";a:1:{s:3:"min";s:7:"1.4.0b1";}s:7:"package";a:3:{s:4:"name";s:4:"PEAR";s:7:"channel";s:12:"pear.php.net";s:3:"min";s:5:"1.0b1";}}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/mdb/allreleases.xml", '

MDB

pear.php.net 1.3.0stable 1.2stable 1.1.4stable 1.1.4RC6devel 1.1.4RC5devel 1.1.4RC4devel 1.1.4RC3devel 1.1.4RC2devel 1.1.4-RC1devel 1.1.3stable 1.1.3-RC2devel 1.1.3-RC1devel 1.1.2stable 1.1.2-RC2devel 1.1.2-RC1devel 1.1.1stable 1.1.0pl1devel 1.1.0devel 1.0.1RC1devel 1.0stable 1.0_RC4devel 1.0_RC3devel 1.0_RC2devel 1.0_RC1devel 0.9.11devel 0.9.10devel 0.9.9beta 0.9.8beta 0.9.7.1beta 0.9.7beta 0.9.6beta 0.9.5beta 0.9.4beta 0.9.3beta 0.9.2beta 0.9.1beta 0.9beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/mdb/info.xml", '

MDB pear.php.net Database BSD style database abstraction layer PEAR MDB is a merge of the PEAR DB and Metabase php database abstraction layers. It provides a common API for all support RDBMS. The main difference to most other DB abstraction packages is that MDB goes much further to ensure portability. Among other things MDB features: * An OO-style query API * A DSN (data source name) or array format for specifying database servers * Datatype abstraction and on demand datatype conversion * Portable error codes * Sequential and non sequential row fetching as well as bulk fetching * Ordered array and associative array for the fetched rows * Prepare/execute (bind) emulation * Sequence emulation * Replace emulation * Limited Subselect emulation * Row limit support * Transactions support * Large Object support * Index/Unique support * Module Framework to load advanced functionality on demand * Table information interface * RDBMS management methods (creating, dropping, altering) * RDBMS independent xml based schema definition management * Altering of a DB from a changed xml schema * Reverse engineering of xml schemas from an existing DB (currently only MySQL) * Full integration into the PEAR Framework * Wrappers for the PEAR DB and Metabase APIs * PHPDoc API documentation Currently supported RDBMS: MySQL PostGreSQL Oracle Frontbase Querysim Interbase/Firebird MSSQL pear.php.net MDB2

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/mdb/1.3.0.xml", '

MDB

pear.php.net 1.3.0 stable BSD style lsmith database abstraction layer PEAR MDB is a merge of the PEAR DB and Metabase php database abstraction layers. It provides a common API for all support RDBMS. The main difference to most other DB abstraction packages is that MDB goes much further to ensure portability. Among other things MDB features: * An OO-style query API * A DSN (data source name) or array format for specifying database servers * Datatype abstraction and on demand datatype conversion * Portable error codes * Sequential and non sequential row fetching as well as bulk fetching * Ordered array and associative array for the fetched rows * Prepare/execute (bind) emulation * Sequence emulation * Replace emulation * Limited Subselect emulation * Row limit support * Transactions support * Large Object support * Index/Unique support * Module Framework to load advanced functionality on demand * Table information interface * RDBMS management methods (creating, dropping, altering) * RDBMS independent xml based schema definition management * Altering of a DB from a changed xml schema * Reverse engineering of xml schemas from an existing DB (currently only MySQL) * Full integration into the PEAR Framework * Wrappers for the PEAR DB and Metabase APIs * PHPDoc API documentation Currently supported RDBMS: MySQL PostGreSQL Oracle Frontbase Querysim Interbase/Firebird MSSQL 2004-04-22 07:26:53 MDB requires PHP 4.2 from now on. MDB: - fixed PHP5 compatibility issue in MDB::isError() all drivers: - added quoteIdentifier() method - added sequence_col_name option to make the column name inside sequence emulation tables configurable - renamed toString() to __toString() in order to take advantage of new PHP5 goodness and made it public - unified the native error raising methods (tested on oracle, pgsql, mysql and ibase) - fixed bug #1159 which would break index handling in getTableFieldDefinition() if not in portability mode MDB_ibase: - fixed several bugs in the buffering code - fixed NULL management - fixed replace() MDB_oci8: - fixed several bugs in the buffering code - added native currId() implementation MDB_Manager_oci8: - added listTables() and listTableFields() MDB_mysql: - added quoteIdentifier() method MDB_fbsql: - removed broken implementations of currId() MDB_mssql: - removed broken implementations of currId() - added quoteIdentifier() method MDB_Manager_mysql: - fixed mysql 4.0.13 issue in createSequence() - several fixes to ensure the correct case is used when fetching data without the portability flag setting enabled MDB_Manager_mssql: - added listTables() and listTableFields() - added getTableFieldDefinition() (still alpha quality) test suite: - added several test and applied PHP5 compatibility fixes - fixed a wrong assumption in the fetchmode bug test - moved set_time_limit() call to the setup script to be easier to customize 218957 http://pear.php.net/get/MDB-1.3.0
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/mdb/deps.1.3.0.txt", 'a:3:{i:1;a:3:{s:4:"type";s:3:"php";s:3:"rel";s:2:"ge";s:7:"version";s:5:"4.2.0";}i:2;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.0b1";s:4:"name";s:4:"PEAR";}i:3;a:3:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:4:"name";s:10:"XML_Parser";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/mdb2/allreleases.xml", '

MDB2

pear.php.net 2.4.0stable 2.3.0stable 2.2.2stable 2.2.1stable 2.2.0stable 2.1.0stable 2.0.3stable 2.0.2stable 2.0.1stable 2.0.0stable 2.0.0RC5beta 2.0.0RC4beta 2.0.0RC3beta 2.0.0RC2beta 2.0.0RC1beta 2.0.0beta6beta 2.0.0beta5beta 2.0.0beta4beta 2.0.0beta3beta 2.0.0beta2beta 2.0.0beta1alpha 2.0.0alpha1alpha
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/mdb2/info.xml", '

MDB2 pear.php.net Database BSD License database abstraction layer PEAR MDB2 is a merge of the PEAR DB and Metabase php database abstraction layers. It provides a common API for all supported RDBMS. The main difference to most other DB abstraction packages is that MDB2 goes much further to ensure portability. MDB2 provides most of its many features optionally that can be used to construct portable SQL statements: * Object-Oriented API * A DSN (data source name) or array format for specifying database servers * Datatype abstraction and on demand datatype conversion * Various optional fetch modes to fix portability issues * Portable error codes * Sequential and non sequential row fetching as well as bulk fetching * Ability to make buffered and unbuffered queries * Ordered array and associative array for the fetched rows * Prepare/execute (bind) named and unnamed placeholder emulation * Sequence/autoincrement emulation * Replace emulation * Limited sub select emulation * Row limit emulation * Transactions/savepoint support * Large Object support * Index/Unique Key/Primary Key support * Pattern matching abstraction * Module framework to load advanced functionality on demand * Ability to read the information schema * RDBMS management methods (creating, dropping, altering) * Reverse engineering schemas from an existing database * SQL function call abstraction * Full integration into the PEAR Framework * PHPDoc API documentation

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/mdb2/2.4.0.xml", '

MDB2

pear.php.net 2.4.0 stable BSD License quipo database abstraction layer PEAR MDB2 is a merge of the PEAR DB and Metabase php database abstraction layers. It provides a common API for all supported RDBMS. The main difference to most other DB abstraction packages is that MDB2 goes much further to ensure portability. MDB2 provides most of its many features optionally that can be used to construct portable SQL statements: * Object-Oriented API * A DSN (data source name) or array format for specifying database servers * Datatype abstraction and on demand datatype conversion * Various optional fetch modes to fix portability issues * Portable error codes * Sequential and non sequential row fetching as well as bulk fetching * Ability to make buffered and unbuffered queries * Ordered array and associative array for the fetched rows * Prepare/execute (bind) named and unnamed placeholder emulation * Sequence/autoincrement emulation * Replace emulation * Limited sub select emulation * Row limit emulation * Transactions/savepoint support * Large Object support * Index/Unique Key/Primary Key support * Pattern matching abstraction * Module framework to load advanced functionality on demand * Ability to read the information schema * RDBMS management methods (creating, dropping, altering) * Reverse engineering schemas from an existing database * SQL function call abstraction * Full integration into the PEAR Framework * PHPDoc API documentation 2007-03-13 16:53:44 - propagate errors in getTableFieldDefinition() in the Reverse module - internally use MDB2::classExists() wrapper instead of directly calling class_exists() - fixed bug #9502: query result misbehaves when the number of returned columns is greater than the number of passed types - fixed bug #9748: Table name is not quoted in Extended.php buildManipSQL() - fixed bug #9800: when the php extension for the driver fails to load, the error is not propagated correctly and the script dies - propagate errors in the Datatype module - implemented guid() in the Function module [globally unique identifier] (thanks to mario dot adam at schaeffler dot com) - fixed bug #4854: Oracle Easy Connect syntax only works with array DSN - fixed bug #10105: inTransaction() was returning an incorrect value after a call to disconnect() or __destruct() - implemented a fallback mechanism within getTableIndexDefinition() and getTableConstraintDefinition() in the Reverse module to ignore the \'idxname_format\' option and use the index name as provided in case of failure before returning an error - added a \'nativetype_map_callback\' option to map native data declarations back to custom data types (thanks to Andrew Hill). - fixed bug #10234 and bug #10233: MDB2_Driver_Datatype_Common::mapNativeDatatype() must ensure that it returns the correct length value, or null - added support for TEMPORARY tables (patch by Andrew Hill) - phpdoc fixes - fixed tests to be compatible with PHP4 - added new tests, including some MDB2 internals tests by Andrew Hill and Monique Szpak open todo items: - handle autoincrement fields in alterTable() - add length handling to LOB reverse engineering - add EXPLAIN abstraction - add cursor support along the lines of PDO (Request #3660 etc.) - add PDO based drivers, especially a driver to support SQLite 3 (Request #6907) - add support to export/import in CSV format - add more functions to the Function module (MD5(), IFNULL(), LENGTH() etc.) - add support for database/table/row LOCKs - add support for FOREIGN KEYs and CHECK (ENUM as possible mysql fallback) constraints - generate STATUS file from test suite results and allow users to submit test results - add support for full text index creation and querying - add tests to check if the RDBMS specific handling with portability options disabled behaves as expected - handle implicit commits (like for DDL) in any affected driver (mysql, sqlite..) - add a getTableFieldsDefinitions() method to be used in tableInfo() - drop ILIKE from matchPattern() and instead add a second parameter to handle case sensitivity with arbitrary operators - add charset and collation support to field declaration in all drivers - handle LOBs in buffered result sets (Request #8793) 118961 http://pear.php.net/get/MDB2-2.4.0
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/mdb2/deps.2.4.0.txt", 'a:2:{s:8:"required";a:3:{s:3:"php";a:1:{s:3:"min";s:5:"4.3.2";}s:13:"pearinstaller";a:1:{s:3:"min";s:7:"1.4.0b1";}s:7:"package";a:3:{s:4:"name";s:4:"PEAR";s:7:"channel";s:12:"pear.php.net";s:3:"min";s:5:"1.3.6";}}s:5:"group";a:9:{i:0;a:2:{s:7:"attribs";a:2:{s:4:"hint";s:29:"Frontbase SQL driver for MDB2";s:4:"name";s:5:"fbsql";}s:10:"subpackage";a:3:{s:4:"name";s:17:"MDB2_Driver_fbsql";s:7:"channel";s:12:"pear.php.net";s:3:"min";s:5:"0.3.0";}}i:1;a:2:{s:7:"attribs";a:2:{s:4:"hint";s:34:"Interbase/Firebird driver for MDB2";s:4:"name";s:5:"ibase";}s:10:"subpackage";a:3:{s:4:"name";s:17:"MDB2_Driver_ibase";s:7:"channel";s:12:"pear.php.net";s:3:"min";s:5:"1.4.0";}}i:2;a:2:{s:7:"attribs";a:2:{s:4:"hint";s:21:"MySQL driver for MDB2";s:4:"name";s:5:"mysql";}s:10:"subpackage";a:3:{s:4:"name";s:17:"MDB2_Driver_mysql";s:7:"channel";s:12:"pear.php.net";s:3:"min";s:5:"1.4.0";}}i:3;a:2:{s:7:"attribs";a:2:{s:4:"hint";s:22:"MySQLi driver for MDB2";s:4:"name";s:6:"mysqli";}s:10:"subpackage";a:3:{s:4:"name";s:18:"MDB2_Driver_mysqli";s:7:"channel";s:12:"pear.php.net";s:3:"min";s:5:"1.4.0";}}i:4;a:2:{s:7:"attribs";a:2:{s:4:"hint";s:29:"MS SQL Server driver for MDB2";s:4:"name";s:5:"mssql";}s:10:"subpackage";a:3:{s:4:"name";s:17:"MDB2_Driver_mssql";s:7:"channel";s:12:"pear.php.net";s:3:"min";s:5:"1.2.0";}}i:5;a:2:{s:7:"attribs";a:2:{s:4:"hint";s:22:"Oracle driver for MDB2";s:4:"name";s:4:"oci8";}s:10:"subpackage";a:3:{s:4:"name";s:16:"MDB2_Driver_oci8";s:7:"channel";s:12:"pear.php.net";s:3:"min";s:5:"1.4.0";}}i:6;a:2:{s:7:"attribs";a:2:{s:4:"hint";s:26:"PostgreSQL driver for MDB2";s:4:"name";s:5:"pgsql";}s:10:"subpackage";a:3:{s:4:"name";s:17:"MDB2_Driver_pgsql";s:7:"channel";s:12:"pear.php.net";s:3:"min";s:5:"1.4.0";}}i:7;a:2:{s:7:"attribs";a:2:{s:4:"hint";s:24:"Querysim driver for MDB2";s:4:"name";s:8:"querysim";}s:10:"subpackage";a:3:{s:4:"name";s:20:"MDB2_Driver_querysim";s:7:"channel";s:12:"pear.php.net";s:3:"min";s:5:"0.6.0";}}i:8;a:2:{s:7:"attribs";a:2:{s:4:"hint";s:23:"SQLite2 driver for MDB2";s:4:"name";s:6:"sqlite";}s:10:"subpackage";a:3:{s:4:"name";s:18:"MDB2_Driver_sqlite";s:7:"channel";s:12:"pear.php.net";s:3:"min";s:5:"1.4.0";}}}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/auth_radius/allreleases.xml", '

Auth_RADIUS

pear.php.net 1.0.5stable 1.0.4stable 1.0.3stable 1.0.2stable 1.0.1stable 1.0stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/auth_radius/info.xml", '

Auth_RADIUS pear.php.net Authentication BSD Wrapper Classes for the RADIUS PECL. This package provides wrapper-classes for the RADIUS PECL. There are different Classes for the different authentication methods. If you are using CHAP-MD5 or MS-CHAP you need also the Crypt_CHAP package. If you are using MS-CHAP you need also the mhash and mcrypt extension.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/auth_radius/1.0.5.xml", '

Auth_RADIUS

pear.php.net 1.0.5 stable BSD mbretter Wrapper Classes for the RADIUS PECL. This package provides wrapper-classes for the RADIUS PECL. There are different Classes for the different authentication methods. If you are using CHAP-MD5 or MS-CHAP you need also the Crypt_CHAP package. If you are using MS-CHAP you need also the mhash and mcrypt extension. 2006-08-18 13:19:16 * BugFix: RADIUS_CLASS attribute should be of type string 8042 http://pear.php.net/get/Auth_RADIUS-1.0.5
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/auth_radius/deps.1.0.5.txt", 'a:1:{i:1;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.2.4";s:4:"name";s:6:"radius";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/file_smbpasswd/allreleases.xml", '

File_SMBPasswd

pear.php.net 1.0.2stable 1.0.1stable 1.0.0stable 0.9.0beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/file_smbpasswd/info.xml", '

File_SMBPasswd pear.php.net File Formats BSD Class for managing SAMBA style password files. With this package, you can maintain smbpasswd-files, usually used by SAMBA.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/file_smbpasswd/1.0.2.xml", '

File_SMBPasswd

pear.php.net 1.0.2 stable BSD mbretter Class for managing SAMBA style password files. With this package, you can maintain smbpasswd-files, usually used by SAMBA. 2005-05-08 05:11:38 * The Account Flags field had the wrong length. 4947 http://pear.php.net/get/File_SMBPasswd-1.0.2
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/file_smbpasswd/deps.1.0.2.txt", 'a:2:{i:1;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"1.0.0";s:4:"name";s:10:"Crypt_CHAP";}i:2;a:3:{s:4:"type";s:3:"ext";s:3:"rel";s:3:"has";s:4:"name";s:5:"mhash";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/packages.xml", ' pear.php.net

Archive_Tar

Archive_Zip

Auth

Auth_HTTP

Auth_PrefManager

Auth_PrefManager2

Auth_RADIUS

Auth_SASL

Benchmark

Cache

Cache_Lite

Calendar

CodeGen

CodeGen_MySQL

CodeGen_MySQL_Plugin

CodeGen_MySQL_UDF

CodeGen_PECL

Config

Console_Color

Console_Getargs

Console_Getopt

Console_ProgressBar

Console_Table

Contact_AddressBook

Contact_Vcard_Build

Contact_Vcard_Parse

Crypt_Blowfish

Crypt_CBC

Crypt_CHAP

Crypt_HMAC

Crypt_RC4

Crypt_RSA

Crypt_Xtea

Crypt_XXTEA

Date

Date_Holidays

DB

DBA

DBA_Relational

DB_ado

DB_DataObject

DB_DataObject_FormBuilder

DB_ldap

DB_ldap2

DB_NestedSet

DB_odbtp

DB_Pager

DB_QueryTool

DB_Sqlite_Tools

DB_Table

Event_Dispatcher

File

File_Archive

File_Bittorrent

File_DICOM

File_DNS

File_Find

File_Fortune

File_Fstab

File_Gettext

File_HtAccess

File_IMC

File_MARC

File_Ogg

File_Passwd

File_PDF

File_SearchReplace

File_SMBPasswd

File_XSPF

FSM

Games_Chess

Genealogy_Gedcom

Gtk2_EntryDialog

Gtk2_ExceptionDump

Gtk2_FileDrop

Gtk2_IndexedComboBox

Gtk2_PHPConfig

Gtk2_ScrollingLabel

Gtk2_VarDump

Gtk_FileDrop

Gtk_MDB_Designer

Gtk_ScrollingLabel

Gtk_Styled

Gtk_VarDump

HTML_AJAX

HTML_BBCodeParser

HTML_Common

HTML_Common2

HTML_Crypt

HTML_CSS

HTML_Form

HTML_Javascript

HTML_Menu

HTML_Page

HTML_Page2

HTML_Progress

HTML_Progress2

HTML_QuickForm

HTML_QuickForm2

HTML_QuickForm_advmultiselect

HTML_QuickForm_altselect

HTML_QuickForm_CAPTCHA

HTML_QuickForm_Controller

HTML_QuickForm_DHTMLRulesTableless

HTML_QuickForm_ElementGrid

HTML_QuickForm_Livesearch

HTML_QuickForm_Renderer_Tableless

HTML_QuickForm_SelectFilter

HTML_Safe

HTML_Select

HTML_Select_Common

HTML_Table

HTML_Table_Matrix

HTML_TagCloud

HTML_Template_Flexy

HTML_Template_IT

HTML_Template_PHPLIB

HTML_Template_Sigma

HTML_Template_Xipe

HTML_TreeMenu

HTTP

HTTP_Client

HTTP_Download

HTTP_FloodControl

HTTP_Header

HTTP_Request

HTTP_Server

HTTP_Session

HTTP_Session2

HTTP_SessionServer

HTTP_Upload

HTTP_WebDAV_Client

HTTP_WebDAV_Server

I18N

I18Nv2

I18N_UnicodeString

Image_3D

Image_Barcode

Image_Canvas

Image_Color

Image_Color2

Image_GIS

Image_Graph

Image_GraphViz

Image_IPTC

Image_MonoBMP

Image_Puzzle

Image_Remote

Image_Text

Image_Tools

Image_Transform

Image_WBMP

Image_XBM

Inline_C

LiveUser

LiveUser_Admin

Log

Mail

Mail_IMAP

Mail_IMAPv2

Mail_Mbox

Mail_Mime

Mail_mimeDecode

Mail_Queue

Math_Basex

Math_BigInteger

Math_BinaryUtils

Math_Complex

Math_Derivative

Math_Fibonacci

Math_Finance

Math_Fraction

Math_Histogram

Math_Integer

Math_Matrix

Math_Numerical_RootFinding

Math_Polynomial

Math_Quaternion

Math_RPN

Math_Stats

Math_TrigOp

Math_Vector

MDB

MDB2

MDB2_Driver_fbsql

MDB2_Driver_ibase

MDB2_Driver_mssql

MDB2_Driver_mysql

MDB2_Driver_mysqli

MDB2_Driver_oci8

MDB2_Driver_pgsql

MDB2_Driver_querysim

MDB2_Driver_sqlite

MDB2_Schema

MDB2_Table

MDB_QueryTool

Message

MIME_Type

MP3_Id

MP3_IDv2

MP3_Playlist

Net_CDDB

Net_CheckIP

Net_Curl

Net_Cyrus

Net_Dict

Net_Dig

Net_DIME

Net_DNS

Net_DNSBL

Net_Finger

Net_FTP

Net_FTP2

Net_GameServerQuery

Net_Geo

Net_GeoIP

Net_Growl

Net_HL7

Net_Ident

Net_IDNA

Net_IMAP

Net_IPv4

Net_IPv6

Net_IRC

Net_LDAP

Net_LMTP

Net_MAC

Net_Monitor

Net_MPD

Net_NNTP

Net_Ping

Net_POP3

Net_Portscan

Net_Server

Net_Sieve

Net_SmartIRC

Net_SMPP

Net_SMPP_Client

Net_SMS

Net_SMTP

Net_Socket

Net_Traceroute

Net_URL

Net_UserAgent_Detect

Net_UserAgent_Mobile

Net_Whois

Net_Wifi

Numbers_Roman

Numbers_Words

OLE

OpenDocument

Pager

Pager_Sliding

Payment_Clieop

Payment_DTA

Payment_Process

PEAR

pearweb

pearweb_channelxml

pearweb_phars

PEAR_Command_Packaging

PEAR_Delegator

PEAR_ErrorStack

PEAR_Frontend_Gtk

PEAR_Frontend_Gtk2

PEAR_Frontend_Web

PEAR_Info

PEAR_PackageFileManager

PEAR_PackageFileManager_Frontend

PEAR_PackageFileManager_Frontend_Web

PEAR_PackageFileManager_GUI_Gtk

PEAR_PackageUpdate

PEAR_PackageUpdate_Gtk2

PEAR_PackageUpdate_Web

PEAR_RemoteInstaller

PHPDoc

PhpDocumentor

PHP_Annotation

PHP_Archive

PHP_Beautifier

PHP_CodeSniffer

PHP_Compat

PHP_CompatInfo

PHP_Fork

PHP_LexerGenerator

PHP_Parser

PHP_ParserGenerator

PHP_Parser_DocblockParser

PHP_Shell

QA_Peardoc_Coverage

RDF

RDF_N3

RDF_NTriple

RDF_RDQL

Science_Chemistry

ScriptReorganizer

Search_Mnogosearch

Services_Amazon

Services_Blogging

Services_Delicious

Services_DynDNS

Services_Ebay

Services_ExchangeRates

Services_Google

Services_Hatena

Services_OpenSearch

Services_Pingback

Services_Technorati

Services_Trackback

Services_W3C_HTMLValidator

Services_Weather

Services_Webservice

Services_Yahoo

Services_YouTube

SOAP

SOAP_Interop

Spreadsheet_Excel_Writer

SQL_Parser

Stream_SHM

Stream_Var

Structures_BibTex

Structures_DataGrid

Structures_DataGrid_DataSource_Array

Structures_DataGrid_DataSource_CSV

Structures_DataGrid_DataSource_DataObject

Structures_DataGrid_DataSource_DB

Structures_DataGrid_DataSource_DBQuery

Structures_DataGrid_DataSource_DBTable

Structures_DataGrid_DataSource_Excel

Structures_DataGrid_DataSource_MDB2

Structures_DataGrid_DataSource_RSS

Structures_DataGrid_DataSource_XML

Structures_DataGrid_Renderer_Console

Structures_DataGrid_Renderer_CSV

Structures_DataGrid_Renderer_Flexy

Structures_DataGrid_Renderer_HTMLSortForm

Structures_DataGrid_Renderer_HTMLTable

Structures_DataGrid_Renderer_Pager

Structures_DataGrid_Renderer_Smarty

Structures_DataGrid_Renderer_XLS

Structures_DataGrid_Renderer_XML

Structures_DataGrid_Renderer_XUL

Structures_Form

Structures_Form_Gtk2

Structures_Graph

Structures_LinkedList

System_Command

System_Folders

System_Mount

System_ProcWatch

System_SharedMemory

System_Socket

System_WinDrives

Testing_Selenium

Text_CAPTCHA

Text_CAPTCHA_Numeral

Text_Diff

Text_Figlet

Text_Highlighter

Text_Huffman

Text_LanguageDetect

Text_Password

Text_PathNavigator

Text_Statistics

Text_TeXHyphen

Text_Wiki

Text_Wiki_BBCode

Text_Wiki_Cowiki

Text_Wiki_Creole

Text_Wiki_Doku

Text_Wiki_Mediawiki

Text_Wiki_Tiki

Translation

Translation2

Tree

UDDI

Validate

Validate_AR

Validate_AT

Validate_AU

Validate_BE

Validate_CA

Validate_CH

Validate_DE

Validate_DK

Validate_ES

Validate_FI

Validate_Finance

Validate_Finance_CreditCard

Validate_FR

Validate_IN

Validate_IS

Validate_ISPN

Validate_IT

Validate_LV

Validate_NL

Validate_NZ

Validate_PL

Validate_ptBR

Validate_UK

Validate_US

Validate_ZA

Var_Dump

VersionControl_SVN

VFS

XML_Beautifier

XML_CSSML

XML_DB_eXist

XML_DTD

XML_FastCreate

XML_Feed_Parser

XML_fo2pdf

XML_FOAF

XML_HTMLSax

XML_HTMLSax3

XML_image2svg

XML_Indexing

XML_MXML

XML_NITF

XML_Parser

XML_Query2XML

XML_RDDL

XML_RPC

XML_RPC2

XML_RSS

XML_SaxFilters

XML_Serializer

XML_sql2xml

XML_Statistics

XML_SVG

XML_svg2image

XML_Transformer

XML_Tree

XML_Util

XML_Wddx

XML_XPath

XML_XSLT_Wrapper

XML_XUL

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/auth/allreleases.xml", '

Auth

pear.php.net 1.3.0r3beta 1.3.0r2beta 1.3.0r1beta 1.2.3stable 1.2.2stable 1.2.1stable 1.2.0stable 1.1.1stable 1.1.0stable 1.0.2stable 1.0.1stable 1.0
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/auth/1.3.0r3.xml", '

Auth

pear.php.net 1.3.0r3 stable PHP License aashley Creating an authentication system. The PEAR::Auth package provides methods for creating an authentication system using PHP. Currently it supports the following storage containers to read/write the login data: * All databases supported by the PEAR database layer * All databases supported by the MDB database layer * All databases supported by the MDB2 database layer * Plaintext files * LDAP servers * POP3 servers * IMAP servers * vpopmail accounts * RADIUS * SAMBA password files * SOAP (Using either PEAR SOAP package or PHP5 SOAP extension) * PEAR website * Kerberos V servers * SAP servers 2007-03-22 19:58:57 * Added missing optional dependancy on PEAR Log to package.xml * Fixed Bug #10125: Auth_Container_LDAP::fetchData only fetching attributes for first entry. 54156 http://pear.php.net/get/Auth-1.3.0r3
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/auth_http/allreleases.xml", '

Auth_HTTP

pear.php.net 2.1.6RC1beta 2.1.4stable 2.1.3rc1beta 2.1.1beta 2.1.0beta 2.1.0RC2beta 2.1RC1beta 2.0stable 1.0.1stable 1.0stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/auth_http/2.1.6RC1.xml", '

Auth_HTTP

pear.php.net 2.1.6RC1 beta PHP License hirokawa HTTP authentication The PEAR::Auth_HTTP class provides methods for creating an HTTP authentication system using PHP, that is similar to Apache\'s realm-based .htaccess authentication. 2005-04-23 00:00:04 - Fixed bug #4047. - Fixed backward compatibility with PHP 4.x - Added PHP_AUTH_DIGEST support. 9294 http://pear.php.net/get/Auth_HTTP-2.1.6RC1
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/auth_http/info.xml", '

Auth_HTTP pear.php.net Authentication PHP License HTTP authentication The PEAR::Auth_HTTP class provides methods for creating an HTTP authentication system using PHP, that is similar to Apache\'s realm-based .htaccess authentication.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/auth_http/deps.2.1.6RC1.txt", 'a:1:{s:8:"required";a:3:{s:3:"php";a:2:{s:3:"min";s:5:"4.1.0";s:3:"max";s:5:"6.0.0";}s:13:"pearinstaller";a:1:{s:3:"min";s:7:"1.4.0a2";}s:7:"package";a:3:{s:4:"name";s:4:"Auth";s:7:"channel";s:12:"pear.php.net";s:3:"min";s:5:"1.2.0";}}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/auth/info.xml", '

Auth pear.php.net Authentication PHP License Creating an authentication system. The PEAR::Auth package provides methods for creating an authentication system using PHP. Currently it supports the following storage containers to read/write the login data: * All databases supported by the PEAR database layer * All databases supported by the MDB database layer * All databases supported by the MDB2 database layer * Plaintext files * LDAP servers * POP3 servers * IMAP servers * vpopmail accounts * RADIUS * SAMBA password files * SOAP (Using either PEAR SOAP package or PHP5 SOAP extension) * PEAR website * Kerberos V servers * SAP servers

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/auth/deps.1.3.0r3.txt", 'a:7:{i:1;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:5:"0.9.5";s:8:"optional";s:3:"yes";s:4:"name";s:11:"File_Passwd";}i:2;a:5:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:3:"1.3";s:8:"optional";s:3:"yes";s:4:"name";s:8:"Net_POP3";}i:3;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:3:"yes";s:4:"name";s:2:"DB";}i:4;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:3:"yes";s:4:"name";s:3:"MDB";}i:5;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:3:"yes";s:4:"name";s:4:"MDB2";}i:6;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:3:"yes";s:4:"name";s:11:"Auth_RADIUS";}i:7;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:8:"optional";s:3:"yes";s:4:"name";s:14:"File_SMBPasswd";}}', 'text/xml'); $_test_dep->setPHPVersion('4.3.10'); $_test_dep->setPEARVersion('1.4.0a10'); $p1 = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'packages'. DIRECTORY_SEPARATOR . 'Auth_HTTP-2.1.4.tgz'; $p2 = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'packages'. DIRECTORY_SEPARATOR . 'Auth-1.3.0r3.tgz'; $p3 = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'packages'. DIRECTORY_SEPARATOR . 'Auth_HTTP-2.1.6RC1.tgz'; $pearweb->addHtmlConfig('http://pear.php.net/get/Auth_HTTP-2.1.6RC1.tgz', $p3); $res = $command->run('install', array(), array($p1, $p2)); $phpunit->assertNoErrors('setup install'); $fakelog->getDownload(); $fakelog->getLog(); $config->set('preferred_state', 'alpha'); test_PEAR_Command_Install::_reset_downloader(); $res = $command->run('upgrade', array(), array('Auth_HTTP')); $dummy = null; $dl = &$command->getDownloader($dummy, array()); echoFakelog($fakelog); echo 'tests done'; ?> --CLEAN-- --EXPECTF-- 3;pear/Auth_HTTP: Skipping required dependency "pear/Auth" version 1.3.0r3, already installed as version 1.3.0r3 3;Downloading "http://pear.php.net/get/Auth_HTTP-2.1.6RC1.tgz" 1;downloading Auth_HTTP-2.1.6RC1.tgz ... 1;Starting to download Auth_HTTP-2.1.6RC1.tgz (9,294 bytes) 1;. 1;. 1;...done: 9,294 bytes 3;adding to transaction: backup %s/PEAR_Command_Install/testinstallertemp/php/Auth/HTTP.php 3;adding to transaction: delete %s/PEAR_Command_Install/testinstallertemp/php/Auth/HTTP.php 3;adding to transaction: backup %s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/sample.sql 3;adding to transaction: delete %s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/sample.sql 3;adding to transaction: backup %s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/test_basic_simple.php 3;adding to transaction: delete %s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/test_basic_simple.php 3;adding to transaction: backup %s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/test_digest_simple.php 3;adding to transaction: delete %s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/test_digest_simple.php 3;adding to transaction: backup %s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/test_digest_get.php 3;adding to transaction: delete %s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/test_digest_get.php 3;adding to transaction: backup %s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/test_digest_post.php 3;adding to transaction: delete %s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/test_digest_post.php 3;+ cp %s/Auth_HTTP-2.1.6RC1/tests/sample.sql %s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/.tmpsample.sql 2;md5sum ok: %s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/sample.sql 3;adding to transaction: chmod 6%d4 %s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/.tmpsample.sql 3;adding to transaction: rename %s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/.tmpsample.sql %s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/sample.sql 3;adding to transaction: installed_as tests/sample.sql %s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/sample.sql %s/PEAR_Command_Install/testinstallertemp/test /Auth_HTTP/tests 3;+ cp %s/Auth_HTTP-2.1.6RC1/tests/test_basic_simple.php %s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/.tmptest_basic_simple.php 2;md5sum ok: %s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/test_basic_simple.php 3;adding to transaction: chmod 6%d4 %s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/.tmptest_basic_simple.php 3;adding to transaction: rename %s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/.tmptest_basic_simple.php %s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/test_basic_simple.php 3;adding to transaction: installed_as tests/test_basic_simple.php %s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/test_basic_simple.php %s/PEAR_Command_Install/testinstallertemp/test /Auth_HTTP/tests 3;+ cp %s/Auth_HTTP-2.1.6RC1/tests/test_digest_get.php %s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/.tmptest_digest_get.php 2;md5sum ok: %s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/test_digest_get.php 3;adding to transaction: chmod 6%d4 %s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/.tmptest_digest_get.php 3;adding to transaction: rename %s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/.tmptest_digest_get.php %s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/test_digest_get.php 3;adding to transaction: installed_as tests/test_digest_get.php %s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/test_digest_get.php %s/PEAR_Command_Install/testinstallertemp/test /Auth_HTTP/tests 3;+ cp %s/Auth_HTTP-2.1.6RC1/tests/test_digest_post.php %s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/.tmptest_digest_post.php 2;md5sum ok: %s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/test_digest_post.php 3;adding to transaction: chmod 6%d4 %s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/.tmptest_digest_post.php 3;adding to transaction: rename %s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/.tmptest_digest_post.php %s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/test_digest_post.php 3;adding to transaction: installed_as tests/test_digest_post.php %s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/test_digest_post.php %s/PEAR_Command_Install/testinstallertemp/test /Auth_HTTP/tests 3;+ cp %s/Auth_HTTP-2.1.6RC1/tests/test_digest_simple.php %s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/.tmptest_digest_simple.php 2;md5sum ok: %s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/test_digest_simple.php 3;adding to transaction: chmod 6%d4 %s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/.tmptest_digest_simple.php 3;adding to transaction: rename %s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/.tmptest_digest_simple.php %s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/test_digest_simple.php 3;adding to transaction: installed_as tests/test_digest_simple.php %s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/test_digest_simple.php %s/PEAR_Command_Install/testinstallertemp/test /Auth_HTTP/tests 3;+ cp %s/Auth_HTTP-2.1.6RC1/Auth_HTTP.php %s/PEAR_Command_Install/testinstallertemp/php/Auth/.tmpHTTP.php 2;md5sum ok: %s/PEAR_Command_Install/testinstallertemp/php/Auth/HTTP.php 3;adding to transaction: chmod 6%d4 %s/PEAR_Command_Install/testinstallertemp/php/Auth/.tmpHTTP.php 3;adding to transaction: rename %s/PEAR_Command_Install/testinstallertemp/php/Auth/.tmpHTTP.php %s/PEAR_Command_Install/testinstallertemp/php/Auth/HTTP.php 3;adding to transaction: installed_as Auth_HTTP.php %s/PEAR_Command_Install/testinstallertemp/php/Auth/HTTP.php %s/PEAR_Command_Install/testinstallertemp/php /Auth 3;adding to transaction: removebackup %s/PEAR_Command_Install/testinstallertemp/php/Auth/HTTP.php 3;adding to transaction: removebackup %s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/sample.sql 3;adding to transaction: removebackup %s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/test_basic_simple.php 3;adding to transaction: removebackup %s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/test_digest_simple.php 3;adding to transaction: removebackup %s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/test_digest_get.php 3;adding to transaction: removebackup %s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/test_digest_post.php 2;about to commit 36 file operations for Auth_HTTP 3;+ backup %s/PEAR_Command_Install/testinstallertemp/php/Auth/HTTP.php to %s/PEAR_Command_Install/testinstallertemp/php/Auth/HTTP.php.bak 3;+ rm %s/PEAR_Command_Install/testinstallertemp/php/Auth/HTTP.php 3;+ backup %s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/sample.sql to %s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/sample.sql.bak 3;+ rm %s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/sample.sql 3;+ backup %s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/test_basic_simple.php to %s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/test_basic_simple.php.bak 3;+ rm %s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/test_basic_simple.php 3;+ backup %s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/test_digest_simple.php to %s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/test_digest_simple.php.bak 3;+ rm %s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/test_digest_simple.php 3;+ backup %s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/test_digest_get.php to %s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/test_digest_get.php.bak 3;+ rm %s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/test_digest_get.php 3;+ backup %s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/test_digest_post.php to %s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/test_digest_post.php.bak 3;+ rm %s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/test_digest_post.php 3;+ chmod 6%d4 %s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/.tmpsample.sql 3;+ mv %s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/.tmpsample.sql %s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/sample.sql 3;+ chmod 6%d4 %s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/.tmptest_basic_simple.php 3;+ mv %s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/.tmptest_basic_simple.php %s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/test_basic_simple.php 3;+ chmod 6%d4 %s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/.tmptest_digest_get.php 3;+ mv %s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/.tmptest_digest_get.php %s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/test_digest_get.php 3;+ chmod 6%d4 %s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/.tmptest_digest_post.php 3;+ mv %s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/.tmptest_digest_post.php %s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/test_digest_post.php 3;+ chmod 6%d4 %s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/.tmptest_digest_simple.php 3;+ mv %s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/.tmptest_digest_simple.php %s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/test_digest_simple.php 3;+ chmod 6%d4 %s/PEAR_Command_Install/testinstallertemp/php/Auth/.tmpHTTP.php 3;+ mv %s/PEAR_Command_Install/testinstallertemp/php/Auth/.tmpHTTP.php %s/PEAR_Command_Install/testinstallertemp/php/Auth/HTTP.php 3;+ rm backup of %s/PEAR_Command_Install/testinstallertemp/php/Auth/HTTP.php (%s/PEAR_Command_Install/testinstallertemp/php/Auth/HTTP.php.bak) 3;+ rm backup of %s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/sample.sql (%s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/sample.sql.bak) 3;+ rm backup of %s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/test_basic_simple.php (%s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/test_basic_simple.php.bak) 3;+ rm backup of %s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/test_digest_simple.php (%s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/test_digest_simple.php.bak) 3;+ rm backup of %s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/test_digest_get.php (%s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/test_digest_get.php.bak) 3;+ rm backup of %s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/test_digest_post.php (%s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests/test_digest_post.php.bak) 2;successfully committed 36 file operations 3;adding to transaction: rmdir %s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP/tests 3;adding to transaction: rmdir %s/PEAR_Command_Install/testinstallertemp/test/Auth_HTTP 3;adding to transaction: rmdir %s/PEAR_Command_Install/testinstallertemp/php/Auth 2;about to commit 3 file operations for Auth_HTTP 2;successfully committed 3 file operations array ( 'info' => array ( 'data' => 'upgrade ok: channel://pear.php.net/Auth_HTTP-2.1.6RC1', ), 'cmd' => 'upgrade', ) tests done php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Install/upgrade/test_bug5683.phpt000066400000000000000000000263521262614675700303540ustar00rootroot00000000000000--TEST-- upgrade command, test for bug #5683 - classical deadlock if deps between downloaded/installed don't match --SKIPIF-- --FILE-- getChannel('pear.php.net'); $chan->setBaseURL('REST1.0', 'http://pear.php.net/rest/'); $reg->updateChannel($chan); $_test_dep->setPHPVersion('4.3.10'); $_test_dep->setPEARVersion('1.4.2'); $_test_dep->setExtensions(array('xml' => 0, 'pcre' => 1)); $dir = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'packages'. DIRECTORY_SEPARATOR; $pearweb->addRESTConfig("http://pear.php.net/rest/r/archive_tar/allreleases.xml", '

Archive_Tar

pear.php.net 1.3.1stable 1.3.0stable 1.2stable 1.1stable 1.0stable 0.10-b1beta 0.9stable 0.4stable 0.3stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/archive_tar/1.3.1.xml", '

Archive_Tar

pear.php.net 1.3.1 stable PHP License vblavet Tar file management class This class provides handling of tar files in PHP. It supports creating, listing, extracting and adding to tar files. Gzip support is available if PHP has the zlib extension built-in or loaded. Bz2 compression is also supported with the bz2 extension loaded. 2005-03-17 16:09:16 Correct Bug #3855 15102 http://pear.php.net/get/Archive_Tar-1.3.1
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/archive_tar/deps.1.3.1.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/console_getopt/allreleases.xml", '

Console_Getopt

pear.php.net 1.2stable 1.0stable 0.11beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/console_getopt/1.2.xml", '

Console_Getopt

pear.php.net 1.2 stable PHP License andrei Command-line option parser This is a PHP implementation of "getopt" supporting both short and long options. 2003-12-11 14:26:46 Fix to preserve BC with 1.0 and allow correct behaviour for new users 3370 http://pear.php.net/get/Console_Getopt-1.2
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/console_getopt/deps.1.2.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/xml_rpc/allreleases.xml", '

XML_RPC

pear.php.net 1.4.4stable 1.4.3stablepear.php.net

PEAR

1.4.0a11.4.1
1.4.2stablepear.php.net

PEAR

1.4.0a11.4.0a14
1.4.1stablepear.php.net

PEAR

1.4.0a11.4.0a14
1.4.0stablepear.php.net

PEAR

1.4.0a11.4.0a12
1.3.3stablepear.php.net

PEAR

1.4.0a11.4.0a12
1.3.2stablepear.php.net

PEAR

1.4.0a11.4.0a12
1.3.1stablepear.php.net

PEAR

1.4.0a11.4.0a12
1.3.0stablepear.php.net

PEAR

1.4.0a11.4.0a12
1.3.0RC3beta 1.3.0RC2betapear.php.net

PEAR

1.4.0a11.4.0a10
1.3.0RC1betapear.php.net

PEAR

1.4.0a11.4.0a10
1.2.2stablepear.php.net

PEAR

1.4.0a11.4.0a4
1.2.1stablepear.php.net

PEAR

1.4.0a11.4.0a2
1.2.0stablepear.php.net

PEAR

1.4.0a11.4.0a1
1.2.0RC7beta 1.2.0RC6beta 1.2.0RC5beta 1.2.0RC4beta 1.2.0RC3beta 1.2.0RC2beta 1.2.0RC1beta 1.1.0stable 1.0.4stable 1.0.3stable 1.0.2stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/xml_rpc/1.4.4.xml", '

XML_RPC

pear.php.net 1.4.4 stable PHP License danielc PHP implementation of the XML-RPC protocol A PEAR-ified version of Useful Inc\'s XML-RPC for PHP. It has support for HTTP/HTTPS transport, proxies and authentication. 2005-10-15 16:36:02 * Properly deal with empty values in struct\'s. 24447 http://pear.php.net/get/XML_RPC-1.4.4
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/xml_rpc/deps.1.4.4.txt", 'b:0;', 'text/xml'); $pearweb->addHTMLConfig('http://pear.php.net/get/XML_RPC-1.4.4.tgz', $dir . 'XML_RPC-1.4.4.tgz'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/pear/info.xml", '

PEAR pear.php.net PEAR PHP License PEAR Base System The PEAR package contains: * the PEAR installer, for creating, distributing and installing packages * the beta-quality PEAR_Exception PHP5 error handling mechanism * 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 of common operations with files and directories * the PEAR base class New features in a nutshell: * full support for channels * pre-download dependency validation * new package.xml 2.0 format allows tremendous flexibility while maintaining BC * support for optional dependency groups and limited support for sub-packaging * robust dependency support * full dependency validation on uninstall * remote install for hosts with only ftp access - no more problems with restricted host installation * full support for mirroring * support for bundling several packages into a single tarball * support for static dependencies on a url-based package * support for custom file roles and installation tasks NOTE: users of PEAR_Frontend_Web/PEAR_Frontend_Gtk must upgrade their installations to the latest version, or PEAR will not upgrade properly

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/archive_tar/info.xml", '

Archive_Tar pear.php.net File Formats PHP License Tar file management class This class provides handling of tar files in PHP. It supports creating, listing, extracting and adding to tar files. Gzip support is available if PHP has the zlib extension built-in or loaded. Bz2 compression is also supported with the bz2 extension loaded.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/console_getopt/info.xml", '

Console_Getopt pear.php.net Console PHP License Command-line option parser This is a PHP implementation of "getopt" supporting both short and long options.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/xml_rpc/info.xml", '

XML_RPC pear.php.net Web Services PHP License PHP implementation of the XML-RPC protocol A PEAR-ified version of Useful Inc\'s XML-RPC for PHP. It has support for HTTP/HTTPS transport, proxies and authentication.

', 'text/xml'); $command->run('install', array(), array($dir . 'PEAR-1.4.3.tgz', $dir . 'XML_RPC-1.4.3.tgz', $dir . 'Console_Getopt-1.2.tgz', $dir . 'Archive_Tar-1.3.1.tgz')); $phpunit->assertNoErrors('setup'); $phpunit->assertEquals(4, count($reg->listPackages()), 'num packages'); $phpunit->assertEquals('1.4.3', $reg->packageInfo('PEAR', 'version'), 'PEAR version'); $phpunit->assertEquals('1.4.3', $reg->packageInfo('XML_RPC', 'version'), 'XML_RPC version'); unset($GLOBALS['__Stupid_php4_a']); // reset downloader $command->run('upgrade', array(), array($dir . 'PEAR-1.4.4.tgz')); $phpunit->assertNoErrors('full test'); $phpunit->assertEquals(4, count($reg->listPackages()), 'num packages 2'); $phpunit->assertEquals('1.4.4', $reg->packageInfo('PEAR', 'version'), 'PEAR version 2'); $phpunit->assertEquals('1.4.4', $reg->packageInfo('XML_RPC', 'version'), 'XML_RPC version 2'); echo 'tests done'; ?> --CLEAN-- --EXPECT-- tests done php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Install/upgrade/test_bug5683_fail.phpt000066400000000000000000000234061262614675700313440ustar00rootroot00000000000000--TEST-- upgrade command, complex test for bug #5683 - example: XML_RPC 1.4.4 is not recommended for PEAR 1.4.2 (which is installed), but works for PEAR 1.4.3 which is downloaded, but PEAR 1.4.3 fails dependency test, so XML_RPC 1.4.4 should not be installed. --SKIPIF-- --FILE-- getChannel('pear.php.net'); $chan->setBaseURL('REST1.0', 'http://pear.php.net/rest/'); $reg->updateChannel($chan); $_test_dep->setPHPVersion('4.3.10'); $_test_dep->setPEARVersion('1.4.2'); $_test_dep->setExtensions(array('xml' => 0, 'pcre' => 1)); $dir = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'packages'. DIRECTORY_SEPARATOR; $pearweb->addRESTConfig("http://pear.php.net/rest/r/archive_tar/allreleases.xml", '

Archive_Tar

pear.php.net 1.3.1stable 1.3.0stable 1.2stable 1.1stable 1.0stable 0.10-b1beta 0.9stable 0.4stable 0.3stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/archive_tar/1.3.1.xml", '

Archive_Tar

pear.php.net 1.3.1 stable PHP License vblavet Tar file management class This class provides handling of tar files in PHP. It supports creating, listing, extracting and adding to tar files. Gzip support is available if PHP has the zlib extension built-in or loaded. Bz2 compression is also supported with the bz2 extension loaded. 2005-03-17 16:09:16 Correct Bug #3855 15102 http://pear.php.net/get/Archive_Tar-1.3.1
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/archive_tar/deps.1.3.1.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/console_getopt/allreleases.xml", '

Console_Getopt

pear.php.net 1.2stable 1.0stable 0.11beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/console_getopt/1.2.xml", '

Console_Getopt

pear.php.net 1.2 stable PHP License andrei Command-line option parser This is a PHP implementation of "getopt" supporting both short and long options. 2003-12-11 14:26:46 Fix to preserve BC with 1.0 and allow correct behaviour for new users 3370 http://pear.php.net/get/Console_Getopt-1.2
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/console_getopt/deps.1.2.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/xml_rpc/allreleases.xml", '

XML_RPC

pear.php.net 1.4.4stable 1.4.3stablepear.php.net

PEAR

1.4.0a11.4.1
1.4.2stablepear.php.net

PEAR

1.4.0a11.4.0a14
1.4.1stablepear.php.net

PEAR

1.4.0a11.4.0a14
1.4.0stablepear.php.net

PEAR

1.4.0a11.4.0a12
1.3.3stablepear.php.net

PEAR

1.4.0a11.4.0a12
1.3.2stablepear.php.net

PEAR

1.4.0a11.4.0a12
1.3.1stablepear.php.net

PEAR

1.4.0a11.4.0a12
1.3.0stablepear.php.net

PEAR

1.4.0a11.4.0a12
1.3.0RC3beta 1.3.0RC2betapear.php.net

PEAR

1.4.0a11.4.0a10
1.3.0RC1betapear.php.net

PEAR

1.4.0a11.4.0a10
1.2.2stablepear.php.net

PEAR

1.4.0a11.4.0a4
1.2.1stablepear.php.net

PEAR

1.4.0a11.4.0a2
1.2.0stablepear.php.net

PEAR

1.4.0a11.4.0a1
1.2.0RC7beta 1.2.0RC6beta 1.2.0RC5beta 1.2.0RC4beta 1.2.0RC3beta 1.2.0RC2beta 1.2.0RC1beta 1.1.0stable 1.0.4stable 1.0.3stable 1.0.2stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/xml_rpc/1.4.4.xml", '

XML_RPC

pear.php.net 1.4.4 stable PHP License danielc PHP implementation of the XML-RPC protocol A PEAR-ified version of Useful Inc\'s XML-RPC for PHP. It has support for HTTP/HTTPS transport, proxies and authentication. 2005-10-15 16:36:02 * Properly deal with empty values in struct\'s. 24447 http://pear.php.net/get/XML_RPC-1.4.4
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/archive_tar/info.xml", '

Archive_Tar pear.php.net File Formats PHP License Tar file management class This class provides handling of tar files in PHP. It supports creating, listing, extracting and adding to tar files. Gzip support is available if PHP has the zlib extension built-in or loaded. Bz2 compression is also supported with the bz2 extension loaded.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/console_getopt/info.xml", '

Console_Getopt pear.php.net Console PHP License Command-line option parser This is a PHP implementation of "getopt" supporting both short and long options.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/xml_rpc/info.xml", '

XML_RPC pear.php.net Web Services PHP License PHP implementation of the XML-RPC protocol A PEAR-ified version of Useful Inc\'s XML-RPC for PHP. It has support for HTTP/HTTPS transport, proxies and authentication.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/xml_rpc/deps.1.4.4.txt", 'b:0;', 'text/xml'); $pearweb->addHTMLConfig('http://pear.php.net/get/XML_RPC-1.4.4.tgz', $dir . 'XML_RPC-1.4.4.tgz'); $command->run('install', array(), array($dir . 'PEAR-1.4.3.tgz', $dir . 'XML_RPC-1.4.3.tgz', $dir . 'Console_Getopt-1.2.tgz', $dir . 'Archive_Tar-1.3.1.tgz')); $phpunit->assertNoErrors('setup'); $phpunit->assertEquals(4, count($reg->listPackages()), 'num packages'); $phpunit->assertEquals('1.4.3', $reg->packageInfo('PEAR', 'version'), 'PEAR version'); $phpunit->assertEquals('1.4.3', $reg->packageInfo('XML_RPC', 'version'), 'XML_RPC version'); unset($GLOBALS['__Stupid_php4_a']); // reset downloader $_test_dep->setExtensions(array()); // make PEAR upgrade fail $command->run('upgrade', array(), array($dir . 'PEAR-1.4.4.tgz')); $phpunit->assertNoErrors('full test'); $phpunit->assertEquals(4, count($reg->listPackages()), 'num packages 2'); $phpunit->assertEquals('1.4.3', $reg->packageInfo('PEAR', 'version'), 'PEAR version 2'); $phpunit->assertEquals('1.4.3', $reg->packageInfo('XML_RPC', 'version'), 'XML_RPC version 2'); echo 'tests done'; ?> --CLEAN-- --EXPECT-- tests done php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Install/upgrade/test_bug6931.phpt000066400000000000000000001217111262614675700303440ustar00rootroot00000000000000--TEST-- upgrade command, test for bug #6931 --SKIPIF-- --FILE-- getChannel('pear.php.net'); $chan->setBaseURL('REST1.0', 'http://pear.php.net/rest/'); $chan->setBaseURL('REST1.1', 'http://pear.php.net/rest/'); $reg->updateChannel($chan); $pearweb->addHTMLConfig('http://pear.php.net/get/PEAR-1.4.0a12.tgz', $dir . 'PEAR-1.4.0a12.tgz'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/xml_rpc/allreleases.xml", '

XML_RPC

pear.php.net 1.4.5stable 1.4.4stable 1.4.3stablepear.php.net

PEAR

1.4.0a11.4.1
1.4.2stablepear.php.net

PEAR

1.4.0a11.4.0a14
1.4.1stablepear.php.net

PEAR

1.4.0a11.4.0a14
1.4.0stablepear.php.net

PEAR

1.4.0a11.4.0a12
1.3.3stablepear.php.net

PEAR

1.4.0a11.4.0a12
1.3.2stablepear.php.net

PEAR

1.4.0a11.4.0a12
1.3.1stablepear.php.net

PEAR

1.4.0a11.4.0a12
1.3.0stablepear.php.net

PEAR

1.4.0a11.4.0a12
1.3.0RC3beta 1.3.0RC2betapear.php.net

PEAR

1.4.0a11.4.0a10
1.3.0RC1betapear.php.net

PEAR

1.4.0a11.4.0a10
1.2.2stablepear.php.net

PEAR

1.4.0a11.4.0a4
1.2.1stablepear.php.net

PEAR

1.4.0a11.4.0a2
1.2.0stablepear.php.net

PEAR

1.4.0a11.4.0a1
1.2.0RC7beta 1.2.0RC6beta 1.2.0RC5beta 1.2.0RC4beta 1.2.0RC3beta 1.2.0RC2beta 1.2.0RC1beta 1.1.0stable 1.0.4stable 1.0.3stable 1.0.2stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/xml_rpc/1.4.5.xml", '

XML_RPC

pear.php.net 1.4.5 stable PHP License danielc PHP implementation of the XML-RPC protocol A PEAR-ified version of Useful Inc\'s XML-RPC for PHP. It has support for HTTP/HTTPS transport, proxies and authentication. 2006-01-14 17:34:28 * Have server send headers individualy as opposed to sending them all at once. Necessary due to changes PHP 4.4.2. 29172 http://pear.php.net/get/XML_RPC-1.4.5
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/xml_rpc/deps.1.4.5.txt", 'a:1:{s:8:"required";a:2:{s:3:"php";a:1:{s:3:"min";s:5:"4.2.0";}s:13:"pearinstaller";a:1:{s:3:"min";s:7:"1.4.0a1";}}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/pear/allreleases.xml", '

PEAR

pear.php.net 1.4.8stable 1.4.7stable 1.4.6stable 1.4.5stable 1.4.4stable 1.4.3stable 1.4.2stable 1.4.1stable 1.4.0stable 1.4.0RC2beta 1.4.0RC1beta 1.4.0b2beta 1.4.0b1beta 1.3.6stable 1.4.0a12alpha 1.4.0a11alpha 1.4.0a10alpha 1.4.0a9alpha 1.4.0a8alpha 1.4.0a7alpha 1.4.0a6alpha 1.4.0a5alpha 1.4.0a4alpha 1.4.0a3alpha 1.4.0a2alpha 1.4.0a1alpha 1.3.5stable 1.3.4stable 1.3.3.1stable 1.3.3stable 1.3.1stable 1.3stable 1.3b6beta 1.3b5beta 1.3b3beta 1.3b2beta 1.3b1beta 1.2.1stable 1.2stable 1.2b5beta 1.2b4beta 1.2b3beta 1.2b2beta 1.2b1beta 1.1stable 1.0.1stable 1.0stable 1.0b3stable 1.0b2stable 1.0b1stable 0.90beta 0.11beta 0.10beta 0.9stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/pear/1.4.0a12.xml", '

PEAR

pear.php.net 1.4.0a12 alpha PHP License cellog PEAR Base System The PEAR package contains: * the PEAR installer, for creating, distributing and installing packages * the alpha-quality PEAR_Exception PHP5 error handling mechanism * 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 of common operations with files and directories * the PEAR base class 2005-05-28 23:19:58 This is a major milestone release for PEAR. In addition to several killer features, every single element of PEAR has a regression test, and so stability is much higher than any previous PEAR release, even with the alpha label. New features in a nutshell: * full support for channels * pre-download dependency validation * new package.xml 2.0 format allows tremendous flexibility while maintaining BC * support for optional dependency groups and limited support for sub-packaging * robust dependency support * full dependency validation on uninstall * support for binary PECL packages * remote install for hosts with only ftp access - no more problems with restricted host installation * full support for mirroring * support for bundling several packages into a single tarball * support for static dependencies on a url-based package Specific changes from 1.3.5: * Implement request #1789: SSL support for xml-rpc and download * Everything above here that you just read Specific changes from 1.4.0a1: * Fix Bug #3610: fix for PDO package in 1.3.5 was never merged to 1.4.0a1 * Fix Bug #3612: fatal error in PEAR_Downloader_Package * Use 1.2.0 as recommended version of XML_RPC Specific changes from 1.4.0a2: BC BREAK FOR PECL DEVS ONLY: In order to circumvent strict package-validation, use "pear channel-update pecl.php.net" prior to packaging a pecl release. * Fix package.xml version 2.0 generation from package.xml 1.0 * Fix Bug #3634: still too many pear-specific restrictions on package valid * Implement Request #3647: "pear package" only includes one package.xml * Fix Bug #3677: Post-Install script message needs to display channel name Specific changes from 1.4.0a3: * upgrade suggested XML_RPC version to 1.2.1 Specific changes from 1.4.0a4: * upgrade suggested XML_RPC version to 1.2.2 * attempt to address memory issues * relax validation further * disable debug_backtrace() in PEAR_Error constructor of PEAR installer * fix a strange version number condition when two packages were upgraded at the same time. * fix Bug #3808 channel packages with non-baseinstalldir files will conflict on upgrade * fix Bug #3801 [PATCH] analyzeSourceCode() reports PHP4 code as PHP5 * fix Bug #3671 Installing package features doesn\'t work as expected * implement Request #3717 [Patch] Implement Simple run-tests output Specific changes from 1.4.0a5: * fix Bug #3860 PEAR_Dependency2 not included in 1 case Specific changes from 1.4.0a6: * implement <usesrole>/<usestask> for custom role/task graceful failure * REALLY fix the debug_backtrace() issue (modified wrong pearcmd.php) * fix Bug #3864 Invalid dependency relation * fix Bug #3863 illogical warning about PEAR_Frontend_Gtk 0.4.0 with PEAR 1.4.0a6 Specific changes from 1.4.0a7: * greatly improve the flexibility of post-install scripts - <param> is no longer required - skipParamgroup() method in Frontends allows dynamic manipulation of what input is requested from users * make error message when a user has no write access absolutely clear and unmistakable * update to new header comment block standard * slight improvement to speed and possibly memory use of Installer when a lot of package.xml version 1.0 packages are installed * add "peardev" command for those with memory_limit issue * make package-validate command work on packaged .tgz files Specific changes from 1.4.0a8: * add --package option to run-tests command, to run installed .phpt tests * significantly drop pear\'s memory footprint for all commands * fix fatal errors when installing pecl packages * make download command work for non-root in a shared environment * make sure that if 1.4.0a8 (alpha) is installed, and 1.3.6 (newer) exists, pear will not attempt to "upgrade" to 1.3.6 * split PEAR_PackageFile_v2 into two classes, read-only PEAR_PackageFile_v2, and read-write PEAR_PackageFile_v2_rw Specific changes from 1.4.0a9: * add support for writeable tasks * fix potential fatal errors in run-tests command, -p option * fix --installroot option for installation * move run-tests command into its own file (testing may expand) * fix fatal error if package.xml has no version="X.0" * fix Bug #3966: Improper path in PEAR/PackageFile/v2.php * fix Bug #3990: PEAR_Error PEAR_EXCEPTION broken * fix Bug #4021: PEAR_Config file_exists can cause warnings * fix Bug #1870: pear makerpm dependancies * fix Bug #4038: Array to string conversion in PEAR/Frontend/CLI.php * fix Bug #4060: pear upgrade Auth_HTTP fails * fix Bug #4072: pear list-all -c channel does not list installed packages Specific changes from 1.4.0a10: * Add new "unusualbaseinstall" role type that allows custom roles similar data/test/doc to honor the baseinstalldir attribute * fix Bug #4095: System::rm does not handle links correctly * fix Bug #4097: Wrong logging in PEAR_Command_Test * make pear/pecl commands list only pear/pecl packages * fix Bug #4161: pear download always leaves a package.xml in the dir * make PEAR_Remote messages more helpful (include server name) * make list-upgrades only search channels from which we have installed packages * remove <max> tag requirement for php dependency Specific changes from 1.4.0a11: * Implement REST 1.0 as per Request #2781 * REST is the default connection method if available * fix bugs in PEAR_ChannelFile REST handling * fix Bug #4069: pear list-all -c <ChannelAlias> does not work * fix Bug #4249: download-all broken in 1.4.0a11 * fix Bug #4257: if rel="has" is used with a version="" attribute, the warning does not work * fix Bug #4278: Parser V1: error handling borked ! * fix Bug #4279: Typo in DependencyDB (_version) * fix Bug #4285: pear install *.tgz miss dependencies * fix Bug #4353: fatal error if using remote_config variable * fix Bug #4354: Remote PEAR upgrade and uninstall operation fail * fix Bug #4355: PEAR 1.4.0a11 ftpInstall chokes on package2.xml packages * fix Bug #4400: pear download chiara/Chiara_XML_RPC5-alpha fails * fix Bug #4458: packaging error message better description * implement Request #2781: support for static channel releases.xml summary * implement versioned conflicting dependencies * fix major problems in subpackages * The next version will split off PEAR_ErrorStack into its own package * fix problems with zero-length files that have tasks on installation * add a check for channel.xml up-to-dateness and gentle warning to users on installing a package from that channel 264326 http://pear.php.net/get/PEAR-1.4.0a12
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/pear/deps.1.4.0a12.txt", 'a:3:{s:8:"required";a:4:{s:3:"php";a:2:{s:3:"min";s:3:"4.2";s:3:"max";s:5:"6.0.0";}s:13:"pearinstaller";a:1:{s:3:"min";s:8:"1.4.0a10";}s:7:"package";a:3:{i:0;a:5:{s:4:"name";s:11:"Archive_Tar";s:7:"channel";s:12:"pear.php.net";s:3:"min";s:3:"1.1";s:11:"recommended";s:5:"1.3.1";s:7:"exclude";s:5:"1.3.0";}i:1;a:4:{s:4:"name";s:14:"Console_Getopt";s:7:"channel";s:12:"pear.php.net";s:3:"min";s:3:"1.2";s:11:"recommended";s:3:"1.2";}i:2;a:4:{s:4:"name";s:7:"XML_RPC";s:7:"channel";s:12:"pear.php.net";s:3:"min";s:8:"1.2.0RC1";s:11:"recommended";s:5:"1.2.2";}}s:9:"extension";a:2:{i:0;a:1:{s:4:"name";s:3:"xml";}i:1;a:1:{s:4:"name";s:4:"pcre";}}}s:8:"optional";a:1:{s:7:"package";a:2:{i:0;a:3:{s:4:"name";s:17:"PEAR_Frontend_Web";s:7:"channel";s:12:"pear.php.net";s:3:"min";s:5:"0.5.0";}i:1;a:3:{s:4:"name";s:17:"PEAR_Frontend_Gtk";s:7:"channel";s:12:"pear.php.net";s:3:"min";s:5:"0.4.0";}}}s:5:"group";a:3:{i:0;a:2:{s:7:"attribs";a:2:{s:4:"hint";s:59:"adds the ability to install packages to a remote ftp server";s:4:"name";s:13:"remoteinstall";}s:7:"package";a:4:{s:4:"name";s:7:"Net_FTP";s:7:"channel";s:12:"pear.php.net";s:3:"min";s:8:"1.3.0RC1";s:11:"recommended";s:5:"1.3.1";}}i:1;a:2:{s:7:"attribs";a:2:{s:4:"hint";s:26:"PEAR\'s web-based installer";s:4:"name";s:12:"webinstaller";}s:7:"package";a:3:{s:4:"name";s:17:"PEAR_Frontend_Web";s:7:"channel";s:12:"pear.php.net";s:3:"min";s:5:"0.5.0";}}i:2;a:2:{s:7:"attribs";a:2:{s:4:"hint";s:30:"PEAR\'s PHP-GTK-based installer";s:4:"name";s:12:"gtkinstaller";}s:7:"package";a:3:{s:4:"name";s:17:"PEAR_Frontend_Gtk";s:7:"channel";s:12:"pear.php.net";s:3:"min";s:5:"0.4.0";}}}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/archive_tar/allreleases.xml", '

Archive_Tar

pear.php.net 1.3.1stable 1.3.0stable 1.2stable 1.1stable 1.0stable 0.10-b1beta 0.9stable 0.4stable 0.3stable
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/archive_tar/1.3.1.xml", '

Archive_Tar

pear.php.net 1.3.1 stable PHP License vblavet Tar file management class This class provides handling of tar files in PHP. It supports creating, listing, extracting and adding to tar files. Gzip support is available if PHP has the zlib extension built-in or loaded. Bz2 compression is also supported with the bz2 extension loaded. 2005-03-17 16:09:16 Correct Bug #3855 15102 http://pear.php.net/get/Archive_Tar-1.3.1
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/archive_tar/deps.1.3.1.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/console_getopt/allreleases.xml", '

Console_Getopt

pear.php.net 1.2stable 1.0stable 0.11beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/console_getopt/1.2.xml", '

Console_Getopt

pear.php.net 1.2 stable PHP License andrei Command-line option parser This is a PHP implementation of "getopt" supporting both short and long options. 2003-12-11 14:26:46 Fix to preserve BC with 1.0 and allow correct behaviour for new users 3370 http://pear.php.net/get/Console_Getopt-1.2
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/console_getopt/deps.1.2.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/xml_rpc/1.4.3.xml", '

XML_RPC

pear.php.net 1.4.3 stable PHP License danielc PHP implementation of the XML-RPC protocol A PEAR-ified version of Useful Inc\'s XML-RPC for PHP. It has support for HTTP/HTTPS transport, proxies and authentication. 2005-09-24 14:22:55 * Make XML_RPC_encode() properly handle dateTime.iso8601. Request 5117. 27198 http://pear.php.net/get/XML_RPC-1.4.3
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/xml_rpc/deps.1.4.3.txt", 'a:1:{s:8:"required";a:2:{s:3:"php";a:1:{s:3:"min";s:5:"4.2.0";}s:13:"pearinstaller";a:1:{s:3:"min";s:7:"1.4.0a1";}}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/pear_frontend_web/allreleases.xml", '

PEAR_Frontend_Web

pear.php.net 0.5.0alpha 0.4beta 0.3beta 0.2.2beta 0.2.1beta 0.2beta 0.1beta
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/pear_frontend_web/0.5.0.xml", '

PEAR_Frontend_Web

pear.php.net 0.5.0 alpha PHP License pajoye HTML (Web) PEAR Installer Web Interface to the PEAR Installer 2006-03-01 22:53:24 Major features addition: channel support Also, support for post-install scripts on install, and package.xml 2.0 38606 http://pear.php.net/get/PEAR_Frontend_Web-0.5.0
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/pear_frontend_web/deps.0.5.0.txt", 'a:3:{i:1;a:3:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:4:"name";s:20:"Net_UserAgent_Detect";}i:2;a:3:{s:4:"type";s:3:"pkg";s:3:"rel";s:3:"has";s:4:"name";s:16:"HTML_Template_IT";}i:3;a:4:{s:4:"type";s:3:"pkg";s:3:"rel";s:2:"ge";s:7:"version";s:7:"1.4.0a1";s:4:"name";s:4:"PEAR";}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/pear_frontend_gtk/allreleases.xml", '

PEAR_Frontend_Gtk

pear.php.net 0.4.0beta 0.3beta 0.2snapshot 0.1snapshot
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/pear_frontend_gtk/0.4.0.xml", '

PEAR_Frontend_Gtk

pear.php.net 0.4.0 beta PHP License alan_k Gtk (Desktop) PEAR Package Manager Desktop Interface to the PEAR Package Manager, Requires PHP-GTK 2005-03-14 02:22:46 Implement channels, support PEAR 1.4.0 (Greg Beaver) Tidy up logging a little. 69762 http://pear.php.net/get/PEAR_Frontend_Gtk-0.4.0
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/pear_frontend_gtk/deps.0.4.0.txt", 'b:0;', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/pear/1.4.8.xml", '

PEAR

pear.php.net 1.4.8 stable PHP License cellog PEAR Base System The PEAR package contains: * the PEAR installer, for creating, distributing and installing packages * the beta-quality PEAR_Exception PHP5 error handling mechanism * 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 of common operations with files and directories * the PEAR base class New features in a nutshell: * full support for channels * pre-download dependency validation * new package.xml 2.0 format allows tremendous flexibility while maintaining BC * support for optional dependency groups and limited support for sub-packaging * robust dependency support * full dependency validation on uninstall * remote install for hosts with only ftp access - no more problems with restricted host installation * full support for mirroring * support for bundling several packages into a single tarball * support for static dependencies on a url-based package * support for custom file roles and installation tasks NOTE: users of PEAR_Frontend_Web/PEAR_Frontend_Gtk must upgrade their installations to the latest version, or PEAR will not upgrade properly 2006-03-05 15:22:14 CRITICAL BUGFIX RELEASE Channels with "-" in their name were suddenly invalid, and caused crashes in many places due to improper error handling * fix Bug #6960: channels are not allowed to have "-" in their name * fix critical Bug #6969: PEAR list-upgrades crashes * fix Bug #6991: Class \'PEAR_PackageFile_v1\' not found in Registry.php at line 1657 * fix Bug #7008: PEAR_Frontend::setFrontendObject doesn\'t set the object * fix Bug #7015: install a package.tgz with unknown channel, fatal error in PEAR/Registry.php * fix Bug #7020: tests/PEAR_Registry/api1_1/test_getChannelValidator.phpt crashes PEAR 283109 http://pear.php.net/get/PEAR-1.4.8
', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/pear/deps.1.4.8.txt", 'a:3:{s:8:"required";a:4:{s:3:"php";a:1:{s:3:"min";s:3:"4.2";}s:13:"pearinstaller";a:1:{s:3:"min";s:8:"1.4.0a12";}s:7:"package";a:4:{i:0;a:5:{s:4:"name";s:11:"Archive_Tar";s:7:"channel";s:12:"pear.php.net";s:3:"min";s:3:"1.1";s:11:"recommended";s:5:"1.3.1";s:7:"exclude";s:5:"1.3.0";}i:1;a:4:{s:4:"name";s:14:"Console_Getopt";s:7:"channel";s:12:"pear.php.net";s:3:"min";s:3:"1.2";s:11:"recommended";s:3:"1.2";}i:2;a:5:{s:4:"name";s:17:"PEAR_Frontend_Web";s:7:"channel";s:12:"pear.php.net";s:3:"max";s:5:"0.5.0";s:7:"exclude";s:5:"0.5.0";s:9:"conflicts";s:0:"";}i:3;a:5:{s:4:"name";s:17:"PEAR_Frontend_Gtk";s:7:"channel";s:12:"pear.php.net";s:3:"max";s:5:"0.4.0";s:7:"exclude";s:5:"0.4.0";s:9:"conflicts";s:0:"";}}s:9:"extension";a:2:{i:0;a:1:{s:4:"name";s:3:"xml";}i:1;a:1:{s:4:"name";s:4:"pcre";}}}s:8:"optional";a:1:{s:7:"package";a:3:{s:4:"name";s:7:"XML_RPC";s:7:"channel";s:12:"pear.php.net";s:3:"min";s:5:"1.4.0";}}s:5:"group";a:3:{i:0;a:2:{s:7:"attribs";a:2:{s:4:"hint";s:26:"PEAR\'s web-based installer";s:4:"name";s:12:"webinstaller";}s:7:"package";a:3:{s:4:"name";s:17:"PEAR_Frontend_Web";s:7:"channel";s:12:"pear.php.net";s:3:"min";s:5:"0.5.0";}}i:1;a:2:{s:7:"attribs";a:2:{s:4:"hint";s:30:"PEAR\'s PHP-GTK-based installer";s:4:"name";s:12:"gtkinstaller";}s:7:"package";a:3:{s:4:"name";s:17:"PEAR_Frontend_Gtk";s:7:"channel";s:12:"pear.php.net";s:3:"min";s:5:"0.4.0";}}i:2;a:2:{s:7:"attribs";a:2:{s:4:"hint";s:31:"PEAR\'s PHP-GTK2-based installer";s:4:"name";s:13:"gtk2installer";}s:7:"package";a:2:{s:4:"name";s:18:"PEAR_Frontend_Gtk2";s:7:"channel";s:12:"pear.php.net";}}}}', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/archive_tar/info.xml", '

Archive_Tar pear.php.net File Formats PHP License Tar file management class This class provides handling of tar files in PHP. It supports creating, listing, extracting and adding to tar files. Gzip support is available if PHP has the zlib extension built-in or loaded. Bz2 compression is also supported with the bz2 extension loaded.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/console_getopt/info.xml", '

Console_Getopt pear.php.net Console PHP License Command-line option parser This is a PHP implementation of "getopt" supporting both short and long options.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/xml_rpc/info.xml", '

XML_RPC pear.php.net Web Services PHP License PHP implementation of the XML-RPC protocol A PEAR-ified version of Useful Inc\'s XML-RPC for PHP. It has support for HTTP/HTTPS transport, proxies and authentication.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/pear/info.xml", '

PEAR pear.php.net PEAR PHP License PEAR Base System The PEAR package contains: * the PEAR installer, for creating, distributing and installing packages * the beta-quality PEAR_Exception PHP5 error handling mechanism * 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 of common operations with files and directories * the PEAR base class New features in a nutshell: * full support for channels * pre-download dependency validation * new package.xml 2.0 format allows tremendous flexibility while maintaining BC * support for optional dependency groups and limited support for sub-packaging * robust dependency support * full dependency validation on uninstall * remote install for hosts with only ftp access - no more problems with restricted host installation * full support for mirroring * support for bundling several packages into a single tarball * support for static dependencies on a url-based package * support for custom file roles and installation tasks NOTE: users of PEAR_Frontend_Web/PEAR_Frontend_Gtk must upgrade their installations to the latest version, or PEAR will not upgrade properly

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/packages.xml", ' pear.php.net

Archive_Tar

Archive_Zip

Auth

Auth_HTTP

Auth_PrefManager

Auth_PrefManager2

Auth_RADIUS

Auth_SASL

Benchmark

Cache

Cache_Lite

Calendar

CodeGen

CodeGen_MySQL

CodeGen_MySQL_Plugin

CodeGen_MySQL_UDF

CodeGen_PECL

Config

Console_Color

Console_Getargs

Console_Getopt

Console_ProgressBar

Console_Table

Contact_AddressBook

Contact_Vcard_Build

Contact_Vcard_Parse

Crypt_Blowfish

Crypt_CBC

Crypt_CHAP

Crypt_HMAC

Crypt_RC4

Crypt_RSA

Crypt_Xtea

Crypt_XXTEA

Date

Date_Holidays

DB

DBA

DBA_Relational

DB_ado

DB_DataObject

DB_DataObject_FormBuilder

DB_ldap

DB_ldap2

DB_NestedSet

DB_odbtp

DB_Pager

DB_QueryTool

DB_Sqlite_Tools

DB_Table

Event_Dispatcher

File

File_Archive

File_Bittorrent

File_DICOM

File_DNS

File_Find

File_Fortune

File_Fstab

File_Gettext

File_HtAccess

File_IMC

File_MARC

File_Ogg

File_Passwd

File_PDF

File_SearchReplace

File_SMBPasswd

File_XSPF

FSM

Games_Chess

Genealogy_Gedcom

Gtk2_EntryDialog

Gtk2_ExceptionDump

Gtk2_FileDrop

Gtk2_IndexedComboBox

Gtk2_PHPConfig

Gtk2_ScrollingLabel

Gtk2_VarDump

Gtk_FileDrop

Gtk_MDB_Designer

Gtk_ScrollingLabel

Gtk_Styled

Gtk_VarDump

HTML_AJAX

HTML_BBCodeParser

HTML_Common

HTML_Common2

HTML_Crypt

HTML_CSS

HTML_Form

HTML_Javascript

HTML_Menu

HTML_Page

HTML_Page2

HTML_Progress

HTML_Progress2

HTML_QuickForm

HTML_QuickForm2

HTML_QuickForm_advmultiselect

HTML_QuickForm_altselect

HTML_QuickForm_CAPTCHA

HTML_QuickForm_Controller

HTML_QuickForm_DHTMLRulesTableless

HTML_QuickForm_ElementGrid

HTML_QuickForm_Livesearch

HTML_QuickForm_Renderer_Tableless

HTML_QuickForm_SelectFilter

HTML_Safe

HTML_Select

HTML_Select_Common

HTML_Table

HTML_Table_Matrix

HTML_TagCloud

HTML_Template_Flexy

HTML_Template_IT

HTML_Template_PHPLIB

HTML_Template_Sigma

HTML_Template_Xipe

HTML_TreeMenu

HTTP

HTTP_Client

HTTP_Download

HTTP_FloodControl

HTTP_Header

HTTP_Request

HTTP_Server

HTTP_Session

HTTP_Session2

HTTP_SessionServer

HTTP_Upload

HTTP_WebDAV_Client

HTTP_WebDAV_Server

I18N

I18Nv2

I18N_UnicodeString

Image_3D

Image_Barcode

Image_Canvas

Image_Color

Image_Color2

Image_GIS

Image_Graph

Image_GraphViz

Image_IPTC

Image_MonoBMP

Image_Puzzle

Image_Remote

Image_Text

Image_Tools

Image_Transform

Image_WBMP

Image_XBM

Inline_C

LiveUser

LiveUser_Admin

Log

Mail

Mail_IMAP

Mail_IMAPv2

Mail_Mbox

Mail_Mime

Mail_mimeDecode

Mail_Queue

Math_Basex

Math_BigInteger

Math_BinaryUtils

Math_Complex

Math_Derivative

Math_Fibonacci

Math_Finance

Math_Fraction

Math_Histogram

Math_Integer

Math_Matrix

Math_Numerical_RootFinding

Math_Polynomial

Math_Quaternion

Math_RPN

Math_Stats

Math_TrigOp

Math_Vector

MDB

MDB2

MDB2_Driver_fbsql

MDB2_Driver_ibase

MDB2_Driver_mssql

MDB2_Driver_mysql

MDB2_Driver_mysqli

MDB2_Driver_oci8

MDB2_Driver_pgsql

MDB2_Driver_querysim

MDB2_Driver_sqlite

MDB2_Schema

MDB2_Table

MDB_QueryTool

Message

MIME_Type

MP3_Id

MP3_IDv2

MP3_Playlist

Net_CDDB

Net_CheckIP

Net_Curl

Net_Cyrus

Net_Dict

Net_Dig

Net_DIME

Net_DNS

Net_DNSBL

Net_Finger

Net_FTP

Net_FTP2

Net_GameServerQuery

Net_Geo

Net_GeoIP

Net_Growl

Net_HL7

Net_Ident

Net_IDNA

Net_IMAP

Net_IPv4

Net_IPv6

Net_IRC

Net_LDAP

Net_LMTP

Net_MAC

Net_Monitor

Net_MPD

Net_NNTP

Net_Ping

Net_POP3

Net_Portscan

Net_Server

Net_Sieve

Net_SmartIRC

Net_SMPP

Net_SMPP_Client

Net_SMS

Net_SMTP

Net_Socket

Net_Traceroute

Net_URL

Net_UserAgent_Detect

Net_UserAgent_Mobile

Net_Whois

Net_Wifi

Numbers_Roman

Numbers_Words

OLE

OpenDocument

Pager

Pager_Sliding

Payment_Clieop

Payment_DTA

Payment_Process

PEAR

pearweb

pearweb_channelxml

pearweb_phars

PEAR_Command_Packaging

PEAR_Delegator

PEAR_ErrorStack

PEAR_Frontend_Gtk

PEAR_Frontend_Gtk2

PEAR_Frontend_Web

PEAR_Info

PEAR_PackageFileManager

PEAR_PackageFileManager_Frontend

PEAR_PackageFileManager_Frontend_Web

PEAR_PackageFileManager_GUI_Gtk

PEAR_PackageUpdate

PEAR_PackageUpdate_Gtk2

PEAR_PackageUpdate_Web

PEAR_RemoteInstaller

PHPDoc

PhpDocumentor

PHP_Annotation

PHP_Archive

PHP_Beautifier

PHP_CodeSniffer

PHP_Compat

PHP_CompatInfo

PHP_Fork

PHP_LexerGenerator

PHP_Parser

PHP_ParserGenerator

PHP_Parser_DocblockParser

PHP_Shell

QA_Peardoc_Coverage

RDF

RDF_N3

RDF_NTriple

RDF_RDQL

Science_Chemistry

ScriptReorganizer

Search_Mnogosearch

Services_Amazon

Services_Blogging

Services_Delicious

Services_DynDNS

Services_Ebay

Services_ExchangeRates

Services_Google

Services_Hatena

Services_OpenSearch

Services_Pingback

Services_Technorati

Services_Trackback

Services_W3C_HTMLValidator

Services_Weather

Services_Webservice

Services_Yahoo

Services_YouTube

SOAP

SOAP_Interop

Spreadsheet_Excel_Writer

SQL_Parser

Stream_SHM

Stream_Var

Structures_BibTex

Structures_DataGrid

Structures_DataGrid_DataSource_Array

Structures_DataGrid_DataSource_CSV

Structures_DataGrid_DataSource_DataObject

Structures_DataGrid_DataSource_DB

Structures_DataGrid_DataSource_DBQuery

Structures_DataGrid_DataSource_DBTable

Structures_DataGrid_DataSource_Excel

Structures_DataGrid_DataSource_MDB2

Structures_DataGrid_DataSource_RSS

Structures_DataGrid_DataSource_XML

Structures_DataGrid_Renderer_Console

Structures_DataGrid_Renderer_CSV

Structures_DataGrid_Renderer_Flexy

Structures_DataGrid_Renderer_HTMLSortForm

Structures_DataGrid_Renderer_HTMLTable

Structures_DataGrid_Renderer_Pager

Structures_DataGrid_Renderer_Smarty

Structures_DataGrid_Renderer_XLS

Structures_DataGrid_Renderer_XML

Structures_DataGrid_Renderer_XUL

Structures_Form

Structures_Form_Gtk2

Structures_Graph

Structures_LinkedList

System_Command

System_Folders

System_Mount

System_ProcWatch

System_SharedMemory

System_Socket

System_WinDrives

Testing_Selenium

Text_CAPTCHA

Text_CAPTCHA_Numeral

Text_Diff

Text_Figlet

Text_Highlighter

Text_Huffman

Text_LanguageDetect

Text_Password

Text_PathNavigator

Text_Statistics

Text_TeXHyphen

Text_Wiki

Text_Wiki_BBCode

Text_Wiki_Cowiki

Text_Wiki_Creole

Text_Wiki_Doku

Text_Wiki_Mediawiki

Text_Wiki_Tiki

Translation

Translation2

Tree

UDDI

Validate

Validate_AR

Validate_AT

Validate_AU

Validate_BE

Validate_CA

Validate_CH

Validate_DE

Validate_DK

Validate_ES

Validate_FI

Validate_Finance

Validate_Finance_CreditCard

Validate_FR

Validate_IN

Validate_IS

Validate_ISPN

Validate_IT

Validate_LV

Validate_NL

Validate_NZ

Validate_PL

Validate_ptBR

Validate_UK

Validate_US

Validate_ZA

Var_Dump

VersionControl_SVN

VFS

XML_Beautifier

XML_CSSML

XML_DB_eXist

XML_DTD

XML_FastCreate

XML_Feed_Parser

XML_fo2pdf

XML_FOAF

XML_HTMLSax

XML_HTMLSax3

XML_image2svg

XML_Indexing

XML_MXML

XML_NITF

XML_Parser

XML_Query2XML

XML_RDDL

XML_RPC

XML_RPC2

XML_RSS

XML_SaxFilters

XML_Serializer

XML_sql2xml

XML_Statistics

XML_SVG

XML_svg2image

XML_Transformer

XML_Tree

XML_Util

XML_Wddx

XML_XPath

XML_XSLT_Wrapper

XML_XUL

', 'text/xml'); $_test_dep->setPHPVersion('4.3.10'); $_test_dep->setPEARVersion('1.4.8'); $_test_dep->setExtensions(array('xml' => 0, 'pcre' => 1)); $command->run('install', array(), array($dir . 'PEAR-1.4.8.tgz', $dir . 'Console_Getopt-1.2.tgz', $dir . 'Archive_Tar-1.3.1.tgz', $dir . 'XML_RPC-1.4.3.tgz')); $phpunit->assertNoErrors('setup'); $phpunit->assertEquals(4, count($reg->listPackages()), 'num packages'); $fakelog->getLog(); $fakelog->getDownload(); unset($GLOBALS['__Stupid_php4_a']); // reset downloader $command->run('upgrade', array(), array('PEAR-alpha')); $phpunit->assertNoErrors('full test'); $phpunit->assertEquals(array ( 0 => array ( 'info' => 'Nothing to upgrade', 'cmd' => 'no command', ), ), $fakelog->getLog(), 'bug part'); $phpunit->assertEquals(array(), $fakelog->getDownload(), 'download bug part'); echo 'tests done'; ?> --CLEAN-- --EXPECT-- tests done php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Mirror/000077500000000000000000000000001262614675700235225ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Mirror/download-all/000077500000000000000000000000001262614675700260775ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Mirror/download-all/packages/000077500000000000000000000000001262614675700276555ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Mirror/download-all/packages/APC.xml000066400000000000000000000014441262614675700310050ustar00rootroot00000000000000 APC APC pear APC pear cellog lead Greg Beaver cellog@php.net 1.4.0a1 2004-10-21 PHP License alpha hi php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Mirror/download-all/packages/APCsmoog.xml000066400000000000000000000022121262614675700320440ustar00rootroot00000000000000 APC smoog APC smoog APC smoog Greg Beaver cellog cellog@php.net yes 2004-09-30 1.5.0a1 1.4.0 alpha alpha PHP License stuff 4.2.0 6.0.0 1.4.0dev13 php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Mirror/download-all/packages/APCstable.xml000066400000000000000000000014431262614675700321770ustar00rootroot00000000000000 APC APC pear APC pear cellog lead Greg Beaver cellog@php.net 1.3.0 2004-09-21 PHP License stable hi php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Mirror/download-all/packages/Archive_Tar.xml000066400000000000000000000022351262614675700325700ustar00rootroot00000000000000 Archive_Tar pear.php.net Archive_Tar Archive_Tar Greg Beaver cellog cellog@php.net yes 2004-10-30 1.5.0a1 1.4.0 alpha alpha PHP License stuff 4.2.0 6.0.0 1.4.0dev13 php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Mirror/download-all/packages/foo.php000066400000000000000000000000111262614675700311410ustar00rootroot00000000000000 php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Mirror/download-all/packages/package.xml000077500000000000000000000023421262614675700317760ustar00rootroot00000000000000 APC smoog APC smoog APC smoog Greg Beaver cellog cellog@php.net yes 2004-12-31 1.5.0a1 1.4.0 alpha alpha PHP License stuff 4.2.0 6.0.0 1.4.0dev13 php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Mirror/download-all/test_normal_alpha_rest.phpt000077500000000000000000000263021262614675700335330ustar00rootroot00000000000000--TEST-- download-all command, preferred_state = alpha (REST) --SKIPIF-- --FILE-- getRegistry(); $chan = $reg->getChannel('pear.php.net'); $chan->setBaseURL('REST1.0', 'http://pear.php.net/rest/'); $reg->updateChannel($chan); $ch = new PEAR_ChannelFile; $ch->setName('smoog'); $ch->setBaseURL('REST1.0', 'http://smoog/rest/'); $ch->setSummary('smoog'); $reg->addChannel($ch); $packageDir = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'packages' . DIRECTORY_SEPARATOR; $pathtoStableAPC = $packageDir . 'APC-1.3.0.tgz'; $pathtoAlphaAPC = $packageDir . 'APC-1.4.0a1.tgz'; $pathtoSmoogAPC = $packageDir . 'APC-1.5.0a1.tgz'; $pathtoAT = $packageDir . 'Archive_Tar-1.5.0a1.tgz'; $pearweb->addHtmlConfig('http://pear.php.net/get/APC-1.3.0.tgz', $pathtoStableAPC); $pearweb->addHtmlConfig('http://pear.php.net/get/APC-1.4.0a1.tgz', $pathtoAlphaAPC); $pearweb->addHtmlConfig('http://pear.php.net/get/Archive_Tar-1.5.0a1.tgz', $pathtoAT); $pearweb->addHtmlConfig('http://smoog/get/APC-1.5.0a1.tgz', $pathtoSmoogAPC); $pearweb->addRESTConfig('http://smoog/rest/p/packages.xml', ' smoog

APC

', 'text/xml'); $pearweb->addRESTConfig('http://pear.php.net/rest/r/apc/allreleases.xml', '

APC

pear.php.net 1.4.0a1alpha 1.3.0stable
', 'text/xml'); $pearweb->addRESTConfig('http://pear.php.net/rest/r/archive_tar/allreleases.xml', '

Archive_Tar

pear.php.net 1.5.0a1alpha
', 'text/xml'); $pearweb->addRESTConfig('http://smoog/rest/r/apc/allreleases.xml', '

APC

smoog 1.5.0a1alpha
', 'text/xml'); $pearweb->addRESTConfig('http://smoog/rest/r/apc/1.5.0a1.xml', '

APC

smoog 1.5.0a1 alpha PHP License rasmus Alternative PHP Cache APC is the Alternative PHP Cache. It was conceived of to provide a free, open, and robust framework for caching and optimizing PHP intermediate code. 2005-04-17 18:40:51 Release notes 252733 http://smoog/get/APC-1.5.a1
', 'text/xml'); $pearweb->addRESTConfig('http://pear.php.net/rest/r/apc/1.3.0.xml', '

APC

pear.php.net 1.3.0 stable PHP License rasmus Alternative PHP Cache APC is the Alternative PHP Cache. It was conceived of to provide a free, open, and robust framework for caching and optimizing PHP intermediate code. 2005-04-17 18:40:51 Release notes 252733 http://pear.php.net/get/APC-1.3.0
', 'text/xml'); $pearweb->addRESTConfig('http://pear.php.net/rest/r/apc/1.4.0a1.xml', '

APC

pear.php.net 1.4.0a1 alpha PHP License rasmus Alternative PHP Cache APC is the Alternative PHP Cache. It was conceived of to provide a free, open, and robust framework for caching and optimizing PHP intermediate code. 2006-04-17 18:40:51 Release notes 262733 http://pear.php.net/get/APC-1.4.0a1
', 'text/xml'); $pearweb->addRESTConfig('http://pear.php.net/rest/r/archive_tar/1.5.0a1.xml', '

Archive_Tar

pear.php.net 1.5.0a1 alpha PHP License cellog Tar file management class This class provides handling of tar files in PHP. It supports creating, listing, extracting and adding to tar files. Gzip support is available if PHP has the zlib extension built-in or loaded. Bz2 compression is also supported with the bz2 extension loaded. 2007-01-03 16:32:15 Correct Bug #4016 Remove duplicate remove error display with "@" Correct Bug #3909 : Check existence of OS_WINDOWS constant Correct Bug #5452 fix for "lone zero block" when untarring packages Change filemode (from pear-core/Archive/Tar.php v.1.21) Correct Bug #6486 Can not extract symlinks Correct Bug #6933 Archive_Tar (Tar file management class) Directory traversal Correct Bug #8114 Files added on-the-fly not storing date Correct Bug #9352 Bug on _dirCheck function over nfs path 17150 http://pear.php.net/get/Archive_Tar-1.5.0a1
', 'text/xml'); $pearweb->addRESTConfig("http://smoog/rest/r/apc/deps.1.5.0a1.txt", 'a:1:{s:8:"required";a:2:{s:3:"php";a:2:{s:3:"min";s:3:"4.2";s:3:"max";s:5:"6.0.0";}s:13:"pearinstaller";a:1:{s:3:"min";s:7:"1.4.0dev13";}}}', 'text/plain'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/apc/deps.1.3.0.txt", 'b:0;', 'text/plain'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/apc/deps.1.4.0a1.txt", 'b:0;', 'text/plain'); $pearweb->addRESTConfig('http://pear.php.net/rest/r/archive_tar/deps.1.5.0a1.txt', 'a:1:{s:8:"required";a:2:{s:3:"php";a:1:{s:3:"min";s:5:"4.0.0";}s:13:"pearinstaller";a:1:{s:3:"min";s:7:"1.4.0b1";}}}', 'text/plain'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/packages.xml", ' pear.php.net

Archive_Tar

APC

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/apc/info.xml", '

APC pear.php.net File Formats PHP License Zip file management class This class provides handling of zip files in PHP. It supports creating, listing, extracting and adding to zip files.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/archive_tar/info.xml", '

Archive_Tar pear.php.net File Formats PHP License Tar file management class This class provides handling of tar files in PHP. It supports creating, listing, extracting and adding to tar files. Gzip support is available if PHP has the zlib extension built-in or loaded. Bz2 compression is also supported with the bz2 extension loaded.

', 'text/xml'); $config->set('preferred_state', 'alpha'); $save = getcwd(); chdir($temp_path); $e = $command->run('download-all', array(), array()); $phpunit->assertNoErrors('after'); $phpunit->showall(); $phpunit->assertEquals(array ( array ( 'info' => 'Using Channel pear.php.net', 'cmd' => 'no command', ), array ( 'info' => 'Using Preferred State of alpha', 'cmd' => 'no command', ), array ( 'info' => 'Gathering release information, please wait...', 'cmd' => 'no command', ), array ( 0 => 3, 1 => 'Downloading "http://pear.php.net/get/Archive_Tar-1.5.0a1.tgz"', ), array ( 0 => 1, 1 => 'downloading Archive_Tar-1.5.0a1.tgz ...', ), array ( 0 => 1, 1 => 'Starting to download Archive_Tar-1.5.0a1.tgz (687 bytes)', ), array ( 0 => 1, 1 => '.', ), array ( 0 => 1, 1 => '...done: 687 bytes', ), array ( 0 => 3, 1 => 'Downloading "http://pear.php.net/get/APC-1.4.0a1.tgz"', ), array ( 0 => 1, 1 => 'downloading APC-1.4.0a1.tgz ...', ), array ( 0 => 1, 1 => 'Starting to download APC-1.4.0a1.tgz (514 bytes)', ), array ( 0 => 1, 1 => '...done: 514 bytes', ), array ( 'info' => 'File ' . $temp_path . DIRECTORY_SEPARATOR . 'Archive_Tar-1.5.0a1.tgz downloaded', 'cmd' => 'download', ), array ( 'info' => 'File ' . $temp_path . DIRECTORY_SEPARATOR . 'APC-1.4.0a1.tgz downloaded', 'cmd' => 'download', ), ), $fakelog->getLog(), 'log'); $phpunit->assertFileExists($temp_path . DIRECTORY_SEPARATOR . 'APC-1.4.0a1.tgz', 'APC 1.4.0a1'); $phpunit->assertFileExists($temp_path . DIRECTORY_SEPARATOR . 'Archive_Tar-1.5.0a1.tgz', 'Archive_Tar 1.5.0a1'); $phpunit->assertEquals(array ( 0 => array ( 0 => 'http://pear.php.net/rest/p/packages.xml', 1 => '200', ), 1 => array ( 0 => 'http://pear.php.net/rest/r/archive_tar/allreleases.xml', 1 => '200', ), 2 => array ( 0 => 'http://pear.php.net/rest/p/archive_tar/info.xml', 1 => '200', ), 3 => array ( 0 => 'http://pear.php.net/rest/r/archive_tar/1.5.0a1.xml', 1 => '200', ), 4 => array ( 0 => 'http://pear.php.net/rest/r/archive_tar/deps.1.5.0a1.txt', 1 => '200', ), 5 => array ( 0 => 'http://pear.php.net/rest/r/apc/allreleases.xml', 1 => '200', ), 6 => array ( 0 => 'http://pear.php.net/rest/p/apc/info.xml', 1 => '200', ), 7 => array ( 0 => 'http://pear.php.net/rest/r/apc/1.4.0a1.xml', 1 => '200', ), 8 => array ( 0 => 'http://pear.php.net/rest/r/apc/deps.1.4.0a1.txt', 1 => '200', ), ) , $pearweb->getRESTCalls(), 'rest calls'); chdir($save); echo 'tests done'; ?> --CLEAN-- --EXPECT-- tests done test_normal_channel_rest.phpt000077500000000000000000000266321262614675700340050ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Mirror/download-all--TEST-- download-all command, --channel option (REST) --SKIPIF-- --FILE-- getRegistry(); $chan = $reg->getChannel('pear.php.net'); $chan->setBaseURL('REST1.0', 'http://pear.php.net/rest/'); $reg->updateChannel($chan); $ch = new PEAR_ChannelFile; $ch->setName('smoog'); $ch->setBaseURL('REST1.0', 'http://smoog/rest/'); $ch->setSummary('smoog'); $reg->addChannel($ch); $packageDir = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'packages' . DIRECTORY_SEPARATOR; $pathtoStableAPC = $packageDir . 'APC-1.3.0.tgz'; $pathtoAlphaAPC = $packageDir . 'APC-1.4.0a1.tgz'; $pathtoSmoogAPC = $packageDir . 'APC-1.5.0a1.tgz'; $pathtoAT = $packageDir . 'Archive_Tar-1.5.0a1.tgz'; $pearweb->addHtmlConfig('http://pear.php.net/get/APC-1.3.0.tgz', $pathtoStableAPC); $pearweb->addHtmlConfig('http://pear.php.net/get/APC-1.4.0a1.tgz', $pathtoAlphaAPC); $pearweb->addHtmlConfig('http://pear.php.net/get/Archive_Tar-1.5.0a1.tgz', $pathtoAT); $pearweb->addHtmlConfig('http://smoog/get/APC-1.5.0a1.tgz', $pathtoSmoogAPC); $pearweb->addRESTConfig('http://smoog/rest/p/packages.xml', ' smoog

APC

', 'text/xml'); $pearweb->addRESTConfig('http://pear.php.net/rest/r/apc/allreleases.xml', '

APC

pear.php.net 1.4.0a1alpha 1.3.0stable
', 'text/xml'); $pearweb->addRESTConfig('http://pear.php.net/rest/r/archive_tar/allreleases.xml', '

Archive_Tar

pear.php.net 1.5.0a1alpha
', 'text/xml'); $pearweb->addRESTConfig('http://smoog/rest/r/apc/allreleases.xml', '

APC

smoog 1.5.0a1alpha
', 'text/xml'); $pearweb->addRESTConfig('http://smoog/rest/r/apc/1.5.0a1.xml', '

APC

smoog 1.5.0a1 alpha PHP License rasmus Alternative PHP Cache APC is the Alternative PHP Cache. It was conceived of to provide a free, open, and robust framework for caching and optimizing PHP intermediate code. 2005-04-17 18:40:51 Release notes 252733 http://smoog/get/APC-1.5.0a1
', 'text/xml'); $pearweb->addRESTConfig('http://pear.php.net/rest/r/apc/1.3.0.xml', '

APC

pear.php.net 1.3.0 stable PHP License rasmus Alternative PHP Cache APC is the Alternative PHP Cache. It was conceived of to provide a free, open, and robust framework for caching and optimizing PHP intermediate code. 2005-04-17 18:40:51 Release notes 252733 http://pear.php.net/get/APC-1.3.0
', 'text/xml'); $pearweb->addRESTConfig('http://pear.php.net/rest/r/apc/1.4.0a1.xml', '

APC

pear.php.net 1.4.0a1 alpha PHP License rasmus Alternative PHP Cache APC is the Alternative PHP Cache. It was conceived of to provide a free, open, and robust framework for caching and optimizing PHP intermediate code. 2006-04-17 18:40:51 Release notes 262733 http://pear.php.net/get/APC-1.4.0a1
', 'text/xml'); $pearweb->addRESTConfig('http://pear.php.net/rest/r/archive_tar/1.5.0a1.xml', '

Archive_Tar

pear.php.net 1.5.0a1 alpha PHP License cellog Tar file management class This class provides handling of tar files in PHP. It supports creating, listing, extracting and adding to tar files. Gzip support is available if PHP has the zlib extension built-in or loaded. Bz2 compression is also supported with the bz2 extension loaded. 2007-01-03 16:32:15 Correct Bug #4016 Remove duplicate remove error display with "@" Correct Bug #3909 : Check existence of OS_WINDOWS constant Correct Bug #5452 fix for "lone zero block" when untarring packages Change filemode (from pear-core/Archive/Tar.php v.1.21) Correct Bug #6486 Can not extract symlinks Correct Bug #6933 Archive_Tar (Tar file management class) Directory traversal Correct Bug #8114 Files added on-the-fly not storing date Correct Bug #9352 Bug on _dirCheck function over nfs path 17150 http://pear.php.net/get/Archive_Tar-1.5.0a1
', 'text/xml'); $pearweb->addRESTConfig("http://smoog/rest/r/apc/deps.1.5.0a1.txt", 'a:1:{s:8:"required";a:2:{s:3:"php";a:1:{s:3:"min";s:5:"5.1.0";}s:13:"pearinstaller";a:1:{s:3:"min";s:5:"1.4.0";}}}', 'text/plain'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/apc/deps.1.3.0.txt", 'b:0;', 'text/plain'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/apc/deps.1.4.0a1.txt", 'b:0;', 'text/plain'); $pearweb->addRESTConfig('http://pear.php.net/rest/r/archive_tar/deps.1.5.0a1.txt', 'a:1:{s:8:"required";a:2:{s:3:"php";a:1:{s:3:"min";s:5:"4.0.0";}s:13:"pearinstaller";a:1:{s:3:"min";s:7:"1.4.0b1";}}}', 'text/plain'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/packages.xml", ' pear.php.net

Archive_Tar

APC

', 'text/xml'); $pearweb->addRESTConfig("http://smoog/rest/p/apc/info.xml", '

APC smoog Caching PHP License Alternative PHP Cache APC is a free, open, and robust framework for caching and optimizing PHP intermediate code.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/apc/info.xml", '

APC pear.php.net Caching PHP License Alternative PHP Cache APC is a free, open, and robust framework for caching and optimizing PHP intermediate code.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/archive_tar/info.xml", '

Archive_Tar pear.php.net File Formats PHP License Tar file management class This class provides handling of tar files in PHP. It supports creating, listing, extracting and adding to tar files. Gzip support is available if PHP has the zlib extension built-in or loaded. Bz2 compression is also supported with the bz2 extension loaded.

', 'text/xml'); $_test_dep->setPEARVersion('1.4.0a1'); $_test_dep->setPHPVersion('4.3.11'); $save = getcwd(); chdir($temp_path); $config->set('preferred_state', 'stable'); $e = $command->run('download-all', array('channel' => 'smoog'), array()); $phpunit->assertNoErrors('after 1'); $phpunit->assertEquals(array ( 0 => array ( 'info' => 'Using Channel smoog', 'cmd' => 'no command', ), 1 => array ( 'info' => 'Using Preferred State of stable', 'cmd' => 'no command', ), 2 => array ( 'info' => 'Gathering release information, please wait...', 'cmd' => 'no command', ), 3 => array ( 0 => 0, 1 => 'Failed to download smoog/APC within preferred state "stable", latest release is version 1.5.0a1, stability "alpha", use "channel://smoog/APC-1.5.0a1" to install', ), 4 => array ( 0 => 2, 1 => 'Cannot initialize \'APC\', invalid or missing package file', ), 5 => array ( 0 => 2, 1 => 'Package "APC" is not valid', ), 6 => array ( 'info' => 'download failed', 'cmd' => 'no command', ), ) , $fakelog->getLog(), 'log 1'); $config->set('preferred_state', 'alpha'); $e = $command->run('download-all', array('channel' => 'smoog'), array()); $phpunit->assertNoErrors('after'); $phpunit->assertEquals(array ( 0 => array ( 'info' => 'Using Channel smoog', 'cmd' => 'no command', ), 1 => array ( 'info' => 'Using Preferred State of alpha', 'cmd' => 'no command', ), 2 => array ( 'info' => 'Gathering release information, please wait...', 'cmd' => 'no command', ), array ( 0 => 3, 1 => 'Downloading "http://smoog/get/APC-1.5.0a1.tgz"', ), array ( 0 => 1, 1 => 'downloading APC-1.5.0a1.tgz ...', ), array ( 0 => 1, 1 => 'Starting to download APC-1.5.0a1.tgz (686 bytes)', ), array ( 0 => 1, 1 => '.', ), array ( 0 => 1, 1 => '...done: 686 bytes', ), array ( 'info' => 'File ' . $temp_path . DIRECTORY_SEPARATOR . 'APC-1.5.0a1.tgz downloaded', 'cmd' => 'download', ), ), $fakelog->getLog(), 'log'); $phpunit->assertFileExists($temp_path . DIRECTORY_SEPARATOR . 'APC-1.5.0a1.tgz', 'APC 1.5.0a1'); chdir($save); echo 'tests done'; ?> --CLEAN-- --EXPECT-- tests donephp-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Mirror/download-all/test_normal_rest.phpt000066400000000000000000000225441262614675700323670ustar00rootroot00000000000000--TEST-- download-all command (REST) --SKIPIF-- --FILE-- getRegistry(); $chan = $reg->getChannel('pear.php.net'); $chan->setBaseURL('REST1.0', 'http://pear.php.net/rest/'); $reg->updateChannel($chan); $ch = new PEAR_ChannelFile; $ch->setName('smoog'); $ch->setBaseURL('REST1.0', 'http://smoog/rest/'); $ch->setSummary('smoog'); $reg->addChannel($ch); $packageDir = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'packages' . DIRECTORY_SEPARATOR; $pathtoStableAPC = $packageDir . 'APC-1.3.0.tgz'; $pathtoAlphaAPC = $packageDir . 'APC-1.4.0a1.tgz'; $pathtoSmoogAPC = $packageDir . 'APC-1.5.0a1.tgz'; $pathtoAT = $packageDir . 'Archive_Tar-1.5.0a1.tgz'; $pearweb->addHtmlConfig('http://pear.php.net/get/APC-1.3.0.tgz', $pathtoStableAPC); $pearweb->addHtmlConfig('http://pear.php.net/get/APC-1.4.0a1.tgz', $pathtoAlphaAPC); $pearweb->addHtmlConfig('http://pear.php.net/get/Archive_Tar-1.5.0a1.tgz', $pathtoAT); $pearweb->addHtmlConfig('http://smoog/get/APC-1.5.0a1.tgz', $pathtoSmoogAPC); $pearweb->addRESTConfig('http://smoog/rest/p/packages.xml', ' smoog

APC

', 'text/xml'); $pearweb->addRESTConfig('http://pear.php.net/rest/r/apc/allreleases.xml', '

APC

pear.php.net 1.4.0a1alpha 1.3.0stable
', 'text/xml'); $pearweb->addRESTConfig('http://pear.php.net/rest/r/archive_tar/allreleases.xml', '

Archive_Tar

pear.php.net 1.5.0a1alpha
', 'text/xml'); $pearweb->addRESTConfig('http://smoog/rest/r/apc/allreleases.xml', '

APC

smoog 1.5.0a1alpha
', 'text/xml'); $pearweb->addRESTConfig('http://smoog/rest/r/apc/1.5.0a1.xml', '

APC

smoog 1.5.0a1 alpha PHP License rasmus Alternative PHP Cache APC is the Alternative PHP Cache. It was conceived of to provide a free, open, and robust framework for caching and optimizing PHP intermediate code. 2005-04-17 18:40:51 Release notes 252733 http://smoog/get/APC-1.5.a1
', 'text/xml'); $pearweb->addRESTConfig('http://pear.php.net/rest/r/apc/1.3.0.xml', '

APC

pear.php.net 1.3.0 stable PHP License rasmus Alternative PHP Cache APC is the Alternative PHP Cache. It was conceived of to provide a free, open, and robust framework for caching and optimizing PHP intermediate code. 2005-04-17 18:40:51 Release notes 252733 http://pear.php.net/get/APC-1.3.0
', 'text/xml'); $pearweb->addRESTConfig('http://pear.php.net/rest/r/archive_tar/1.5.0a1.xml', '

Archive_Tar

pear.php.net 1.5.0a1 alpha PHP License cellog Tar file management class This class provides handling of tar files in PHP. It supports creating, listing, extracting and adding to tar files. Gzip support is available if PHP has the zlib extension built-in or loaded. Bz2 compression is also supported with the bz2 extension loaded. 2007-01-03 16:32:15 Correct Bug #4016 Remove duplicate remove error display with "@" Correct Bug #3909 : Check existence of OS_WINDOWS constant Correct Bug #5452 fix for "lone zero block" when untarring packages Change filemode (from pear-core/Archive/Tar.php v.1.21) Correct Bug #6486 Can not extract symlinks Correct Bug #6933 Archive_Tar (Tar file management class) Directory traversal Correct Bug #8114 Files added on-the-fly not storing date Correct Bug #9352 Bug on _dirCheck function over nfs path 17150 http://pear.php.net/get/Archive_Tar-1.5.0a1
', 'text/xml'); $pearweb->addRESTConfig("http://smoog/rest/r/apc/deps.1.5.0a1.txt", 'a:1:{s:8:"required";a:2:{s:3:"php";a:2:{s:3:"min";s:3:"4.2";s:3:"max";s:5:"6.0.0";}s:13:"pearinstaller";a:1:{s:3:"min";s:7:"1.4.0dev13";}}}', 'text/plain'); $pearweb->addRESTConfig("http://pear.php.net/rest/r/apc/deps.1.3.0.txt", 'b:0;', 'text/plain'); $pearweb->addRESTConfig('http://pear.php.net/rest/r/archive_tar/deps.1.5.0a1.txt', 'a:1:{s:8:"required";a:2:{s:3:"php";a:1:{s:3:"min";s:5:"4.0.0";}s:13:"pearinstaller";a:1:{s:3:"min";s:7:"1.4.0b1";}}}', 'text/plain'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/packages.xml", ' pear.php.net

APC

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/apc/info.xml", '

APC pear.php.net File Formats PHP License Zip file management class This class provides handling of zip files in PHP. It supports creating, listing, extracting and adding to zip files.

', 'text/xml'); $pearweb->addRESTConfig("http://pear.php.net/rest/p/archive_tar/info.xml", '

Archive_Tar pear.php.net File Formats PHP License Tar file management class This class provides handling of tar files in PHP. It supports creating, listing, extracting and adding to tar files. Gzip support is available if PHP has the zlib extension built-in or loaded. Bz2 compression is also supported with the bz2 extension loaded.

', 'text/xml'); $config->set('preferred_state', 'stable'); $save = getcwd(); chdir($temp_path); $e = $command->run('download-all', array(), array()); $phpunit->assertNoErrors('after'); $phpunit->showall(); $phpunit->assertEquals(array ( 0 => array ( 'info' => 'Using Channel pear.php.net', 'cmd' => 'no command', ), 1 => array ( 'info' => 'Using Preferred State of stable', 'cmd' => 'no command', ), 2 => array ( 'info' => 'Gathering release information, please wait...', 'cmd' => 'no command', ), array ( 0 => 3, 1 => 'Downloading "http://pear.php.net/get/APC-1.3.0.tgz"', ), array ( 0 => 1, 1 => 'downloading APC-1.3.0.tgz ...', ), array ( 0 => 1, 1 => 'Starting to download APC-1.3.0.tgz (517 bytes)', ), array ( 0 => 1, 1 => '.', ), array ( 0 => 1, 1 => '...done: 517 bytes', ), array ( 'info' => 'File ' . $temp_path . DIRECTORY_SEPARATOR . 'APC-1.3.0.tgz downloaded', 'cmd' => 'download', ), ), $fakelog->getLog(), 'log'); $phpunit->assertFileExists($temp_path . DIRECTORY_SEPARATOR . 'APC-1.3.0.tgz', 'APC 1.3.0'); $phpunit->assertEquals(array ( 0 => array ( 0 => 'http://pear.php.net/rest/p/packages.xml', 1 => '200', ), 1 => array ( 0 => 'http://pear.php.net/rest/r/apc/allreleases.xml', 1 => '200', ), array ( 0 => 'http://pear.php.net/rest/p/apc/info.xml', 1 => '200', ), array ( 0 => 'http://pear.php.net/rest/r/apc/1.3.0.xml', 1 => '200', ), array ( 0 => 'http://pear.php.net/rest/r/apc/deps.1.3.0.txt', 1 => '200', ), ) , $pearweb->getRESTCalls(), 'rest calls'); chdir($save); echo 'tests done'; ?> --CLEAN-- --EXPECT-- tests done php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Mirror/setup.php.inc000066400000000000000000000073041262614675700261470ustar00rootroot00000000000000 $server, 'preferred_state' => 'stable', 'cache_dir' => $temp_path . DIRECTORY_SEPARATOR . 'cache', 'php_dir' => $temp_path . DIRECTORY_SEPARATOR . 'php', 'ext_dir' => $temp_path . DIRECTORY_SEPARATOR . 'ext', 'data_dir' => $temp_path . DIRECTORY_SEPARATOR . 'data', 'www_dir' => $temp_path . DIRECTORY_SEPARATOR . 'www', 'doc_dir' => $temp_path . DIRECTORY_SEPARATOR . 'doc', 'test_dir' => $temp_path . DIRECTORY_SEPARATOR . 'test', 'bin_dir' => $temp_path . DIRECTORY_SEPARATOR . 'bin',)); touch($temp_path . DIRECTORY_SEPARATOR . 'pear.conf'); $fp = fopen($temp_path . DIRECTORY_SEPARATOR . 'pear.conf', 'w'); fwrite($fp, $config); fclose($fp); touch($temp_path . DIRECTORY_SEPARATOR . 'pear.ini'); $fp = fopen($temp_path . DIRECTORY_SEPARATOR . 'pear.ini', 'w'); fwrite($fp, $config); fclose($fp); touch($temp_path . DIRECTORY_SEPARATOR . 'pear.conf'); $fp = fopen($temp_path . DIRECTORY_SEPARATOR . 'pear.conf', 'w'); fwrite($fp, $config); fclose($fp); putenv('PHP_PEAR_SYSCONF_DIR='.$temp_path); $home = getenv('HOME'); if (!empty($home)) { // for PEAR_Config initialization putenv('HOME="'.$temp_path); } require_once "PEAR/ChannelFile.php"; require_once dirname(dirname(__FILE__)) . '/download_test_classes.php.inc'; require_once dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'phpt_test.php.inc'; $phpunit = new PEAR_PHPTest(true); $fakelog = new fake_log; $config = &test_PEAR_Config::singleton($temp_path . '/pear.ini', $temp_path . '/pear.conf'); $reg = &$config->getRegistry(); $chan = $reg->getChannel('pear.php.net'); $chan->resetFunctions('rest'); $reg->updateChannel($chan); test_PEAR_Dependency2::singleton($config); require_once 'PEAR/Command/Mirror.php'; require_once 'PEAR/Command/Remote.php'; class test_PEAR_Command_Remote extends PEAR_Command_Remote { function &getDownloader($options) { $a = new test_PEAR_Downloader($this->ui, $options, $this->config); return $a; } } class test_PEAR_Command_Mirror extends PEAR_Command_Mirror { function &factory($a) { $a = new test_PEAR_Command_Remote($this->ui, $this->config); return $a; } } $command = new test_PEAR_Command_Mirror($fakelog, $config); ?> php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Mirror/teardown.php.inc000066400000000000000000000014761262614675700266360ustar00rootroot00000000000000 php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/000077500000000000000000000000001262614675700236035ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/convert/000077500000000000000000000000001262614675700252635ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/convert/packagefiles/000077500000000000000000000000001262614675700277015ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/convert/packagefiles/bug11703.xml000066400000000000000000000355471262614675700316120ustar00rootroot00000000000000 Translation2 Class for multilingual applications management. This class provides an easy way to retrieve all the strings for a multilingual site from a data source (i.e. db). The following containers are provided, more will follow: - PEAR::DB - PEAR::MDB - PEAR::MDB2 - gettext - XML - PEAR::DB_DataObject (experimental) It is designed to reduce the number of queries to the db, caching the results when possible. An Admin class is provided to easily manage translations (add/remove a language, add/remove a string). Currently, the following decorators are provided: - CacheLiteFunction (for file-based caching) - CacheMemory (for memory-based caching) - DefaultText (to replace empty strings with their keys) - ErrorText (to replace empty strings with a custom error text) - Iconv (to switch from/to different encodings) - Lang (resort to fallback languages for empty strings) - SpecialChars (replace html entities with their hex codes) - UTF-8 (to convert UTF-8 strings to ISO-8859-1) quipo Lorenzo Alberton l.alberton@quipo.it lead ieure Ian Eure ieure@php.net developer mike Michael Wallner mike@php.net developer 2.0.0beta13 2007-06-30 BSD License beta - fixed bug #9855: missing call to _prepare() in setLang() - propagate errors in the decorators - fixed testsuite: added missing db_test_base.php file and fixed problem with class redeclaration - fixed constraint creation in addLang() in the MDB2 Admin driver - fixed setCharset() proxy in the Decorator - fixed bug #11482: missing return in Translation2_Admin_Container_mdb2::addLang() when the table already exists Cache_Lite DB DB_DataObject MDB MDB2 gettext File_Gettext I18Nv2 XML_Serializer 2.0.0beta13 2007-06-30 BSD License beta - fixed bug #9855: missing call to _prepare() in setLang() - propagate errors in the decorators - fixed testsuite: added missing db_test_base.php file and fixed problem with class redeclaration - fixed constraint creation in addLang() in the MDB2 Admin driver - fixed setCharset() proxy in the Decorator - fixed bug #11482: missing return in Translation2_Admin_Container_mdb2::addLang() when the table already exists 2.0.0beta12 2006-12-15 BSD License beta - force MDB2_FETCHMODE_ORDERED in Translation2_Container_mdb2::getPage() to avoid error when using an existing db connection with fetchmode set to MDB2_FETCHMODE_ASSOC (bug #8734) - force lowercase keys in fetchLang() for Oracle compatibility (bug #8915) - added defaultGroup to cache_lite options - added new $options optional parameter to addLang() to set charset/collate info (MDB2 driver only) - fixed bug #8546: index names are not escaped in SQL queries (DB and MDB admin containers) - fixed dataobjectsimple container, get[Raw]Page() was returning integers as keys instead of strings (thanks to Michael Henry) - added setCharset() method (currently only implemented in the MDB2 driver) - added setLang() and setCacheOption() in CacheLiteFunction decorator (request #9301) (thanks to Sascha Grossenbacher) - fixed bug #5539: DefaultText decorator does not call _replaceParams() 2.0.0beta11 2006-09-07 BSD License beta - fixed an error that would result in losing strings when getting a specific language's string in Translation2_Admin_Decorator_Autoadd. - fixed bug #8287: addLang() SQL not compatible with MSSQL - fixed MDB/MDB2 test runner - fixed bug #8546: column/table names are not escaped in SQL queries 2.0.0beta10 2006-07-12 BSD License beta - fixed bug #7058, issue with array_merge not respecting existing array keys - request #7736: ability to specify CacheLite group for CacheLite Decorator (thanks to ajt at localhype dot net) - if an empty xml file is given, don't return an error (bug #7793) - propagate errors in getPage() and getOne() (bug #8127) - Fix Autoadd decorator, which was not adding entries for new string IDs for all languages, which made update() to fail on those strings. 2.0.0beta9 2006-02-22 BSD License beta - Translation2_Decorator_Lang: append keys when fallback lang contains more than current (request #5773) - Removed leftover code from the MDB admin container that caused inserting the same record twice (bug #6233) - Better error handling and cache refreshing in the gettext driver (bug #6410) [thanks to Alan Knowles and ivanwyc@gmail.com] - Honor global PEAR error settings in Translation2_Container::raiseError() (bug #6574) - Added missing updateLang() proxy in Translation2_Admin_Decorator (bug #6753) - Added length to INDEX on TEXT column in Translation2_Admin::addLang() when the dbms is MySQL (thanks to AJ Tarachanowicz) - Fixed UNIQUE INDEX in Translation2_Admin::addLang(), one of the two columns got lost in a previous revision 2.0.0beta8 2005-10-04 BSD License beta - changed license to BSD - removeLang() used to drop the entire table if there weren't any languages left. Now it does so only if the $force parameter is set (request #4218 and #5142) - Translation2_Decorator now extends Translation2 - fixed warning with the CacheLiteFunction decorator and PHP 5.1 2.0.0beta7 2005-06-28 PHP License beta - added some options to the DefaultText decoration, now it is more customizable (thanks to Rolf 'Red' Ochsenbein) - added a __clone() method to clone the internal object references (bug #3641, patch by Olivier Guilyardi) - Some fixes to the XML container, many thanks to Olivier Guilyardi: * fixed bug #3408: empty data sets were not correctly handled; * fixed bug #3420: get a shared file lock instead of an exclusive one; * fixed bug #3498: saveData() is not registered multiple times as shutdown function anymore; optimized saving when save_on_shutdown is set to false. - added blank_on_missing option to the gettext container, which makes it behave like the other containers and automatically disables native mode; * see bug #4002 - fixed bug #4476: gettext container not working without the gettext extension (thanks to sergey at pushok dot com) - added setContainerOptions() method to alter some container options after the object instantiation (bug #2508) - some minor fixes 2.0.0beta6 2005-01-30 PHP License beta - added Translation2::getRaw() - fixed bug #3068: Translation2_Admin::update() on multiple tables didn't insert new records for missing langs, only updated the existing ones. - fixed bug #3149: XML container didn't properly handle redundant strings - added TRANSLATION2_DTD constant to the xml container (thanks to Olivier Guilyardi) - added t2xmlchk.php script to check if a XML file is Translation2 compliant (thanks to Olivier Guilyardi) - added ErrorText decorator 2.0.0beta5 2004-12-24 PHP License beta - renamed createNewLang() to addLang() [BC break!] - renamed addLangToAvailList() to addLangToList() - added Translation2_Admin::getPageNames() - added Translation2_Admin::updateLang() - fixed bug #2890: getLang() raised a NOTICE if setLang() was not called before - fixed bug #2972: CacheLiteFunction decorator not handling parameter subtitution as expected - updated dataobjectsimple container (alank) - some internal minor fixes and tweaks 2.0.0beta4 2004-11-20 PHP License beta - added a complete TestSuite - updated gettext docs - fixed typo in error code (TRANSLATION_ERROR_UNKNOWN_LANG => TRANSLATION2_ERROR_UNKNOWN_LANG) - fixed typo in the MDB Admin container [quote() => getTextValue()] - fixed typo in db admin containers ($this->queries => $this->_queries) - in the gettext admin container - fixed many bugs in the gettext admin container: * fixed old field [remove "windows", add "encoding"] * fixed error in remove() [can't pass by reference] * fixed typo in update() [$stingID => $stringID] * in _add(), create the domains on demand * handle stale cache - many fixes/updates to the xml container: * init() accepts an array as parameter (not a string) * added 'save_on_shutdown' option (you can choose to save in real time, now) * return Translation2 errors with numeric codes * added 'encoding' field * added removeLang() * other minor fixes and tweaks 2.0.0beta3 2004-11-11 PHP License beta - Welcome to the new developers, Ian Eure and Michael Wallner - The last release contained an old gettext driver (bug #2503) (ieure) - Many portability fixes applied to the database containers (thanks to Ian Eure and Xavier Lembo for their suggestions and patches) - Minor changes to the table definitions for better portability (lowercase field names, VARCHAR instead of CHAR, bigger field size) - setLang() now returns an error if called with an unknown $langID (bug #2498). - Added $cleaningFrequency option to the CacheLiteFunction to implement statistic cache cleaning - Added Translation2_Admin::cleanCache() method to clean the cache on demand. It is automatically triggered after a change if $options['autoCleanCache'] is TRUE. - Big cleanup of the DB and Admin_DB containers. See CVS changelog for details. (ieure) - Added update() method to Translation2_Admin. This is a BC break; you used to be able to update strings with add(). This is no longer possible, use update(). (ieure) - Re-added a check in add() to see if an update() is needed instead of an insert - String ID columns are created as type TEXT to support gettext-style string IDs. (ieure) - Reflect the changes made to the DB container into the MDB and MDB2 containers too, plus other minor fixes/optimizations. - strings_default_table may use %s to represent the language name. You may now have one table per language without having to explicitly specify them all. (ieure) - DefaultText decorator has new getStringID() method, which will return the string which was requested if no stringID exists. This mirrors the gettext() semantics. (ieure) - Added Admin_Decorator class, which allows you to create Decorators for Translation2_Admin. (ieure) - New 'Autoadd' Admin Decorator, which automatically adds requested strings. (ieure) - Removed translate(), added getStringID(). You can mimic the old behaviour in two steps: $stringID = $tr->getStringID('mystring', 'mypage'); $translatedString = $tr->get($stringID, 'mypage', $otherLangID); - Major cleanup of the gettext container and added some examples (mike) - removeLang() was missing. Fixed. - The gettext container no longer require the gettext extension (thanks to Sergey Korotkov); it is used when loaded, though, since it's faster. - Both .mo and .po files are valid data sources for the gettext container (Sergey Korotkov) - New Iconv decorator based on the one written by Sergey Korotkov - Added a new "encoding" column to the langsAvail table - New xml container by Olivier Guilyardi 2.0.0beta1 2004-05-05 PHP License beta - BC break! Run the example to see what's new - refactoring in progress: added a Decorator class and some subclasses to control the output (now you can set a stack of fallback languages, a filter to deal with empty strings, one or more cache layers...) - improved gettext support (thanks to Michael Wallner) - added gettext admin class - fixes in the db admin classes - when adding a new string, if it matches one already in the db, the old one is replaced by the new one. - added a MDB2 container - added a DB_DataObject container (by Alan Knowles) 2.0.0alpha2 2004-02-05 PHP License alpha - added an experimental GNU gettext driver - translate() now accepts a third parameter ($pageID) - PHP5 fix - renamed old getPage() to getRawPage() - new getPage() resorts to fallback lang and replaces parameters when needed - added error checking/codes 0.0.1 2004-01-21 PHP License alpha First alpha release php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/convert/packagefiles/invalidv1.xml000066400000000000000000000061441262614675700323250ustar00rootroot00000000000000 foo foo foo hi there single person joe@example.com lead 1.2.0a1 2004-11-27 PHP License alpha here are the multi-line release notes xmlrpc Console_Getopt 1.3.3 2004-10-28 stable 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 1.3.2 2004-10-28 stable 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 php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/convert/packagefiles/nosummary1.xml000066400000000000000000000053731262614675700325460ustar00rootroot00000000000000 foo foo hi there single person joe@example.com lead 1.2.0a1 2004-11-27 PHP License alpha here are the multi-line release notes xmlrpc Console_Getopt 1.3.3 2004-10-28 stable 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 1.3.2 2004-10-28 stable 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 php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/convert/packagefiles/v2.xml000066400000000000000000000100241262614675700307470ustar00rootroot00000000000000 fakebar pear.php.net foo foo hi there person single joe@example.com yes 2004-12-10 1.9.0 1.9.0 stable stable PHP License here are the multi-line release notes 4.3.0 6.0.0 1.4.0a1 Console_Getopt pear.php.net 1.2 1.2 xmlrpc 1.0 * 1.3.3 1.3.3 stable stable 2004-10-28 PHP License 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 1.3.2 1.3.2 stable stable 2004-10-28 PHP License 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 php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/convert/packagefiles/validv1.xml000066400000000000000000000054231262614675700317750ustar00rootroot00000000000000 foo foo foo hi there single person joe@example.com lead 1.2.0a1 2004-11-27 PHP License alpha here are the multi-line release notes xmlrpc Console_Getopt 1.3.3 2004-10-28 stable 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 1.3.2 2004-10-28 stable 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 php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/convert/test.phpt000066400000000000000000000252351262614675700271460ustar00rootroot00000000000000--TEST-- convert command success --SKIPIF-- --FILE-- run('convert', array(), array()); $phpunit->assertNoErrors('1'); $phpunit->assertEquals(array ( 0 => array ( 'info' => 'Wrote new version 2.0 package.xml to ".' . DIRECTORY_SEPARATOR . 'package2.xml"', 'cmd' => 'no command', ), ), $fakelog->getLog(), 'log 1'); $pkg = new PEAR_PackageFile($config); $pf = &$pkg->fromPackageFile($temp_path . DIRECTORY_SEPARATOR . 'package2.xml', PEAR_VALIDATE_NORMAL); $gen = &$pf->getDefaultGenerator(); $contents = implode('', file($temp_path . DIRECTORY_SEPARATOR . 'package2.xml')); $phpunit->assertEquals(' foo pear.php.net foo foo hi there person single joe@example.com yes ' . date('Y-m-d') . ' 1.2.0a1 1.2.0a1 alpha alpha PHP License here are the multi-line release notes 4.3.0 1.4.0b1 Console_Getopt pear.php.net 1.2 1.2 xmlrpc 1.0 1.3.3 1.3.3 stable stable 2004-10-28 PHP License 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 1.3.2 1.3.2 stable stable 2004-10-28 PHP License 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 ', $contents, 'contents 1'); $e = $command->run('convert', array('flat' => true), array()); $phpunit->assertErrors(array( array('package' => 'PEAR_PackageFile_v2', 'message' => 'Channel validator warning: field "date" - Release Date "2004-11-27" is not today'), ), '1.1'); $phpunit->assertEquals(array ( 0 => array ( 0 => 1, 1 => 'Analyzing foo.php', ), 1 => array ( 'info' => 'Wrote new version 2.0 package.xml to ".' . DIRECTORY_SEPARATOR . 'package2.xml"', 'cmd' => 'no command', ), ), $fakelog->getLog(), 'log 1.1'); $pkg = new PEAR_PackageFile($config); $pf = &$pkg->fromPackageFile($temp_path . DIRECTORY_SEPARATOR . 'package2.xml', PEAR_VALIDATE_NORMAL); $gen = &$pf->getDefaultGenerator(); $contents = implode('', file($temp_path . DIRECTORY_SEPARATOR . 'package2.xml')); $phpunit->assertEquals(' foo pear.php.net foo foo hi there person single joe@example.com yes ' . date('Y-m-d') . ' 1.2.0a1 1.2.0a1 alpha alpha PHP License here are the multi-line release notes 4.3.0 1.4.0b1 Console_Getopt pear.php.net 1.2 1.2 xmlrpc 1.0 1.3.3 1.3.3 stable stable 2004-10-28 PHP License 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 1.3.2 1.3.2 stable stable 2004-10-28 PHP License 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 ', $contents, 'contents 2'); $phpunit->assertIsa('PEAR_PackageFile_v2', $pf, 'test 1'); $phpunit->assertEquals('foo', $pf->getPackage(), 'package test 1'); $e = $command->run('convert', array(), array($temp_path . DIRECTORY_SEPARATOR . 'validv1.xml', $temp_path . DIRECTORY_SEPARATOR . 'package3.xml')); $phpunit->assertNoErrors('2'); $phpunit->assertEquals(array ( 0 => array ( 'info' => 'Wrote new version 2.0 package.xml to "' . $temp_path . DIRECTORY_SEPARATOR . 'package3.xml"', 'cmd' => 'no command', ), ), $fakelog->getLog(), 'log 2'); $pf2 = &$pkg->fromPackageFile($temp_path . DIRECTORY_SEPARATOR . 'package3.xml', PEAR_VALIDATE_NORMAL); $phpunit->assertIsa('PEAR_PackageFile_v2', $pf2, 'test 2'); $phpunit->assertEquals('foo', $pf->getPackage(), 'package test 2'); chdir($savedir); echo 'tests done'; ?> --CLEAN-- --EXPECT-- tests done php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/convert/test_bug11703.phpt000066400000000000000000000453421262614675700304000ustar00rootroot00000000000000--TEST-- convert command, bug #11703 [pear convert and package.xml with optional dependencies fails] --SKIPIF-- --FILE-- run('convert', array(), array()); $phpunit->assertNoErrors('1'); $phpunit->assertEquals(array ( 0 => array ( 'info' => 'Wrote new version 2.0 package.xml to ".' . DIRECTORY_SEPARATOR . 'package2.xml"', 'cmd' => 'no command', ), ), $fakelog->getLog(), 'log 1'); $pkg = new PEAR_PackageFile($config); $pf = &$pkg->fromPackageFile($temp_path . DIRECTORY_SEPARATOR . 'package2.xml', PEAR_VALIDATE_NORMAL); $gen = &$pf->getDefaultGenerator(); $contents = implode('', file($temp_path . DIRECTORY_SEPARATOR . 'package2.xml')); $phpunit->assertEquals(' Translation2 pear.php.net Class for multilingual applications management. This class provides an easy way to retrieve all the strings for a multilingual site from a data source (i.e. db). The following containers are provided, more will follow: - PEAR::DB - PEAR::MDB - PEAR::MDB2 - gettext - XML - PEAR::DB_DataObject (experimental) It is designed to reduce the number of queries to the db, caching the results when possible. An Admin class is provided to easily manage translations (add/remove a language, add/remove a string). Currently, the following decorators are provided: - CacheLiteFunction (for file-based caching) - CacheMemory (for memory-based caching) - DefaultText (to replace empty strings with their keys) - ErrorText (to replace empty strings with a custom error text) - Iconv (to switch from/to different encodings) - Lang (resort to fallback languages for empty strings) - SpecialChars (replace html entities with their hex codes) - UTF-8 (to convert UTF-8 strings to ISO-8859-1) Lorenzo Alberton quipo l.alberton@quipo.it yes Ian Eure ieure ieure@php.net yes Michael Wallner mike mike@php.net yes ' . date('Y-m-d') . ' 2.0.0beta13 2.0.0beta13 beta beta BSD License - fixed bug #9855: missing call to _prepare() in setLang() - propagate errors in the decorators - fixed testsuite: added missing db_test_base.php file and fixed problem with class redeclaration - fixed constraint creation in addLang() in the MDB2 Admin driver - fixed setCharset() proxy in the Decorator - fixed bug #11482: missing return in Translation2_Admin_Container_mdb2::addLang() when the table already exists 4.0.0 1.4.0b1 Cache_Lite pear.php.net DB pear.php.net DB_DataObject pear.php.net MDB pear.php.net MDB2 pear.php.net File_Gettext pear.php.net I18Nv2 pear.php.net 0.9.1 XML_Serializer pear.php.net 0.13.0 gettext 2.0.0beta13 2.0.0beta13 beta beta 2007-06-30 BSD License - fixed bug #9855: missing call to _prepare() in setLang() - propagate errors in the decorators - fixed testsuite: added missing db_test_base.php file and fixed problem with class redeclaration - fixed constraint creation in addLang() in the MDB2 Admin driver - fixed setCharset() proxy in the Decorator - fixed bug #11482: missing return in Translation2_Admin_Container_mdb2::addLang() when the table already exists 2.0.0beta12 2.0.0beta12 beta beta 2006-12-15 BSD License - force MDB2_FETCHMODE_ORDERED in Translation2_Container_mdb2::getPage() to avoid error when using an existing db connection with fetchmode set to MDB2_FETCHMODE_ASSOC (bug #8734) - force lowercase keys in fetchLang() for Oracle compatibility (bug #8915) - added defaultGroup to cache_lite options - added new $options optional parameter to addLang() to set charset/collate info (MDB2 driver only) - fixed bug #8546: index names are not escaped in SQL queries (DB and MDB admin containers) - fixed dataobjectsimple container, get[Raw]Page() was returning integers as keys instead of strings (thanks to Michael Henry) - added setCharset() method (currently only implemented in the MDB2 driver) - added setLang() and setCacheOption() in CacheLiteFunction decorator (request #9301) (thanks to Sascha Grossenbacher) - fixed bug #5539: DefaultText decorator does not call _replaceParams() 2.0.0beta11 2.0.0beta11 beta beta 2006-09-07 BSD License - fixed an error that would result in losing strings when getting a specific language's string in Translation2_Admin_Decorator_Autoadd. - fixed bug #8287: addLang() SQL not compatible with MSSQL - fixed MDB/MDB2 test runner - fixed bug #8546: column/table names are not escaped in SQL queries 2.0.0beta10 2.0.0beta10 beta beta 2006-07-12 BSD License - fixed bug #7058, issue with array_merge not respecting existing array keys - request #7736: ability to specify CacheLite group for CacheLite Decorator (thanks to ajt at localhype dot net) - if an empty xml file is given, don't return an error (bug #7793) - propagate errors in getPage() and getOne() (bug #8127) - Fix Autoadd decorator, which was not adding entries for new string IDs for all languages, which made update() to fail on those strings. 2.0.0beta9 2.0.0beta9 beta beta 2006-02-22 BSD License - Translation2_Decorator_Lang: append keys when fallback lang contains more than current (request #5773) - Removed leftover code from the MDB admin container that caused inserting the same record twice (bug #6233) - Better error handling and cache refreshing in the gettext driver (bug #6410) [thanks to Alan Knowles and ivanwyc@gmail.com] - Honor global PEAR error settings in Translation2_Container::raiseError() (bug #6574) - Added missing updateLang() proxy in Translation2_Admin_Decorator (bug #6753) - Added length to INDEX on TEXT column in Translation2_Admin::addLang() when the dbms is MySQL (thanks to AJ Tarachanowicz) - Fixed UNIQUE INDEX in Translation2_Admin::addLang(), one of the two columns got lost in a previous revision 2.0.0beta8 2.0.0beta8 beta beta 2005-10-04 BSD License - changed license to BSD - removeLang() used to drop the entire table if there weren't any languages left. Now it does so only if the $force parameter is set (request #4218 and #5142) - Translation2_Decorator now extends Translation2 - fixed warning with the CacheLiteFunction decorator and PHP 5.1 2.0.0beta7 2.0.0beta7 beta beta 2005-06-28 PHP License - added some options to the DefaultText decoration, now it is more customizable (thanks to Rolf 'Red' Ochsenbein) - added a __clone() method to clone the internal object references (bug #3641, patch by Olivier Guilyardi) - Some fixes to the XML container, many thanks to Olivier Guilyardi: * fixed bug #3408: empty data sets were not correctly handled; * fixed bug #3420: get a shared file lock instead of an exclusive one; * fixed bug #3498: saveData() is not registered multiple times as shutdown function anymore; optimized saving when save_on_shutdown is set to false. - added blank_on_missing option to the gettext container, which makes it behave like the other containers and automatically disables native mode; * see bug #4002 - fixed bug #4476: gettext container not working without the gettext extension (thanks to sergey at pushok dot com) - added setContainerOptions() method to alter some container options after the object instantiation (bug #2508) - some minor fixes 2.0.0beta6 2.0.0beta6 beta beta 2005-01-30 PHP License - added Translation2::getRaw() - fixed bug #3068: Translation2_Admin::update() on multiple tables didn't insert new records for missing langs, only updated the existing ones. - fixed bug #3149: XML container didn't properly handle redundant strings - added TRANSLATION2_DTD constant to the xml container (thanks to Olivier Guilyardi) - added t2xmlchk.php script to check if a XML file is Translation2 compliant (thanks to Olivier Guilyardi) - added ErrorText decorator 2.0.0beta5 2.0.0beta5 beta beta 2004-12-24 PHP License - renamed createNewLang() to addLang() [BC break!] - renamed addLangToAvailList() to addLangToList() - added Translation2_Admin::getPageNames() - added Translation2_Admin::updateLang() - fixed bug #2890: getLang() raised a NOTICE if setLang() was not called before - fixed bug #2972: CacheLiteFunction decorator not handling parameter subtitution as expected - updated dataobjectsimple container (alank) - some internal minor fixes and tweaks 2.0.0beta4 2.0.0beta4 beta beta 2004-11-20 PHP License - added a complete TestSuite - updated gettext docs - fixed typo in error code (TRANSLATION_ERROR_UNKNOWN_LANG => TRANSLATION2_ERROR_UNKNOWN_LANG) - fixed typo in the MDB Admin container [quote() => getTextValue()] - fixed typo in db admin containers ($this->queries => $this->_queries) - in the gettext admin container - fixed many bugs in the gettext admin container: * fixed old field [remove "windows", add "encoding"] * fixed error in remove() [can't pass by reference] * fixed typo in update() [$stingID => $stringID] * in _add(), create the domains on demand * handle stale cache - many fixes/updates to the xml container: * init() accepts an array as parameter (not a string) * added 'save_on_shutdown' option (you can choose to save in real time, now) * return Translation2 errors with numeric codes * added 'encoding' field * added removeLang() * other minor fixes and tweaks 2.0.0beta3 2.0.0beta3 beta beta 2004-11-11 PHP License - Welcome to the new developers, Ian Eure and Michael Wallner - The last release contained an old gettext driver (bug #2503) (ieure) - Many portability fixes applied to the database containers (thanks to Ian Eure and Xavier Lembo for their suggestions and patches) - Minor changes to the table definitions for better portability (lowercase field names, VARCHAR instead of CHAR, bigger field size) - setLang() now returns an error if called with an unknown $langID (bug #2498). - Added $cleaningFrequency option to the CacheLiteFunction to implement statistic cache cleaning - Added Translation2_Admin::cleanCache() method to clean the cache on demand. It is automatically triggered after a change if $options['autoCleanCache'] is TRUE. - Big cleanup of the DB and Admin_DB containers. See CVS changelog for details. (ieure) - Added update() method to Translation2_Admin. This is a BC break; you used to be able to update strings with add(). This is no longer possible, use update(). (ieure) - Re-added a check in add() to see if an update() is needed instead of an insert - String ID columns are created as type TEXT to support gettext-style string IDs. (ieure) - Reflect the changes made to the DB container into the MDB and MDB2 containers too, plus other minor fixes/optimizations. - strings_default_table may use %s to represent the language name. You may now have one table per language without having to explicitly specify them all. (ieure) - DefaultText decorator has new getStringID() method, which will return the string which was requested if no stringID exists. This mirrors the gettext() semantics. (ieure) - Added Admin_Decorator class, which allows you to create Decorators for Translation2_Admin. (ieure) - New 'Autoadd' Admin Decorator, which automatically adds requested strings. (ieure) - Removed translate(), added getStringID(). You can mimic the old behaviour in two steps: $stringID = $tr->getStringID('mystring', 'mypage'); $translatedString = $tr->get($stringID, 'mypage', $otherLangID); - Major cleanup of the gettext container and added some examples (mike) - removeLang() was missing. Fixed. - The gettext container no longer require the gettext extension (thanks to Sergey Korotkov); it is used when loaded, though, since it's faster. - Both .mo and .po files are valid data sources for the gettext container (Sergey Korotkov) - New Iconv decorator based on the one written by Sergey Korotkov - Added a new "encoding" column to the langsAvail table - New xml container by Olivier Guilyardi 2.0.0beta1 2.0.0beta1 beta beta 2004-05-05 PHP License - BC break! Run the example to see what's new - refactoring in progress: added a Decorator class and some subclasses to control the output (now you can set a stack of fallback languages, a filter to deal with empty strings, one or more cache layers...) - improved gettext support (thanks to Michael Wallner) - added gettext admin class - fixes in the db admin classes - when adding a new string, if it matches one already in the db, the old one is replaced by the new one. - added a MDB2 container - added a DB_DataObject container (by Alan Knowles) 2.0.0alpha2 2.0.0alpha2 alpha alpha 2004-02-05 PHP License - added an experimental GNU gettext driver - translate() now accepts a third parameter ($pageID) - PHP5 fix - renamed old getPage() to getRawPage() - new getPage() resorts to fallback lang and replaces parameters when needed - added error checking/codes 0.0.1 0.0.1 alpha alpha 2004-01-21 PHP License First alpha release ' , $contents, 'contents 1'); chdir($savedir); echo 'tests done'; ?> --CLEAN-- --EXPECT-- tests done php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/convert/test_fail.phpt000066400000000000000000000060231262614675700301330ustar00rootroot00000000000000--TEST-- convert command failure --SKIPIF-- --FILE-- run('convert', array(), array($temp_path . DIRECTORY_SEPARATOR . 'invalid.xml')); $phpunit->assertErrors(array( array('package' => 'PEAR_PackageFile_v2', 'message' => 'File "validv1.xml" in directory "" has invalid role "ext", should be one of cfg, data, doc, man, php, script, src, test, www'), ), 'invalid packagexml 1'); $phpunit->assertEquals(array ( 0 => array ( 'info' => 'File "validv1.xml" in directory "" has invalid role "ext", should be one of cfg, data, doc, man, php, script, src, test, www', 'cmd' => 'no command', ), 1 => array ( 'info' => 'PEAR_Packagefile_v2::toPackageFile: invalid package.xml', 'cmd' => 'no command', ), ), $fakelog->getLog(), 'invalid packagexml'); $e = $command->run('convert', array(), array($temp_path . DIRECTORY_SEPARATOR . 'nosummary.xml')); $phpunit->assertErrors(array( array('package' => 'PEAR_PackageFile_v1', 'message' => 'No summary found'), array('package' => 'PEAR_Error', 'message' => 'Parsing of package.xml from file "' . $temp_path . DIRECTORY_SEPARATOR . 'nosummary.xml" failed'), ), 'invalid packagexml 2'); $phpunit->assertEquals(array ( 0 => array ( 0 => 0, 1 => 'ERROR: No summary found', ), 1 => array ( 'info' => 'No summary found', 'cmd' => 'no command', ), ), $fakelog->getLog(), 'invalid packagexml, no summary'); $e = $command->run('convert', array(), array()); $phpunit->assertErrors(array( array('package' => 'PEAR_Error', 'message' => 'Unable to open package.xml'), ), 'file not found 1'); $phpunit->assertEquals(array ( ), $fakelog->getLog(), 'log 1'); $e = $command->run('convert', array(), array('http://www.example.com/package.xml')); $phpunit->assertErrors(array( array('package' => 'PEAR_Error', 'message' => 'Unable to open http://www.example.com/package.xml'), ), 'file not found 2'); $phpunit->assertEquals(array ( ), $fakelog->getLog(), 'log 2'); copy(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'packagefiles' . DIRECTORY_SEPARATOR . 'v2.xml', $temp_path . DIRECTORY_SEPARATOR . 'package.xml'); $e = $command->run('convert', array(), array()); $phpunit->assertNoErrors('already a 2.0'); $phpunit->assertEquals(array ( 0 => array ( 'info' => 'package.xml is already a package.xml version 2.0', 'cmd' => 'no command', ), ), $fakelog->getLog(), 'log 3'); chdir($savedir); echo 'tests done'; ?> --CLEAN-- --EXPECT-- tests done php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/makerpm/000077500000000000000000000000001262614675700252375ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/makerpm/test_makerpm_passthru.phpt000066400000000000000000000020141262614675700325550ustar00rootroot00000000000000--TEST-- makerpm with fall-through to PEAR_Command_Packaging --SKIPIF-- --FILE-- run('makerpm', array(), array('Net_SMTP-1.2.8.tgz')); $phpunit->assertNoErrors('ret OK'); $phpunit->showall(); $phpunit->assertEquals(array( 'info' => 'PEAR_Command_Packaging is installed; using newer "make-rpm-spec" command instead', 'cmd' => 'no command' ), array_shift($fakelog->getLog()),'descriptive output about passthru'); echo 'tests done'; ?> --CLEAN-- --EXPECT-- tests done php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package-dependencies/000077500000000000000000000000001262614675700276225ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package-dependencies/packagefiles/000077500000000000000000000000001262614675700322405ustar00rootroot00000000000000packageinvalidv1.xml000066400000000000000000000057031262614675700361210ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package-dependencies/packagefiles foo foo hi there single person joe@example.com lead 1.2.0a1 2004-11-27 PHP License alpha here are the multi-line release notes xmlrpc Console_Getopt 1.3.3 2004-10-28 stable 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 1.3.2 2004-10-28 stable 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 sunger/000077500000000000000000000000001262614675700334645ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package-dependencies/packagefilesfoo.dat000066400000000000000000000000321262614675700347340ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package-dependencies/packagefiles/sunger php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package-dependencies/packagefiles/v1.xml000066400000000000000000000062561262614675700333210ustar00rootroot00000000000000 foo hi foo hi there single person joe@example.com lead 1.2.0a1 2004-11-27 PHP License alpha here are the multi-line release notes brump zoomp xmlrpc Console_Getopt Archive_Tar 1.3.3 2004-10-28 stable 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 1.3.2 2004-10-28 stable 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 php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package-dependencies/packagefiles/v2.xml000066400000000000000000000117431262614675700333170ustar00rootroot00000000000000 fakebar pear.php.net foo foo hi there person single joe@example.com yes 2004-12-26 1.9.0 1.9.0 stable stable PHP License here are the multi-line release notes 4.3.0 6.0.0 1.4.0a1 Console_Getopt pear.php.net 1.2 1.2 foo_child gronk.onk.net 1.2 1.2 hi 2.0 1.4 windows * boomnp http://www.bloop.example.com/boomnp.tgz Archive_Tar pear.php.net 1.2 1.2 foo_helper gronk.onk.net 1.2 1.2 xmlrpc 1.0 hithere hi.example.com hithere2 pear.php.net * 1.3.3 1.3.3 stable stable 2004-10-28 PHP License 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 1.3.2 1.3.2 stable stable 2004-10-28 PHP License 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 php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package-dependencies/test_fail.phpt000066400000000000000000000033711262614675700324750ustar00rootroot00000000000000--TEST-- package-dependencies command failure --SKIPIF-- --FILE-- run('package-dependencies', array(), array($temp_path . DIRECTORY_SEPARATOR . 'invalid.xml')); $phpunit->assertErrors(array( array('package' => 'PEAR_Error', 'message' => 'Cannot open \'' . $temp_path . DIRECTORY_SEPARATOR . 'invalid.xml' . '\' for parsing'), array('package' => 'PEAR_Error', 'message' => 'Cannot open \'' . $temp_path . DIRECTORY_SEPARATOR . 'invalid.xml' . '\' for parsing'), ), 'file not found'); $phpunit->assertEquals(array (), $fakelog->getLog(), 'log 1'); $e = $command->run('package-dependencies', array(), array(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'packagefiles' . DIRECTORY_SEPARATOR . 'packageinvalidv1.xml')); $phpunit->assertErrors(array( array('package' => 'PEAR_Error', 'message' => 'Parsing of package.xml from file "' . dirname(__FILE__) . DIRECTORY_SEPARATOR . 'packagefiles' . DIRECTORY_SEPARATOR . 'packageinvalidv1.xml' . '" failed'), array('package' => 'PEAR_Error', 'message' => 'Parsing of package.xml from file "' . dirname(__FILE__) . DIRECTORY_SEPARATOR . 'packagefiles' . DIRECTORY_SEPARATOR . 'packageinvalidv1.xml' . '" failed'), array('package' => 'PEAR_PackageFile_v1', 'message' => 'No summary found'), ), 'validation errors'); $phpunit->assertEquals(array ( 0 => array ( 0 => 0, 1 => 'ERROR: No summary found', ), ), $fakelog->getLog(), 'log 2'); echo 'tests done'; ?> --CLEAN-- --EXPECT-- tests done php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package-dependencies/test_v1.phpt000066400000000000000000000040241262614675700321040ustar00rootroot00000000000000--TEST-- package-dependencies command, package.xml 1.0 --SKIPIF-- --FILE-- run('package-dependencies', array(), array(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'packagefiles' . DIRECTORY_SEPARATOR . 'v1.xml')); $phpunit->assertNoErrors('v1'); $phpunit->assertEquals(array ( 0 => array ( 'info' => array ( 'caption' => 'Dependencies for pear/foo', 'border' => true, 'headline' => array ( 0 => 'Required?', 1 => 'Type', 2 => 'Name', 3 => 'Relation', 4 => 'Version', ), 'data' => array ( 0 => array ( 0 => 'Yes', 1 => 'PHP', 2 => '', 3 => '!=', 4 => '4.3.10', ), 1 => array ( 0 => 'Yes', 1 => 'Extension', 2 => 'brump', 3 => 'not', 4 => '', ), 2 => array ( 0 => 'Yes', 1 => 'Extension', 2 => 'zoomp', 3 => '>=', 4 => '1.0', ), 3 => array ( 0 => 'No', 1 => 'Extension', 2 => 'xmlrpc', 3 => '>=', 4 => '1.0', ), 4 => array ( 0 => 'Yes', 1 => 'Package', 2 => 'Console_Getopt', 3 => '<', 4 => '1.2', ), 5 => array ( 0 => 'Yes', 1 => 'Package', 2 => 'Archive_Tar', 3 => '<=', 4 => '2.0', ), 6 => array ( 0 => 'Yes', 1 => 'PHP', 2 => '', 3 => '>=', 4 => '4.3.0', ), ), ), 'cmd' => 'package-dependencies', ), ), $fakelog->getLog(), 'log 1'); echo 'tests done'; ?> --CLEAN-- --EXPECT-- tests done php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package-dependencies/test_v2.phpt000066400000000000000000000064761262614675700321220ustar00rootroot00000000000000--TEST-- package-dependencies command, package.xml 2.0 --SKIPIF-- --FILE-- run('package-dependencies', array(), array(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'packagefiles' . DIRECTORY_SEPARATOR . 'v2.xml')); $phpunit->assertNoErrors('v2'); $phpunit->assertEquals(array ( 0 => array ( 'info' => array ( 'caption' => 'Dependencies for fakebar', 'border' => true, 'headline' => array ( 0 => 'Required?', 1 => 'Type', 2 => 'Name', 3 => 'Versioning', 4 => 'Group', ), 'data' => array ( 0 => array ( 0 => 'Yes', 1 => 'Php', 2 => '', 3 => ' (version >= 4.3.0, version <= 6.0.0)', 4 => '', ), 1 => array ( 0 => 'Yes', 1 => 'Pear Installer', 2 => '', 3 => ' (version >= 1.4.0a1)', 4 => '', ), 2 => array ( 0 => 'Yes', 1 => 'Package', 2 => 'pear/Console_Getopt', 3 => ' (version <= 1.2, excluded versions: 1.2)', 4 => '', ), 3 => array ( 0 => 'Yes', 1 => 'Subpackage', 2 => '(channel?) gronk.onk.net/foo_child', 3 => ' (version <= 1.2, excluded versions: 1.2)', 4 => '', ), 4 => array ( 0 => 'Yes', 1 => 'Extension', 2 => 'hi', 3 => ' (version <= 2.0, excluded versions: 1.4)', 4 => '', ), 5 => array ( 0 => 'Yes', 1 => 'Os', 2 => 'windows', 3 => 'conflicts', 4 => '', ), 6 => array ( 0 => 'Yes', 1 => 'Arch', 2 => '*', 3 => '', 4 => '', ), 7 => array ( 0 => 'No', 1 => 'Package', 2 => 'boomnp [http://www.bloop.example.com/boomnp.tgz]', 3 => '', 4 => '', ), 8 => array ( 0 => 'No', 1 => 'Package', 2 => 'pear/Archive_Tar', 3 => ' (version >= 1.2, excluded versions: 1.2)', 4 => '', ), 9 => array ( 0 => 'No', 1 => 'Subpackage', 2 => '(channel?) gronk.onk.net/foo_helper', 3 => ' (version <= 1.2, excluded versions: 1.2)', 4 => '', ), 10 => array ( 0 => 'No', 1 => 'Extension', 2 => 'xmlrpc', 3 => ' (version >= 1.0)', 4 => '', ), 11 => array ( 0 => 'No', 1 => 'Package', 2 => '(channel?) hi.example.com/hithere', 3 => '', 4 => 'default', ), 12 => array ( 0 => 'No', 1 => 'Subpackage', 2 => 'pear/hithere2', 3 => '', 4 => 'default', ), ), ), 'cmd' => 'package-dependencies', ), ), $fakelog->getLog(), 'log 1'); echo 'tests done'; ?> --CLEAN-- --EXPECT-- tests done php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package-validate/000077500000000000000000000000001262614675700267655ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package-validate/packagefiles/000077500000000000000000000000001262614675700314035ustar00rootroot00000000000000equivv1.xml000066400000000000000000000057371262614675700334620ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package-validate/packagefiles fakebar fakebar foo hi there single person joe@example.com lead 1.9.0 2004-11-27 PHP License stable here are the multi-line release notes xmlrpc Console_Getopt 1.3.3 2004-10-28 stable 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 1.3.2 2004-10-28 stable 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 fakebar.xml000066400000000000000000000077731262614675700334570ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package-validate/packagefiles fakebar pear.php.net foo foo hi there person single joe@example.com yes 1.9.0 1.9.0 stable stable PHP License here are the multi-line release notes 4.3.0 6.0.0 1.4.0a1 Console_Getopt pear.php.net 1.2 1.2 xmlrpc 1.0 * 1.3.3 1.3.3 stable stable 2004-10-28 PHP License 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 1.3.2 1.3.2 stable stable 2004-10-28 PHP License 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 php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package-validate/packagefiles/foo.php000066400000000000000000000000301262614675700326700ustar00rootroot00000000000000 php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package-validate/packagefiles/foo1.php000066400000000000000000000000111262614675700327500ustar00rootroot00000000000000 packageinvalidv1.xml000066400000000000000000000057421262614675700352670ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package-validate/packagefiles foo foo foo hi there single person joe@example.com lead 1.2.0a1 2004-11-27 PHP License alpha here are the multi-line release notes xmlrpc Console_Getopt 1.3.3 2004-10-28 stable 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 1.3.2 2004-10-28 stable 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 packageinvalidv2.xml000066400000000000000000000100341262614675700352560ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package-validate/packagefiles fakebar pear.php.net foo foo hi there person single joe@example.com yes 2004-12-25 1.9.0 1.9.0 stable stable PHP License here are the multi-line release notes 4.3.0 6.0.0 1.4.0a1 Console_Getopt pear.php.net 1.2 1.2 xmlrpc 1.0 * 1.3.3 1.3.3 stable stable 2004-10-28 PHP License 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 1.3.2 1.3.2 stable stable 2004-10-28 PHP License 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 php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package-validate/packagefiles/sunger/000077500000000000000000000000001262614675700327065ustar00rootroot00000000000000foo.dat000066400000000000000000000000321262614675700340770ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package-validate/packagefiles/sunger php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package-validate/packagefiles/v1.xml000066400000000000000000000057061262614675700324630ustar00rootroot00000000000000 foo foo hi there single person joe@example.com lead 1.2.0a1 2004-11-27 PHP License alpha here are the multi-line release notes xmlrpc Console_Getopt 1.3.3 2004-10-28 stable 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 1.3.2 2004-10-28 stable 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 validfakebar.xml000066400000000000000000000100261262614675700344600ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package-validate/packagefiles fakebar pear.php.net foo foo hi there person single joe@example.com yes 2004-12-25 1.9.0 1.9.0 stable stable PHP License here are the multi-line release notes 4.3.0 6.0.0 1.4.0a1 Console_Getopt pear.php.net 1.2 1.2 xmlrpc 1.0 * 1.3.3 1.3.3 stable stable 2004-10-28 PHP License 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 1.3.2 1.3.2 stable stable 2004-10-28 PHP License 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 validv1.xml000066400000000000000000000057371262614675700334300ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package-validate/packagefiles foo foo foo hi there single person joe@example.com lead 1.2.0a1 2004-11-27 PHP License alpha here are the multi-line release notes xmlrpc Console_Getopt 1.3.3 2004-10-28 stable 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 1.3.2 2004-10-28 stable 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 validwarnfakebar.xml000066400000000000000000000100241262614675700353460ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package-validate/packagefiles fakebar pear.php.net foo foo hi there person single joe@example.com yes 2004-12-25 1.9.0 1.9.0 stable stable PHP License here are the multi-line release notes 4.3.0 6.0.0 1.4.0a1 Console_Getopt pear.php.net 1.2 1.2 xmlrpc 1.0 * 1.3.3 1.3.3 stable stable 2004-10-28 PHP License 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 1.3.2 1.3.2 stable stable 2004-10-28 PHP License 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 validwarnv1.xml000066400000000000000000000057361262614675700343170ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package-validate/packagefiles foo foo foo hi there single person joe@example.com lead 1.2.0a1 2004-11-27 PHP License alpha here are the multi-line release notes xmlrpc Console_Getopt 1.3.3 2004-10-28 stable 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 1.3.2 2004-10-28 stable 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 php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package-validate/test.phpt000066400000000000000000000132221262614675700306410ustar00rootroot00000000000000--TEST-- package-validate command --SKIPIF-- --FILE-- run('package-validate', array(), array($temp_path . DIRECTORY_SEPARATOR . 'validv1.xml')); $phpunit->assertErrors(array( array('package' => 'PEAR_PackageFile_v1', 'message' => 'Channel validator error: field "date" - Release Date "2004-11-27" is not today'), array('package' => 'PEAR_PackageFile_v1', 'message' => 'File "' . $temp_path . DIRECTORY_SEPARATOR . 'foo1.php" in package.xml does not exist'), array('package' => 'PEAR_PackageFile_v1', 'message' => 'File "' . $temp_path . DIRECTORY_SEPARATOR . 'sunger/foo.dat" in package.xml does not exist'), ), 'ret 1'); $phpunit->assertEquals(array ( 0 => array ( 'info' => 'Error: File "' . $temp_path . DIRECTORY_SEPARATOR . 'foo1.php" in package.xml does not exist Error: File "' . $temp_path . DIRECTORY_SEPARATOR . 'sunger/foo.dat" in package.xml does not exist Warning: Channel validator error: field "date" - Release Date "2004-11-27" is not today Validation: 2 error(s), 1 warning(s) ', 'cmd' => 'package-validate', ), ), $fakelog->getLog(), 'log 1'); $ret = $command->run('package-validate', array(), array()); $phpunit->assertErrors(array( array('package' => 'PEAR_PackageFile_v1', 'message' => 'Channel validator error: field "date" - Release Date "2004-11-27" is not today'), array('package' => 'PEAR_PackageFile_v1', 'message' => 'File "' . $temp_path . DIRECTORY_SEPARATOR . 'foo1.php" in package.xml does not exist'), array('package' => 'PEAR_PackageFile_v1', 'message' => 'File "' . $temp_path . DIRECTORY_SEPARATOR . 'sunger/foo.dat" in package.xml does not exist'), ), 'ret 1.5'); $phpunit->assertEquals(array ( 0 => array ( 'info' => 'Error: File "' . $temp_path . DIRECTORY_SEPARATOR . 'foo1.php" in package.xml does not exist Error: File "' . $temp_path . DIRECTORY_SEPARATOR . 'sunger/foo.dat" in package.xml does not exist Warning: Channel validator error: field "date" - Release Date "2004-11-27" is not today Validation: 2 error(s), 1 warning(s) ', 'cmd' => 'package-validate', ), ), $fakelog->getLog(), 'log 1.5'); // 2.0 $ret = $command->run('package-validate', array(), array($temp_path . DIRECTORY_SEPARATOR . 'validv2.xml')); $phpunit->assertErrors(array( array('package' => 'PEAR_PackageFile_v2', 'message' => 'Channel validator warning: field "date" - Release Date "2004-12-25" is not today'), array('package' => 'PEAR_PackageFile_v2', 'message' => 'File "' . $temp_path . DIRECTORY_SEPARATOR . 'foo1.php" in package.xml does not exist'), array('package' => 'PEAR_PackageFile_v2', 'message' => 'File "' . $temp_path . DIRECTORY_SEPARATOR . 'sunger/foo.dat" in package.xml does not exist'), ), 'ret 2'); $phpunit->assertEquals(array ( 0 => array ( 'info' => 'Error: File "' . $temp_path . DIRECTORY_SEPARATOR . 'foo1.php" in package.xml does not exist Error: File "' . $temp_path . DIRECTORY_SEPARATOR . 'sunger/foo.dat" in package.xml does not exist Warning: Channel validator warning: field "date" - Release Date "2004-12-25" is not today Validation: 2 error(s), 1 warning(s) ', 'cmd' => 'package-validate', ), ), $fakelog->getLog(), 'log 2'); copy(dirname(__FILE__) . '/packagefiles/foo1.php', $temp_path . DIRECTORY_SEPARATOR . 'foo1.php'); $ret = $command->run('package-validate', array(), array($temp_path . DIRECTORY_SEPARATOR . 'validv2.xml')); $phpunit->assertErrors(array( array('package' => 'PEAR_PackageFile_v2', 'message' => 'Channel validator warning: field "date" - Release Date "2004-12-25" is not today'), array('package' => 'PEAR_PackageFile_v2', 'message' => 'File "' . $temp_path . DIRECTORY_SEPARATOR . 'sunger/foo.dat" in package.xml does not exist'), ), 'ret 2.1'); $phpunit->assertEquals(array ( 0 => array ( 0 => 1, 1 => 'Analyzing foo1.php', ), 1 => array ( 'info' => 'Error: File "' . $temp_path . DIRECTORY_SEPARATOR . 'sunger/foo.dat" in package.xml does not exist Warning: Channel validator warning: field "date" - Release Date "2004-12-25" is not today Validation: 1 error(s), 1 warning(s) ', 'cmd' => 'package-validate', ), ), $fakelog->getLog(), 'log 2.1'); mkdir($temp_path . DIRECTORY_SEPARATOR . 'sunger'); copy(dirname(__FILE__) . '/packagefiles/sunger/foo.dat', $temp_path . DIRECTORY_SEPARATOR . 'sunger' . DIRECTORY_SEPARATOR . 'foo.dat'); $contents = file_get_contents($temp_path . DIRECTORY_SEPARATOR . 'validv2.xml'); $contents = str_replace('2004-12-25', date('Y-m-d'), $contents); $fp = fopen($temp_path . DIRECTORY_SEPARATOR . 'validv2.xml', 'wb'); fwrite($fp, $contents); fclose($fp); $ret = $command->run('package-validate', array(), array($temp_path . DIRECTORY_SEPARATOR . 'validv2.xml')); $phpunit->assertNoErrors('ret success'); $phpunit->assertEquals(array ( 0 => array ( 0 => 1, 1 => 'Analyzing foo1.php', ), 1 => array ( 'info' => 'Validation: 0 error(s), 0 warning(s) ', 'cmd' => 'package-validate', ), ), $fakelog->getLog(), 'log success'); chdir($savedir); echo 'tests done'; ?> --CLEAN-- --EXPECT-- tests done php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package-validate/test_fail.phpt000066400000000000000000000022701262614675700316350ustar00rootroot00000000000000--TEST-- package-validate command failure --SKIPIF-- --FILE-- run('package-validate', array(), array($temp_path . DIRECTORY_SEPARATOR . 'bloob.xml')); if (version_compare(phpversion(), '5.0.0', '>=')) { if (version_compare(phpversion(), '5.0.3', '>=')) { $errmsg = 'XML error: Invalid document end at line 1'; } else { $errmsg = 'XML error: XML_ERR_DOCUMENT_END at line 1'; } } else { $errmsg = 'XML error: no element found at line 1'; } $phpunit->assertErrors(array( array('package' => 'PEAR_PackageFile', 'message' => 'package.xml "' . $temp_path . DIRECTORY_SEPARATOR . 'bloob.xml" has no package.xml version'), array('package' => 'PEAR_Error', 'message' => $errmsg), ), 'ret 1'); $phpunit->assertIsa('PEAR_Error', $ret, 'bloob.xml'); $phpunit->assertEquals(array ( ), $fakelog->getLog(), 'log'); echo 'tests done'; ?> --CLEAN-- --EXPECT-- tests done php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package/000077500000000000000000000000001262614675700251765ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package/packagefiles/000077500000000000000000000000001262614675700276145ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package/packagefiles/DB_Table/000077500000000000000000000000001262614675700312105ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package/packagefiles/DB_Table/DB/000077500000000000000000000000001262614675700314755ustar00rootroot00000000000000Table.php000066400000000000000000002244151262614675700331660ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package/packagefiles/DB_Table/DB * @author Mark Wiesemann * * @license http://www.gnu.org/copyleft/lesser.html LGPL * * @version $Id: Table.php,v 1.87 2007/06/14 15:07:27 morse Exp $ */ /** * Error code at instantiation time when the first parameter to the * constructor is not a PEAR DB object. */ define('DB_TABLE_ERR_NOT_DB_OBJECT', -1); /** * Error code at instantiation time when the PEAR DB/MDB2 $phptype is not * supported by DB_Table. */ define('DB_TABLE_ERR_PHPTYPE', -2); /** * Error code when you call select() or selectResult() and the first * parameter is a string that does not match any of the $this->sql keys. */ define('DB_TABLE_ERR_SQL_UNDEF', -3); /** * Error code when you call select*() or buildSQL() and the first * parameter is neither an array nor a string */ define('DB_TABLE_ERR_SQL_NOT_STRING', -4); /** * Error code when you try to insert data to a column that is not in the * $this->col array. */ define('DB_TABLE_ERR_INS_COL_NOMAP', -5); /** * Error code when you try to insert data, and that data does not have a * column marked as 'require' in the $this->col array. */ define('DB_TABLE_ERR_INS_COL_REQUIRED', -6); /** * Error code when auto-validation fails on data to be inserted. */ define('DB_TABLE_ERR_INS_DATA_INVALID', -7); /** * Error code when you try to update data to a column that is not in the * $this->col array. */ define('DB_TABLE_ERR_UPD_COL_NOMAP', -8); /** * Error code when you try to update data, and that data does not have a * column marked as 'require' in the $this->col array. */ define('DB_TABLE_ERR_UPD_COL_REQUIRED', -9); /** * Error code when auto-validation fails on update data. */ define('DB_TABLE_ERR_UPD_DATA_INVALID', -10); /** * Error code when you use a create() flag that is not recognized (must * be 'safe', 'drop', 'verify' or boolean false. */ define('DB_TABLE_ERR_CREATE_FLAG', -11); /** * Error code at create() time when you define an index in $this->idx * that has no columns. */ define('DB_TABLE_ERR_IDX_NO_COLS', -12); /** * Error code at create() time when you define an index in $this->idx * that refers to a column that does not exist in the $this->col array. */ define('DB_TABLE_ERR_IDX_COL_UNDEF', -13); /** * Error code at create() time when you define a $this->idx index type * that is not recognized (must be 'normal' or 'unique'). */ define('DB_TABLE_ERR_IDX_TYPE', -14); /** * Error code at create() time when you have an error in a 'char' or * 'varchar' definition in $this->col (usually because 'size' is wrong). */ define('DB_TABLE_ERR_DECLARE_STRING', -15); /** * Error code at create() time when you have an error in a 'decimal' * definition (usually because the 'size' or 'scope' are wrong). */ define('DB_TABLE_ERR_DECLARE_DECIMAL', -16); /** * Error code at create() time when you define a column in $this->col * with an unrecognized 'type'. */ define('DB_TABLE_ERR_DECLARE_TYPE', -17); /** * Error code at validation time when a column in $this->col has an * unrecognized 'type'. */ define('DB_TABLE_ERR_VALIDATE_TYPE', -18); /** * Error code at create() time when you define a column in $this->col * with an invalid column name (usually because it's a reserved keyword). */ define('DB_TABLE_ERR_DECLARE_COLNAME', -19); /** * Error code at create() time when you define an index in $this->idx * with an invalid index name (usually because it's a reserved keyword). */ define('DB_TABLE_ERR_DECLARE_IDXNAME', -20); /** * Error code at create() time when you define an index in $this->idx * that refers to a CLOB column. */ define('DB_TABLE_ERR_IDX_COL_CLOB', -21); /** * Error code at create() time when you define a column name that is * more than 30 chars long (an Oracle restriction). */ define('DB_TABLE_ERR_DECLARE_STRLEN', -22); /** * Error code at create() time when the index name ends up being more * than 30 chars long (an Oracle restriction). */ define('DB_TABLE_ERR_IDX_STRLEN', -23); /** * Error code at create() time when the table name is more than 30 chars * long (an Oracle restriction). */ define('DB_TABLE_ERR_TABLE_STRLEN', -24); /** * Error code at nextID() time when the sequence name is more than 30 * chars long (an Oracle restriction). */ define('DB_TABLE_ERR_SEQ_STRLEN', -25); /** * Error code at verify() time when the table does not exist in the * database. */ define('DB_TABLE_ERR_VER_TABLE_MISSING', -26); /** * Error code at verify() time when the column does not exist in the * database table. */ define('DB_TABLE_ERR_VER_COLUMN_MISSING', -27); /** * Error code at verify() time when the column type does not match the * type specified in the column declaration. */ define('DB_TABLE_ERR_VER_COLUMN_TYPE', -28); /** * Error code at instantiation time when the column definition array * does not contain at least one column. */ define('DB_TABLE_ERR_NO_COLS', -29); /** * Error code at verify() time when an index cannot be found in the * database table. */ define('DB_TABLE_ERR_VER_IDX_MISSING', -30); /** * Error code at verify() time when an index does not contain all * columns that it should contain. */ define('DB_TABLE_ERR_VER_IDX_COL_MISSING', -31); /** * Error code at instantiation time when a creation mode * is not available for a phptype. */ define('DB_TABLE_ERR_CREATE_PHPTYPE', -32); /** * Error code at create() time when you define more than one primary key * in $this->idx. */ define('DB_TABLE_ERR_DECLARE_PRIMARY', -33); /** * Error code at create() time when a primary key is defined in $this->idx * and SQLite is used (SQLite does not support primary keys). */ define('DB_TABLE_ERR_DECLARE_PRIM_SQLITE', -34); /** * Error code at alter() time when altering a table field is not possible * (e.g. because MDB2 has no support for the change or because the DBMS * does not support the change). */ define('DB_TABLE_ERR_ALTER_TABLE_IMPOS', -35); /** * Error code at alter() time when altering a(n) index/constraint is not possible * (e.g. because MDB2 has no support for the change or because the DBMS * does not support the change). */ define('DB_TABLE_ERR_ALTER_INDEX_IMPOS', -36); /** * Error code at insert() time due to invalid the auto-increment column * definition. This column must be an integer type and required. */ define('DB_TABLE_ERR_AUTO_INC_COL', -37); /** * The DB_Table_Base parent class */ require_once 'DB/Table/Base.php'; /** * The PEAR class for errors */ require_once 'PEAR.php'; /** * The Date class for recasting date and time values */ require_once 'DB/Table/Date.php'; /** * DB_Table supports these RDBMS engines and their various native data * types; we need these here instead of in Manager.php because the * initial array key tells us what databases are supported. */ $GLOBALS['_DB_TABLE']['type'] = array( 'fbsql' => array( 'boolean' => 'DECIMAL(1,0)', 'char' => 'CHAR', 'varchar' => 'VARCHAR', 'smallint' => 'SMALLINT', 'integer' => 'INTEGER', 'bigint' => 'LONGINT', 'decimal' => 'DECIMAL', 'single' => 'REAL', 'double' => 'DOUBLE PRECISION', 'clob' => 'CLOB', 'date' => 'CHAR(10)', 'time' => 'CHAR(8)', 'timestamp' => 'CHAR(19)' ), 'ibase' => array( 'boolean' => 'DECIMAL(1,0)', 'char' => 'CHAR', 'varchar' => 'VARCHAR', 'smallint' => 'SMALLINT', 'integer' => 'INTEGER', 'bigint' => 'BIGINT', 'decimal' => 'DECIMAL', 'single' => 'FLOAT', 'double' => 'DOUBLE PRECISION', 'clob' => 'BLOB SUB_TYPE 1', 'date' => 'DATE', 'time' => 'TIME', 'timestamp' => 'TIMESTAMP' ), 'mssql' => array( 'boolean' => 'DECIMAL(1,0)', 'char' => 'CHAR', 'varchar' => 'VARCHAR', 'smallint' => 'SMALLINT', 'integer' => 'INTEGER', 'bigint' => 'BIGINT', 'decimal' => 'DECIMAL', 'single' => 'REAL', 'double' => 'FLOAT', 'clob' => 'TEXT', 'date' => 'CHAR(10)', 'time' => 'CHAR(8)', 'timestamp' => 'CHAR(19)' ), 'mysql' => array( 'boolean' => 'DECIMAL(1,0)', 'char' => 'CHAR', 'varchar' => 'VARCHAR', 'smallint' => 'SMALLINT', 'integer' => 'INTEGER', 'bigint' => 'BIGINT', 'decimal' => 'DECIMAL', 'single' => 'FLOAT', 'double' => 'DOUBLE', 'clob' => 'LONGTEXT', 'date' => 'CHAR(10)', 'time' => 'CHAR(8)', 'timestamp' => 'CHAR(19)' ), 'mysqli' => array( 'boolean' => 'DECIMAL(1,0)', 'char' => 'CHAR', 'varchar' => 'VARCHAR', 'smallint' => 'SMALLINT', 'integer' => 'INTEGER', 'bigint' => 'BIGINT', 'decimal' => 'DECIMAL', 'single' => 'FLOAT', 'double' => 'DOUBLE', 'clob' => 'LONGTEXT', 'date' => 'CHAR(10)', 'time' => 'CHAR(8)', 'timestamp' => 'CHAR(19)' ), 'oci8' => array( 'boolean' => 'NUMBER(1)', 'char' => 'CHAR', 'varchar' => 'VARCHAR2', 'smallint' => 'NUMBER(6)', 'integer' => 'NUMBER(11)', 'bigint' => 'NUMBER(19)', 'decimal' => 'NUMBER', 'single' => 'REAL', 'double' => 'DOUBLE PRECISION', 'clob' => 'CLOB', 'date' => 'CHAR(10)', 'time' => 'CHAR(8)', 'timestamp' => 'CHAR(19)' ), 'pgsql' => array( 'boolean' => 'DECIMAL(1,0)', 'char' => 'CHAR', 'varchar' => 'VARCHAR', 'smallint' => 'SMALLINT', 'integer' => 'INTEGER', 'bigint' => 'BIGINT', 'decimal' => 'DECIMAL', 'single' => 'REAL', 'double' => 'DOUBLE PRECISION', 'clob' => 'TEXT', 'date' => 'CHAR(10)', 'time' => 'CHAR(8)', 'timestamp' => 'CHAR(19)' ), 'sqlite' => array( 'boolean' => 'BOOLEAN', 'char' => 'CHAR', 'varchar' => 'VARCHAR', 'smallint' => 'SMALLINT', 'integer' => 'INTEGER', 'bigint' => 'BIGINT', 'decimal' => 'NUMERIC', 'single' => 'FLOAT', 'double' => 'DOUBLE', 'clob' => 'CLOB', 'date' => 'DATE', 'time' => 'TIME', 'timestamp' => 'TIMESTAMP' ) ); /** * US-English default error messages. If you want to internationalize, you can * set the translated messages via $GLOBALS['_DB_TABLE']['error']. You can also * use DB_Table::setErrorMessage(). Examples: * * * (1) $GLOBALS['_DB_TABLE]['error'] = array(DB_TABLE_ERR_PHPTYPE => '...', * DB_TABLE_ERR_SQL_UNDEF => '...'); * (2) DB_Table::setErrorMessage(DB_TABLE_ERR_PHPTYPE, '...'); * DB_Table::setErrorMessage(DB_TABLE_ERR_SQL_UNDEF, '...'); * (3) DB_Table::setErrorMessage(array(DB_TABLE_ERR_PHPTYPE => '...'); * DB_TABLE_ERR_SQL_UNDEF => '...'); * (4) $obj =& new DB_Table(); * $obj->setErrorMessage(DB_TABLE_ERR_PHPTYPE, '...'); * $obj->setErrorMessage(DB_TABLE_ERR_SQL_UNDEF, '...'); * (5) $obj =& new DB_Table(); * $obj->setErrorMessage(array(DB_TABLE_ERR_PHPTYPE => '...'); * DB_TABLE_ERR_SQL_UNDEF => '...'); * * * For errors that can occur with-in the constructor call (i.e. e.g. creating * or altering the database table), only the code from examples (1) to (3) * will alter the default error messages early enough. For errors that can * occur later, examples (4) and (5) are also valid. */ $GLOBALS['_DB_TABLE']['default_error'] = array( DB_TABLE_ERR_NOT_DB_OBJECT => 'First parameter must be a DB/MDB2 object', DB_TABLE_ERR_PHPTYPE => 'DB/MDB2 phptype (or dbsyntax) not supported', DB_TABLE_ERR_SQL_UNDEF => 'Select query string not in a key of $sql. Key', DB_TABLE_ERR_SQL_NOT_STRING => 'Select query is neither an array nor a string', DB_TABLE_ERR_INS_COL_NOMAP => 'Insert column not in map', DB_TABLE_ERR_INS_COL_REQUIRED => 'Insert data must be set and non-null for column', DB_TABLE_ERR_INS_DATA_INVALID => 'Insert data not valid for column', DB_TABLE_ERR_UPD_COL_NOMAP => 'Update column not in map', DB_TABLE_ERR_UPD_COL_REQUIRED => 'Update column must be set and non-null', DB_TABLE_ERR_UPD_DATA_INVALID => 'Update data not valid for column', DB_TABLE_ERR_CREATE_FLAG => 'Create flag not valid', DB_TABLE_ERR_IDX_NO_COLS => 'No columns for index', DB_TABLE_ERR_IDX_COL_UNDEF => 'Column not in map for index', DB_TABLE_ERR_IDX_TYPE => 'Type not valid for index', DB_TABLE_ERR_DECLARE_STRING => 'String column declaration not valid', DB_TABLE_ERR_DECLARE_DECIMAL => 'Decimal column declaration not valid', DB_TABLE_ERR_DECLARE_TYPE => 'Column type not valid', DB_TABLE_ERR_VALIDATE_TYPE => 'Cannot validate for unknown type on column', DB_TABLE_ERR_DECLARE_COLNAME => 'Column name not valid', DB_TABLE_ERR_DECLARE_IDXNAME => 'Index name not valid', DB_TABLE_ERR_DECLARE_TYPE => 'Column type not valid', DB_TABLE_ERR_IDX_COL_CLOB => 'CLOB column not allowed for index', DB_TABLE_ERR_DECLARE_STRLEN => 'Column name too long, 30 char max', DB_TABLE_ERR_IDX_STRLEN => 'Index name too long, 30 char max', DB_TABLE_ERR_TABLE_STRLEN => 'Table name too long, 30 char max', DB_TABLE_ERR_SEQ_STRLEN => 'Sequence name too long, 30 char max', DB_TABLE_ERR_VER_TABLE_MISSING => 'Verification failed: table does not exist', DB_TABLE_ERR_VER_COLUMN_MISSING => 'Verification failed: column does not exist', DB_TABLE_ERR_VER_COLUMN_TYPE => 'Verification failed: wrong column type', DB_TABLE_ERR_NO_COLS => 'Column definition array may not be empty', DB_TABLE_ERR_VER_IDX_MISSING => 'Verification failed: index does not exist', DB_TABLE_ERR_VER_IDX_COL_MISSING => 'Verification failed: index does not contain all specified cols', DB_TABLE_ERR_CREATE_PHPTYPE => 'Creation mode is not supported for this phptype', DB_TABLE_ERR_DECLARE_PRIMARY => 'Only one primary key is allowed', DB_TABLE_ERR_DECLARE_PRIM_SQLITE => 'SQLite does not support primary keys', DB_TABLE_ERR_ALTER_TABLE_IMPOS => 'Alter table failed: changing the field type not possible', DB_TABLE_ERR_ALTER_INDEX_IMPOS => 'Alter table failed: changing the index/constraint not possible', DB_TABLE_ERR_AUTO_INC_COL => 'Illegal auto-increment column definition' ); // merge default and user-defined error messages if (!isset($GLOBALS['_DB_TABLE']['error'])) { $GLOBALS['_DB_TABLE']['error'] = array(); } foreach ($GLOBALS['_DB_TABLE']['default_error'] as $code => $message) { if (!array_key_exists($code, $GLOBALS['_DB_TABLE']['error'])) { $GLOBALS['_DB_TABLE']['error'][$code] = $message; } } /** * DB_Table is a database API and data type SQL abstraction class. * * DB_Table provides database API abstraction, data type abstraction, * automated SELECT, INSERT, and UPDATE queries, automated table * creation, automated validation of inserted/updated column values, * and automated creation of QuickForm elemnts based on the column * definitions. * * @category Database * @package DB_Table * @author Paul M. Jones * @author Mark Wiesemann * * @version @package_version@ * */ class DB_Table extends DB_Table_Base { /** * The table or view in the database to which this object binds. * * @access public * @var string */ var $table = null; /** * DB_Table_Database instance that this table belongs to. * * @access private * @var object */ var $_database = null; /** * Associative array of column definitions. * * @access public * @var array */ var $col = array(); /** * Associative array of index definitions. * * @access public * @var array */ var $idx = array(); /** * Name of an auto-increment column, if any. Null otherwise. * * A table can contain at most one auto-increment column. * Auto-incrementing is implemented in the insert() method, * using a sequence accessed by the nextID() method. * * @access public * @var string */ var $auto_inc_col = null; /** * Boolean flag to turn on (true) or off (false) auto-incrementing. * * Auto-increment column $auto_inc_col upon insertion only if $_auto_inc is * true and the value of that column is null in the data to be inserted. * * @var bool * @access private */ var $_auto_inc = true; /** * Whether or not to automatically validate data at insert-time. * * @var bool * @access private */ var $_valid_insert = true; /** * Whether or not to automatically validate data at update-time. * * @var bool * @access private */ var $_valid_update = true; /** * Whether or not to automatically recast data at insert- and update-time. * * @var bool * @access private */ var $_auto_recast = true; /** * Constructor. * * The constructor returns a DB_Table object that wraps an * instance $db DB or MDB2, and that binds to a specific database * table named $table. It can optionally create the database table * or verify that its schema matches that declared in the $col and * $idx parameters, depending on the value of the $create parameter. * * If there is an error on instantiation, $this->error will be * populated with the PEAR_Error. * * @param object &$db A PEAR DB/MDB2 object. * * @param string $table The table name to connect to in the database. * * @param mixed $create The automatic table creation mode to pursue: * - boolean false to not attempt creation * - 'safe' to create the table only if it does not exist * - 'drop' to drop any existing table with the same name and re-create it * - 'verify' to check whether the table exists, whether all the columns * exist, whether the columns have the right type, and whether the indexes * exist and have the right type * - 'alter' does the same as 'safe' if the table does not exist; if it * exists, a verification for columns existence, the column types, the * indexes existence, and the indexes types will be performed and the * table schema will be modified if needed * * @return object DB_Table * @access public */ function DB_Table(&$db, $table, $create = false) { // is the first argument a DB/MDB2 object? $this->backend = null; if (is_subclass_of($db, 'db_common')) { $this->backend = 'db'; } elseif (is_subclass_of($db, 'mdb2_driver_common')) { $this->backend = 'mdb2'; } if (is_null($this->backend)) { $this->error =& DB_Table::throwError(DB_TABLE_ERR_NOT_DB_OBJECT); return; } // set the class properties $this->db =& $db; $this->table = $table; // Identify the class for error handling by parent class $this->_primary_subclass = 'DB_TABLE'; // is the RDBMS supported? $phptype = $db->phptype; $dbsyntax = $db->dbsyntax; if (! DB_Table::supported($phptype, $dbsyntax)) { $this->error =& DB_Table::throwError( DB_TABLE_ERR_PHPTYPE, "({$db->phptype})" ); return; } // load MDB2_Extended module if ($this->backend == 'mdb2') { $this->db->loadModule('Extended', null, false); } // should we attempt table creation? if ($create) { if ($this->backend == 'mdb2') { $this->db->loadModule('Manager'); } // check whether the chosen mode is supported $mode_supported = DB_Table::modeSupported($create, $phptype); if (PEAR::isError($mode_supported)) { $this->error =& $mode_supported; return; } if (!$mode_supported) { $this->error =& $this->throwError( DB_TABLE_ERR_CREATE_PHPTYPE, "('$create', '$phptype')" ); return; } include_once 'DB/Table/Manager.php'; switch ($create) { case 'alter': $result = $this->alter(); break; case 'drop': case 'safe': $result = $this->create($create); break; case 'verify': $result = $this->verify(); break; } if (PEAR::isError($result)) { // problem creating/altering/verifing the table $this->error =& $result; return; } } } /** * Is a particular RDBMS supported by DB_Table? * * @static * @param string $phptype The RDBMS type for PHP. * @param string $dbsyntax The chosen database syntax. * @return bool True if supported, false if not. * @access public */ function supported($phptype, $dbsyntax = '') { // only Firebird is supported, not its ancestor Interbase if ($phptype == 'ibase' && $dbsyntax != 'firebird') { return false; } $supported = array_keys($GLOBALS['_DB_TABLE']['type']); return in_array(strtolower($phptype), $supported); } /** * Is a creation mode supported for a RDBMS by DB_Table? * * @param string $mode The chosen creation mode. * @param string $phptype The RDBMS type for PHP. * @return bool True if supported, false if not (PEAR_Error on failure) * * @throws PEAR_Error if * Unknown creation mode is specified (DB_TABLE_ERR_CREATE_FLAG) * * @access public */ function modeSupported($mode, $phptype) { // check phptype for validity $supported = array_keys($GLOBALS['_DB_TABLE']['type']); if (!in_array(strtolower($phptype), $supported)) { return false; } switch ($mode) { case 'drop': case 'safe': // supported for all RDBMS return true; case 'alter': case 'verify': // not supported for fbsql and mssql (yet) switch ($phptype) { case 'fbsql': case 'mssql': return false; default: return true; } default: // unknown creation mode return $this->throwError( DB_TABLE_ERR_CREATE_FLAG, "('$mode')" ); } } /** * Overwrite one or more error messages, e.g. to internationalize them. * * @param mixed $code If string, the error message with code $code will * be overwritten by $message. If array, the error messages with code * of each array key will be overwritten by the key's value. * * @param string $message Only used if $key is not an array. * @return void * @access public */ function setErrorMessage($code, $message = null) { if (is_array($code)) { foreach ($code as $single_code => $single_message) { $GLOBALS['_DB_TABLE']['error'][$single_code] = $single_message; } } else { $GLOBALS['_DB_TABLE']['error'][$code] = $message; } } /** * * Returns all or part of the $this->col property array. * * @param mixed $col If null, returns the $this->col property array * as it is. If string, returns that column name from the $this->col * array. If an array, returns those columns named as the array * values from the $this->col array as an array. * * @return mixed All or part of the $this->col property array, or * boolean false if no matching column names are found. * @access public */ function getColumns($col = null) { // by default, return all column definitions if (is_null($col)) { return $this->col; } // if the param is a string, only return the column definition // named by the that string if (is_string($col)) { if (isset($this->col[$col])) { return $this->col[$col]; } else { return false; } } // if the param is a sequential array of column names, // return only those columns named in that array if (is_array($col)) { $set = array(); foreach ($col as $name) { $set[$name] = $this->getColumns($name); } if (count($set) == 0) { return false; } else { return $set; } } // param was not null, string, or array return false; } /** * Returns all or part of the $this->idx property array. * * @param mixed $idx Index name (key in $this->idx), or array of * index name strings. * * @return mixed All or part of the $this->idx property array, * or boolean false if $idx is not null but invalid * * @access public */ function getIndexes($idx = null) { // by default, return all index definitions if (is_null($idx)) { return $this->idx; } // if the param is a string, only return the index definition // named by the that string if (is_string($idx)) { if (isset($this->idx[$idx])) { return $this->idx[$idx]; } else { return false; } } // if the param is a sequential array of index names, // return only those indexes named in that array if (is_array($idx)) { $set = array(); foreach ($idx as $name) { $set[$name] = $this->getIndexes($name); } if (count($set) == 0) { return false; } else { return $set; } } // param was not null, string, or array return false; } /** * Connect or disconnect a DB_Table_Database instance to this table * instance. * * Used to re-connect this DB_Table object to a parent DB_Table_Database * object during unserialization. Can also disconnect if the $database * parameter is null. Use the DB_Table_Database::addTable method instead * to add a table to a new DB_Table_Database. * * @param object &$database DB_Table_Database instance that this table * belongs to (or null to disconnect from instance). * * @return void * @access public */ function setDatabaseInstance(&$database) { if (is_a($database, 'DB_Table_Database')) { $this->_database =& $database; } elseif (is_null($database)) { $this->_database = null; } } /** * Inserts a single table row. * * Inserts data from associative array $data, in which keys are column * names and values are column values. All required columns (except an * auto-increment column) must be included in the data array. Columns * values that are not set or null are inserted as SQL NULL values. * * If an auto-increment column is declared (by setting $this->auto_inc_col), * and the value of that column in $data is not set or null, then a new * sequence value will be generated and inserted. * * If auto-recasting is enabled (if $this->_auto_recast), the method will * try, if necessary to recast $data to proper column types, with recast(). * * If auto-validation is enabled (if $this->_valid_insert), the method * will validates column types with validInsert() before insertion. * * @access public * * @param array $data An associative array of key-value pairs where * the key is the column name and the value is the column value. * This is the data that will be inserted into the table. * * @return mixed Void on success (PEAR_Error on failure) * * @throws PEAR_Error if: * - Error in auto_inc_col declaration (DB_TABLE_ERR_AUTO_INC_COL) * - Error returned by DB/MDB2::autoExecute() (Error bubbled up) * * @see validInsert() * @see DB::autoExecute() * @see MDB2::autoExecute() */ function insert($data) { // Auto-increment if enabled and input value is null or not set if ($this->_auto_inc && !is_null($this->auto_inc_col) && !isset($data[$this->auto_inc_col]) ) { $column = $this->auto_inc_col; // check that the auto-increment column exists if (!array_key_exists($column, $this->col)) { return $this->throwError( DB_TABLE_ERR_AUTO_INC_COL, ": $column does not exist"); } // check that the column is integer if (!in_array($this->col[$column]['type'], array('integer','smallint','bigint'))) { return $this->throwError( DB_TABLE_ERR_AUTO_INC_COL, ": $column is not an integer"); } // check that the column is required // Note: The insert method will replace a null input value // of $data[$column] with a sequence value. This makes // the column effectively 'not null'. This column must be // 'required' for consistency, to make this explicit. if (!$this->isRequired($column)) { return $this->throwError( DB_TABLE_ERR_AUTO_INC_COL, ": $column is not required"); } // set the value $id = $this->nextID(); if (PEAR::isError($id)) { return $id; } $data[$column] = $id; } // forcibly recast the data elements to their proper types? if ($this->_auto_recast) { $this->recast($data); } // validate the data if auto-validation is turned on if ($this->_valid_insert) { $result = $this->validInsert($data); if (PEAR::isError($result)) { return $result; } } // Does a parent DB_Table_Database object exist? if ($this->_database) { $_database = $this->_database; // Validate foreign key values (if enabled) if ($_database->_check_fkey) { $result = $_database->validForeignKeys($this->table, $data); if (PEAR::isError($result)) { return $result; } } } // Do insertion if ($this->backend == 'mdb2') { $result = $this->db->extended->autoExecute($this->table, $data, MDB2_AUTOQUERY_INSERT); } else { $result = $this->db->autoExecute($this->table, $data, DB_AUTOQUERY_INSERT); } return $result; } /** * Turns on or off auto-incrementing of $auto_inc_col column (if any) * * For auto-incrementing to work, an $auto_inc_col column must be declared, * auto-incrementing must be enabled (by this method), and the value of * the $auto_inc_col column must be not set or null in the $data passed to * the insert method. * * @param bool $flag True to turn on auto-increment, false to turn off. * @return void * @access public */ function setAutoInc($flag = true) { if ($flag) { $this->_auto_inc = true; } else { $this->_auto_inc = false; } } /** * Turns on (or off) automatic validation of inserted data. * * Enables (if $flag is true) or disables (if $flag is false) automatic * validation of data types prior to actual insertion into the database * by the DB_Table::insert() method. * * @param bool $flag True to turn on auto-validation, false to turn off. * @return void * @access public */ function autoValidInsert($flag = true) { if ($flag) { $this->_valid_insert = true; } else { $this->_valid_insert = false; } } /** * Validates an array for insertion into the table. * * @param array $data An associative array of key-value pairs where * the key is the column name and the value is the column value. This * is the data that will be inserted into the table. Data is checked * against the column data type for validity. * * @return boolean true on success (PEAR_Error on failure) * * @throws PEAR_Error if: * - Invalid column name key in $data (DB_TABLE_ERR_INS_COL_NOMAP) * - Missing required column value (DB_TABLE_ERR_INS_COL_NOMAP) * - Column value doesn't match type (DB_TABLE_ERR_INS_DATA_INVALID) * * @access public * * @see insert() */ function validInsert(&$data) { // loop through the data, and disallow insertion of unmapped // columns foreach ($data as $col => $val) { if (! isset($this->col[$col])) { return $this->throwError( DB_TABLE_ERR_INS_COL_NOMAP, "('$col')" ); } } // loop through each column mapping, and check the data to be // inserted into it against the column data type. we loop through // column mappings instead of the insert data to make sure that // all necessary columns are being inserted. foreach ($this->col as $col => $val) { // is the value allowed to be null? if (isset($val['require']) && $val['require'] == true && (! isset($data[$col]) || is_null($data[$col]))) { return $this->throwError( DB_TABLE_ERR_INS_COL_REQUIRED, "'$col'" ); } // does the value to be inserted match the column data type? if (isset($data[$col]) && ! $this->isValid($data[$col], $col)) { return $this->throwError( DB_TABLE_ERR_INS_DATA_INVALID, "'$col' ('$data[$col]')" ); } } return true; } /** * Update table row or rows that match a custom WHERE clause * * Constructs and submits an SQL UPDATE command to update columns whose * names are keys in the $data array parameter, in all rows that match * the logical condition given by the $where string parameter. * * If auto-recasting is enabled (if $this->_auto_recast), update() will * try, if necessary, to recast $data to proper column types, with recast(). * * If auto-validation is enabled (if $this->_valid_insert), update() * validates column types with validUpdate() before insertion. * * @param array $data An associative array of key-value pairs where the * key is the column name and the value is the column value. These are * the columns that will be updated with new values. * * @param string $where An SQL WHERE clause limiting which records are * are to be updated. * * @return mixed Void on success, a PEAR_Error object on failure. * * @throws PEAR_Error if: * - Data fails type validation (bubbles error returned by validUpdate) * - Error thrown by DB/MDB2::autoexecute() * * @access public * * @see validUpdate() * @see DB::autoExecute() * @see MDB2::autoExecute() */ function update($data, $where) { // forcibly recast the data elements to their proper types? if ($this->_auto_recast) { $this->recast($data); } // validate the data if auto-validation is turned on if ($this->_valid_update) { $result = $this->validUpdate($data); if (PEAR::isError($result)) { return $result; } } // Does a parent DB_Table_Database object exist? if ($this->_database) { $_database =& $this->_database; // Validate foreign key values (if enabled) if ($_database->_check_fkey) { $result = $_database->validForeignKeys($this->table, $data); if (PEAR::isError($result)) { return $result; } } // Implement any relevant ON UPDATE actions $result = $_database->onUpdateAction($this, $data, $where); if (PEAR::isError($result)) { return $result; } } // Submit update command if ($this->backend == 'mdb2') { $result = $this->db->extended->autoExecute($this->table, $data, MDB2_AUTOQUERY_UPDATE, $where); } else { $result = $this->db->autoExecute($this->table, $data, DB_AUTOQUERY_UPDATE, $where); } return $result; } /** * Turns on (or off) automatic validation of updated data. * * Enables (if $flag is true) or disables (if $flag is false) automatic * validation of data types prior to updating rows in the database by * the {@link update()} method. * * @param bool $flag True to turn on auto-validation, false to turn off. * @return void * @access public */ function autoValidUpdate($flag = true) { if ($flag) { $this->_valid_update = true; } else { $this->_valid_update = false; } } /** * Validates an array for updating the table. * * @param array $data An associative array of key-value pairs where * the key is the column name and the value is the column value. This * is the data that will be inserted into the table. Data is checked * against the column data type for validity. * * @return mixed Boolean true on success (PEAR_Error object on failure) * * @throws PEAR_Error if * - Invalid column name key in $data (DB_TABLE_ERR_UPD_COL_NOMAP) * - Missing required column value (DB_TABLE_ERR_UPD_COL_NOMAP) * - Column value doesn't match type (DB_TABLE_ERR_UPD_DATA_INVALID) * * @access public * * @see update() */ function validUpdate(&$data) { // loop through each data element, and check the // data to be updated against the column data type. foreach ($data as $col => $val) { // does the column exist? if (! isset($this->col[$col])) { return $this->throwError( DB_TABLE_ERR_UPD_COL_NOMAP, "('$col')" ); } // the column definition $defn = $this->col[$col]; // is it allowed to be null? if (isset($defn['require']) && $defn['require'] == true && isset($data[$col]) && is_null($data[$col])) { return $this->throwError( DB_TABLE_ERR_UPD_COL_REQUIRED, $col ); } // does the value to be inserted match the column data type? if (! $this->isValid($data[$col], $col)) { return $this->throwError( DB_TABLE_ERR_UPD_DATA_INVALID, "$col ('$data[$col]')" ); } } return true; } /** * Deletes table rows matching a custom WHERE clause. * * Constructs and submits and SQL DELETE command with the specified WHERE * clause. Command is submitted by DB::query() or MDB2::exec(). * * If a reference to a DB_Table_Database instance exists, carry out any * ON DELETE actions declared in that instance before actual insertion, * if emulation of ON DELETE actions is enabled in that instance. * * @param string $where Logical condition in the WHERE clause of the * delete command. * * @return mixed void on success (PEAR_Error on failure) * * @throws PEAR_Error if * DB::query() or MDB2::exec() returns error (bubbles up) * * @access public * * @see DB::query() * @see MDB2::exec() */ function delete($where) { // Does a parent DB_Table_Database object exist? if ($this->_database) { $_database =& $this->_database; // Implement any relevant ON DELETE actions $result = $_database->onDeleteAction($this, $where); if (PEAR::isError($result)) { return $result; } } if ($this->backend == 'mdb2') { $result = $this->db->exec("DELETE FROM $this->table WHERE $where"); } else { $result = $this->db->query("DELETE FROM $this->table WHERE $where"); } return $result; } /** * * Generates and returns a sequence value. * * Generates a sequence value by calling the DB or MDB2::nextID() method. The * sequence name defaults to the table name, or may be specified explicitly. * * @param string $seq_name The sequence name; defaults to table_id. * * @return integer The next value in the sequence (PEAR_Error on failure) * * @throws PEAR_Error if * Sequence name too long (>26 char + _seq) (DB_TABLE_ERR_SEQ_STRLEN) * * @access public * * @see DB::nextID() * @see MDB2::nextID() */ function nextID($seq_name = null) { if (is_null($seq_name)) { $seq_name = "{$this->table}"; } else { $seq_name = "{$this->table}_{$seq_name}"; } // the maximum length is 30, but PEAR DB/MDB2 will add "_seq" to the // name, so the max length here is less 4 chars. we have to // check here because the sequence will be created automatically // by PEAR DB/MDB2, which will not check for length on its own. if (strlen($seq_name) > 26) { return DB_Table::throwError( DB_TABLE_ERR_SEQ_STRLEN, " ('$seq_name')" ); } return $this->db->nextId($seq_name); } /** * Escapes and enquotes a value for use in an SQL query. * * Simple wrapper for DB_Common::quoteSmart() or MDB2::quote(), which * returns the value of one of these functions. Helps makes user input * safe against SQL injection attack. * * @param mixed $val The value to be quoted * * @return string The value with quotes escaped, inside single quotes if * non-numeric. * * @throws PEAR_Error if * DB_Common::quoteSmart() or MDB2::quote() returns Error (bubbled up) * * @access public * * @see DB_Common::quoteSmart() * @see MDB2::quote() */ function quote($val) { if ($this->backend == 'mdb2') { $val = $this->db->quote($val); } else { $val = $this->db->quoteSmart($val); } return $val; } /** * Returns a blank row array based on the column map. * * The array keys are the column names, and all values are set to null. * * @return array An associative array where keys are column names and * all values are null. * @access public */ function getBlankRow() { $row = array(); foreach ($this->col as $key => $val) { $row[$key] = null; } $this->recast($row); return $row; } /** * Turns on (or off) automatic recasting of insert and update data. * * Turns on (if $flag is true) or off (if $flag is false) automatic forcible * recasting of data to the declared data type, if required, prior to inserting * or updating. The recasting is done by calling the DB_Table::recast() * method from within the DB_Table::insert() and DB_Table::update(). * * @param bool $flag True to automatically recast insert and update data, * false to not do so. * @return void * @access public */ function autoRecast($flag = true) { if ($flag) { $this->_auto_recast = true; } else { $this->_auto_recast = false; } } /** * Forces array elements to the proper types for their columns. * * This will not valiate the data, and will forcibly change the data * to match the recast-type. * * The date, time, and timestamp recasting has special logic for * arrays coming from an HTML_QuickForm object so that the arrays * are converted into properly-formatted strings. * * @todo If a column key holds an array of values (say from a multiple * select) then this method will not work properly; it will recast the * value to the string 'Array'. Is this bad? * * @param array &$data The data array to re-cast. * * @return void * * @access public */ function recast(&$data) { $keys = array_keys($data); $null_if_blank = array('date', 'time', 'timestamp', 'smallint', 'integer', 'bigint', 'decimal', 'single', 'double'); foreach ($keys as $key) { if (! isset($this->col[$key])) { continue; } unset($val); $val =& $data[$key]; // convert blanks to null for non-character field types $convert = in_array($this->col[$key]['type'], $null_if_blank); if (is_array($val)) { // if one of the given array values is // empty, null will be the new value if // the field is not required $tmp_val = implode('', $val); foreach ($val as $array_val) { if (trim((string) $array_val) == '') { $tmp_val = ''; break; } } } else { $tmp_val = $val; } if ($convert && trim((string) $tmp_val) == '' && ( !isset($this->col[$key]['require']) || $this->col[$key]['require'] === false ) ) { $val = null; } // skip explicit NULL values if (is_null($val)) { continue; } // otherwise, recast to the column type switch ($this->col[$key]['type']) { case 'boolean': $val = ($val) ? 1 : 0; break; case 'char': case 'varchar': case 'clob': settype($val, 'string'); break; case 'date': // smart handling of non-standard (i.e. Y-m-d) date formats, // this allows to use two-digit years (y) and short (M) or // long (F) names of months without having to recast the // date value yourself if (is_array($val)) { if (isset($val['y'])) { $val['Y'] = $val['y']; } if (isset($val['F'])) { $val['m'] = $val['F']; } if (isset($val['M'])) { $val['m'] = $val['M']; } } if (is_array($val) && isset($val['Y']) && isset($val['m']) && isset($val['d'])) { // the date is in HTML_QuickForm format, // convert into a string $y = (strlen($val['Y']) < 4) ? str_pad($val['Y'], 4, '0', STR_PAD_LEFT) : $val['Y']; $m = (strlen($val['m']) < 2) ? '0'.$val['m'] : $val['m']; $d = (strlen($val['d']) < 2) ? '0'.$val['d'] : $val['d']; $val = "$y-$m-$d"; } else { // convert using the Date class $tmp =& new DB_Table_Date($val); $val = $tmp->format('%Y-%m-%d'); } break; case 'time': if (is_array($val) && isset($val['H']) && isset($val['i']) && isset($val['s'])) { // the time is in HTML_QuickForm format, // convert into a string $h = (strlen($val['H']) < 2) ? '0' . $val['H'] : $val['H']; $i = (strlen($val['i']) < 2) ? '0' . $val['i'] : $val['i']; $s = (strlen($val['s']) < 2) ? '0' . $val['s'] : $val['s']; $val = "$h:$i:$s"; } else { // date does not matter in this case, so // pre 1970 and post 2040 are not an issue. $tmp = strtotime(date('Y-m-d') . " $val"); $val = date('H:i:s', $tmp); } break; case 'timestamp': // smart handling of non-standard (i.e. Y-m-d) date formats, // this allows to use two-digit years (y) and short (M) or // long (F) names of months without having to recast the // date value yourself if (is_array($val)) { if (isset($val['y'])) { $val['Y'] = $val['y']; } if (isset($val['F'])) { $val['m'] = $val['F']; } if (isset($val['M'])) { $val['m'] = $val['M']; } } if (is_array($val) && isset($val['Y']) && isset($val['m']) && isset($val['d']) && isset($val['H']) && isset($val['i']) && isset($val['s'])) { // timestamp is in HTML_QuickForm format, // convert each element to a string. pad // with zeroes as needed. $y = (strlen($val['Y']) < 4) ? str_pad($val['Y'], 4, '0', STR_PAD_LEFT) : $val['Y']; $m = (strlen($val['m']) < 2) ? '0'.$val['m'] : $val['m']; $d = (strlen($val['d']) < 2) ? '0'.$val['d'] : $val['d']; $h = (strlen($val['H']) < 2) ? '0' . $val['H'] : $val['H']; $i = (strlen($val['i']) < 2) ? '0' . $val['i'] : $val['i']; $s = (strlen($val['s']) < 2) ? '0' . $val['s'] : $val['s']; $val = "$y-$m-$d $h:$i:$s"; } else { // convert using the Date class $tmp =& new DB_Table_Date($val); $val = $tmp->format('%Y-%m-%d %H:%M:%S'); } break; case 'smallint': case 'integer': case 'bigint': settype($val, 'integer'); break; case 'decimal': case 'single': case 'double': settype($val, 'float'); break; } } } /** * Creates the table based on $this->col and $this->idx. * * @param string $flag The automatic table creation mode to pursue: * - 'safe' to create the table only if it does not exist * - 'drop' to drop any existing table with the same name and re-create it * * @return mixed Boolean true if the table was successfully created, * false if there was no need to create the table, or * a PEAR_Error if the attempted creation failed. * * @throws PEAR_Error if * - DB_Table_Manager::tableExists() returns Error (bubbles up) * - DB_Table_Manager::create() returns Error (bubbles up) * * @access public * * @see DB_Table_Manager::tableExists() * @see DB_Table_Manager::create() */ function create($flag) { include_once 'DB/Table/Manager.php'; // are we OK to create the table? $ok = false; // check the create-flag switch ($flag) { case 'drop': // drop only if table exists $table_exists = DB_Table_Manager::tableExists($this->db, $this->table); if (PEAR::isError($table_exists)) { return $table_exists; } if ($table_exists) { // forcibly drop an existing table if ($this->backend == 'mdb2') { $this->db->manager->dropTable($this->table); } else { $this->db->query("DROP TABLE {$this->table}"); } } $ok = true; break; case 'safe': // create only if table does not exist $table_exists = DB_Table_Manager::tableExists($this->db, $this->table); if (PEAR::isError($table_exists)) { return $table_exists; } // ok to create only if table does not exist $ok = !$table_exists; break; } // are we going to create the table? if (! $ok) { return false; } return DB_Table_Manager::create( $this->db, $this->table, $this->col, $this->idx ); } /** * Alters the table to match schema declared in $this->col and $this->idx. * * If the table does not exist, create it instead. * * @return boolean true if altering is successful (PEAR_Error on failure) * * @throws PEAR_Error if * - DB_Table_Manager::tableExists() returns Error (bubbles up) * - DB_Table_Manager::create() returns Error (bubbles up) * - DB_Table_Manager::alter() returns Error (bubbles up) * * @access public * * @see DB_Table_Manager::tableExists() * @see DB_Table_Manager::create() * @see DB_Table_Manager::alter() */ function alter() { $create = false; // alter the table columns and indexes if the table exists $table_exists = DB_Table_Manager::tableExists($this->db, $this->table); if (PEAR::isError($table_exists)) { return $table_exists; } if (!$table_exists) { // table does not exist => just create the table, there is // nothing that could be altered $create = true; } if ($create) { return DB_Table_Manager::create( $this->db, $this->table, $this->col, $this->idx ); } return DB_Table_Manager::alter( $this->db, $this->table, $this->col, $this->idx ); } /** * Verifies the table based on $this->col and $this->idx. * * @return boolean true if verification succees (PEAR_Error on failure). * * @throws PEAR_Error if * DB_Table_Manager::verify() returns Error (bubbles up) * * @access public * * @see DB_Table_Manager::verify() */ function verify() { return DB_Table_Manager::verify( $this->db, $this->table, $this->col, $this->idx ); } /** * Checks if a value validates against the DB_Table data type for a * given column. This only checks that it matches the data type; it * does not do extended validation. * * @param array $val A value to check against the column's DB_Table * data type. * * @param array $col A column name from $this->col. * * @return boolean True if $val validates against data type, false if not * * @throws PEAR_Error if * Invalid column type in $this->col (DB_TABLE_ERR_VALIDATE_TYPE) * * @access public * * @see DB_Table_Valid */ function isValid($val, $col) { // is the value null? if (is_null($val)) { // is the column required? if ($this->isRequired($col)) { // yes, so not valid return false; } else { // not required, so it's valid return true; } } // make sure we have the validation class include_once 'DB/Table/Valid.php'; // validate values per the column type. we use sqlite // as the single authentic list of allowed column types, // regardless of the actual rdbms being used. $map = array_keys($GLOBALS['_DB_TABLE']['type']['sqlite']); // is the column type on the map? if (! in_array($this->col[$col]['type'], $map)) { return $this->throwError( DB_TABLE_ERR_VALIDATE_TYPE, "'$col' ('{$this->col[$col]['type']}')" ); } // validate for the type switch ($this->col[$col]['type']) { case 'char': case 'varchar': $result = DB_Table_Valid::isChar( $val, $this->col[$col]['size'] ); break; case 'decimal': $result = DB_Table_Valid::isDecimal( $val, $this->col[$col]['size'], $this->col[$col]['scope'] ); break; default: $result = call_user_func( array( 'DB_Table_Valid', 'is' . ucwords($this->col[$col]['type']) ), $val ); break; } // have we passed the check so far, and should we // also check for allowed values? if ($result && isset($this->col[$col]['qf_vals'])) { $keys = array_keys($this->col[$col]['qf_vals']); $result = in_array( $val, array_keys($this->col[$col]['qf_vals']) ); } return $result; } /** * Is a specific column required to be set and non-null? * * @param mixed $column The column to check against. * @return boolean True if required, false if not. * @access public */ function isRequired($column) { if (isset($this->col[$column]['require']) && $this->col[$column]['require'] == true) { return true; } else { return false; } } /** * * Creates and returns a QuickForm object based on table columns. * * @param array $columns A sequential array of column names to use in * the form; if null, uses all columns. * * @param string $array_name By default, the form will use the names * of the columns as the names of the form elements. If you pass * $array_name, the column names will become keys in an array named * for this parameter. * * @param array $args An associative array of optional arguments to * pass to the QuickForm object. The keys are... * * 'formName' : String, name of the form; defaults to the name of this * table. * * 'method' : String, form method; defaults to 'post'. * * 'action' : String, form action; defaults to * $_SERVER['REQUEST_URI']. * * 'target' : String, form target target; defaults to '_self' * * 'attributes' : Associative array, extra attributes for
* tag; the key is the attribute name and the value is attribute * value. * * 'trackSubmit' : Boolean, whether to track if the form was * submitted by adding a special hidden field * * @param string $clientValidate By default, validation will match * the 'qf_client' value from the column definition. However, if * you set $clientValidate to true or false, this will override the * value from the column definition. * * @param array $formFilters An array with filter function names or * callbacks that will be applied to all form elements. * * @return object HTML_QuickForm * * @access public * * @see HTML_QuickForm * @see DB_Table_QuickForm */ function &getForm($columns = null, $array_name = null, $args = array(), $clientValidate = null, $formFilters = null) { include_once 'DB/Table/QuickForm.php'; $coldefs = $this->_getFormColDefs($columns); $form =& DB_Table_QuickForm::getForm($coldefs, $array_name, $args, $clientValidate, $formFilters); return $form; } /** * Adds elements and rules to a pre-existing HTML_QuickForm object. * * By default, the form will use the names of the columns as the names * of the form elements. If you pass $array_name, the column names * will become keys in an array named for this parameter. * * @param object &$form An HTML_QuickForm object. * * @param array $columns A sequential array of column names to use in * the form; if null, uses all columns. * * @param string $array_name Name of array of column names * * @param clientValidate * * @return void * * @access public * * @see HTML_QuickForm * * @see DB_Table_QuickForm */ function addFormElements(&$form, $columns = null, $array_name = null, $clientValidate = null) { include_once 'DB/Table/QuickForm.php'; $coldefs = $this->_getFormColDefs($columns); DB_Table_QuickForm::addElements($form, $coldefs, $array_name); DB_Table_QuickForm::addRules($form, $coldefs, $array_name, $clientValidate); } /** * Adds static form elements like 'header', 'static', 'submit' or 'reset' * to a pre-existing HTML_QuickForm object. The form elements needs to be * defined in a property called $frm. * * @param object &$form An HTML_QuickForm object. * @return void * @access public * * @see HTML_QuickForm * @see DB_Table_QuickForm */ function addStaticFormElements(&$form) { include_once 'DB/Table/QuickForm.php'; DB_Table_QuickForm::addStaticElements($form, $this->frm); } /** * * Creates and returns an array of QuickForm elements based on an * array of DB_Table column names. * * @param array $columns A sequential array of column names to use in * the form; if null, uses all columns. * * @param string $array_name By default, the form will use the names * of the columns as the names of the form elements. If you pass * $array_name, the column names will become keys in an array named * for this parameter. * * @return array An array of HTML_QuickForm_Element objects. * * @access public * * @see HTML_QuickForm * @see DB_Table_QuickForm */ function &getFormGroup($columns = null, $array_name = null) { include_once 'DB/Table/QuickForm.php'; $coldefs = $this->_getFormColDefs($columns); $group =& DB_Table_QuickForm::getGroup($coldefs, $array_name); return $group; } /** * Creates and returns a single QuickForm element based on a DB_Table * column name. * * @param string $column A DB_Table column name. * @param string $elemname The name to use for the generated QuickForm * element. * * @return object HTML_QuickForm_Element * * @access public * * @see HTML_QuickForm * @see DB_Table_QuickForm */ function &getFormElement($column, $elemname) { include_once 'DB/Table/QuickForm.php'; $coldef = $this->_getFormColDefs($column); DB_Table_QuickForm::fixColDef($coldef[$column], $elemname); $element =& DB_Table_QuickForm::getElement($coldef[$column], $elemname); return $element; } /** * Creates and returns an array of QuickForm elements based on a DB_Table * column name. * * @author Ian Eure * * @param array $cols Array of DB_Table column names * @param string $array_name The name to use for the generated QuickForm * elements. * @return object HTML_QuickForm_Element * * @access public * * @see HTML_QuickForm * @see DB_Table_QuickForm */ function &getFormElements($cols, $array_name = null) { include_once 'DB/Table/QuickForm.php'; $elements =& DB_Table_QuickForm::getElements($cols, $array_name); return $elements; } /** * Creates a column definition array suitable for DB_Table_QuickForm. * * @param string|array $column_set A string column name, a sequential * array of columns names, or an associative array where the key is a * column name and the value is the default value for the generated * form element. If null, uses all columns for this class. * * @return array An array of column definitions suitable for passing * to DB_Table_QuickForm. * * @access public * */ function _getFormColDefs($column_set = null) { if (is_null($column_set)) { // no columns or columns+values; just return the $this->col // array. return $this->getColumns($column_set); } // check to see if the keys are sequential integers. if so, // the $column_set is just a list of columns. settype($column_set, 'array'); $keys = array_keys($column_set); $all_integer = true; foreach ($keys as $val) { if (! is_integer($val)) { $all_integer = false; break; } } if ($all_integer) { // the column_set is just a list of columns; get back the $this->col // array elements matching this list. $coldefs = $this->getColumns($column_set); } else { // the columns_set is an associative array where the key is a // column name and the value is the form element value. $coldefs = $this->getColumns($keys); foreach ($coldefs as $key => $val) { $coldefs[$key]['qf_setvalue'] = $column_set[$key]; } } return $coldefs; } /** * Returns XML string representation of the table * * @param string $indent string of whitespace * @return string XML string * @access public */ function toXML($indent = '') { require_once 'DB/Table/XML.php'; $s = array(); $s[] = DB_Table_XML::openTag('table', $indent); $s[] = DB_Table_XML::lineElement('name', $this->table, $indent); $s[] = DB_Table_XML::openTag('declaration', $indent); // Column declarations foreach ($this->col as $name => $col) { $type = (isset($col['type'])) ? $col['type'] : null; $size = (isset($col['size'])) ? $col['size'] : null; $scope = (isset($col['scope'])) ? $col['scope'] : null; $require = (isset($col['require'])) ? $col['require'] : null; $default = (isset($col['set default'])) ? $col['set default'] : null; $line = ' ' . $name . ' ' . $type; $s[] = DB_Table_XML::openTag('field', $indent); $s[] = DB_Table_XML::lineElement('name', $name, $indent); $s[] = DB_Table_XML::lineElement('type', $type, $indent); if ($size) { $s[] = DB_Table_XML::lineElement('length', $size, $indent); } if ($require) { $require = (int) $require; $s[] = DB_Table_XML::lineElement('notnull', $require, $indent); } if (!($default === null)) { $s[] = DB_Table_XML::lineElement('set default', $default, $indent); } if ($this->auto_inc_col == $name) { $s[] = DB_Table_XML::lineElement('autoincrement', '1', $indent); } $s[] = DB_Table_XML::closeTag('field', $indent); } // Index declarations foreach ($this->idx as $name => $idx) { $s[] = DB_Table_XML::openTag('index', $indent); $cols = $idx['cols']; $type = $idx['type']; if (is_string($name)) { $s[] = DB_Table_XML::lineElement('name', $name, $indent); } if ($type == 'primary') { $s[] = DB_Table_XML::lineElement('primary', '1', $indent); } elseif ($type == 'unique') { $s[] = DB_Table_XML::lineElement('unique', '1', $indent); } if (is_string($cols)) { $cols = array($cols); } foreach ($cols as $col) { $s[] = DB_Table_XML::lineElement('field', $col, $indent); } $s[] = DB_Table_XML::closeTag('index', $indent); } // Foreign key references (if $this->_database is not null) if ($this->_database) { if (isset($this->_database->_ref[$this->table])) { $refs = $this->_database->_ref[$this->table]; foreach ($refs as $rtable => $def) { $fkey = $def['fkey']; // foreign key of referencing table $rkey = $def['rkey']; // referenced/primary key if (is_string($fkey)) { $fkey = array($fkey); } if (is_string($rkey)) { $rkey = array($rkey); } $on_delete = $def['on_delete']; // on-delete action $on_update = $def['on_update']; // on-update action $s[] = DB_Table_XML::openTag('foreign', $indent); foreach ($fkey as $fcol) { $s[] = DB_Table_XML::lineElement('field', $fcol, $indent); } $s[] = DB_Table_XML::openTag('references', $indent); $s[] = DB_Table_XML::lineElement('table', $rtable, $indent); if ($rkey) { foreach ($rkey as $rcol) { $s[] = DB_Table_XML::lineElement('field', $rcol, $indent); } } $s[] = DB_Table_XML::closeTag('references', $indent); if ($on_delete) { $s[] = DB_Table_XML::lineElement('ondelete', $on_delete, $indent); } if ($on_update) { $s[] = DB_Table_XML::lineElement('onupdate', $on_update, $indent); } $s[] = DB_Table_XML::closeTag('foreign', $indent); } } } $s[] = DB_Table_XML::closeTag('declaration', $indent); $s[] = DB_Table_XML::closeTag('table', $indent); return implode("\n", $s); } } ?> php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package/packagefiles/DB_Table/DB/Table/000077500000000000000000000000001262614675700325245ustar00rootroot00000000000000Base.php000066400000000000000000000603001262614675700340270ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package/packagefiles/DB_Table/DB/Table * @license http://www.gnu.org/copyleft/lesser.html LGPL * @version $Id: Base.php,v 1.3 2007/06/14 05:10:46 morse Exp $ */ // {{{ DB_Table_Base /** * Base class for DB_Table and DB_Table_Database * * @category Database * @package DB_Table * @author David C. Morse * */ class DB_Table_Base { // {{{ properties /** * The PEAR DB/MDB2 object that connects to the database. * * @var object * @access public */ var $db = null; /** * The backend type, which must be 'db' or 'mdb2' * * @var string * @access public */ var $backend = null; /** * If there is an error on instantiation, this captures that error. * * This property is used only for errors encountered in the constructor * at instantiation time. To check if there was an instantiation error... * * * $obj =& new DB_Table_*(); * if ($obj->error) { * // ... error handling code here ... * } * * * @var object PEAR_Error * @access public */ var $error = null; /** * Baseline SELECT maps for buildSQL() and select*() methods. * * @var array * @access public */ var $sql = array(); /** * Format of rows in sets returned by the select() method * * This should be one of the DB/MDB2_FETCHMODE_* constant values, such as * MDB2_FETCHMODE_ASSOC, MDB2_FETCHMODE_ORDERED, or MDB2_FETCHMODE_OBJECT. * It determines whether select() returns represents individual rows as * associative arrays with column name keys, ordered/sequential arrays, * or objects with column names mapped to properties. Use corresponding * DB_FETCHMODE_* constants for use with the DB backend. It has no effect * upon the return value of selectResult(). * * If a 'fetchmode' element is set for a specific query array, the query * fetchmode will override this DB_Table or DB_Table_Database property. * If no value is set for the query or the DB_Table_Base object, the value * or default set in the underlying DB/MDB2 object will be used. * * @var int * @access public */ var $fetchmode = null; /** * Class of objects to use for rows returned as objects by select() * * When fetchmode is DB/MDB2_FETCHMODE_OBJECT, use this class for each * returned row in rsults of select(). May be overridden by value of * 'fetchmode_object_class'. If no class name is set in the query or * the DB_Table_Base, defaults to that set in the DB/MDB2 object, or * to default of StdObject. * * @var string * @access public */ var $fetchmode_object_class = null; /** * Upper case name of primary subclass, 'DB_TABLE' or 'DB_TABLE_DATABASE' * * This should be set in the constructor of the child class, and is * used in the DB_Table_Base::throwError() method to determine the * location of the relevant error codes and messages. Error codes and * error code messages are defined in class $this->_primary_subclass. * Messages are stored in $GLOBALS['_' . $this->_primary_subclass]['error'] * * @var string * @access private */ var $_primary_subclass = null; // }}} // {{{ Methods /** * Specialized version of throwError() modeled on PEAR_Error. * * Throws a PEAR_Error with an error message based on an error code * and corresponding error message defined in $this->_primary_subclass * * @param string $code An error code constant * @param string $extra Extra text for the error (in addition to the * regular error message). * @return object PEAR_Error * @access public * @static */ function &throwError($code, $extra = null) { // get the error message text based on the error code $index = '_' . $this->_primary_subclass; $text = $this->_primary_subclass . " Error - \n" . $GLOBALS[$index]['error'][$code]; // add any additional error text if ($extra) { $text .= ' ' . $extra; } // done! $error = PEAR::throwError($text, $code); return $error; } /** * Overwrites one or more error messages, e.g., to internationalize them. * * May be used to change messages stored in global array $GLOBALS[$class_key] * @param mixed $code If string, the error message with code $code will be * overwritten by $message. If array, each key is a code * and each value is a new message. * * @param string $message Only used if $key is not an array. * @return void * @access public */ function setErrorMessage($code, $message = null) { $index = '_' . $this->_primary_subclass; if (is_array($code)) { foreach ($code as $single_code => $single_message) { $GLOBALS[$index]['error'][$single_code] = $single_message; } } else { $GLOBALS[$index]['error'][$code] = $message; } } /** * Returns SQL SELECT string constructed from sql query array * * @param mixed $query SELECT query array, or key string of $this->sql * @param string $filter SQL snippet to AND with default WHERE clause * @param string $order SQL snippet to override default ORDER BY clause * @param int $start The row number from which to start result set * @param int $count The number of rows to list in the result set. * * @return string SQL SELECT command string (or PEAR_Error on failure) * * @access public */ function buildSQL($query, $filter = null, $order = null, $start = null, $count = null) { // Is $query a query array or a key of $this->sql ? if (!is_array($query)) { if (is_string($query)) { if (isset($this->sql[$query])) { $query = $this->sql[$query]; } else { return $this->throwError( constant($this->_primary_subclass . '_ERR_SQL_UNDEF'), $query); } } else { return $this->throwError( constant($this->_primary_subclass . '_ERR_SQL_NOT_STRING')); } } // Construct SQL command from parts $s = array(); if (isset($query['select'])) { $s[] = 'SELECT ' . $query['select']; } else { $s[] = 'SELECT *'; } if (isset($query['from'])) { $s[] = 'FROM ' . $query['from']; } elseif ($this->_primary_subclass == 'DB_TABLE') { $s[] = 'FROM ' . $this->table; } if (isset($query['join'])) { $s[] = $query['join']; } if (isset($query['where'])) { if ($filter) { $s[] = 'WHERE ( ' . $query['where'] . ' )'; $s[] = ' AND ( '. $filter . ' )'; } else { $s[] = 'WHERE ' . $query['where']; } } elseif ($filter) { $s[] = 'WHERE ' . $filter; } if (isset($query['group'])) { $s[] = 'GROUP BY ' . $query['group']; } if (isset($query['having'])) { $s[] = 'HAVING '. $query['having']; } // If $order parameter is set, override 'order' element if (!is_null($order)) { $s[] = 'ORDER BY '. $order; } elseif (isset($query['order'])) { $s[] = 'ORDER BY ' . $query['order']; } $cmd = implode("\n", $s); // add LIMIT if requested if (!is_null($start) && !is_null($count)) { $db =& $this->db; if ($this->backend == 'mdb2') { $db->setLimit($count, $start); } else { $cmd = $db->modifyLimitQuery( $cmd, $start, $count); } } // Return command string return $cmd; } /** * Selects rows using one of the DB/MDB2 get*() methods. * * @param string $query SQL SELECT query array, or a key of the * $this->sql property array. * @param string $filter SQL snippet to AND with default WHERE clause * @param string $order SQL snippet to override default ORDER BY clause * @param int $start The row number from which to start result set * @param int $count The number of rows to list in the result set. * @param array $params Parameters for placeholder substitutions, if any * @return mixed An array of records from the table if anything but * ('getOne'), a single value (if 'getOne'), or a PEAR_Error * @see DB::getAll() * @see MDB2::getAll() * @see DB::getAssoc() * @see MDB2::getAssoc() * @see DB::getCol() * @see MDB2::getCol() * @see DB::getOne() * @see MDB2::getOne() * @see DB::getRow() * @see MDB2::getRow() * @see DB_Table_Base::_swapModes() * @access public */ function select($query, $filter = null, $order = null, $start = null, $count = null, $params = array()) { // Is $query a query array or a key of $this->sql ? // On output from this block, $query is an array if (!is_array($query)) { if (is_string($query)) { if (isset($this->sql[$query])) { $query = $this->sql[$query]; } else { return $this->throwError( constant($this->_primary_subclass . '_ERR_SQL_UNDEF'), $query); } } else { return $this->throwError( constant($this->_primary_subclass . '_ERR_SQL_NOT_STRING')); } } // build the base command $sql = $this->buildSQL($query, $filter, $order, $start, $count); if (PEAR::isError($sql)) { return $sql; } // set the get*() method name if (isset($query['get'])) { $method = ucwords(strtolower(trim($query['get']))); $method = "get$method"; } else { $method = 'getAll'; } // DB_Table assumes you are using a shared PEAR DB/MDB2 object. // Record fetchmode settings, to be restored before returning. $db =& $this->db; $restore_mode = $db->fetchmode; if ($this->backend == 'mdb2') { $restore_class = $db->getOption('fetch_class'); } else { $restore_class = $db->fetchmode_object_class; } // swap modes $fetchmode = $this->fetchmode; $fetchmode_object_class = $this->fetchmode_object_class; if (isset($query['fetchmode'])) { $fetchmode = $query['fetchmode']; } if (isset($query['fetchmode_object_class'])) { $fetchmode_object_class = $query['fetchmode_object_class']; } $this->_swapModes($fetchmode, $fetchmode_object_class); // make sure params is an array if (!is_null($params)) { $params = (array) $params; } // get the result if ($this->backend == 'mdb2') { $result = $db->extended->$method($sql, null, $params); } else { switch ($method) { case 'getCol': $result = $db->$method($sql, 0, $params); break; case 'getAssoc': $result = $db->$method($sql, false, $params); break; default: $result = $db->$method($sql, $params); break; } } // restore old fetch_mode and fetch_object_class back $this->_swapModes($restore_mode, $restore_class); return $result; } /** * Selects rows as a DB_Result/MDB2_Result_* object. * * @param string $query The name of the SQL SELECT to use from the * $this->sql property array. * @param string $filter SQL snippet to AND to the default WHERE clause * @param string $order SQL snippet to override default ORDER BY clause * @param int $start The record number from which to start result set * @param int $count The number of records to list in result set. * @param array $params Parameters for placeholder substitutions, if any. * @return object DB_Result/MDB2_Result_* object on success * (PEAR_Error on failure) * @see DB_Table::_swapModes() * @access public */ function selectResult($query, $filter = null, $order = null, $start = null, $count = null, $params = array()) { // Is $query a query array or a key of $this->sql ? // On output from this block, $query is an array if (!is_array($query)) { if (is_string($query)) { if (isset($this->sql[$query])) { $query = $this->sql[$query]; } else { return $this->throwError( constant($this->_primary_subclass . '_ERR_SQL_UNDEF'), $query); } } else { return $this->throwError( constant($this->_primary_subclass . '_ERR_SQL_NOT_STRING')); } } // build the base command $sql = $this->buildSQL($query, $filter, $order, $start, $count); if (PEAR::isError($sql)) { return $sql; } // DB_Table assumes you are using a shared PEAR DB/MDB2 object. // Record fetchmode settings, to be restored afterwards. $db =& $this->db; $restore_mode = $db->fetchmode; if ($this->backend == 'mdb2') { $restore_class = $db->getOption('fetch_class'); } else { $restore_class = $db->fetchmode_object_class; } // swap modes $fetchmode = $this->fetchmode; $fetchmode_object_class = $this->fetchmode_object_class; if (isset($query['fetchmode'])) { $fetchmode = $query['fetchmode']; } if (isset($query['fetchmode_object_class'])) { $fetchmode_object_class = $query['fetchmode_object_class']; } $this->_swapModes($fetchmode, $fetchmode_object_class); // make sure params is an array if (!is_null($params)) { $params = (array) $params; } // get the result if ($this->backend == 'mdb2') { $stmt =& $db->prepare($sql); if (PEAR::isError($stmt)) { return $stmt; } $result =& $stmt->execute($params); } else { $result =& $db->query($sql, $params); } // swap modes back $this->_swapModes($restore_mode, $restore_class); // return the result return $result; } /** * Counts the number of rows which will be returned by a query. * * This function works identically to {@link select()}, but it * returns the number of rows returned by a query instead of the * query results themselves. * * @author Ian Eure * @param string $query The name of the SQL SELECT to use from the * $this->sql property array. * @param string $filter Ad-hoc SQL snippet to AND with the default * SELECT WHERE clause. * @param string $order Ad-hoc SQL snippet to override the default * SELECT ORDER BY clause. * @param int $start Row number from which to start listing in result * @param int $count Number of rows to list in result set * @param array $params Parameters to use in placeholder substitutions * (if any). * @return int Number of records from the table (or PEAR_Error on failure) * * @see DB_Table::select() * @access public */ function selectCount($query, $filter = null, $order = null, $start = null, $count = null, $params = array()) { // Is $query a query array or a key of $this->sql ? if (is_array($query)) { $sql_key = null; $count_query = $query; } else { if (is_string($query)) { if (isset($this->sql[$query])) { $sql_key = $query; $count_query = $this->sql[$query]; } else { return $this->throwError( constant($this->_primary_subclass . '_ERR_SQL_UNDEF'), $query); } } else { return $this->throwError( constant($this->_primary_subclass . '_ERR_SQL_NOT_STRING')); } } // Use Table name as default 'from' if child class is DB_TABLE if ($this->_primary_subclass == 'DB_TABLE') { if (!isset($query['from'])) { $count_query['from'] = $this->table; } } // If the query is a stored query in $this->sql, then create a corresponding // key for the count query, or check if the count-query already exists $ready = false; if ($sql_key) { // Create an sql key name for this count-query $count_key = '__count_' . $sql_key; // Check if a this count query alread exists in $this->sql if (isset($this->sql[$count_key])) { $ready = true; } } // If a count-query does not already exist, create $count_query array if ($ready) { $count_query = $this->sql[$count_key]; } else { // Is a count-field set for the query? if (!isset($count_query['count']) || trim($count_query['count']) == '') { $count_query['count'] = '*'; } // Replace the SELECT fields with a COUNT() command $count_query['select'] = "COUNT({$count_query['count']})"; // Replace the 'get' key so we only get one result item $count_query['get'] = 'one'; // Create a new count-query in $this->sql if ($sql_key) { $this->sql[$count_key] = $count_query; } } // Retrieve the count results return $this->select($count_query, $filter, $order, $start, $count, $params); } /** * Changes the $this->db PEAR DB/MDB2 object fetchmode and * fetchmode_object_class. * * @param string $new_mode A DB/MDB2_FETCHMODE_* constant. If null, * defaults to whatever the DB/MDB2 object is currently using. * * @param string $new_class The object class to use for results when * the $db object is in DB/MDB2_FETCHMODE_OBJECT fetch mode. If null, * defaults to whatever the the DB/MDB2 object is currently using. * * @return void * @access private */ function _swapModes($new_mode, $new_class) { // get the old (current) mode and class $db =& $this->db; $old_mode = $db->fetchmode; if ($this->backend == 'mdb2') { $old_class = $db->getOption('fetch_class'); } else { $old_class = $db->fetchmode_object_class; } // don't need to swap anything if the new modes are both // null or if the old and new modes already match. if ((is_null($new_mode) && is_null($new_class)) || ($old_mode == $new_mode && $old_class == $new_class)) { return; } // set the default new mode if (is_null($new_mode)) { $new_mode = $old_mode; } // set the default new class if (is_null($new_class)) { $new_class = $old_class; } // swap modes $db->setFetchMode($new_mode, $new_class); } /** * Returns SQL condition equating columns to literal values. * * The parameter $data is an associative array in which keys are * column names and values are corresponding values. The method * returns an SQL string that is true if the value of every * specified database columns is equal to the corresponding * value in $data. * * For example, if: * * $data = array( 'c1' => 'thing', 'c2' => 23, 'c3' => 0.32 ) * * then buildFilter($data) returns a string * * c1 => 'thing' AND c2 => 23 AND c3 = 0.32 * * in which string values are replaced by SQL literal values, * quoted and escaped as necessary. * * Values are quoted and escaped as appropriate for each data * type and the backend RDBMS, using the MDB2::quote() or * DB::smartQuote() method. The behavior depends on the PHP type * of the value: string values are quoted and escaped, while * integer and float numerical values are not. Boolean values * in $data are represented as 0 or 1, consistent with the way * booleans are stored by DB_Table. * * Null values: The treatment of null values in $data depends upon * the value of the $match parameter . If $match == 'simple', an * empty string is returned if any $value of $data with a key in * $data_key is null. If $match == 'partial', the returned SQL * expression equates only the relevant non-null values of $data * to the values of corresponding database columns. If * $match == 'full', the function returns an empty string if all * of the relevant values of data are null, and returns a * PEAR_Error if some of the selected values are null and others * are not null. * * @param array $data associative array, keys are column names * @return string SQL expression equating values in $data to * values of columns named by keys. * @access public */ function buildFilter($data, $match = 'simple') { // Check $match type value if (!in_array($match, array('simple', 'partial', 'full'))) { return $this->throwError( DB_TABLE_DATABASE_ERR_MATCH_TYPE); } if (count($data) == 0) { return ''; } $filter = array(); foreach ($data as $key => $value) { if (!is_null($value)) { if ($match == 'full' && isset($found_null)) { return $this->throwError( DB_TABLE_DATABASE_ERR_FULL_KEY); } if (is_bool($value)) { $value = $value ? '1' : '0'; } else { if ($this->backend == 'mdb2') { $value = $this->db->quote($value); } else { $value = $this->db->quoteSmart($value); } } $filter[] = "$key = $value"; } else { if ($match == 'simple') { return ''; // if any value in $data is null } elseif ($match == 'full') { $found_null = true; } } } return implode(' AND ', $filter); } // }}} } // }}} /* Local variables: * tab-width: 4 * c-basic-offset: 4 * c-hanging-comment-ender-p: nil * End: */ ?> Database.php000066400000000000000000003677071262614675700347060ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package/packagefiles/DB_Table/DB/Table * @license http://www.gnu.org/copyleft/lesser.html LGPL * @version $Id: Database.php,v 1.13 2007/06/14 15:09:16 morse Exp $ */ // {{{ Error code constants /** * Parameter is not a DB/MDB2 object */ define('DB_TABLE_DATABASE_ERR_DB_OBJECT', -201); /** * Error in addTable, parameter $table_obj is not a DB_Table object */ define('DB_TABLE_DATABASE_ERR_DBTABLE_OBJECT', -202); /** * Error for table name that does not exist in the database */ define('DB_TABLE_DATABASE_ERR_NO_TBL', -203); /** * Error for table name parameter that is not a string */ define('DB_TABLE_DATABASE_ERR_TBL_NOT_STRING', -204); /** * Error in getCol for a non-existent column name */ define('DB_TABLE_DATABASE_ERR_NO_COL', -205); /** * Error in getForeignCol for a non-existent foreign key column */ define('DB_TABLE_DATABASE_ERR_NO_FOREIGN_COL', -206); /** * Error for column name that is not a string */ define('DB_TABLE_DATABASE_ERR_COL_NOT_STRING', -207); /** * Error in addTable for multiple primary keys */ define('DB_TABLE_DATABASE_ERR_MULT_PKEY', -208); /** * Error in addRef for a non-existent foreign key table */ define('DB_TABLE_DATABASE_ERR_NO_FTABLE', -209); /** * Error in addRef for non-existence referenced table */ define('DB_TABLE_DATABASE_ERR_NO_RTABLE', -210); /** * Error in addRef for null referenced key in a table with no primary key */ define('DB_TABLE_DATABASE_ERR_NO_PKEY', -211); /** * Error in addRef for an invalid foreign key, neither string nor array */ define('DB_TABLE_DATABASE_ERR_FKEY', -212); /** * Error in addRef for referenced key that is not a string, string foreign key */ define('DB_TABLE_DATABASE_ERR_RKEY_NOT_STRING', -213); /** * Error in addRef for referenced key that is not an array, array foreign key */ define('DB_TABLE_DATABASE_ERR_RKEY_NOT_ARRAY', -214); /** * Error in addRef for wrong number of columns in referenced key */ define('DB_TABLE_DATABASE_ERR_RKEY_COL_NUMBER', -215); /** * Error in addRef for non-existence foreign key (referencing) column */ define('DB_TABLE_DATABASE_ERR_NO_FCOL', -216); /** * Error in addRef for non-existence referenced column */ define('DB_TABLE_DATABASE_ERR_NO_RCOL', -217); /** * Error in addRef for referencing and referenced columns of different types */ define('DB_TABLE_DATABASE_ERR_REF_TYPE', -218); /** * Error in addRef for multiple references from one table to another */ define('DB_TABLE_DATABASE_ERR_MULT_REF', -219); /** * Error due to invalid ON DELETE action name */ define('DB_TABLE_DATABASE_ERR_ON_DELETE_ACTION', -220); /** * Error due to invalid ON UPDATE action name */ define('DB_TABLE_DATABASE_ERR_ON_UPDATE_ACTION', -221); /** * Error in addLink due to missing required reference */ define('DB_TABLE_DATABASE_ERR_NO_REF_LINK', -222); /** * Error in validCol for a column name that does not exist in the datase */ define('DB_TABLE_DATABASE_ERR_NO_COL_DB', -223); /** * Error in validCol for column name that does not exist in the specified table */ define('DB_TABLE_DATABASE_ERR_NO_COL_TBL', -224); /** * Error in a buildSQL or select* method for an undefined key of $this->sql */ define('DB_TABLE_DATABASE_ERR_SQL_UNDEF', -225); /** * Error in a buildSQL or select* method for a key of $this->sql that is * not a string */ define('DB_TABLE_DATABASE_ERR_SQL_NOT_STRING', -226); /** * Error in buildFilter due to invalid match type */ define('DB_TABLE_DATABASE_ERR_MATCH_TYPE', -227); /** * Error in buildFilter due to invalid key for full match */ define('DB_TABLE_DATABASE_ERR_DATA_KEY', -228); /** * Error in buildFilter due to invalid key for full match */ define('DB_TABLE_DATABASE_ERR_FILT_KEY', -229); /** * Error in buildFilter due to invalid key for full match */ define('DB_TABLE_DATABASE_ERR_FULL_KEY', -230); /** * Error in insert for a failed foreign key constraint */ define('DB_TABLE_DATABASE_ERR_FKEY_CONSTRAINT', -231); /** * Error in delete due to a referentially triggered 'restrict' action */ define('DB_TABLE_DATABASE_ERR_RESTRICT_DELETE', -232); /** * Error in update due to a referentially triggered 'restrict' action */ define('DB_TABLE_DATABASE_ERR_RESTRICT_UPDATE', -233); /** * Error in fromXML for table with multiple auto_increment columns */ define('DB_TABLE_DATABASE_ERR_XML_MULT_AUTO_INC', -234); /** * Error in autoJoin, column and tables parameter both null */ define('DB_TABLE_DATABASE_ERR_NO_COL_NO_TBL', -235); /** * Error in autoJoin for ambiguous column name */ define('DB_TABLE_DATABASE_ERR_COL_NOT_UNIQUE', -236); /** * Error in autoJoin for non-unique set of join conditions */ define('DB_TABLE_DATABASE_ERR_AMBIG_JOIN', -237); /** * Error in autoJoin for failed construction of join */ define('DB_TABLE_DATABASE_ERR_FAIL_JOIN', -238); /** * Error in fromXML for PHP 4 (this function requires PHP 5) */ define('DB_TABLE_DATABASE_ERR_PHP_VERSION', -239); /** * Error parsing XML string in fromXML */ define('DB_TABLE_DATABASE_ERR_XML_PARSE', -240); // }}} /** * DB_Table_Base base class */ require_once 'DB/Table/Base.php'; /** * DB_Table table abstraction class */ require_once 'DB/Table.php'; /** * The PEAR class for errors */ require_once 'PEAR.php'; /** * US-English default error messages. If you want to internationalize, you can * set the translated messages via $GLOBALS['_DB_TABLE_DATABASE']['error']. * You can also use DB_Table_Database::setErrorMessage(). Examples: * * * (1) $GLOBALS['_DB_TABLE_DATABASE']['error'] = array( * DB_TABLE_DATABASE_ERR_.. => '...', * DB_TABLE_DATABASE_ERR_.. => '...'); * (2) DB_Table_Database::setErrorMessage(DB_TABLE_DATABASE_ERR_.., '...'); * DB_Table_Database::setErrorMessage(DB_TABLE_DATABASE_ERR_.., '...'); * (3) DB_Table_Database::setErrorMessage(array( * DB_TABLE_DATABASE_ERR_.. => '...'); * DB_TABLE_DATABASE_ERR_.. => '...'); * (4) $obj =& new DB_Table(); * $obj->setErrorMessage(DB_TABLE_DATABASE_ERR_.., '...'); * $obj->setErrorMessage(DB_TABLE_DATABASE_ERR_.., '...'); * (5) $obj =& new DB_Table(); * $obj->setErrorMessage(array(DB_TABLE_DATABASE_ERR_.. => '...'); * DB_TABLE_DATABASE_ERR_.. => '...'); * * * For errors that can occur with-in the constructor call (i.e. e.g. creating * or altering the database table), only the code from examples (1) to (3) * will alter the default error messages early enough. For errors that can * occur later, examples (4) and (5) are also valid. */ $GLOBALS['_DB_TABLE_DATABASE']['default_error'] = array( DB_TABLE_DATABASE_ERR_DB_OBJECT => 'Invalid DB/MDB2 object parameter. Function', DB_TABLE_DATABASE_ERR_NO_TBL => 'Table does not exist in database. Method, Table =', DB_TABLE_DATABASE_ERR_TBL_NOT_STRING => 'Table name parameter is not a string in method', DB_TABLE_DATABASE_ERR_NO_COL => 'In getCol, non-existent column name parameter', DB_TABLE_DATABASE_ERR_NO_FOREIGN_COL => 'In getForeignCol, non-existent column name parameter', DB_TABLE_DATABASE_ERR_COL_NOT_STRING => 'Column name parameter is not a string in method', DB_TABLE_DATABASE_ERR_DBTABLE_OBJECT => 'Parameter of addTable is not a DB_Table object', DB_TABLE_DATABASE_ERR_MULT_PKEY => 'Multiple primary keys in one table detected in addTable. Table', DB_TABLE_DATABASE_ERR_NO_FTABLE => 'Foreign key reference from non-existent table in addRef. Reference', DB_TABLE_DATABASE_ERR_NO_RTABLE => 'Reference to a non-existent referenced table in addRef. Reference', DB_TABLE_DATABASE_ERR_NO_PKEY => 'Missing primary key of referenced table in addRef. Reference', DB_TABLE_DATABASE_ERR_FKEY => 'Foreign / referencing key is not a string or array in addRef', DB_TABLE_DATABASE_ERR_RKEY_NOT_STRING => 'Foreign key is a string, referenced key is not a string in addRef', DB_TABLE_DATABASE_ERR_RKEY_NOT_ARRAY => 'Foreign key is an array, referenced key is not an array in addRef', DB_TABLE_DATABASE_ERR_RKEY_COL_NUMBER => 'Wrong number of columns in referencing key in addRef', DB_TABLE_DATABASE_ERR_NO_FCOL => 'Nonexistent foreign / referencing key column in addRef. Reference', DB_TABLE_DATABASE_ERR_NO_RCOL => 'Nonexistent referenced key column in addRef. Reference', DB_TABLE_DATABASE_ERR_REF_TYPE => 'Different referencing and referenced column types in addRef. Reference', DB_TABLE_DATABASE_ERR_MULT_REF => 'Multiple references between two tables in addRef. Reference', DB_TABLE_DATABASE_ERR_ON_DELETE_ACTION => 'Invalid ON DELETE action. Reference', DB_TABLE_DATABASE_ERR_ON_UPDATE_ACTION => 'Invalid ON UPDATE action. Reference', DB_TABLE_DATABASE_ERR_NO_REF_LINK => 'Error in addLink due to missing required reference(s)', DB_TABLE_DATABASE_ERR_NO_COL_DB => 'In validCol, column name does not exist in database. Column', DB_TABLE_DATABASE_ERR_NO_COL_TBL => 'In validCol, column does not exist in specified table. Column', DB_TABLE_DATABASE_ERR_SQL_UNDEF => 'Query string is not a key of $sql property array. Key is', DB_TABLE_DATABASE_ERR_SQL_NOT_STRING => 'Query is neither an array nor a string', DB_TABLE_DATABASE_ERR_MATCH_TYPE => 'Invalid match parameter of buildFilter', DB_TABLE_DATABASE_ERR_DATA_KEY => 'Invalid data_key in buildFilter, neither string nor array', DB_TABLE_DATABASE_ERR_FILT_KEY => 'Incompatible data_key and filter_key in buildFilter', DB_TABLE_DATABASE_ERR_FULL_KEY => 'Invalid key value in buildFilter: Mixed null and not null', DB_TABLE_DATABASE_ERR_FKEY_CONSTRAINT => 'Foreign key constraint failure: Key does not reference any rows', DB_TABLE_DATABASE_ERR_RESTRICT_DELETE => 'Referentially trigger restrict of delete from table', DB_TABLE_DATABASE_ERR_RESTRICT_UPDATE => 'Referentially trigger restrict of update of table', DB_TABLE_DATABASE_ERR_NO_COL_NO_TBL => 'No columns or tables provided as parameters to autoJoin', DB_TABLE_DATABASE_ERR_COL_NOT_UNIQUE => 'Ambiguous column name in autoJoin. Column', DB_TABLE_DATABASE_ERR_AMBIG_JOIN => 'Ambiguous join in autoJoin, during join of table', DB_TABLE_DATABASE_ERR_FAIL_JOIN => 'Failed join in autoJoin, failed to join table', DB_TABLE_DATABASE_ERR_PHP_VERSION => 'PHP 5 is required for fromXML method. Interpreter version is', DB_TABLE_DATABASE_ERR_XML_PARSE => 'Error parsing XML in fromXML method' ); // merge default and user-defined error messages if (!isset($GLOBALS['_DB_TABLE_DATABASE']['error'])) { $GLOBALS['_DB_TABLE_DATABASE']['error'] = array(); } foreach ($GLOBALS['_DB_TABLE_DATABASE']['default_error'] as $code => $message) { if (!array_key_exists($code, $GLOBALS['_DB_TABLE_DATABASE']['error'])) { $GLOBALS['_DB_TABLE_DATABASE']['error'][$code] = $message; } } // {{{ DB_Table_Database /** * Relational database abstraction class * * DB_Table_Database is an abstraction class for a relational database. * It is a layer built on top of DB_Table, in which each table in a * database is represented as an instance of DB_Table. It provides: * * - an object-oriented representation of the database schema * - automated construction of SQL commands for simple joins * - an API for insert, update, and select commands very similar * to that of DB_Table, with optional emulation of standard SQL * foreign key integrity checks and referential triggered actions * such as cascading deletes. * - Serialization and unserialization of the database schema via * either php serialization or XML, using the MDB2 XML schema. * * @category Database * @package DB_Table * @author David C. Morse * */ class DB_Table_Database extends DB_Table_Base { // {{{ properties /** * Name of the database * * @var string * @access public */ var $name = null; /** * Associative array of DB_Table object references. Keys are table names. * * Associative array in which keys are table names, values are references to * DB_Table objects. Each referenced DB_Table object represents one table in * the database. * * @var array * @access private */ var $_table = array(); /** * Array in which keys are table names, values are DB_Table subclass names. * * See the getTableSubclass() method docblock for further details. * * @var array * @access private */ var $_table_subclass = array(); /** * Path to directory containing DB_Table subclass declaration files * * See the setTableSubclassPath() method docblock for further details. * * @var string * @access private */ var $_table_subclass_path = ''; /** * Array in which keys are table names, values are primary keys. * * Each primary key value may be a column name string, a sequential array of * column name strings, or null. * * See the getPrimaryKey() method docblock for details. * * @var array * @access private */ var $_primary_key = array(); /** * Associative array that maps column names keys to table names. * * Each key is the name string of a column in the database. Each value * is a numerical array containing the names of all tables that contain * a column with that name. * * See the getCol() method docblock for details. * * @var array * @access private */ var $_col = array(); /** * Associative array that maps names of foreign key columns to table names * * Each key is the name string of a foreign key column. Each value is a * sequential array containing the names of all tables that contain a * foreign key column with that name. * * See the getForeignCol() method docblock for further details. * * @var array * @access private */ var $_foreign_col = array(); /** * Two-dimensional associative array of foreign key references. * * Keys are pairs of table names (referencing table first, referenced * table second). Each value is an array containing information about * the referencing and referenced keys, and about any referentially * triggered actions (e.g., cascading delete). * * See the getRef() docblock for further details. * * @var array * @access private */ var $_ref = array(); /** * Array in which each key is the names of a referenced tables, each value * an sequential array containing names of referencing tables. * * See the docblock for the getRefTo() method for further discussion. * * @var array * @access private */ var $_ref_to = array(); /** * Two-dimensional associative array of linking tables. * * Two-dimensional associative array in which pairs of keys are names * of pairs of tables that are linked by one or more linking/association * table. Each value is an array containing the names of all table that * link the tables specified by the pair of keys. A linking table is a * table that creates a many-to-many relationship between two linked * tables, via foreign key references from the linking table to the two * linked tables. The $_link property is used by the autoJoin() method * to join tables that are related only through such a linking table. * * See the getLink() method docblock for further details. * * @var array * @access private */ var $_link = array(); /** * If the column keys in associative array return sets are fixed case * (all upper or lower case) this property should be set true. * * The column keys in rows of associative array return sets may either * preserve capitalization of the column names or they may be fixed case, * depending on the options set in the backend (DB/MDB2) and on phptype. * If these column names are returned with a fixed case (either upper * or lower), $fix_case must be set true in order for php emulation of * ON DELETE and ON UPDATE actions to work correctly. Otherwise, the * $fix_case property should be false (the default). * * The choice between mixed or fixed case column keys may be made by using * using the setFixCase() method, which resets both the behavior of the * backend and the $fix_case property. It may also be changed by using the * setOption() method of the DB or MDB2 backend object to directly set the * DB_PORTABILITY_LOWERCASE or MDB2_PORTABILITY_FIX_CASE bits of the * DB/MDB2 'portability' option. * * By default, DB returns mixed case and MDB2 returns lower case. * * @see DB_Table_Database::setFixCase() * @see DB::setOption() * @see MDB2::setOption() * * @var boolean * @access public */ var $fix_case = false; /** * Take on_update actions if $_act_on_update is true * * By default, on_update actions are enabled ($_act_on_update = true) * * @var boolean * @access private */ var $_act_on_update = true; /** * Take on_delete actions if $_act_on_delete is true * * By default, on_delete actions are enabled ($_act_on_delete = true) * * @var boolean * @access private */ var $_act_on_delete = true; /** * Validate foreign keys before insert or update if $_check_fkey is true * * By default, validation is disabled ($_check_fkey = false) * * @var boolean * @access private */ var $_check_fkey = false; // }}} // {{{ Methods /** * Constructor * * If an error is encountered during instantiation, the error * message is stored in the $this->error property of the resulting * object. See $error property docblock for a discussion of error * handling. * * @param object &$db DB/MDB2 database connection object * @param string $name the database name * @return object DB_Table_Database * @access public */ function DB_Table_Database(&$db, $name) { // Is $db an DB/MDB2 object or null? if (is_a($db, 'db_common')) { $this->backend = 'db'; $this->fetchmode = DB_FETCHMODE_ORDERED; } elseif (is_a($db, 'mdb2_driver_common')) { $this->backend = 'mdb2'; $this->fetchmode = MDB2_FETCHMODE_ORDERED; } else { $code = DB_TABLE_DATABASE_ERR_DB_OBJECT ; $text = $GLOBALS['_DB_TABLE_DATABASE']['error'][$code] . ' DB_Table_Database'; $this->error =& PEAR::throwError($text, $code); return; } $this->db =& $db; $this->name = $name; $this->_primary_subclass = 'DB_TABLE_DATABASE'; $this->setFixCase(false); } /** * Set DB/MDB2 connection instance for database and all tables * * Assign a reference to the DB/MDB2 object $db to $this->db, set * $this->backend to 'db' or 'mdb2' accordingly, and set the same pair * of values for the $db and $backend properties of every DB_Table * object in the database. * * Returns true on success, and PEAR error on failure. Returns error code * DB_TABLE_DATABASE_ERR_DB_OBJECT if $db is not a DB or MDB2 object. * * @param object &$db DB/MDB2 connection object * @return boolean true on success (PEAR_Error on failure) * @access public */ function setDBconnection(&$db) { // Is the first argument a DB/MDB2 object ? if (is_subclass_of($db, 'DB_Common')) { $backend = 'db'; } elseif (is_subclass_of($db, 'MDB2_Driver_Common')) { $backend = 'mdb2'; } else { return $this->throwError( DB_TABLE_DATABASE_ERR_DB_OBJECT, "setDBconnection"); } // Set db and backend for database and all of its tables $this->db =& $db; $this->backend = $backend; foreach ($this->_table as $name => $table) { $table->db =& $db; $table->backend = $backend; } return true; } /** * Turns on (or off) automatic php emulation of on delete actions * * @param bool $flag True to turn on action, false to turn off * @return void * @access public */ function setActOnDelete($flag = true) { if ($flag) { $this->_act_on_delete = true; } else { $this->_act_on_delete = false; } } /** * Turns on (or off) automatic php emulation of on update actions * * @param bool $flag True to turn on action, false to turn off * @return void * @access public */ function setActOnUpdate($flag = true) { if ($flag) { $this->_act_on_update = true; } else { $this->_act_on_update = false; } } /** * Turns on (or off) validation of foreign key values on insert and update * * @param bool $flag True to turn on checking, false to turn off * @return void * @access public */ function setCheckFKey($flag = true) { if ($flag) { $this->_check_fkey = true; } else { $this->_check_fkey = false; } } /** * Sets backend option such that column keys in associative array return * sets are converted to fixed case, if true, or mixed case, if false. * * Sets the DB/MDB2 'portability' option, and sets $this->fix_case = $flag. */ function setFixCase($flag = false) { $flag = (bool) $flag; $option = $this->db->getOption('portability'); if ($this->backend == 'db') { $option = $option | DB_PORTABILITY_LOWERCASE; if (!$flag) { $option = $option ^ DB_PORTABILITY_LOWERCASE; } } else { $option = $option | MDB2_PORTABILITY_FIX_CASE; if (!$flag) { $option = $option ^ MDB2_PORTABILITY_FIX_CASE; } } $this->db->setOption('portability', $option); $this->fix_case = $flag; } /** * Return reference to $this->db DB/MDB2 object * * @return object reference to DB/MDB2 object * @access public */ function &getDBInstance() { return $this->db; } /** * Returns all or part of $_table property array * * If $name is absent or null, return entire $_table property array. * If $name is a table name, return $this->_table[$name] DB_Table object * reference * * Returns PEAR_Error with the following DB_TABLE_DATABASE_ERR* codes * if: * - $name is not a string ( _TBL_NOT_STRING ) * - $name is not valid table name ( _NO_TBL ) * * The $_table property is an associative array in which keys are table * name strings and values are references to DB_Table objects. Each of * the referenced objects represents one table in the database. * * @return mixed $_table property, one element of $_table, or Error * @access public */ function getTable($name = null) { if (is_null($name)) { return $this->_table; } elseif (is_string($name)) { if (isset($this->_table[$name])) { return $this->_table[$name]; } else { return $this->throwError( DB_TABLE_DATABASE_ERR_NO_TBL, "getTable, $name"); } } else { return $this->throwError( DB_TABLE_DATABASE_ERR_TBL_NOT_STRING, "getTable"); } } /** * Returns all or part of the $_primary_key property array * * If $name is null, return the $this->_primary_key array * If $name is a table name, return $this->_primary_key[$name] * * Returns PEAR_Error with the following DB_TABLE_DATABASE_* error * codes if: * - $name is not a string ( _TBL_NOT_STRING ) * - $name is not valid table name ( _NO_TBL ) * * The $_primary_key property is an associative array in which each key * a table name, and each value is the primary key of that table. Each * primary key value may be a column name string, a sequential array of * column name strings (for a multi-column key), or null (if no primary * key has been declared). * * @return mixed $primary_key array or $this->_primary_key[$name] * @access public */ function getPrimaryKey($name = null) { if (is_null($name)) { return $this->_primary_key; } elseif (is_string($name)) { if (isset($this->_primary_key[$name])) { return $this->_primary_key[$name]; } else { return $this->throwError( DB_TABLE_DATABASE_ERR_NO_TBL, "getPrimaryKey, $name"); } } else { return $this->throwError( DB_TABLE_DATABASE_ERR_TBL_NOT_STRING, "getPrimaryKey"); } } /** * Returns all or part of the $_table_subclass property array * * If $name is null, return the $this->_table_subclass array * If $name is a table name, return $this->_table_subclass[$name] * * Returns PEAR_Error with the following DB_TABLE_DATABASE_* error * codes if: * - $name is not a string ( _TBL_NOT_STRING ) * - $name is not valid table name ( _NO_TBL ) * * The $_table_subclass property is an associative array in which each key * is a table name string, and each value is the name of the corresponding * subclass of DB_Table. The value is null if the table is an instance of * DB_Table itself. * * Subclass names are set within the addTable method by applying the * built in get_class() function to a DB_Table object. The class names * returned by get_class() are stored unmodified. In PHP 4, get_class * converts all class names to lower case. In PHP 5, it preserves the * capitalization of the name used in the class definition. * * In the __wakeup() method, for each table $table_name for which * $subclass = $this->_table_subclass[$table_name] is not null, but * class $subclass is not defined, the method attempts to include a * file named "$subclass.php" in directory $this->table_subclass_path. * For autoloading to work properly, the base name of each subclass * definition file (excluding the .php extension) should thus be a * lower case version of the class name in PHP 4 or identical to the * class name in PHP 5. * * @return mixed $_table_subclass array or $this->_table_subclass[$name] * @access public */ function getTableSubclass($name = null) { if (is_null($name)) { return $this->_table_subclass; } elseif (is_string($name)) { if (isset($this->_table_subclass[$name])) { return $this->_table_subclass[$name]; } else { return $this->throwError( DB_TABLE_DATABASE_ERR_NO_TBL, "getTableSubclass, $name"); } } else { return $this->throwError( DB_TABLE_DATABASE_ERR_TBL_NOT_STRING, "getTableSubclass"); } } /** * Returns all or part of the $_col property array * * If $column_name is null, return $_col property array * If $column_name is valid, return $_col[$column_name] subarray * * Returns a PEAR_Error with the following DB_TABLE_DATABASE_* error * codes if: * - $column_name is not a string ( _COL_NOT_STRING ) * - $column_name is not valid column name ( _NO_COL ) * * The $_col property is an associative array in which each key is the * name of a column in the database, and each value is a numerical array * containing the names of all tables that contain a column with that * name. * * @var array * @param string $column_name a column name string * @return mixed $this->_col property array or $this->_col[$column_name] * @access public */ function getCol($column_name = null) { if (is_null($column_name)) { return $this->_col; } elseif (is_string($column_name)) { if (isset($this->_col[$column_name])) { return $this->_col[$column_name]; } else { return $this->throwError( DB_TABLE_DATABASE_ERR_NO_COL, "'$column_name'"); } } else { return $this->throwError( DB_TABLE_DATABASE_ERR_COL_NOT_STRING, 'getCol'); } } /** * Returns all or part of the $_foreign_col property array * * If $column_name is null, return $this->_foreign_col property array * If $column_name is valid, return $this->_foreign_col[$column_name] * * Returns a PEAR_Error with the following DB_TABLE_DATABASE_* error * codes if: * - $column_name is not a string ( _COL_NOT_STRING ) * - $column_name is not valid foreign column name ( _NO_FOREIGN_COL ) * * The $_foreign_col property is an associative array in which each * key is the name string of a foreign key column, and each value is a * sequential array containing the names of all tables that contain a * foreign key column with that name. * * If a column $column in a referencing table $ftable is part of the * foreign key for references to two or more different referenced tables * tables, the name $ftable will also appear multiple times in the array * $this->_foreign_col[$column]. * * @param string column name string for foreign key column * @return array $_foreign_col property array * @access public */ function getForeignCol($column_name = null) { if (is_null($column_name)) { return $this->_foreign_col; } elseif (is_string($column_name)) { if (isset($this->_foreign_col[$column_name])) { return $this->_foreign_col[$column_name]; } else { return $this->throwError( DB_TABLE_DATABASE_ERR_NO_FOREIGN_COL, $column_name); } } else { return $this->throwError( DB_TABLE_DATABASE_ERR_COL_NOT_STRING, 'getForeignCol'); } } /** * Returns all or part of the $_ref two-dimensional property array * * Returns $this->_ref 2D property array if $table1 and $table2 are null. * Returns $this->_ref[$table1] subarray if only $table2 is null. * Returns $this->_ref[$table1][$table2] if both parameters are present. * * Returns null if $table1 is a table that references no others, or * if $table1 and $table2 are both valid table names, but there is no * reference from $table1 to $table2. * * Returns a PEAR_Error with the following DB_TABLE_DATABASE_* error * codes if: * - $table1 or $table2 is not a string ( _TBL_NOT_STRING ) * - $table1 or $table2 is not a valid table name ( _NO_TBL ) * * The $_ref property is a two-dimensional associative array in which * the keys are pairs of table names, each value is an array containing * information about referenced and referencing keys, and referentially * triggered actions (if any). An element of the $_ref array is of the * form $ref[$ftable][$rtable] = $reference, where $ftable is the name * of a referencing (or foreign key) table and $rtable is the name of * a corresponding referenced table. The value $reference is an array * $reference = array($fkey, $rkey, $on_delete, $on_update) in which * $fkey and $rkey are the foreign (or referencing) and referenced * keys, respectively: Foreign key $fkey of table $ftable references * key $rkey of table $rtable. The values of $fkey and $rkey must either * both be valid column name strings for columns of the same type, or * they may both be sequential arrays of column name names, with equal * numbers of columns of corresponding types, for multi-column keys. The * $on_delete and $on_update values may be either null or string values * that indicate actions to be taken upon deletion or updating of a * referenced row (e.g., cascading deletes). A null value of $on_delete * or $on_update indicates that no referentially triggered action will * be taken. See addRef() for further details about allowed values of * these action strings. * * @var array * @param string $table1 name of referencing table * @param string $table2 name of referenced table * @return mixed $ref property array, sub-array, or value * @access public */ function getRef($table1 = null, $table2 = null) { if (is_null($table1)) { return $this->_ref; } elseif (is_string($table1)) { if (isset($this->_ref[$table1])) { if (is_null($table2)) { return $this->_ref[$table1]; } elseif (is_string($table2)) { if (isset($this->_ref[$table1][$table2])) { return $this->_ref[$table1][$table2]; } else { if (isset($this->_table[$table2])) { // Valid table names but no references to return null; } else { // Invalid table name return $this->throwError( DB_TABLE_DATABASE_ERR_NO_TBL, "getRef, $table2"); } } } else { return $this->throwError( DB_TABLE_DATABASE_ERR_TBL_NOT_STRING, "getRef"); } } else { if (isset($this->_table[$table1])) { // Valid table name, but no references from return null; } else { // Invalid table name return $this->throwError( DB_TABLE_DATABASE_ERR_NO_TBL, "getRef, $table1"); } } } else { return $this->throwError( DB_TABLE_DATABASE_ERR_TBL_NOT_STRING, "getRef"); } } /** * Returns all or part of the $_ref_to property array * * Returns $this->_ref_to property array if $table_name is null. * Returns $this->_ref_to[$table_name] if $table_name is not null. * * Returns a PEAR_Error with the following DB_TABLE_DATABASE_* error * codes if: * - $table_name is not a string ( _TBL_NOT_STRING ) * - $table_name is not a valid table name ( _NO_TBL ) * * The $_ref_to property is an associative array in which each key * is the name of a referenced table, and each value is a sequential * array containing the names of all tables that contain foreign keys * that reference that table. Each element is thus of the form * $_ref_to[$rtable] = array($ftable1, $ftable2,...), where * $ftable1, $ftable2, ... are the names of tables that reference * the table named $rtable. * * @param string $table_name name of table * @return mixed $_ref_to property array or subarray * @access public */ function getRefTo($table_name = null) { if (is_null($table_name)) { return $this->_ref_to; } elseif (is_string($table_name)) { if (isset($this->_ref_to[$table_name])) { return $this->_ref_to[$table_name]; } else { if (isset($this->_table[$table_name])) { // Valid table name, but no references to return null; } else { // Invalid table name return $this->throwError( DB_TABLE_DATABASE_ERR_NO_TBL, "getRefTo, $table_name"); } } } else { return $this->throwError( DB_TABLE_DATABASE_ERR_TBL_NOT_STRING, "getRefTo"); } } /** * Returns all or part of the $link two-dimensional property array * * Returns $this->_link 2D property array if $table1 and $table2 are null. * Returns $this->_link[$table1] subarray if only $table2 is null. * Returns $this->_link[$table1][$table2] if both parameters are present. * * Returns null if $table1 is a valid table with links to no others, or * if $table1 and $table2 are both valid table names but there is no * link between them. * * Returns a PEAR_Error with the following DB_TABLE_DATABASE_* error * codes if $table1 or $table2 is not null and: * - $table1 or $table2 is not a string ( _TBL_NOT_STRING ) * - $table1 or $table2 is not a valid table name ( _NO_TBL ) * * The $_link property is a two-dimensional associative array with * elements of the form $this->_link[$table1][$table2] = array($link1, ...), * in which the value is an array containing the names of all tables * that `link' tables named $table1 and $table2, and thereby create a * many-to-many relationship between these two tables. * * The $_link property is used in the autoJoin method to join tables * that are related by a many-to-many relationship via a linking table, * rather than via a direct foreign key reference. A table that is * declared to be linking table for tables $table1 and $table2 must * contain foreign keys that reference both of these tables. * * Each binary link in a database is listed twice in $_link, in * $_link[$table1][$table2] and in $_link[$table2][$table1]. If a * linking table contains foreign key references to N tables, with * N > 2, each of the resulting binary links is listed separately. * For example, a table with references to 3 tables A, B, and C can * create three binary links (AB, AC, and BC) and six entries in the * link property array (i.e., in $_link[A][B], $_link[B][A], ... ). * * Linking tables may be added to the $_link property by using the * addLink method or deleted using the delLink method. Alternatively, * all possible linking tables can be identified and added to the * $_link array at once by the addAllLinks() method. * * @var array * @param string $table1 name of linked table * @param string $table2 name of linked table * @return mixed $_link property array, sub-array, or value * @access public */ function getLink($table1 = null, $table2 = null) { if (is_null($table1)) { return $this->_link; } elseif (is_string($table1)) { if (isset($this->_link[$table1])) { if (is_null($table2)) { return $this->_link[$table1]; } elseif (is_string($table2)) { if (isset($this->_link[$table1][$table2])) { return $this->_link[$table1][$table2]; } else { if (isset($this->_table[$table2])) { // Valid table names, but no links return null; } else { // Invalid 2nd table name string return $this->throwError( DB_TABLE_DATABASE_ERR_NO_TBL, "getLink, $table2"); } } } else { return $this->throwError( DB_TABLE_DATABASE_ERR_TBL_NOT_STRING, "getLink"); } } else { if (isset($this->_table[$table1])) { // Valid first table name, but no links return null; } else { // Invalid 1st table name string return $this->throwError( DB_TABLE_DATABASE_ERR_NO_TBL, "getLink, $table1"); } } } else { return $this->throwError( DB_TABLE_DATABASE_ERR_TBL_NOT_STRING, "getLink"); } } /** * Sets the path to a the directory containing DB_Table subclass definitions. * * This method sets the $_table_subclass_path string property. The value of * this property is the path to the directory containing DB_Table subclass * definitions, without a trailing directory separator. * * This path may be used by the __wakeup(), if necessary, in an attempt to * autoload class definitions when unserializing a DB_Table_Database object * and its child DB_Table objects. If a DB_Table subclass named $subclass_name * has not been defined when it is needed, within DB_Table_Database::__wakeup(), * to unserialize an instance of this class, the __wakeup() method attempts * to include a class definition file from this directory, as follows: * * $dir = $this->_table_subclass_path; * require_once $dir . '/' . $subclass . '.php'; * * See the getTableSubclass() docblock for a discusion of capitalization * conventions in PHP 4 and 5 for subclass file names. * * @param string $path path to directory containing class definitions * @return void * @access public */ function setTableSubclassPath($path) { $this->_table_subclass_path = $path; } /** * Adds a table to the database. * * Creates references between $this DB_Table_Database object and * the child DB_Table object, by adding a reference to $table_obj * to the $this->_table array, and setting $table_obj->database = * $this. * * Adds the primary key to $this->_primary_key array. The relevant * element of $this->_primary_key is set to null if no primary key * index is declared. Returns an error if more than one primary key * is declared. * * Returns true on success, and PEAR error on failure. Returns the * following DB_TABLE_DATABASE_ERR_* error codes if: * - $table_obj is not a DB_Table ( _DBTABLE_OBJECT ) * - more than one primary key is defined ( _ERR_MULT_PKEY ) * * @param object &$table_obj the DB_Table object (reference) * @return boolean true on success (PEAR_Error on failure) * @access public */ function addTable(&$table_obj) { // Check that $table_obj is a DB_Table object // Identify subclass name, if any if (is_subclass_of($table_obj, 'DB_Table')) { $subclass = get_class($table_obj); } elseif (is_a($table_obj, 'DB_Table')) { $subclass = null; } else { return $this->throwError( DB_TABLE_DATABASE_ERR_DBTABLE_OBJECT); } // Identify table name and table object (sub)class name $table = $table_obj->table; // Set $this->_primary_key[$table] $this->_primary_key[$table] = null; foreach ($table_obj->idx as $idx_name => $idx_def) { if ($idx_def['type'] == 'primary') { if (is_null($this->_primary_key[$table])) { $this->_primary_key[$table] = $idx_def['cols']; } else { // More than one primary key defined in the table unset($this->_primary_key[$table]); return $this->throwError( DB_TABLE_DATABASE_ERR_MULT_PKEY, $table); } } } // Add references between $this parent and child table object $this->_table[$table] =& $table_obj; $table_obj->setDatabaseInstance($this); // Add subclass name (if any) to $this->_table_subclass $this->_table_subclass[$table] = $subclass; // Set shared properties $table_obj->db =& $this->db; $table_obj->backend = $this->backend; $table_obj->fetchmode = $this->fetchmode; // Add all columns to $_col property foreach ($table_obj->col as $key => $def) { if (!isset($this->_col[$key])) { $this->_col[$key] = array(); } $this->_col[$key][] = $table; } return true; } /** * Deletes a table from $this database object. * * Removes all dependencies on $table from the database model. The table * is removed from $_table and $_primary_key properties. Its columns are * removed from the $_col and $_foreign_col properties. References to * and from the table are removed from the $_ref, $_ref_to, and $_link * properties. Referencing columns are removed from $_foreign_col. * * @param string $table name of table to be deleted * @return void * @access public */ function deleteTable($table) { if (isset($this->_table[$table])) { $table_obj =& $this->_table[$table]; } else { return; } // Remove reference to database from table object $null_instance = null; $table_obj->setDatabaseInstance($null_instance); // Remove columns from $_col and $_foreign_col property arrays foreach ($table_obj->col as $column => $def) { $key = array_search($table, $this->_col[$column]); if (is_integer($key)) { unset($this->_col[$column][$key]); if (count($this->_col[$column]) == 0) { unset($this->_col[$column]); } else { $new = array_values($this->_col[$column]); $this->_col[$column] = $new; } } if (isset($this->_foreign_col[$column])) { $key = array_search($table, $this->_foreign_col[$column]); if (is_integer($key)) { unset($this->_foreign_col[$column][$key]); if (count($this->_foreign_col[$column]) == 0) { unset($this->_foreign_col[$column]); } else { $new = array_values($this->_foreign_col[$column]); $this->_foreign_col[$column] = $new; } } } } // Remove all references involving the deleted table. // Corresponding links are removed from $this->_link by deleteRef // Referencing columns are removed from $this->_foreign_col by deleteRef foreach ($this->_ref as $ftable => $referenced) { foreach ($referenced as $rtable => $ref) { if ($ftable == $table || $rtable == $table) { $this->deleteRef($ftable, $rtable); } } } // Remove table from $this->_table and $this->_primary_key unset($this->_table[$table]); unset($this->_primary_key[$table]); } /** * Adds a foreign key reference to the database. * * Adds a reference from foreign key $fkey of table $ftable to * referenced key $rkey of table named $rtable to the $this->_ref * property. The values of $fkey and $rkey (if not null) may either * both be column name strings (for single column keys) or they * may both be numerically indexed arrays of corresponding column * names (for multi-column keys). If $rkey is null (the default), * the referenced key taken to be the primary key of $rtable, if * any. * * The $on_delete and $on_update parameters may be either be null, * or may have string values 'restrict', 'cascade', 'set null', or * 'set default' that indicate referentially triggered actions to be * taken deletion or updating of referenced row in $rtable. Each of * these actions corresponds to a standard SQL action (e.g., cascading * delete) that may be taken upon referencing rows of table $ftable * when a referenced row of $rtable is deleted or updated. A PHP * null value for either parameter (the default) signifies that no * such action will be taken upon deletion or updating. * * There may no more than one reference from a table to another, though * reference may contain multiple columns. * * Returns true on success, and PEAR error on failure. Returns the * following DB_TABLE_DATABASE_ERR_* error codes if: * - $ftable does not exist ( _NO_FTABLE ) * - $rtable does not exist ( _NO_RTABLE ) * - $rkey is null and $rtable has no primary key ( _NO_PKEY ) * - $fkey is neither a string nor an array ( _FKEY ) * - $rkey is not a string, $fkey is a string ( _RKEY_NOT_STRING ) * - $rkey is not an array, $fkey is an array ( _RKEY_NOT_ARRAY ) * - A column of $fkey does not exist ( _NO_FCOL ) * - A column of $rkey does not exist ( _NO_RCOL ) * - A column of $fkey and $rkey have different types ( _REF_TYPE ) * - A reference from $ftable to $rtable already exists ( _MULT_REF ) * * @param string $ftable name of foreign/referencing table * @param mixed $fkey foreign key in referencing table * @param string $rtable name of referenced table * @param mixed $rkey referenced key in referenced table * @param string $on_delete action upon delete of a referenced row. * @param string $on_update action upon update of a referenced row. * @return boolean true on success (PEAR_Error on failure) * @access public */ function addRef($ftable, $fkey, $rtable, $rkey = null, $on_delete = null, $on_update = null) { // Check existence of $ftable is a key in $this->_table. if (isset($this->_table[$ftable])) { $ftable_obj =& $this->_table[$ftable]; } else { return $this->throwError( DB_TABLE_DATABASE_ERR_NO_FTABLE, "$ftable => $rtable"); } // Check existence of referenced table if (isset($this->_table[$rtable])) { $rtable_obj =& $this->_table[$rtable]; } else { return $this->throwError( DB_TABLE_DATABASE_ERR_NO_RTABLE, "$ftable => $rtable"); } // If referenced key is null, set it to the primary key if (!$rkey) { if (isset($this->_primary_key[$rtable])) { $rkey = $this->_primary_key[$rtable]; } else { // Error: null referenced key and no primary key return $this->throwError( DB_TABLE_DATABASE_ERR_NO_PKEY, "$ftable => $rtable"); } } // Check $fkey and $rkey types and compatibility if (is_string($fkey)) { if (!is_string($rkey)) { return $this->throwError( DB_TABLE_DATABASE_ERR_RKEY_NOT_STRING, "$ftable => $rtable"); } if (!isset($ftable_obj->col[$fkey])) { return $this->throwError( DB_TABLE_DATABASE_ERR_NO_FCOL, "$ftable.$fkey => $rtable.$rkey"); } if (!isset($rtable_obj->col[$rkey])) { return $this->throwError( DB_TABLE_DATABASE_ERR_NO_RCOL, "$ftable.$fkey => $rtable.$rkey"); } $ftype = $ftable_obj->col[$fkey]['type']; $rtype = $rtable_obj->col[$rkey]['type']; if (!($rtype == $ftype)) { return $this->throwError( DB_TABLE_DATABASE_ERR_REF_TYPE, "$ftable.$fkey => $rtable.$rkey"); } } elseif (is_array($fkey)) { if (!is_array($rkey)) { return $this->throwError( DB_TABLE_DATABASE_ERR_RKEY_NOT_ARRAY, "$ftable => $rtable"); } if (!(count($fkey) == count($rkey))) { return $this->throwError( DB_TABLE_DATABASE_ERR_RKEY_COL_NUMBER, "$ftable => $rtable"); } for ($i=0 ; $i < count($rkey) ; $i++) { $fcol = $fkey[$i]; $rcol = $rkey[$i]; if (!isset($ftable_obj->col[$fcol])) { return $this->throwError( DB_TABLE_DATABASE_ERR_NO_FCOL, "$ftable.$fcol => $rtable.$rcol"); } if (!isset($rtable_obj->col[$rcol])) { return $this->throwError( DB_TABLE_DATABASE_ERR_NO_RCOL, "$ftable.$fcol => $rtable.$rcol"); } $ftype = $ftable_obj->col[$fcol]['type']; $rtype = $rtable_obj->col[$rcol]['type']; if (!($rtype == $ftype)) { return $this->throwError( DB_TABLE_DATABASE_ERR_REF_TYPE, "$ftable.$fcol => $rtable.$rcol"); } } } else { return $this->throwError( DB_TABLE_DATABASE_ERR_FKEY, "$ftable => $rtable"); } // Check validity of on_delete and on_update actions $valid_actions = array(null, 'cascade', 'set null', 'set default', 'restrict'); if (!in_array($on_delete, $valid_actions)) { return $this->throwError( DB_TABLE_DATABASE_ERR_ON_DELETE_ACTION, "$ftable => $rtable"); } if (!in_array($on_update, $valid_actions)) { return $this->throwError( DB_TABLE_DATABASE_ERR_ON_UPDATE_ACTION, "$ftable => $rtable"); } // Add reference to $this->_ref; $ref = array( 'fkey' => $fkey, 'rkey' => $rkey, 'on_delete' => $on_delete, 'on_update' => $on_update); if (!isset($this->_ref[$ftable])) { $this->_ref[$ftable] = array(); } else { if (isset($this->_ref[$ftable][$rtable])) { // Multiple references from $ftable to $rtable return $this->throwError( DB_TABLE_DATABASE_ERR_MULT_REF, "$ftable => $rtable"); } } $this->_ref[$ftable][$rtable] = $ref; // Add referencing table $ftable to $ref_to property if (!isset($this->_ref_to[$rtable])) { $this->_ref_to[$rtable] = array(); } $this->_ref_to[$rtable][] = $ftable; // Add foreign key columns to $this->_foreign_col if (is_string($fkey)) { if (!isset($this->_foreign_col[$fkey])) { $this->_foreign_col[$fkey] = array(); } $this->_foreign_col[$fkey][] = $ftable; } elseif (is_array($fkey)) { foreach ($fkey as $fcol) { if (!isset($this->_foreign_col[$fcol])) { $this->_foreign_col[$fcol] = array(); } $this->_foreign_col[$fcol][] = $ftable; } } // Normal completion return true; } /** * Deletes one reference from database model * * Removes reference from referencing (foreign key) table named * $ftable to referenced table named $rtable. Unsets relevant elements * of the $ref, $_ref_to, and $_link property arrays, and removes the * foreign key columns of $ftable from the $_foreign_col property. * * Does nothing, silently, if no such reference exists, i.e., if * $this->_ref[$ftable][$rtable] is not set. * * @param $ftable name of referencing (foreign key) table * @param $rtable name of referenced table * @return void * @access public */ function deleteRef($ftable, $rtable) { // Delete from $_ref property if (isset($this->_ref[$ftable])) { if (isset($this->_ref[$ftable][$rtable])) { $fkey = $this->_ref[$ftable][$rtable]['fkey']; unset($this->_ref[$ftable][$rtable]); } else { // No such reference, abort silently return; } } // Remove foreign key columns from $foreign_col property if (isset($fkey)) { if (is_string($fkey)) { $fkey = array($fkey); } foreach ($fkey as $column) { if (isset($this->_foreign_col[$column])) { $key = array_search($ftable, $this->_foreign_col[$column]); if (is_integer($key)) { unset($this->_foreign_col[$column][$key]); if (count($this->_foreign_col[$column]) == 0) { unset($this->_foreign_col[$column]); } else { $new = array_values($this->_foreign_col[$column]); $this->_foreign_col[$column] = $new; } } } } } // Delete from $_ref_to property if (isset($this->_ref_to[$rtable])) { $key = array_search($ftable, $this->_ref_to[$rtable]); // Unset element unset($this->_ref_to[$rtable][$key]); if (count($this->_ref_to[$rtable]) == 0) { unset($this->_ref_to[$rtable]); } else { // Redefine numerical keys of remaining elements $ref_to = array_values($this->_ref_to[$rtable]); $this->_ref_to[$rtable] = $ref_to; } } // Delete all relevant links from $_link property if (isset($this->_link[$rtable])) { foreach ($this->_link[$rtable] as $table2 => $links) { if (in_array($ftable, $links)) { $this->deleteLink($rtable, $table2, $ftable); } } } } /** * Modifies the on delete action for one foreign key reference. * * Modifies the value of the on_delete action associated with a reference * from $ftable to $rtable. The parameter action may be one of the action * strings 'cascade', 'restrict', 'set null', or 'set default', or it may * be php null. A null value of $action indicates that no action should be * taken upon deletion of a referenced row. * * Returns true on success, and PEAR error on failure. Returns the error * code DB_TABLE_DATABASE_ERR_REF_TRIG_ACTION if $action is a neither a * valid action string nor null. Returns true, and does nothing, if * $this->_ref[$ftable][$rtable] is not set. * * @param string $ftable name of referencing (foreign key) table * @param string $rtable name of referenced table * @param string $action on delete action (action string or null) * @return boolean true on normal completion (PEAR_Error on failure) * @access public */ function setOnDelete($ftable, $rtable, $action) { $valid_actions = array(null, 'cascade', 'set null', 'set default', 'restrict'); if (isset($this->_ref[$ftable])) { if (isset($this->_ref[$ftable][$rtable])) { if (!in_array($action, $valid_actions)) { return $this->throwError( DB_TABLE_DATABASE_ERR_REF_ON_DELETE_ACTION, "$ftable => $rtable"); } $this->_ref[$ftable][$rtable]['on_delete'] = $action; } } return true; } /** * Modifies on update action for one foreign key reference. * * Similar to setOnDelete. See setOnDelete for further details. * * @param string $ftable name of referencing (foreign key) table * @param string $rtable name of referenced table * @param array $action on update action (action string or null) * @return boolean true on normal completion (PEAR_Error on failure) * @access public */ function setOnUpdate($ftable, $rtable, $action) { $valid_actions = array(null, 'cascade', 'set null', 'set default', 'restrict'); if (isset($this->_ref[$ftable])) { if (isset($this->_ref[$ftable][$rtable])) { if (!in_array($action, $valid_actions)) { return $this->throwError( DB_TABLE_DATABASE_ERR_REF_ON_UPDATE_ACTION, "$ftable => $rtable"); } $this->_ref[$ftable][$rtable]['on_update'] = $action; } } return true; } /** * Identifies a linking/association table that links two others * * Adds table name $link to $this->_link[$table1][$table2] and * to $this->_link[$table2][$table1]. * * Returns true on success, and PEAR error on failure. Returns the * following DB_TABLE_DATABASE_ERR_* error codes if: * - $ftable does not exist ( _NO_FTABLE ) * - $rtable does not exist ( _NO_RTABLE ) * * @param string $table1 name of 1st linked table * @param string $table2 name of 2nd linked table * @param string $link name of linking/association table. * @return boolean true on success (PEAR_Error on failure) * @access public */ function addLink($table1, $table2, $link) { // Check for existence of all three tables if (is_string($table1)) { if (!isset($this->_table[$table1])) { return $this->throwError( DB_TABLE_DATABASE_ERR_NO_TBL, "addLink, $table1"); } } else { return $this->throwError( DB_TABLE_DATABASE_ERR_NO_TBL, "addLink, $table1"); } if (!isset($this->_table[$table2])) { return $this->throwError( DB_TABLE_DATABASE_ERR_NO_TBL, "addLink, $table2"); } if (!isset($this->_table[$link])) { return $this->throwError( DB_TABLE_DATABASE_ERR_NO_TBL, "addLink, $link"); } if (!isset($this->_ref[$link])) { return $this->throwError( DB_TABLE_DATABASE_ERR_NO_REF_LINK, "$link => $table1, $table2"); } else { if (!isset($this->_ref[$link][$table1])) { return $this->throwError( DB_TABLE_DATABASE_ERR_NO_REF_LINK, "$link => $table1"); } if (!isset($this->_ref[$link][$table2])) { return $this->throwError( DB_TABLE_DATABASE_ERR_NO_REF_LINK, "$link => $table2"); } } // Add $this_link[$table1][$table2] if (!key_exists($table1, $this->_link)) { $this->_link[$table1] = array(); } if (!key_exists($table2, $this->_link[$table1])) { $this->_link[$table1][$table2] = array(); } $this->_link[$table1][$table2][] = $link; // Add $this_link[$table2][$table1] if (!key_exists($table2, $this->_link)) { $this->_link[$table2] = array(); } if (!key_exists($table1, $this->_link[$table2])) { $this->_link[$table2][$table1] = array(); } $this->_link[$table2][$table1][] = $link; } /** * Adds all possible linking tables to the $_link property array * * Identifies all potential linking tables in the datbase, and adds * them all to the $_link property. Table $link is taken to be a * link between tables $table1 and $table2 if it contains foreign * key references to both $table1 and $table2. * * @return void * @access public */ function addAllLinks() { foreach ($this->_table as $link => $link_obj) { if (isset($this->_ref[$link])) { $ref = $this->_ref[$link]; $n = count($ref); $names = array_keys($ref); if ($n > 1) { $is_link = true; } else { $is_link = false; } if ($is_link) { if ($n == 2) { $table1 = $names[0]; $table2 = $names[1]; $this->addLink($table1, $table2, $link); } elseif ($n > 2) { for ($i=1 ; $i < $n; $i++) { for ($j=0 ; $j < $i; $j++) { $table1 = $names[$j]; $table2 = $names[$i]; $this->addLink($table1, $table2, $link); } } } } } } } /** * Removes a link between two tables from the $_link property * * If $link is not null, remove table $link from the list of links * between $table1 and $table2, if present. If $link is null, delete * all links between $table1 and $table2. * * @param string $table1 name of 1st linked table * @param string $table2 name of 2nd linked table * @param string $link name of linking table * @return void * @access public */ function deleteLink($table1, $table2, $link = null) { if (isset($this->_link[$table1])) { if (isset($this->_link[$table1][$table2])) { if ($link) { // Find numerical key of $link in _link[$table1][$table2] $key = array_search($link, $this->_link[$table1][$table2]); if (is_integer($key)) { unset($this->_link[$table1][$table2][$key]); if (count($this->_link[$table1][$table2]) == 0) { unset($this->_link[$table1][$table2]); unset($this->_link[$table2][$table1]); if (count($this->_link[$table1]) == 0) { unset($this->_link[$table1]); } if (count($this->_link[$table2]) == 0) { unset($this->_link[$table2]); } } else { // Reset remaining indices sequentially from zero $new = array_values($this->_link[$table1][$table2]); $this->_link[$table1][$table2] = $new; $this->_link[$table2][$table1] = $new; } } } else { unset($this->_link[$table1][$table2]); unset($this->_link[$table2][$table1]); if (count($this->_link[$table1]) == 0) { unset($this->_link[$table1]); } if (count($this->_link[$table2]) == 0) { unset($this->_link[$table2]); } } } } } /** * Validates and (if necessary) disambiguates a column name. * * The parameter $col is a string may be either a column name or * a column name qualified by a table name, using the SQL syntax * "$table.$column". If $col contains a table name, and is valid, * an array($table, $column) is returned. If $col is not qualified * by a column name, an array array($table, $column) is returned, * in which $table is either the name of one table, or an array * containing the names of two or more tables containing a column * named $col. * * The $from parameter, if present, is a numerical array of * names of tables with which $col should be associated, if no * explicit table name is provided, and if possible. If one * or more of the tables in $from contains a column $col, the * returned table or set of tables is restricted to those in * array $from. * * If the table name remains ambiguous after testing for tables in * the $from set, and $col is not a foreign key in one or more of * the remaining tables, the returned table or set of tables is * restricted to those in which $col is not a foreign key. * * Returns a PEAR_Error with the following DB_TABLE_DATABASE_ERR_* error * codes if: * - column $col does not exist in the database ( _NO_COL_DB ) * - column $col does not exist in the specified table ( _NO_COL_TBL ) * * @param string $col column name, optionally qualified by a table name * @param array $from array of tables from which $col should be chosen, * if possible. * @return array array($table, $column), or PEAR_Error $column is a string, $table is a string or array * @access public */ function validCol($col, $from = null) { $col = explode('.',trim($col)); if (count($col) == 1) { // Parameter $col is a column name with no table name $column = $col[0]; // Does $column exist in database ? if (!isset($this->_col[$column])) { return $this->throwError( DB_TABLE_DATABASE_ERR_NO_COL_DB, "$column"); } $table = $this->_col[$column]; // If $table is not unique, try restricting to arrays in $from if (count($table) > 1 && $from) { $ptable = array_intersect($table, $from); if (count($ptable) > 0) { $table = array_values($ptable); } } // If count($table)>1, try excluding foreign key columns if (count($table) > 1 && isset($this->_foreign_col[$column])) { $ptable = array_diff($table, $this->_foreign_col[$column]); if (count($ptable) > 0) { $table = array_values($ptable); } } // If only one table remains, set $table = table name string if (count($table) == 1) { $table = $table[0]; } } elseif (count($col) == 2) { // parameter $col is qualified by a table name $table = $col[0]; $column = $col[1]; if (isset($this->_table[$table])) { $table_obj =& $this->_table[$table]; $col_array = $table_obj->col; if (!isset($col_array[$column])) { return $this->throwError( DB_TABLE_DATABASE_ERR_NO_COL_TBL, "$table.$column"); } } else { return $this->throwError( DB_TABLE_DATABASE_ERR_NO_TBL, "validCol, $table"); } } return array($table, $column); } /** * Creates all the tables in a database in a RDBMS * * Note: this method creates all the tables in a database, but does * NOT create the parent database or set it to the current or default * database -- the database must exist before the method is called. * * If creation of any table fails, the method immediately returns the * PEAR error returned by DB_Table::create($flag). * * @param mixed $flag The automatic database creation mode, which is * applied to each table in the database. It can have * values: * - 'safe' to create a table only if it does not exist * - 'drop' to drop and recreate any existing table with the same name * * @see DB_Table::create() * * @return boolean true on success (PEAR_Error on failure of any table) * @access public */ function createTables($flag = 'safe') { foreach ($this->_table as $name => $table) { $result = $table->create($flag); if (PEAR::isError($result)) { return $result; } } return true; } /** * Check validity of any foreign key values in associative array $data * containing values to be inserted or updated in table $table_name. * * Returns true if each foreign key in $data matches a row in the * referenced table, or if there are no foreign key columns in $data. * Returns false if any foreign key column in associative array $data * (which may contain a full or partial row of $table_name), does not * match the the value of the referenced column in any row of the * referenced table. * * Returns any PEAR error thrown by the select method, which is called * to implement the required query, or by the buildFilter method. * * @param $table_name name of the referencing table containing $data * @param @data associative array containing all or part of a row * of data of $table_name, with column name keys. * @return bool true if all foreign keys are valid, false otherwise. * PEAR_Error if an error is thrown by a required query * @access public */ function validForeignKeys($table_name, $data) { if (isset($this->_ref[$table_name])) { foreach ($this->_ref[$table_name] as $rtable_name => $ref) { $fkey = $ref['fkey']; $rkey = $ref['rkey']; $rtable_obj =& $this->_table[$rtable_name]; // Construct select where clause for referenced rows, // $filter = '' if $data contains no foreign key columns, $filter = $this->_buildFKeyFilter($data, $fkey, $rkey); if (PEAR::isError($filter)) { return $filter; } // If inserted data contain FK columns referenced by rtable, // select referenced row of rtable, return error if none is // found if ($filter) { $sql = array('select'=> '*', 'from' => $rtable_name, 'where' => $filter); $referenced_rows = $this->select($sql); // Check for failed query if (PEAR::isError($referenced_rows)) { return $referenced_rows; } // Check for failed foreign key constraint if (count($referenced_rows) == 0) { return $this->throwError( DB_TABLE_DATABASE_ERR_FKEY_CONSTRAINT); } } } } return true; } /** * Inserts a single table row * * Wrapper for insert method of the corresponding DB_Table object. * * @param string $table_name Name of table into which to insert data * @param array $data Associative array, in which each key is a column * name and each value is that column's value. * This is the data that will be inserted into * the table. Data is checked against the column * names and data types for validity. * @return boolean true on success (PEAR_Error on failure) * @access public */ function insert($table_name, $data) { // Dereference table object if (isset($this->_table[$table_name])) { $table_obj =& $this->_table[$table_name]; } else { return $this->throwError( DB_TABLE_DATABASE_ERR_NO_TBL, "insert, $table_name"); } // Insert into $table_obj $result = $table_obj->insert($data); // Return value: true or PEAR_Error if (PEAR::isError($result)) { return $result; } else { return true; } } /** * Turns on or off automatic validation of inserted data for all tables * * @param bool $flag true to turn on auto-validation, false to turn off. * @return void * @access public */ function autoValidInsert($flag = true) { foreach ($this->_table as $table_obj) { $table_obj->autoValidInsert($flag); } } /** * Updates all row(s) of table that match a custom where clause. * * Data can be validated before insertion using validUpdate(). * Implements any required 'on_update' actions on referencing * tables that reference columns of updated rows * * @param string $table_name name of table to update * @param array $data associative array in which keys are names of * columns to be updated values are new values. * @param string $where SQL WHERE clause that limits the set of * records to update. * @return boolean true on success (PEAR_Error on failure) * @access public */ function update($table_name, $data, $where) { // Dereference table object if (isset($this->_table[$table_name])) { $table_obj =& $this->_table[$table_name]; } else { return $this->throwError( DB_TABLE_DATABASE_ERR_NO_TBL, "update, $table_name"); } // Apply update $result = $table_obj->update($data, $where); // Return value: true or PEAR_Error if (PEAR::isError($result)) { return $result; } else { return true; } } /** * Turns on (or off) automatic validation of updated data for all tables. * * @param bool $flag true to turn on auto-validation, false to turn off * @return void * @access public */ function autoValidUpdate($flag = true) { foreach ($this->_table as $table_obj) { $table_obj->autoValidUpdate($flag); } } function onUpdateAction(&$table_obj, $data, $where) { $table_name = $table_obj->table; if ($this->_act_on_update and isset($this->_ref_to[$table_name])) { $update_rows = null; foreach ($this->_ref_to[$table_name] as $ftable_name) { $ref = $this->_ref[$ftable_name][$table_name]; $action = isset($ref['on_update']) ? $ref['on_update'] : null; if (is_null($action)) { continue; } $rtable_obj =& $this->_table[$table_name]; $ftable_obj =& $this->_table[$ftable_name]; $fkey = $ref['fkey']; $rkey = $ref['rkey']; // Check if any column(s) of referenced $rkey are updated $rkey_updated = false; foreach ($data as $key => $value) { if (is_string($rkey)){ if ($key == $rkey) { $rkey_updated = true; break; } } else { if (in_array($key, $rkey)) { $rkey_updated = true; break; } } } // If $rkey is not updated, continue to next referencing table if (!$rkey_updated) { continue; } // Select rows to be updated, if not done previously if ($update_rows === null) { if ($this->backend == 'mdb2') { $fetchmode_assoc = MDB2_FETCHMODE_ASSOC; } else { $fetchmode_assoc = DB_FETCHMODE_ASSOC; } $sql = array('select' => '*', 'from' => $table_name, 'where' => $where, 'fetchmode' => $fetchmode_assoc); $update_rows = $this->select($sql); if (PEAR::isError($update_rows)) { return $update_rows; } } // Construct $fdata array if cascade, set null, or set default $fdata = null; if ($action == 'cascade') { if (is_string($rkey)) { if (array_key_exists($rkey, $data)) { $fdata = array($fkey => $data[$rkey]); } } else { $fdata = array(); for ($i=0; $i < count($rkey); $i++) { $rcol = $rkey[$i]; $fcol = $fkey[$i]; if (array_key_exists($rcol, $data)) { $fdata[$fcol] = $data[$rcol]; } } if (count($fdata) == 0) { $fdata = null; } } } elseif ($action == 'set null' or $action == 'set default') { if (is_string($fkey)) { if ($action == 'set default') { $value = isset($ftable_obj->col[$fkey]['default']) ? $ftable_obj->col[$fkey]['default'] : null; } else { $value = null; } $fdata = array($fkey => $value); } else { $fdata = array(); foreach ($fkey as $fcol) { if ($action == 'set default') { $value = isset($ftable_obj->col[$fcol]['default']) ? $ftable_obj->col[$fcol]['default'] : null; } else { $value = null; } $fdata[$fcol] = $value; } if (count($fdata) == 0) { $fdata = null; } } } elseif ($action == 'restrict') { $fdata = true; } elseif ($action == null) { $fdata = null; } else { return $this->throwError( DB_TABLE_DATABASE_ERR_ON_UPDATE_ACTION, "$ftable_name => $table_name"); } if (!is_null($fdata)) { // Loop over rows to be updated from $table foreach ($update_rows as $update_row) { // If necessary, restore case of column names if ($this->fix_case) { $cols = array_keys($table_obj->col); $update_row = $this->_replaceKeys($update_row, $cols); } // Construct filter for rows that reference $update_row $filter = $this->_buildFKeyFilter($update_row, $rkey, $fkey); // Apply action to foreign/referencing rows if ($action == 'restrict') { $sql = array('select'=>'*', 'from' => $ftable_name, 'where' => $filter); $frows = $this->select($sql); if (PEAR::isError($frows)) { return $frows; } if (count($frows) > 0) { return $this->throwError( DB_TABLE_DATABASE_ERR_RESTRICT_UPDATE, $table_name); } } else { // If 'cascade', 'set null', or 'set default', // then update the referencing foreign key. // Note: Turn off foreign key validity check // during update, then restore original value $check_fkey = $this->_check_fkey; $this->_check_fkey = false; $result = $this->update($ftable_name, $fdata, $filter); $this->_check_fkey = $check_fkey; if (PEAR::isError($result)) { return $result; } } } // foreach ($update_row) } // if (!is_null($fdata)) } // foreach loop over referencing tables } // end if // Normal completion return true; } /** * Turns on (or off) automatic recasting of insert and update data * for all tables * * @param bool $flag True to automatically recast insert and update * data, in all tables, false to not do so. * @return void * @access public */ function autoRecast($flag = true) { foreach ($this->_table as $table_obj) { $table_obj->autoRecast($flag); } } /** * Turns on (or off) php implementation of auto-incrementing on insertion * for all tables * * @param bool $flag True to turn on auto-incrementing, false to turn off * @return void * @access public */ function autoInc($flag = true) { foreach ($this->_table as $table_obj) { $table_obj->auto_inc = $flag; } } /** * Deletes all row(s) of table that match a custom where clause. * * Implements any required 'on_delete' action on tables that * reference the table from which rows are deleted. * * @param string $table_name name of table from which to delete * @param string $where SQL WHERE clause that limits the set * of records to delete * @return boolean true on success (PEAR_Error on failure) * @access public */ function delete($table_name, $where) { // Dereference table object if (isset($this->_table[$table_name])) { $table_obj =& $this->_table[$table_name]; } else { return $this->throwError( DB_TABLE_DATABASE_ERR_NO_TBL, "delete, $table_name"); } // Delete from $table_obj $result = $table_obj->delete($where); // Return value: true or PEAR_Error if (PEAR::isError($result)) { return $result; } else { return true; } } function onDeleteAction(&$table_obj, $where) { $table_name = $table_obj->table; if ($this->_act_on_delete and isset($this->_ref_to[$table_name])) { $delete_rows = null; foreach ($this->_ref_to[$table_name] as $ftable_name) { $ref = $this->_ref[$ftable_name][$table_name]; $action = $ref['on_delete']; if (is_null($action)) { continue; } $ftable_obj =& $this->_table[$ftable_name]; $rtable_obj =& $this->_table[$table_name]; $fkey = $ref['fkey']; $rkey = $ref['rkey']; // Select rows to be deleted, if not done previously if ($delete_rows === null) { if ($this->backend == 'mdb2') { $fetchmode_assoc = MDB2_FETCHMODE_ASSOC; } else { $fetchmode_assoc = DB_FETCHMODE_ASSOC; } $sql = array('select' => '*', 'from' => $table_name, 'where' => $where, 'fetchmode' => $fetchmode_assoc); $delete_rows = $this->select($sql); if (PEAR::isError($delete_rows)) { return $delete_rows; } } // If set null or set default, construct update $fdata // $fdata contains data for updating referencing rows if ($action == 'set null' or $action == 'set default') { if (is_string($fkey)) { if ($action == 'set default') { $value = isset($ftable_obj->col[$fkey]['default']) ? $ftable_obj->col[$fkey]['default'] : null; } else { $value = null; } $fdata = array($fkey => $value); } else { $fdata = array(); foreach ($fkey as $fcol) { if ($action == 'set default') { $value = isset($ftable_obj->col[$fcol]['default']) ? $ftable_obj->col[$fcol]['default'] : null; } else { $value = null; } $fdata[$fcol] = $value; } } } // Loop over rows to be deleted from $table_name foreach ($delete_rows as $delete_row) { // If necessary, restore case of $delete_row column names if ($this->fix_case) { $cols = array_keys($table_obj->col); $delete_row = $this->_replaceKeys($delete_row, $cols); } // Construct filter for referencing rows in $ftable_name $filter = $this->_buildFKeyFilter($delete_row, $rkey, $fkey); // Apply action for one deleted row if ($action == 'restrict') { // Select for referencing rows throw error if found $sql = array('select'=>'*', 'from' => $ftable_name, 'where' => $filter); $frows = $this->select($sql); if (PEAR::isError($frows)) { return $frows; } if (count($frows) > 0) { return $this->throwError( DB_TABLE_DATABASE_ERR_RESTRICT_DELETE, $table_name); } } elseif ($action == 'cascade') { // Delete referencing rows // Note: Recursion on delete $result = $this->delete($ftable_name, $filter); if (PEAR::isError($result)) { return $result; } } elseif ($action == 'set null' OR $action == 'set default') { // Update referencing rows, using $fdata // Note: Turn off foreign key validity check during // update of referencing key to null or default, then // restore $this->_check_fkey to original value $check_fkey = $this->_check_fkey; $this->_check_fkey = false; $result = $this->update($ftable_name, $fdata, $filter); $this->_check_fkey = $check_fkey; #$result = $ftable_obj->update($fdata, $filter); if (PEAR::isError($result)) { return $result; } } else { // Invalid $action name, throw Error return $this->throwError( DB_TABLE_DATABASE_ERR_ON_DELETE_ACTION, "$ftable_name => $table_name"); } } // end foreach ($delete_rows) } // end foreach ($this->_ref_to[...] as $ftable_name) } // end if } /** * Returns array in which keys of $data are replaced by values of $keys. * * This function is used by the insert() and update() methods to restore * the case of column names in associative arrays that are returned from * an automatically generated query "SELECT * FROM $table WHERE ...", when * these column name keys are returned with a fixed case. In this usage, * $keys is a sequential array of the names of all columns in $table. * * @param array $data associative array * @param array $key numerical array of replacement key names * @return array associative array in which keys of $data have been replaced * by the values of array $keys. * @access private */ function _replaceKeys($data, $keys) { $new_data = array(); $i = 0; foreach ($data as $old_key => $value) { $new_key = $keys[$i]; $new_data[$new_key] = $value; $i = $i + 1; } return $new_data; } /** * Builds a select command involving joined tables from * a list of column names and/or a list of table names. * * Returns an query array of the form used in $this->buildSQL, * constructed on the basis of a sequential array $cols of * column names and/or a sequential array $tables of table * names. The 'FROM' clause in the resulting SQL contains * all the table listed in the $tables parameter and all * those containing the columns listed in the $cols array, * as well as any linking tables required to establish * many to many relationships between these tables. The * 'WHERE' clause is constructed so as to create an inner * join of these tables. * * The $cols parameter is a sequential array in which the * values are column names. Column names may be qualified * by a table name, using the SQL table.column syntax, but * need not be qualified if they are unambiguous. The * values in $cols can only be column names, and may not * be functions or more complicated SQL expressions. If * cols is null, the resulting SQL command will start with * 'SELECT * FROM ...' . * * The $tables parameter is a sequential array in which the * values are table names. If $tables is null, the FROM * clause is constructed from the tables containing the * columns in the $cols. * * The $params array is an associative array can have * 'filter', and 'order' keys, which are both optional. * A value $params['filter'] is an condition string to * add (i.e., AND) to the automatically constructed set * of join conditions. A value $params['order'] is an * SQL 'ORDER BY' clause, with no 'ORDER BY' prefix. * * The function returns an associative array with keys * ('select', 'from', 'where', ['order']), for which the * associated values are strings containing the SELECT, * FROM, WHERE and (optionally) ORDER BY clauses of the * select statement. The entire SELECT command string * can be obtained by passing the resulting array to * the buildSQL method. * * @param array $cols sequential array of column names * @param array $tables sequential array of table names * @param array $filter SQL logical expression to be added * (ANDed) to the where clause * @return array sql query array for select statement * @access public */ function autoJoin($cols = null, $tables = null, $filter = null) { // initialize array containing clauses of select statement $query = array(); if (is_null($tables)) { if (is_null($cols)) { return $this->throwError( DB_TABLE_DATABASE_ERR_NO_COL_NO_TBL); } $tables = array(); } if (!$cols) { // If no columns specified, SELECT * FROM ... $query['select'] = '*'; } else { // Qualify unqualified columns with table names $all_tables = $tables; foreach ($cols as $key => $col) { $col_array = $this->validCol($col, $tables); if (PEAR::isError($col_array)) { return $col_array; } $table = $col_array[0]; $column = $col_array[1]; if (is_array($table)) { return $this->throwError( DB_TABLE_DATABASE_ERR_COL_NOT_UNIQUE, $col); } $cols[$key] = "$table.$column"; if (!in_array($table, $all_tables)) { $all_tables[] = $table; } } $tables = $all_tables; // Construct select clause $query['select'] = implode(', ', $cols); } // Construct array $joins of join conditions $n_tables = count($tables); if ($n_tables == 1) { $query['from'] = $tables[0]; } else { $join_tables = array($tables[0]); // list of joined tables $link_tables = array(); // list of required linking tables $joins = array(); // list of join conditions // Initialize linked list of unjoined tables $next = array(); for ( $i=1 ; $i < $n_tables-1 ; $i++) { $next[$tables[$i]] = $tables[$i+1]; $prev[$tables[$i+1]] = $tables[$i]; } $next[$tables[$n_tables-1]] = $tables[1]; $prev[$tables[1]] = $tables[$n_tables-1]; $n_remain = $n_tables - 1; $head = $tables[1]; $table1 = $tables[1]; $joined = false; $direct = true; while ($n_remain > 0) { if ($direct) { // Search for references from table1 to joined tables if (isset($this->_ref[$table1])) { $list = $this->_ref[$table1]; foreach ($list as $table2 => $def) { if (in_array($table2, $join_tables)) { if ($joined) { return $this->throwError( DB_TABLE_DATABASE_ERR_AMBIG_JOIN, $table1); } $fkey = $def['fkey']; $rkey = $def['rkey']; if (is_string($fkey)) { $joins[] = "$table1.$fkey = $table2.$rkey"; } else { for ($i=0; $i < count($fkey); $i++ ) { $fcol = $fkey[$i]; $rcol = $rkey[$i]; $joins[] = "$table1.$fcol = $table2.$rcol"; } } $joined = true; } } } // Search for references to table1 from joined tables if (isset($this->_ref_to[$table1])) { $list = $this->_ref_to[$table1]; foreach ($list as $table2) { if (in_array($table2, $join_tables)) { if ($joined) { return $this->throwError( DB_TABLE_DATABASE_ERR_AMBIG_JOIN, $table1); } $def = $this->_ref[$table2][$table1]; $fkey = $def['fkey']; $rkey = $def['rkey']; if (is_string($fkey)) { $joins[] = "$table2.$fkey = $table1.$rkey"; } else { for ($i=0; $i < count($fkey); $i++ ) { $fcol = $fkey[$i]; $rcol = $rkey[$i]; $joins[] = "$table2.$fcol = $table1.$rcol"; } } $joined = true; } } } } else { // Search for indirect linking table to table1 if (isset($this->_link[$table1])) { foreach ($this->_link[$table1] as $table2 => $links) { if (in_array($table2, $join_tables)) { $n_link = count($links); if ($n_link > 1) { return $this->throwError( DB_TABLE_DATABASE_ERR_AMBIG_JOIN, $table1); } if ($joined and $n_link > 0) { return $this->throwError( DB_TABLE_DATABASE_ERR_AMBIG_JOIN, $table1); } $link = $links[0]; $def1 = $this->_ref[$link][$table1]; $fkey1 = $def1['fkey']; $rkey1 = $def1['rkey']; if (is_string($fkey1)) { $joins[] = "$link.$fkey1 = $table1.$rkey1"; } else { for ($i=0; $i < count($fkey1); $i++ ) { $fcol1 = $fkey1[$i]; $rcol1 = $rkey1[$i]; $joins[] = "$link.$fcol1 = $table1.$rcol1"; } } $def2 = $this->_ref[$link][$table2]; $fkey2 = $def2['fkey']; $rkey2 = $def2['rkey']; if (is_string($fkey2)) { $joins[] = "$link.$fkey2 = $table2.$rkey2"; } else { for ($i=0; $i < count($fkey2); $i++ ) { $fcol2 = $fkey2[$i]; $rcol2 = $rkey2[$i]; $joins[] = "$link.$fcol2 = $table2.$rcol2"; } } $link_tables[] = $link; $joined = true; } } } } if ($joined) { $join_tables[] = $table1; $n_remain = $n_remain - 1; if ($n_remain > 0) { $head = $next[$table1]; $tail = $prev[$table1]; $prev[$head] = $tail; $next[$tail] = $head; $table1 = $head; $joined = false; $direct = true; } } else { $table1 = $next[$table1]; if ($table1 == $head) { if ($direct) { $direct = false; } else { return $this->throwError( DB_TABLE_DATABASE_ERR_FAIL_JOIN,$table1); } } } } // Add any required linking tables to $tables array if ($link_tables) { foreach ($link_tables as $link) { if (!in_array($link, $tables)) { $tables[] = $link; } } } // Construct from clause from $tables array $query['from'] = implode(', ', $tables); // Construct where clause from $joins array $query['where'] = implode("\n AND ", $joins); } // Add $filter condition, if present if ($filter) { if (isset($query['where'])) { $query['where'] = '( ' . $query['where'] . " )\n" . ' AND ( ' . $filter . ')'; } else { $query['where'] = $filter; } } return $query; } /** * Returns WHERE clause equating values of $data array to database column * values * * Usage: In the simplest usage of this method, which is obtained when * both $data_key and $filt_key are null or absent, the method returns an * SQL logical expression that equates the values of $data to the values * of database columns whose names are given by the keys of $data. In * the general case, function is designed to return an SQL logical * expression that equates the values of a set of foreign key columns in * associative array $data, which is a row to be inserted or updated in * one table, to the values of the corresponding columns of a referenced * table. In this usage, $data_key is the foreign key (a column name or * numerical array of column names), and $filt_key is the corresponding * referenced key. * * Parameters: Parameter $data is an associative array containing data to * be inserted into or used to update one row of a database table, in which * array keys are column names. When present, $data_key contains either * the name of a single array key of interest, or a numerical array of such * keys. These are usually the names of the columns of a foreign key in * that table. When, $data_key is null or absent, it is taken to be equal * to an array containing all of the keys of $data. When present, $filt_key * contains either a string or a numerical array of strings that are * aliases for the keys in $data_key. These are usually the names of the * corresponding columns in the referenced table. When $filt_key is null * or absent, it is equated with $data_key internally. The function * returns an SQL logical expression that equates the values in $data * whose keys are specified by $data_key, to the values of database * columns whose names are specified in $filt_key. * * Simple case: If parameters $data_key and $filt_key are null, and * * $data = array( 'c1' => $v1, 'c2' => $v2, 'c3' => $v3) * * then buildFilter($data) returns a string * * "c1 => $val1 AND c2 => $val2 AND c3 = $v3" * * in which the values $v1, $v2, $v3 are replaced by SQL literal values, * quoted and escaped as appropriate for each data type and the backend * RDBMS. * * General case: Buildfilter returns a SQL logical exprssion that equates * the values of $data whose keys are given in $data_key with the values * values of database columns with names given in $filt_key. For example, * if * * $data = array( 'k1' => $v1, 'k2' => $v2, ... , 'k10' => $v10 ); * $data_key = array('k2', 'k5', 'k7'); * $filt_key = array('c2', 'c5', 'c7'); * * then buildFilter($data, $data_key, $filt_key) returns a string * * "c2 = $v2 AND c5 = $v5 AND c7 = $v7" * * in which the values $v2, $v5, $v7 are replaced by properly quoted * SQL literal values. If, in the above example, $data_key = 'k5' and * $filt_key = 'c5', then the function will return * * "c5 = $v5" * * where (again) $v5 is replaced by an SQL literal. * * Quoting is done by the DB_Table_Database::quote() method, based on * the php type of the values in $array. The treatment of null values * in $data depends upon the value of the $match parameter. * * Null values: The treatment to null values in $data depends upon * the value of the $match parameter . If $match == 'simple', an empty * string is returned if any $value of $data with a key in $data_key * is null. If $match == 'partial', the returned SQL expression * equates only the relevant non-null values of $data to the values of * corresponding database columns. If $match == 'full', the function * returns an empty string if all of the relevant values of data are * null, and returns a PEAR_Error if some of the selected values are * null and others are not null. * * @param array $data associative array, keys are column names * @param mixed $data_key string or numerical array of strings, in which * values are a set of keys of interest in $data * @param mixed $data_key string or numerical array of strings, in which * values are names of a corresponding set of * database column names. * @return string SQL expression equating values in $data, for which keys * also appear in $data_key, to values of corresponding * database columns named in $filt_key. * @access private */ function _buildFKeyFilter($data, $data_key = null, $filt_key = null, $match = 'simple') { // Check $match type value if (!in_array($match, array('simple', 'partial', 'full'))) { return $this->throwError( DB_TABLE_DATABASE_ERR_MATCH_TYPE); } // Simple case: Build filter from $data array alone if (is_null($data_key) && is_null($filt_key)) { return $this->buildFilter($data, $match); } // Defaults for $data_key and $filt_key: if (is_null($data_key)) { $data_key = array_keys($data); } if (is_null($filt_key)) { $filt_key = $data_key; } // General case: $data_key and/or $filt_key not null if (is_string($data_key)) { if (!is_string($filt_key)) { return $this->throwError( DB_TABLE_DATABASE_ERR_FILT_KEY); } if (array_key_exists($data_key, $data)) { $value = $data[$data_key]; if (!is_null($value)) { $value = (string) $this->quote($data[$data_key]); return "$filt_key = $value"; } else { return ''; } } else { return ''; } } elseif (is_array($data_key)) { if (!is_array($filt_key)) { return $this->throwError( DB_TABLE_DATABASE_ERR_FILT_KEY); } $filter = array(); for ($i=0; $i < count($data_key); $i++) { $data_col = $data_key[$i]; $filt_col = $filt_key[$i]; if (array_key_exists($data_col, $data)) { $value = $data[$data_col]; if (!is_null($value)) { if ($match == 'full' && isset($found_null)) { return $this->throwError( DB_TABLE_DATABASE_ERR_FULL_KEY); } $value = $this->quote($value); $filter[] = "$filt_col = $value"; } else { $found_null = true; } } } if ($match == 'simple' && isset($found_null)) { return ''; } if (count($filter) == 0) { return ''; } return implode(' AND ', $filter); } else { // Invalid data key return $this->throwError( DB_TABLE_DATABASE_ERR_DATA_KEY); } } /** * Returns SQL literal string representation of a php value * * If $value is: * - a string, return the string enquoted and escaped * - a number, return cast of number to string, without quotes * - a boolean, return '1' for true and '0' for false * - null, return the string 'NULL' * * @param mixed $value * @return string representation of value as an SQL literal * * @see DB_Common::quoteSmart() * @see MDB2::quote() * @access public */ function quote($value) { if (is_bool($value)) { return $value ? '1' : '0'; } if ($this->backend == 'mdb2') { $value = $this->db->quote($value); } else { $value = $this->db->quoteSmart($value); } return (string) $value; } /** * Serializes all table references and sets $db = null, $backend = null * * @return array names of all properties * @access public */ function __sleep() { $this->db = null; $this->backend = null; // needed in setDatabaseInstance, where null is passed by reference $null_variable = null; foreach ($this->_table as $name => $table_obj) { $table_obj->db = null; $table_obj->setDatabaseInstance($null_variable); $this->_table[$name] = serialize($table_obj); } return array_keys(get_object_vars($this)); } /** * Unserializes child DB_Table objects * * Immediately after unserialization, a DB_Table_Databse object * has null $db and $backend properties, and each of its child * DB_Table objects has null $db and $backend properties. The * DB_Table_Database::setDB method should be called immediately * after unserialization to re-establish the database connection, * like so: * * $db_object = unserialize($serialized_db); * $db_object->setDB($conn); * * where $conn is a DB/MDB2 object. This establishes a DB/MDB2 * connection for both the parent database and all child tables. * * @return void * @access public */ function __wakeup() { foreach ($this->_table as $name => $table_string) { // Check for subclass definition, and autoload if necessary. $subclass = $this->_table_subclass[$name]; if (!is_null($subclass)) { if (!class_exists($subclass)) { $dir = $this->_table_subclass_path; require_once $dir . '/' . $subclass . '.php'; } } // Unserialize table $table_obj = unserialize($table_string); // Reset references between database and table objects $table_obj->setDatabaseInstance($this); $this->_table[$name] = $table_obj; } } /** * Returns XML string representation of database declaration * * @param string $indent string of whitespace, prefix to each line * @return string XML string representation * @access public */ function toXML($indent = '') { require_once 'DB/Table/XML.php'; $s = array(); $s[] = DB_Table_XML::openTag('database', $indent); foreach ($this->_table as $name => $table_obj) { $s[] = $table_obj->toXML($indent); } $s[] = DB_Table_XML::closeTag('database', $indent); return implode("\n", $s); } /** * Returns a DB_Table_Database object constructed from an XML string * * Uses the MDB2 XML schema for a database element, including a new * syntax for foreign key indices. * * NOTE: This function requires PHP 5. It throws an error if used * with PHP 4. * * @param string XML string representation * @return object DB_Table_Database object on success, or error on failure * @access public */ function fromXML($xml_string, $conn) { // Check PHP version. Throw error if not >= PHP 5.0.0 $version = phpversion(); if (version_compare($version, '5.0.0', "<")) { return $this->throwError( DB_TABLE_DATABASE_ERR_PHP_VERSION, $version); } $xml = simplexml_load_string($xml_string); if ($xml == false) { return $this->throwError( DB_TABLE_DATABASE_ERR_XML_PARSE); } // Instantiate database object $database_name = (string) $xml->name; $database_obj = new DB_Table_Database($conn, $database_name); // Create array of foreign key references $ref = array(); // Loop over tables foreach ($xml->table as $table) { $table_name = (string) $table->name; // Instantiate table object $table_obj = new DB_Table($conn, $table_name); // Add columns to table object $declaration = $table->declaration; foreach ($declaration->field as $field) { $col_name = (string) $field->name; $type = (string) $field->type; $def = array('type' => $type); if (isset($field->length)) { $def['size'] = (integer) $field->length; } if (isset($field->notnull)) { if ($field->notnull) { $def['require'] = true; } else { $def['require'] = false; } } if (isset($field->default)) { $def['default'] = $field->default; } if (isset($field->autoincrement)) { if (is_null($table_obj->auto_inc_col)) { $table_obj->auto_inc_col = $col_name; } else { return $this->throwError( DB_TABLE_DATABASE_ERR_XML_MULT_AUTO_INC); } } $table_obj->col[$col_name] = $def; } // Add indices foreach ($declaration->index as $index) { if (isset($index->name)) { $name = (string) $index->name; } else { $name = null; } $def = array(); if (isset($index->primary)) { $def['type'] = 'primary'; } elseif (isset($index->unique)) { $def['type'] = 'unique'; } else { $def['type'] = 'normal'; } foreach ($index->field as $field) { $def['cols'][] = (string) $field; } if ($name) { $table_obj->idx[$name] = $def; } else { $table_obj->idx[] = $def; } } // Add table object to database object $database_obj->addTable($table_obj); // Foreign key references foreach ($declaration->foreign as $foreign) { if (isset($foreign->name)) { $name = (string) $foreign->name; } else { $name = null; } $fkey = array(); foreach ($foreign->field as $field) { $fkey[] = (string) $field; } if (count($fkey) == 1) { $fkey = $fkey[0]; } $rtable = (string) $foreign->references->table; if (isset($foreign->references->field)) { $rkey = array(); foreach ($foreign->references->field as $field) { $rkey[] = (string) $field; } if (count($rkey)==1) { $rkey = $rkey[0]; } } else { $rkey = null; } if (isset($foreign->ondelete)) { $on_delete = (string) $foreign->ondelete; } else { $on_delete = null; } if (isset($foreign->onupdate)) { $on_update = (string) $foreign->onupdate; } else { $on_update = null; } // Add reference definition to $ref array $def = array(); $def['fkey'] = $fkey; $def['rkey'] = $rkey; $def['on_delete'] = $on_delete; $def['on_update'] = $on_update; if (!isset($ref[$table_name])) { $ref[$table_name] = array(); } $ref[$table_name][$rtable] = $def; } // Release variable $table_obj to refer to another table unset($table_obj); } // Add all references to database object foreach ($ref as $ftable => $list) { foreach ($list as $rtable => $def) { $fkey = $def['fkey']; $rkey = $def['rkey']; $on_delete = $def['on_delete']; $on_update = $def['on_update']; $database_obj->addRef($ftable, $fkey, $rtable, $rkey, $on_delete, $on_update); } } return $database_obj; } // }}} } // }}} /* Local variables: * tab-width: 4 * c-basic-offset: 4 * c-hanging-comment-ender-p: nil * End: */ ?> Date.php000066400000000000000000000125331262614675700340370ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package/packagefiles/DB_Table/DB/Table | // | Pierre-Alain Joye | // | | // | Stripped down to two essential methods specially for DB_Table | // | under PHP 5.1 by Paul M. Jones | // +----------------------------------------------------------------------+ // // $Id: Date.php,v 1.2 2007/03/23 10:41:13 morse Exp $ /** * Generic date handling class for DB_Table. * * @category Database * @package DB_Table * @author Baba Buehler * @access public */ class DB_Table_Date { /** * the year * @var int */ var $year; /** * the month * @var int */ var $month; /** * the day * @var int */ var $day; /** * the hour * @var int */ var $hour; /** * the minute * @var int */ var $minute; /** * the second * @var int */ var $second; /** * the parts of a second * @var float */ var $partsecond; /** * Constructor * * Creates a new DB_Table_Date Object. The date should be near to * ISO 8601 format. * * @access public * @param string $date A date in ISO 8601 format. */ function DB_Table_Date($date) { // This regex is very loose and accepts almost any butchered // format you could throw at it. e.g. 2003-10-07 19:45:15 and // 2003-10071945:15 are the same thing in the eyes of this // regex, even though the latter is not a valid ISO 8601 date. preg_match('/^(\d{4})-?(\d{2})-?(\d{2})([T\s]?(\d{2}):?(\d{2}):?(\d{2})(\.\d+)?(Z|[\+\-]\d{2}:?\d{2})?)?$/i', $date, $regs); $this->year = $regs[1]; $this->month = $regs[2]; $this->day = $regs[3]; $this->hour = isset($regs[5])?$regs[5]:0; $this->minute = isset($regs[6])?$regs[6]:0; $this->second = isset($regs[7])?$regs[7]:0; $this->partsecond = isset($regs[8])?(float)$regs[8]:(float)0; // if an offset is defined, convert time to UTC // Date currently can't set a timezone only by offset, // so it has to store it as UTC if (isset($regs[9])) { $this->toUTCbyOffset($regs[9]); } } /** * Date pretty printing, similar to strftime() * * Formats the date in the given format, much like * strftime(). Most strftime() options are supported.

* * formatting options:

* * %Y year as decimal including century (range 0000 to 9999)
* %m month as decimal number (range 01 to 12)
* %d day of month (range 00 to 31)
* %H hour as decimal number (00 to 23)
* %M minute as a decimal number (00 to 59)
* %S seconds as a decimal number (00 to 59)
* %% literal '%'
*
* * @access public * @param string format the format string for returned date/time * @return string date/time in given format */ function format($format) { $output = ""; for($strpos = 0; $strpos < strlen($format); $strpos++) { $char = substr($format,$strpos,1); if ($char == "%") { $nextchar = substr($format,$strpos + 1,1); switch ($nextchar) { case "Y": $output .= $this->year; break; case "m": $output .= sprintf("%02d",$this->month); break; case "d": $output .= sprintf("%02d",$this->day); break; case "H": $output .= sprintf("%02d", $this->hour); break; case "M": $output .= sprintf("%02d",$this->minute); break; case "S": $output .= sprintf("%02d", $this->second); break; default: $output .= $char.$nextchar; } $strpos++; } else { $output .= $char; } } return $output; } } ?> Generator.php000066400000000000000000001113001262614675700351000ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package/packagefiles/DB_Table/DB/Table * @license http://www.gnu.org/copyleft/lesser.html LGPL * @version $Id: Generator.php,v 1.10 2007/04/03 03:27:22 morse Exp $ */ // {{{ Includes /** * The PEAR class (used for errors) */ require_once 'PEAR.php'; /** * DB_Table table abstraction class */ require_once 'DB/Table.php'; /** * DB_Table_Manager class (used to reverse engineer indices) */ require_once 'DB/Table/Manager.php'; // }}} // {{{ Error code constants /** * Parameter is not a DB/MDB2 object */ define('DB_TABLE_GENERATOR_ERR_DB_OBJECT', -301); /** * Parameter is not a DB/MDB2 object */ define('DB_TABLE_GENERATOR_ERR_INDEX_COL', -302); // }}} // {{{ Error messages /** * US-English default error messages. */ $GLOBALS['_DB_TABLE_GENERATOR']['default_error'] = array( DB_TABLE_GENERATOR_ERR_DB_OBJECT => 'Invalid DB/MDB2 object parameter. Function', DB_TABLE_GENERATOR_ERR_INDEX_COL => 'Index column is not a valid column name. Index column' ); // merge default and user-defined error messages if (!isset($GLOBALS['_DB_TABLE_GENERATOR']['error'])) { $GLOBALS['_DB_TABLE_GENERATOR']['error'] = array(); } foreach ($GLOBALS['_DB_TABLE_GENERATOR']['default_error'] as $code => $message) { if (!array_key_exists($code, $GLOBALS['_DB_TABLE_GENERATOR']['error'])) { $GLOBALS['_DB_TABLE_GENERATOR']['error'][$code] = $message; } } // }}} // {{{ class DB_Table_Generator /** * class DB_Table_Generator - Generates DB_Table subclass skeleton code * * This class generates the php code necessary to use the DB_Table * package to interact with an existing database. This requires the * generation of a skeleton subclass definition be generated for each * table in the database, in which the $col, $idx, and $auto_inc_col * properties are constructed using a table schema that is obtained * by querying the database. * * The class can also generate a file, named 'Database.php' by default, * that includes (require_once) each of the table subclass definitions, * instantiates one object of each DB_Table subclass (i.e., one object * for each table), instantiates a parent DB_Table_Database object, * adds all the tables to that parent, attempts to guess foreign key * relationships between tables based on the column names, and adds * the inferred references to the parent object. * * All of the code is written to a directory whose path is given by * the property $class_write_path. By default, this is the current * directory. By default, the name of the class constructed for a * table named 'thing' is "Thing_Table". That is, the class name is * the table name, with the first letter upper case, with a suffix * '_Table'. This suffix can be changed by setting the $class_suffix * property. The file containing a subclass definition is the * subclass name with a php extension, e.g., 'Thing_Table.php'. The * object instantiated from that subclass is the same as the table * name, with no suffix, e.g., 'thing'. * * To generate the code for all of the tables in a database named * $database, instantiate a MDB2 or DB object named $db that connects * to the database of interest, and execute the following code: * * $generator = DB_Table_Generator($db, $database); * $generator->class_write_path = $class_write_path; * $generator->generateTableClassFiles(); * $generator->generateDatabaseFile(); * * Here $class_write_path should be the path (without a trailing * separator) to a directory in which all of the code should be * written. If this directory does not exist, it will be created. * If the directory does already exist, exising files will not * be overwritten. If $class_write_path is not set (i.e., if this * line is omitted) all the code will be written to the current * directory. If ->generateDatabaseFile() is called, it must be * called after ->generateTableClassFiles(). * * By default, ->generateTableClassFiles() and ->generateDatabaseFiles() * generate code for all of the tables in the current database. To * generate code for a specified list of tables, set the value of the * public $tables property to a sequential list of table names before * calling either of these methods. Code can be generated for three * tables named 'table1', 'table2', and 'table3' as follows: * * $generator = DB_Table_Generator($db, $database); * $generator->class_write_path = $class_write_path; * $generator->tables = array('table1', 'table2', 'table3'); * $generator->generateTableClassFiles(); * $generator->generateDatabaseFile(); * * If the $tables property is not set to a non-null value prior * to calling ->generateTableClassFiles() then, by default, the * database is queried for a list of all table names, by calling the * ->getTableNames() method from within ->generateTableClassFiles(). * * PHP version 4 and 5 * * @category Database * @package DB_Table * @author David C. Morse * @license http://www.gnu.org/copyleft/lesser.html LGPL * @version $Id: Generator.php,v 1.10 2007/04/03 03:27:22 morse Exp $ */ class DB_Table_Generator { // {{{ properties /** * Name of the database * * @var string * @access public */ var $name = null; /** * The PEAR DB/MDB2 object that connects to the database. * * @var object * @access private */ var $db = null; /** * The backend type. May have values 'db' or 'mdb2' * * @var string * @access private */ var $backend = null; /** * If there is an error on instantiation, this captures that error. * * This property is used only for errors encountered in the constructor * at instantiation time. To check if there was an instantiation error... * * * $obj =& new DB_Table_Generator(); * if ($obj->error) { * // ... error handling code here ... * } * * * @var object PEAR_Error * @access public */ var $error = null; /** * Numerical array of table name strings * * @var array * @access public */ var $tables = array(); /** * Class being extended (DB_Table or generic subclass) * * @var string * @access public */ var $extends = 'DB_Table'; /** * Path to definition of the class $this->extends * * @var string * @access public */ var $extends_file = 'DB/Table.php'; /** * Suffix to add to table names to obtain corresponding class names * * @var string * @access public */ var $class_suffix = "_Table"; /** * Path to directory in which subclass definitions should be written * * Value should not include a trailing "/". * * @var string * @access public */ var $class_write_path = ''; /** * Include path to subclass definition files from database file * * Used to create require_once statements in the Database.php file, * which is in the same directory as the class definition files. Leave * as empty string if your PHP include_path contains ".". The value * should not include a trailing "/", which is added automatically * to values other than the empty string. * * @var string * @access public */ var $class_include_path = ''; /** * Array of column definitions * * Array $this->col[table_name][column_name] = column definition. * Column definition is an array with the same format as the $col * property of a DB_Table object * * @var array * @access public */ var $col = array(); /** * Array of index/constraint definitions. * * Array $this->idx[table_table][index_name] = Index definition. * The index definition is an array with the same format as the * DB_Table $idx property property array. * * @var array * @access public */ var $idx = array(); /** * Array of auto_increment column names * * Array $this->auto_inc_col[table_name] = auto-increment column * * @var array * @access public */ var $auto_inc_col = array(); /** * Array of primary keys * * @var array * @access public */ var $primary_key = array(); /** * MDB2 'idxname_format' option, format of index names * * For use in printf() formatting. Use '%s' to use index names as * returned by getTableConstraints/Indexes, and '%s_idx' to add an * '_idx' suffix. For MySQL, use the default value '%'. */ var $idxname_format = '%s'; // }}} // {{{ function DB_Table_Generator(&$db, $name) /** * Constructor * * If an error is encountered during instantiation, the error * message is stored in the $this->error property of the resulting * object. See $error property docblock for a discussion of error * handling. * * @param object $db DB/MDB2 database connection object * @param string $name database name string * @return object DB_Table_Generator * @access public */ function DB_Table_Generator(&$db, $name) { // Is $db an DB/MDB2 object or null? if (is_a($db, 'db_common')) { $this->backend = 'db'; } elseif (is_a($db, 'mdb2_driver_common')) { $this->backend = 'mdb2'; } else { $this->error =& DB_Table_Generator::throwError( DB_TABLE_GENERATOR_ERR_DB_OBJECT, "DB_Table_Generator"); return; } $this->db =& $db; $this->name = $name; } // }}} // {{{ function &throwError($code, $extra = null) /** * Specialized version of throwError() modeled on PEAR_Error. * * Throws a PEAR_Error with a DB_Table_Generator error message based * on a DB_Table_Generator constant error code. * * @param string $code A DB_Table_Generator error code constant. * @param string $extra Extra text for the error (in addition to the * regular error message). * @return object PEAR_Error * @access public * @static */ function &throwError($code, $extra = null) { // get the error message text based on the error code $text = 'DB_TABLE_GENERATOR ERROR - ' . "\n" . $GLOBALS['_DB_TABLE_GENERATOR']['error'][$code]; // add any additional error text if ($extra) { $text .= ' ' . $extra; } // done! $error = PEAR::throwError($text, $code); return $error; } // }}} // {{{ function setErrorMessage($code, $message = null) /** * Overwrites one or more error messages, e.g., to internationalize them. * * @param mixed $code If string, the error message with code $code will be * overwritten by $message. If array, each key is a code * and each value is a new message. * * @param string $message Only used if $key is not an array. * @return void * @access public */ function setErrorMessage($code, $message = null) { if (is_array($code)) { foreach ($code as $single_code => $single_message) { $GLOBALS['_DB_TABLE_GENERATOR']['error'][$single_code] = $single_message; } } else { $GLOBALS['_DB_TABLE_GENERATOR']['error'][$code] = $message; } } // }}} // {{{ function getTableNames() /** * Gets a list of tables from the database * * Upon successful completion, names are stored in the $this->tables * array. If an error is encountered, a PEAR Error is returned, and * $this->tables is reset to null. * * @access public * @return mixed true on success, PEAR Error on failure */ function getTableNames() { if ($this->backend == 'db') { // try getting a list of schema tables first. (postgres) $this->db->expectError(DB_ERROR_UNSUPPORTED); $this->tables = $this->db->getListOf('schema.tables'); $this->db->popExpect(); if (PEAR::isError($this->tables)) { // try a list of tables, not qualified by 'schema' $this->db->expectError(DB_ERROR_UNSUPPORTED); $this->tables = $this->db->getListOf('tables'); $this->db->popExpect(); } } else { $this->db->setOption('portability', MDB2_PORTABILITY_ALL ^ MDB2_PORTABILITY_FIX_CASE); $this->db->loadModule('Manager'); $this->db->loadModule('Reverse'); // Get list of tables $this->tables = $this->db->manager->listTables(); } if (PEAR::isError($this->tables)) { $error = $this->tables; $this->tables = null; return $error; } else { return true; } } // }}} // {{{ function getTableDefinition($table) /** * Gets column and index definitions by querying database * * Upon return, column definitions are stored in $this->col[$table], * and index definitions in $this->idx[$table]. * * Calls DB/MDB2::tableInfo() for column definitions, and uses * the DB_Table_Manager class to obtain index definitions. * * @param $table string name of table * @return void * @access public */ function getTableDefinition($table) { #// postgres strip the schema bit from the #if (!empty($options['generator_strip_schema'])) { # $bits = explode('.', $table,2); # $table = $bits[0]; # if (count($bits) > 1) { # $table = $bits[1]; # } #} $db =& $this->db; if ($this->backend == 'db') { $defs = $db->tableInfo($table); if (PEAR::isError($defs)) { return $defs; } $this->columns[$table] = $defs; } else { // Columns $defs = $db->reverse->tableInfo($table); if (PEAR::isError($defs)) { return $defs; } // rename the 'length' key, so it matches db's return. foreach ($defs as $k => $v) { if (isset($defs[$k]['length'])) { $defs[$k]['len'] = $defs[$k]['length']; } } $this->columns[$table] = $defs; // Temporarily set 'idxname_format' MDB2 option to $this->idx_format $idxname_format = $db->getOption('idxname_format'); $db->setOption('idxname_format', $this->idxname_format); } // Default - no auto increment column $this->auto_inc_col[$table] = null; // Loop over columns to create $this->col[$table] $this->col[$table] = array(); foreach($defs as $t) { $name = $t['name']; $col = array(); switch (strtoupper($t['type'])) { case 'INT2': // postgres case 'TINYINT': case 'TINY': //mysql case 'SMALLINT': $col['type'] = 'smallint'; break; case 'INT4': // postgres case 'SERIAL4': // postgres case 'INT': case 'SHORT': // mysql case 'INTEGER': case 'MEDIUMINT': case 'YEAR': $col['type'] = 'integer'; break; case 'BIGINT': case 'LONG': // mysql case 'INT8': // postgres case 'SERIAL8': // postgres $col['type'] = 'bigint'; break; case 'REAL': case 'NUMERIC': case 'NUMBER': // oci8 case 'FLOAT': // mysql case 'FLOAT4': // real (postgres) $col['type'] = 'single'; break; case 'DOUBLE': case 'DOUBLE PRECISION': // double precision (firebird) case 'FLOAT8': // double precision (postgres) $col['type'] = 'double'; break; case 'DECIMAL': case 'MONEY': // mssql and maybe others $col['type'] = 'decimal'; break; case 'BIT': case 'BOOL': case 'BOOLEAN': $col['type'] = 'boolean'; break; case 'STRING': case 'CHAR': $col['type'] = 'char'; break; case 'VARCHAR': case 'VARCHAR2': case 'TINYTEXT': $col['type'] = 'varchar'; break; case 'TEXT': case 'MEDIUMTEXT': case 'LONGTEXT': $col['type'] = 'clob'; break; case 'DATE': $col['type'] = 'date'; break; case 'TIME': $col['type'] = 'time'; break; case 'DATETIME': // mysql case 'TIMESTAMP': $col['type'] = 'timestamp'; break; case 'ENUM': case 'SET': // not really but oh well case 'TIMESTAMPTZ': // postgres case 'BPCHAR': // postgres case 'INTERVAL': // postgres (eg. '12 days') case 'CIDR': // postgres IP net spec case 'INET': // postgres IP case 'MACADDR': // postgress network Mac address. case 'INTEGER[]': // postgres type case 'BOOLEAN[]': // postgres type $col['type'] = 'varchar'; break; default: $col['type'] = $t['type'] . ' (Unknown type)'; break; } // Set length and scope if required if (in_array($col['type'], array('char','varchar','decimal'))) { if (isset($t['len'])) { $col['size'] = (int) $t['len']; } elseif ($col['type'] == 'varchar') { $col['size'] = 255; // default length } elseif ($col['type'] == 'char') { $col['size'] = 128; // default length } elseif ($col['type'] == 'decimal') { $col['size'] = 15; // default length } if ($col['type'] == 'decimal') { $col['scope'] = 2; } } if (isset($t['notnull'])) { if ($t['notnull']) { $col['required'] = true; } } if (isset($t['autoincrement'])) { $this->auto_inc_col[$table] = $name; } if (isset($t['flags'])){ $flags = $t['flags']; if (preg_match('/not[ _]null/i',$flags)) { $col['required'] = true; } if (preg_match("/(auto_increment|nextval\()/i", $flags)) { $this->auto_inc_col[$table] = $name; } } $required = isset($col['required']) ? $col['required'] : false; if ($required) { if (isset($t['default'])) { $default = $t['default']; $type = $col['type']; if (in_array($type, array('smallint', 'integer', 'bigint'))) { $default = (int) $default; } elseif (in_array($type, array('single', 'double'))) { $default = (float) $default; } elseif ($type == 'boolean') { $default = (int) $default ? 1 : 0; } $col['default'] = $default; } } $this->col[$table][$name] = $col; } // Make array with lower case column array names as keys $col_lc = array(); foreach ($this->col[$table] as $name => $def) { $name_lc = strtolower($name); $col_lc[$name_lc] = $name; } // Constraints/Indexes $DB_indexes = DB_Table_Manager::getIndexes($db, $table); if (PEAR::isError($DB_indexes)) { return $DB_indexes; } // Check that index columns correspond to valid column names. // Try to correct problems with capitalization, if necessary. foreach ($DB_indexes as $type => $indexes) { foreach ($indexes as $name => $fields) { foreach ($fields as $key => $field) { // If index column is not a valid column name if (!array_key_exists($field, $this->col[$table])) { // Try a case-insensitive match $field_lc = strtolower($field); if (isset($col_lc[$field_lc])) { $correct = $col_lc[$field_lc]; $DB_indexes[$type][$name][$key] = $correct; } else { $return =& DB_Table_Generator::throwError( DB_TABLE_GENERATOR_ERR_INDEX_COL, "$field"); } } } } } // Generate index definitions, if any, as php code $n_idx = 0; $u = array(); $this->idx[$table] = array(); $this->primary_key[$table] = null; foreach ($DB_indexes as $type => $indexes) { if (count($indexes) > 0) { foreach ($indexes as $name => $fields) { $this->idx[$table][$name] = array(); $this->idx[$table][$name]['type'] = $type; if (count($fields) == 1) { $key = $fields[0]; } else { $key = array(); foreach ($fields as $value) { $key[] = $value; } } $this->idx[$table][$name]['cols'] = $key; if ($type == 'primary') { $this->primary_key[$table] = $key; } } } } if ($this->backend == 'mdb2') { // Restore original MDB2 idxname_format $db->setOption('idxname_format', $idxname_format); } } // }}} // {{{ function buildTableClass($table, $indent = '') /** * Returns one skeleton DB_Table subclass definition, as php code * * The returned subclass definition string contains values for the * $col (column), $idx (index) and $auto_inc_col properties, with * no method definitions. * * @param $table string name of table * @param $indent string string of whitespace for base indentation * @return string skeleton DB_Table subclass definition * @access public */ function buildTableClass($table, $indent = '') { $s = array(); $idx = array(); $s[] = $indent . 'class ' . $this->className($table) . ' extends ' . $this->extends . " {\n"; $indent = $indent . ' '; $s[] = $indent . 'var $col = array(' . "\n"; $u = array(); $indent = $indent . ' '; // Begin loop over columns foreach($this->col[$table] as $name => $col) { // Generate DB_Table column definitions as php code $v = $indent . "'" . $name . "' => array(\n"; $indent = $indent . ' '; $t = array(); foreach ($col as $key => $value) { if (is_string($value)) { $value = "'" . $value . "'"; } elseif (is_bool($value)) { $value = $value ? 'true' : 'false'; } else { $value = (string) $value; } $t[] = $indent . "'" . $key . "'" . ' => ' . $value ; } $v = $v . implode($t,",\n") . "\n"; $indent = substr($indent, 0, -4); $v = $v . $indent . ")"; $u[] = $v; } //end loop over columns $s[] = implode($u,",\n\n") . "\n"; $indent = substr($indent, 0, -4); $s[] = $indent . ");\n"; // Generate index definitions, if any, as php code if (count($this->idx[$table]) > 0) { $u = array(); $s[] = $indent . 'var $idx = array(' . "\n"; $indent = $indent . ' '; foreach ($this->idx[$table] as $name => $def) { $type = $def['type']; $cols = $def['cols']; $v = $indent . "'" . $name . "' => array(\n"; $indent = $indent . ' '; $v = $v . $indent . "'type' => '$type',\n"; if (is_array($cols)) { $v = $v . $indent . "'cols' => array(\n"; $indent = $indent . ' '; $t = array(); foreach ($cols as $value) { $t[] = $indent . "'{$value}'"; } $v = $v . implode($t,",\n") . "\n"; $indent = substr($indent, 0, -4); $v = $v . $indent . ")\n"; } else { $v = $v . $indent . "'cols' => '$cols'\n"; } $indent = substr($indent, 0, -4); $v = $v . $indent . ")"; $u[] = $v; } $s[] = implode($u,",\n\n") . "\n"; $indent = substr($indent, 0, -4); $s[] = $indent . ");\n"; } // Write auto_inc_col if (isset($this->auto_inc_col[$table])) { $s[] = $indent . 'var $auto_inc_col = ' . "'{$this->auto_inc_col[$table]}';\n"; } $indent = substr($indent, 0, -4); $s[] = $indent . '}'; // Implode and return lines of class definition return implode($s,"\n") . "\n"; } // }}} // {{{ function buildTableClasses() /** * Returns a string containing all table class definitions in one file * * The returned string contains the contents of a single php file with * definitions of DB_Table subclasses associated with all of the tables * in $this->tables. If $this->tables is initially null, method * $this->getTableNames() is called internally to generate a list of * table names. * * The returned string includes the opening and closing * script elements, and the require_once line needed to include the * $this->extend_class (i.e., DB_Table or a subclass) that is being * extended. To use, write this string to a new php file. * * Usage: * * $generator = DB_Table_Generator($db, $database); * print $generator->buildTablesClasses(); * * */ function buildTableClasses() { // If $this->tables is null, call getTableNames() if (!$this->tables) { $return = $this->getTableNames(); if (PEAR::isError($return)) { return $return; } } $s = array(); $s[] = "extends_file}';\n"; foreach($this->tables as $table) { $this->getTableDefinition($table); $s[] = $this->buildTableClass($table) . "\n"; } $s[] = '?>'; return implode($s,"\n"); } // }}} // {{{ function generateTableClassFiles() /** * Writes all table class definitions to separate files * * Usage: * * $generator = DB_Table_Generator($db, $database); * $generator->generateTableClassFiles(); * * * @return void * @access public */ function generateTableClassFiles() { // If $this->tables is null, call getTableNames() if (!$this->tables) { $return = $this->getTableNames(); if (PEAR::isError($return)) { return $return; } } // Write all table class definitions to separate files foreach($this->tables as $table) { $classname = $this->className($table); $filename = $this->classFileName($classname); $base = $this->class_write_path; if ($base) { if (!file_exists($base)) { require_once 'System.php'; System::mkdir(array('-p', $base)); } $filename = "$base/$filename"; } if (!file_exists($filename)) { $s = array(); $s[] = "extends_file}';\n"; $this->getTableDefinition($table); $s[] = $this->buildTableClass($table) ; $s[] = '?>'; $out = implode($s,"\n"); $file = fopen( $filename, "w"); fputs($file, $out); fclose($file); } } } // }}} // {{{ function generateDatabaseFile($object_name = null) /** * Writes a file to instantiate Table and Database objects * * After successful completion, a file named 'Database.php' will be * have been created in the $this->class_write_path directory. This * file should normally be included in application php scripts. It * can be renamed by the user. * * Usage: * * $generator = DB_Table_Generator($db, $database); * $generator->generateTableClassFiles(); * $generator->generateDatabaseFile(); * * * @param string variable name for DB_Table_Database object * @return void * @access public */ function generateDatabaseFile($object_name = null) { // Set name for DB_Table_Database object if ($object_name) { $object_name = '$' . $object_name; } else { $object_name = '$db'; //default } $backend = strtoupper($this->backend); // 'DB' or 'MDB2' // Create array d[] containing lines of database php file $d = array(); $d[] = "tables as $table) { $classname = $this->className($table); $class_filename = $this->classFileName($classname); if ($this->class_include_path) { $d[] = 'require_once ' . "'{$this->class_include_path}/{$class_filename}';"; } else { $d[] = "require_once '{$class_filename}';"; } } $d[] = ""; $d[] = '// NOTE: User must uncomment & edit code to create $dsn'; $d[] = '# $phptype = ' . "'mysqli';"; $d[] = '# $username = ' . "'root';"; $d[] = '# $password = ' . "'password';"; $d[] = '# $hostname = ' . "'localhost';"; $d[] = '# $dsn = "$phptype://$username:$password@$hostname";'; $d[] = ""; $d[] = '// Instantiate DB/MDB2 connection object $conn'; $d[] = '$conn =& ' . $backend . '::connect($dsn);'; $d[] = 'if (PEAR::isError($conn)) {'; $d[] = ' print "Error connecting to database server\n";'; $d[] = ' print $conn->getMessage();'; $d[] = ' die;'; $d[] = '}'; $d[] = ""; $d[] = '// Create one instance of each DB_Table subclass'; foreach ($this->tables as $table) { $classname = $this->className($table); $d[] = '$' . $table . " = new $classname(" . '$conn, ' . "'{$table}');"; } $d[] = ""; $d[] = '// Instantiate a parent DB_Table_Database object'; $d[] = $object_name . ' = new DB_Table_Database($conn, ' . "'{$this->name}');"; $d[] = ""; $d[] = '// Add DB_Table objects to parent DB_Table_Database object'; foreach ($this->tables as $table) { $classname = $this->className($table); $d[] = $object_name . '->addTable($' . $table . ');'; } $d[] = ""; // Add foreign key references: If the name of an integer column // matches "/id$/i" (i.e., the names ends with id, ID, or Id), the // remainder of the name matches the name $rtable of another table, // and $rtable has an integer primary key, then the column is // assumed to be a foreign key that references $rtable. $d[] = '// Add auto-guessed foreign references'; foreach ($this->col as $table => $col) { foreach ($col as $col_name => $def) { // Only consider integer columns $ftype = $def['type']; if (!in_array($ftype, array('integer','smallint','bigint'))) { continue; } if (preg_match("/id$/i", $col_name)) { $column_base = preg_replace('/_?id$/i', '', $col_name); foreach ($this->tables as $rtable) { if (!preg_match("/^{$rtable}$/i", $column_base)) { continue; } if (preg_match("/^{$table}$/i", $column_base)) { continue; } if (!isset($this->primary_key[$rtable])) { continue; } $rkey = $this->primary_key[$rtable]; if (is_array($rkey)) { continue; } $rtype = $this->col[$rtable][$rkey]['type']; if (!in_array($rtype, array('integer','smallint','bigint'))) { continue; } $d[] = $object_name . "->addRef('$table', '$col_name', '$rtable');"; } } } } $d[] = ""; $d[] = '// Add any additional foreign key references here'; $d[] = ""; $d[] = '// Add any linking table declarations here'; $d[] = '// Uncomment next line to add all possible linking tables;'; $d[] = '# ' . $object_name . '->addAllLinks();'; $d[] = ""; // Closing script element $d[] = "?>"; // Open and write file $base = $this->class_write_path; if ($base) { if (!file_exists($base)) { require_once 'System.php'; System::mkdir(array('-p', $base)); } $filename = $base . "/Database.php"; } else { $filename = "Database.php"; } $file = fopen($filename, "w"); $out = implode("\n", $d); fputs($file, $out); fclose($file); } // }}} // {{{ function className($table) /** * Convert a table name into a class name * * Converts all non-alphanumeric characters to '_', capitalizes * first letter, and adds $this->class_suffix to end. Override * this if you want something else. * * @param string $class_name name of table * @return string class name; * @access public */ function className($table) { $name = preg_replace('/[^A-Z0-9]/i','_',ucfirst(trim($table))); return $name . $this->class_suffix; } // }}} // {{{ function classFileName($class_name) /** * Returns the path to a file containing a class definition * * Appends '.php' to class name. * * @param string $class_name name of class * @return string file name * @access public */ function classFileName($class_name) { $filename = $class_name . ".php" ; return $filename; } // }}} } // }}} Manager.php000066400000000000000000002016741262614675700345420ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package/packagefiles/DB_Table/DB/Table * @author Mark Wiesemann * * @license http://www.gnu.org/copyleft/lesser.html LGPL * * @version $Id: Manager.php,v 1.34 2007/04/25 15:49:15 wiesemann Exp $ * */ require_once 'DB/Table.php'; /** * Valid types for the different data types in the different DBMS. */ $GLOBALS['_DB_TABLE']['valid_type'] = array( 'fbsql' => array( // currently not supported 'boolean' => '', 'char' => '', 'varchar' => '', 'smallint' => '', 'integer' => '', 'bigint' => '', 'decimal' => '', 'single' => '', 'double' => '', 'clob' => '', 'date' => '', 'time' => '', 'timestamp' => '' ), 'ibase' => array( 'boolean' => array('char', 'integer', 'real', 'smallint'), 'char' => array('char', 'varchar'), 'varchar' => 'varchar', 'smallint' => array('integer', 'smallint'), 'integer' => 'integer', 'bigint' => array('bigint', 'integer'), 'decimal' => 'numeric', 'single' => array('double precision', 'float'), 'double' => 'double precision', 'clob' => 'blob', 'date' => 'date', 'time' => 'time', 'timestamp' => 'timestamp' ), 'mssql' => array( // currently not supported 'boolean' => '', 'char' => '', 'varchar' => '', 'smallint' => '', 'integer' => '', 'bigint' => '', 'decimal' => '', 'single' => '', 'double' => '', 'clob' => '', 'date' => '', 'time' => '', 'timestamp' => '' ), 'mysql' => array( 'boolean' => array('char', 'decimal', 'int', 'real', 'tinyint'), 'char' => array('char', 'string', 'varchar'), 'varchar' => array('char', 'string', 'varchar'), 'smallint' => array('smallint', 'int'), 'integer' => 'int', 'bigint' => array('int', 'bigint'), 'decimal' => array('decimal', 'real'), 'single' => array('double', 'real'), 'double' => array('double', 'real'), 'clob' => array('blob', 'longtext'), 'date' => array('char', 'date', 'string'), 'time' => array('char', 'string', 'time'), 'timestamp' => array('char', 'datetime', 'string') ), 'mysqli' => array( 'boolean' => array('char', 'decimal', 'tinyint'), 'char' => array('char', 'varchar'), 'varchar' => array('char', 'varchar'), 'smallint' => array('smallint', 'int'), 'integer' => 'int', 'bigint' => array('int', 'bigint'), 'decimal' => 'decimal', 'single' => array('double', 'float'), 'double' => 'double', 'clob' => array('blob', 'longtext'), 'date' => array('char', 'date', 'varchar'), 'time' => array('char', 'time', 'varchar'), 'timestamp' => array('char', 'datetime', 'varchar') ), 'oci8' => array( 'boolean' => 'number', 'char' => array('char', 'varchar2'), 'varchar' => 'varchar2', 'smallint' => 'number', 'integer' => 'number', 'bigint' => 'number', 'decimal' => 'number', 'single' => array('float', 'number'), 'double' => array('float', 'number'), 'clob' => 'clob', 'date' => array('char', 'date'), 'time' => array('char', 'date'), 'timestamp' => array('char', 'date') ), 'pgsql' => array( 'boolean' => array('bool', 'numeric'), 'char' => array('bpchar', 'varchar'), 'varchar' => 'varchar', 'smallint' => array('int2', 'int4'), 'integer' => 'int4', 'bigint' => array('int4', 'int8'), 'decimal' => 'numeric', 'single' => array('float4', 'float8'), 'double' => 'float8', 'clob' => array('oid', 'text'), 'date' => array('bpchar', 'date'), 'time' => array('bpchar', 'time'), 'timestamp' => array('bpchar', 'timestamp') ), 'sqlite' => array( 'boolean' => 'boolean', 'char' => 'char', 'varchar' => array('char', 'varchar'), 'smallint' => array('int', 'smallint'), 'integer' => array('int', 'integer'), 'bigint' => array('int', 'bigint'), 'decimal' => array('decimal', 'numeric'), 'single' => array('double', 'float'), 'double' => 'double', 'clob' => array('clob', 'longtext'), 'date' => 'date', 'time' => 'time', 'timestamp' => array('datetime', 'timestamp') ), ); /** * Mapping between DB_Table and MDB2 data types. */ $GLOBALS['_DB_TABLE']['mdb2_type'] = array( 'boolean' => 'boolean', 'char' => 'text', 'varchar' => 'text', 'smallint' => 'integer', 'integer' => 'integer', 'bigint' => 'integer', 'decimal' => 'decimal', 'single' => 'float', 'double' => 'float', 'clob' => 'clob', 'date' => 'date', 'time' => 'time', 'timestamp' => 'timestamp' ); /** * * Creates, checks or alters tables from DB_Table definitions. * * DB_Table_Manager provides database automated table creation * facilities. * * @category Database * @package DB_Table * @author Paul M. Jones * @author Mark Wiesemann * */ class DB_Table_Manager { /** * * Create the table based on DB_Table column and index arrays. * * @static * * @access public * * @param object &$db A PEAR DB/MDB2 object. * * @param string $table The table name to connect to in the database. * * @param mixed $column_set A DB_Table $this->col array. * * @param mixed $index_set A DB_Table $this->idx array. * * @return mixed Boolean false if there was no attempt to create the * table, boolean true if the attempt succeeded, and a PEAR_Error if * the attempt failed. * */ function create(&$db, $table, $column_set, $index_set) { if (is_subclass_of($db, 'db_common')) { $backend = 'db'; } elseif (is_subclass_of($db, 'mdb2_driver_common')) { $backend = 'mdb2'; $db->loadModule('Manager'); } $phptype = $db->phptype; // columns to be created $column = array(); // max. value for scope (only used with MDB2 as backend) $max_scope = 0; // indexes to be created $indexes = array(); // check the table name $name_check = DB_Table_Manager::_validateTableName($table); if (PEAR::isError($name_check)) { return $name_check; } // ------------------------------------------------------------- // // validate each column mapping and build the individual // definitions, and note column indexes as we go. // if (is_null($column_set)) { $column_set = array(); } foreach ($column_set as $colname => $val) { $colname = trim($colname); // check the column name $name_check = DB_Table_Manager::_validateColumnName($colname); if (PEAR::isError($name_check)) { return $name_check; } // prepare variables $type = (isset($val['type'])) ? $val['type'] : null; $size = (isset($val['size'])) ? $val['size'] : null; $scope = (isset($val['scope'])) ? $val['scope'] : null; $require = (isset($val['require'])) ? $val['require'] : null; $default = (isset($val['default'])) ? $val['default'] : null; if ($backend == 'mdb2') { // get the declaration string $column[$colname] = DB_Table_Manager::getDeclareMDB2($type, $size, $scope, $require, $default, $max_scope); } else { // get the declaration string $result = DB_Table_Manager::getDeclare($phptype, $type, $size, $scope, $require, $default); // did it work? if (PEAR::isError($result)) { $result->userinfo .= " ('$colname')"; return $result; } // add the declaration to the array of all columns $column[] = "$colname $result"; } } // ------------------------------------------------------------- // // validate the indexes. // if (is_null($index_set)) { $index_set = array(); } $count_primary_keys = 0; foreach ($index_set as $idxname => $val) { list($type, $cols) = DB_Table_Manager::_getIndexTypeAndColumns($val, $idxname); $newIdxName = ''; // check the index definition $index_check = DB_Table_Manager::_validateIndexName($idxname, $table, $phptype, $type, $cols, $column_set, $newIdxName); if (PEAR::isError($index_check)) { return $index_check; } // check number of primary keys (only one is allowed) if ($type == 'primary') { // SQLite does not support primary keys if ($phptype == 'sqlite') { return DB_Table::throwError(DB_TABLE_ERR_DECLARE_PRIM_SQLITE); } $count_primary_keys++; } if ($count_primary_keys > 1) { return DB_Table::throwError(DB_TABLE_ERR_DECLARE_PRIMARY); } // create index entry if ($backend == 'mdb2') { // array with column names as keys $idx_cols = array(); foreach ($cols as $col) { $idx_cols[$col] = array(); } switch ($type) { case 'primary': $indexes['primary'][$newIdxName] = array('fields' => $idx_cols, 'primary' => true); break; case 'unique': $indexes['unique'][$newIdxName] = array('fields' => $idx_cols, 'unique' => true); break; case 'normal': $indexes['normal'][$newIdxName] = array('fields' => $idx_cols); break; } } else { $indexes[] = DB_Table_Manager::getDeclareForIndex($phptype, $type, $newIdxName, $table, $cols); } } // ------------------------------------------------------------- // // now for the real action: create the table and indexes! // if ($backend == 'mdb2') { // save user defined 'decimal_places' option $decimal_places = $db->getOption('decimal_places'); $db->setOption('decimal_places', $max_scope); // attempt to create the table $result = $db->manager->createTable($table, $column); // restore user defined 'decimal_places' option $db->setOption('decimal_places', $decimal_places); if (PEAR::isError($result)) { return $result; } } else { // build the CREATE TABLE command $cmd = "CREATE TABLE $table (\n\t"; $cmd .= implode(",\n\t", $column); $cmd .= "\n)"; // attempt to create the table $result = $db->query($cmd); if (PEAR::isError($result)) { return $result; } } $result = DB_Table_Manager::_createIndexesAndConstraints($db, $backend, $table, $indexes); if (PEAR::isError($result)) { return $result; } // we're done! return true; } /** * * Verify whether the table and columns exist, whether the columns * have the right type and whether the indexes exist. * * @static * * @access public * * @param object &$db A PEAR DB/MDB2 object. * * @param string $table The table name to connect to in the database. * * @param mixed $column_set A DB_Table $this->col array. * * @param mixed $index_set A DB_Table $this->idx array. * * @return mixed Boolean true if the verification was successful, and a * PEAR_Error if verification failed. * */ function verify(&$db, $table, $column_set, $index_set) { if (is_subclass_of($db, 'db_common')) { $backend = 'db'; $reverse =& $db; $table_info_mode = DB_TABLEINFO_FULL; $table_info_error = DB_ERROR_NEED_MORE_DATA; } elseif (is_subclass_of($db, 'mdb2_driver_common')) { $backend = 'mdb2'; $reverse =& $this->db->loadModule('Reverse'); $table_info_mode = MDB2_TABLEINFO_FULL; $table_info_error = MDB2_ERROR_NEED_MORE_DATA; } $phptype = $db->phptype; // check #1: does the table exist? // check the table name $name_check = DB_Table_Manager::_validateTableName($table); if (PEAR::isError($name_check)) { return $name_check; } // get table info $tableInfo = $reverse->tableInfo($table, $table_info_mode); if (PEAR::isError($tableInfo)) { if ($tableInfo->getCode() == $table_info_error) { return DB_Table::throwError( DB_TABLE_ERR_VER_TABLE_MISSING, "(table='$table')" ); } return $tableInfo; } $tableInfoOrder = array_change_key_case($tableInfo['order'], CASE_LOWER); if (is_null($column_set)) { $column_set = array(); } foreach ($column_set as $colname => $val) { $colname = strtolower(trim($colname)); // check the column name $name_check = DB_Table_Manager::_validateColumnName($colname); if (PEAR::isError($name_check)) { return $name_check; } // check #2: do all columns exist? $column_exists = DB_Table_Manager::_columnExists($colname, $tableInfoOrder, 'verify'); if (PEAR::isError($column_exists)) { return $column_exists; } // check #3: do all columns have the right type? // check whether the column type is a known type $type_check = DB_Table_Manager::_validateColumnType($phptype, $val['type']); if (PEAR::isError($type_check)) { return $type_check; } // check whether the column has the right type $type_check = DB_Table_Manager::_checkColumnType($phptype, $colname, $val['type'], $tableInfoOrder, $tableInfo, 'verify'); if (PEAR::isError($type_check)) { return $type_check; } } // check #4: do all indexes exist? $table_indexes = DB_Table_Manager::getIndexes($db, $table); if (PEAR::isError($table_indexes)) { return $table_indexes; } if (is_null($index_set)) { $index_set = array(); } foreach ($index_set as $idxname => $val) { list($type, $cols) = DB_Table_Manager::_getIndexTypeAndColumns($val, $idxname); $newIdxName = ''; // check the index definition $index_check = DB_Table_Manager::_validateIndexName($idxname, $table, $phptype, $type, $cols, $column_set, $newIdxName); if (PEAR::isError($index_check)) { return $index_check; } // check whether the index has the right type and has all // specified columns $index_check = DB_Table_Manager::_checkIndex($idxname, $newIdxName, $type, $cols, $table_indexes, 'verify'); if (PEAR::isError($index_check)) { return $index_check; } } return true; } /** * * Alter columns and indexes of a table based on DB_Table column and index * arrays. * * @static * * @access public * * @param object &$db A PEAR DB/MDB2 object. * * @param string $table The table name to connect to in the database. * * @param mixed $column_set A DB_Table $this->col array. * * @param mixed $index_set A DB_Table $this->idx array. * * @return bool|object True if altering was successful or a PEAR_Error on * failure. * */ function alter(&$db, $table, $column_set, $index_set) { $phptype = $db->phptype; if (is_subclass_of($db, 'db_common')) { $backend = 'db'; $reverse =& $db; // workaround for missing index and constraint information methods // in PEAR::DB ==> use adopted code from MDB2's driver classes require_once 'DB/Table/Manager/' . $phptype . '.php'; $classname = 'DB_Table_Manager_' . $phptype; $dbtm =& new $classname(); $dbtm->_db =& $db; // pass database instance to the 'workaround' class $manager =& $dbtm; $table_info_mode = DB_TABLEINFO_FULL; $ok_const = DB_OK; } elseif (is_subclass_of($db, 'mdb2_driver_common')) { $backend = 'mdb2'; $db->loadModule('Reverse'); $manager =& $db->manager; $reverse =& $db->reverse; $table_info_mode = MDB2_TABLEINFO_FULL; $ok_const = MDB2_OK; } // get table info $tableInfo = $reverse->tableInfo($table, $table_info_mode); if (PEAR::isError($tableInfo)) { return $tableInfo; } $tableInfoOrder = array_change_key_case($tableInfo['order'], CASE_LOWER); // emulate MDB2 Reverse extension for PEAR::DB as backend if (is_subclass_of($db, 'db_common')) { $reverse =& $dbtm; } // check (and alter) columns if (is_null($column_set)) { $column_set = array(); } foreach ($column_set as $colname => $val) { $colname = strtolower(trim($colname)); // check the column name $name_check = DB_Table_Manager::_validateColumnName($colname); if (PEAR::isError($name_check)) { return $name_check; } // check the column's existence $column_exists = DB_Table_Manager::_columnExists($colname, $tableInfoOrder, 'alter'); if (PEAR::isError($column_exists)) { return $column_exists; } if ($column_exists === false) { // add the column $definition = DB_Table_Manager::_getColumnDefinition($backend, $phptype, $val); if (PEAR::isError($definition)) { return $definition; } $changes = array('add' => array($colname => $definition)); if (array_key_exists('debug', $GLOBALS['_DB_TABLE'])) { echo "(alter) New table field will be added ($colname):\n"; var_dump($changes); echo "\n"; } $result = $manager->alterTable($table, $changes, false); if (PEAR::isError($result)) { return $result; } continue; } // check whether the column type is a known type $type_check = DB_Table_Manager::_validateColumnType($phptype, $val['type']); if (PEAR::isError($type_check)) { return $type_check; } // check whether the column has the right type $type_check = DB_Table_Manager::_checkColumnType($phptype, $colname, $val['type'], $tableInfoOrder, $tableInfo, 'alter'); if (PEAR::isError($type_check)) { return $type_check; } if ($type_check === false) { // change the column type $definition = DB_Table_Manager::_getColumnDefinition($backend, $phptype, $val); if (PEAR::isError($definition)) { return $definition; } $changes = array('change' => array($colname => array('type' => null, 'definition' => $definition))); if (array_key_exists('debug', $GLOBALS['_DB_TABLE'])) { echo "(alter) Table field's type will be changed ($colname):\n"; var_dump($changes); echo "\n"; } $result = $manager->alterTable($table, $changes, false); if (PEAR::isError($result)) { return $result; } continue; } } // get information about indexes / constraints $table_indexes = DB_Table_Manager::getIndexes($db, $table); if (PEAR::isError($table_indexes)) { return $table_indexes; } // check (and alter) indexes / constraints if (is_null($index_set)) { $index_set = array(); } foreach ($index_set as $idxname => $val) { list($type, $cols) = DB_Table_Manager::_getIndexTypeAndColumns($val, $idxname); $newIdxName = ''; // check the index definition $index_check = DB_Table_Manager::_validateIndexName($idxname, $table, $phptype, $type, $cols, $column_set, $newIdxName); if (PEAR::isError($index_check)) { return $index_check; } // check whether the index has the right type and has all // specified columns $index_check = DB_Table_Manager::_checkIndex($idxname, $newIdxName, $type, $cols, $table_indexes, 'alter'); if (PEAR::isError($index_check)) { return $index_check; } if ($index_check === false) { // (1) drop wrong index/constraint // (2) add right index/constraint if ($backend == 'mdb2') { // save user defined 'idxname_format' option $idxname_format = $db->getOption('idxname_format'); $db->setOption('idxname_format', '%s'); } // drop index/constraint only if it exists foreach (array('normal', 'unique', 'primary') as $idx_type) { if (array_key_exists(strtolower($newIdxName), $table_indexes[$idx_type])) { if (array_key_exists('debug', $GLOBALS['_DB_TABLE'])) { echo "(alter) Index/constraint will be deleted (name: '$newIdxName', type: '$idx_type').\n"; } if ($idx_type == 'normal') { $result = $manager->dropIndex($table, $newIdxName); } else { $result = $manager->dropConstraint($table, $newIdxName); } if (PEAR::isError($result)) { if ($backend == 'mdb2') { // restore user defined 'idxname_format' option $db->setOption('idxname_format', $idxname_format); } return $result; } break; } } // prepare index/constraint definition $indexes = array(); if ($backend == 'mdb2') { // array with column names as keys $idx_cols = array(); foreach ($cols as $col) { $idx_cols[$col] = array(); } switch ($type) { case 'primary': $indexes['primary'][$newIdxName] = array('fields' => $idx_cols, 'primary' => true); break; case 'unique': $indexes['unique'][$newIdxName] = array('fields' => $idx_cols, 'unique' => true); break; case 'normal': $indexes['normal'][$newIdxName] = array('fields' => $idx_cols); break; } } else { $indexes[] = DB_Table_Manager::getDeclareForIndex($phptype, $type, $newIdxName, $table, $cols); } // create index/constraint if (array_key_exists('debug', $GLOBALS['_DB_TABLE'])) { echo "(alter) New index/constraint will be created (name: '$newIdxName', type: '$type'):\n"; var_dump($indexes); echo "\n"; } $result = DB_Table_Manager::_createIndexesAndConstraints( $db, $backend, $table, $indexes); if ($backend == 'mdb2') { // restore user defined 'idxname_format' option $db->setOption('idxname_format', $idxname_format); } if (PEAR::isError($result)) { return $result; } continue; } } return true; } /** * * Check whether a table exists. * * @static * * @access public * * @param object &$db A PEAR DB/MDB2 object. * * @param string $table The table name that should be checked. * * @return bool|object True if the table exists, false if not, or a * PEAR_Error on failure. * */ function tableExists(&$db, $table) { if (is_subclass_of($db, 'db_common')) { $list = $db->getListOf('tables'); } elseif (is_subclass_of($db, 'mdb2_driver_common')) { $db->loadModule('Manager'); $list = $db->manager->listTables(); } if (PEAR::isError($list)) { return $list; } array_walk($list, create_function('&$value,$key', '$value = trim(strtolower($value));')); return in_array(strtolower($table), $list); } /** * * Get the column declaration string for a DB_Table column. * * @static * * @access public * * @param string $phptype The DB/MDB2 phptype key. * * @param string $coltype The DB_Table column type. * * @param int $size The size for the column (needed for string and * decimal). * * @param int $scope The scope for the column (needed for decimal). * * @param bool $require True if the column should be NOT NULL, false * allowed to be NULL. * * @param string $default The SQL calculation for a default value. * * @return string|object A declaration string on success, or a * PEAR_Error on failure. * */ function getDeclare($phptype, $coltype, $size = null, $scope = null, $require = null, $default = null) { // validate char/varchar/decimal type declaration $validation = DB_Table_Manager::_validateTypeDeclaration($coltype, $size, $scope); if (PEAR::isError($validation)) { return $validation; } // map of column types and declarations for this RDBMS $map = $GLOBALS['_DB_TABLE']['type'][$phptype]; // is it a recognized column type? $types = array_keys($map); if (! in_array($coltype, $types)) { return DB_Table::throwError( DB_TABLE_ERR_DECLARE_TYPE, "('$coltype')" ); } // basic declaration switch ($coltype) { case 'char': case 'varchar': $declare = $map[$coltype] . "($size)"; break; case 'decimal': $declare = $map[$coltype] . "($size,$scope)"; break; default: $declare = $map[$coltype]; break; } // set the "NULL"/"NOT NULL" portion $null = ' NULL'; if ($phptype == 'ibase') { // Firebird does not like 'NULL' $null = ''; // in CREATE TABLE } if ($phptype == 'pgsql') { // PostgreSQL does not like 'NULL' $null = ''; // in ALTER TABLE } $declare .= ($require) ? ' NOT NULL' : $null; // set the "DEFAULT" portion if ($default) { switch ($coltype) { case 'char': case 'varchar': case 'clob': $declare .= " DEFAULT '$default'"; break; default: $declare .= " DEFAULT $default"; break; } } // done return $declare; } /** * * Get the column declaration string for a DB_Table column. * * @static * * @access public * * @param string $coltype The DB_Table column type. * * @param int $size The size for the column (needed for string and * decimal). * * @param int $scope The scope for the column (needed for decimal). * * @param bool $require True if the column should be NOT NULL, false * allowed to be NULL. * * @param string $default The SQL calculation for a default value. * * @param int $max_scope The maximal scope for all table column * (pass-by-reference). * * @return string|object A MDB2 column definition array on success, or a * PEAR_Error on failure. * */ function getDeclareMDB2($coltype, $size = null, $scope = null, $require = null, $default = null, &$max_scope) { // validate char/varchar/decimal type declaration $validation = DB_Table_Manager::_validateTypeDeclaration($coltype, $size, $scope); if (PEAR::isError($validation)) { return $validation; } // map of MDB2 column types $map = $GLOBALS['_DB_TABLE']['mdb2_type']; // is it a recognized column type? $types = array_keys($map); if (! in_array($coltype, $types)) { return DB_Table::throwError( DB_TABLE_ERR_DECLARE_TYPE, "('$coltype')" ); } // build declaration array $new_column = array( 'type' => $map[$coltype], 'notnull' => $require ); if ($size) { $new_column['length'] = $size; } // determine integer length to be used in MDB2 if (in_array($coltype, array('smallint', 'integer', 'bigint'))) { switch ($coltype) { case 'smallint': $new_column['length'] = 2; break; case 'integer': $new_column['length'] = 4; break; case 'bigint': $new_column['length'] = 5; break; } } if ($scope) { $max_scope = max($max_scope, $scope); } if ($default) { $new_column['default'] = $default; } return $new_column; } /** * * Get the index declaration string for a DB_Table index. * * @static * * @access public * * @param string $phptype The DB phptype key. * * @param string $type The index type. * * @param string $idxname The index name. * * @param string $table The table name. * * @param mixed $cols Array with the column names for the index. * * @return string A declaration string. * */ function getDeclareForIndex($phptype, $type, $idxname, $table, $cols) { // string of column names $colstring = implode(', ', $cols); switch ($type) { case 'primary': switch ($phptype) { case 'ibase': case 'oci8': case 'pgsql': $declare = "ALTER TABLE $table ADD"; $declare .= " CONSTRAINT $idxname"; $declare .= " PRIMARY KEY ($colstring)"; break; case 'mysql': case 'mysqli': $declare = "ALTER TABLE $table ADD PRIMARY KEY"; $declare .= " ($colstring)"; break; case 'sqlite': // currently not possible break; } break; case 'unique': $declare = "CREATE UNIQUE INDEX $idxname ON $table ($colstring)"; break; case 'normal': $declare = "CREATE INDEX $idxname ON $table ($colstring)"; break; } return $declare; } /** * * Return the definition array for a column. * * @access private * * @param string $backend The name of the backend ('db' or 'mdb2'). * * @param string $phptype The DB/MDB2 phptype key. * * @param mixed $column A single DB_Table column definition array. * * @return mixed|object Declaration string (DB), declaration array (MDB2) or a * PEAR_Error with a description about the invalidity, otherwise. * */ function _getColumnDefinition($backend, $phptype, $column) { static $max_scope; // prepare variables $type = (isset($column['type'])) ? $column['type'] : null; $size = (isset($column['size'])) ? $column['size'] : null; $scope = (isset($column['scope'])) ? $column['scope'] : null; $require = (isset($column['require'])) ? $column['require'] : null; $default = (isset($column['default'])) ? $column['default'] : null; if ($backend == 'db') { return DB_Table_Manager::getDeclare($phptype, $type, $size, $scope, $require, $default); } else { return DB_Table_Manager::getDeclareMDB2($type, $size, $scope, $require, $default, $max_scope); } } /** * * Check char/varchar/decimal type declarations for validity. * * @access private * * @param string $coltype The DB_Table column type. * * @param int $size The size for the column (needed for string and * decimal). * * @param int $scope The scope for the column (needed for decimal). * * @return bool|object Boolean true if the type declaration is valid or a * PEAR_Error with a description about the invalidity, otherwise. * */ function _validateTypeDeclaration($coltype, $size, $scope) { // validate char and varchar: does it have a size? if (($coltype == 'char' || $coltype == 'varchar') && ($size < 1 || $size > 255) ) { return DB_Table::throwError( DB_TABLE_ERR_DECLARE_STRING, "(size='$size')" ); } // validate decimal: does it have a size and scope? if ($coltype == 'decimal' && ($size < 1 || $size > 255 || $scope < 0 || $scope > $size)) { return DB_Table::throwError( DB_TABLE_ERR_DECLARE_DECIMAL, "(size='$size' scope='$scope')" ); } return true; } /** * * Check a table name for validity. * * @access private * * @param string $tablename The table name. * * @return bool|object Boolean true if the table name is valid or a * PEAR_Error with a description about the invalidity, otherwise. * */ function _validateTableName($tablename) { // is the table name too long? if (strlen($tablename) > 30) { return DB_Table::throwError( DB_TABLE_ERR_TABLE_STRLEN, " ('$tablename')" ); } return true; } /** * * Check a column name for validity. * * @access private * * @param string $colname The column name. * * @return bool|object Boolean true if the column name is valid or a * PEAR_Error with a description about the invalidity, otherwise. * */ function _validateColumnName($colname) { // column name cannot be a reserved keyword $reserved = in_array( strtoupper($colname), $GLOBALS['_DB_TABLE']['reserved'] ); if ($reserved) { return DB_Table::throwError( DB_TABLE_ERR_DECLARE_COLNAME, " ('$colname')" ); } // column name must be no longer than 30 chars if (strlen($colname) > 30) { return DB_Table::throwError( DB_TABLE_ERR_DECLARE_STRLEN, "('$colname')" ); } return true; } /** * * Check whether a column exists. * * @access private * * @param string $colname The column name. * * @param mixed $tableInfoOrder Array with columns in the table (result * from tableInfo(), shortened to key 'order'). * * @param string $mode The name of the calling function, this can be either * 'verify' or 'alter'. * * @return bool|object Boolean true if the column exists. * Otherwise, either boolean false (case 'alter') or a PEAR_Error * (case 'verify'). * */ function _columnExists($colname, $tableInfoOrder, $mode) { if (array_key_exists($colname, $tableInfoOrder)) { return true; } switch ($mode) { case 'alter': return false; case 'verify': return DB_Table::throwError( DB_TABLE_ERR_VER_COLUMN_MISSING, "(column='$colname')" ); } } /** * * Check whether a column type is a known type. * * @access private * * @param string $phptype The DB/MDB2 phptype key. * * @param string $type The column type. * * @return bool|object Boolean true if the column type is a known type * or a PEAR_Error, otherwise. * */ function _validateColumnType($phptype, $type) { // map of valid types for the current RDBMS $map = $GLOBALS['_DB_TABLE']['valid_type'][$phptype]; // is it a recognized column type? $types = array_keys($map); if (!in_array($type, $types)) { return DB_Table::throwError( DB_TABLE_ERR_DECLARE_TYPE, "('" . $type . "')" ); } return true; } /** * * Check whether a column has the right type. * * @access private * * @param string $phptype The DB/MDB2 phptype key. * * @param string $colname The column name. * * @param string $coltype The column type. * * @param mixed $tableInfoOrder Array with columns in the table (result * from tableInfo(), shortened to key 'order'). * * @param mixed $tableInfo Array with information about the table (result * from tableInfo()). * * @param string $mode The name of the calling function, this can be either * 'verify' or 'alter'. * * @return bool|object Boolean true if the column has the right type. * Otherwise, either boolean false (case 'alter') or a PEAR_Error * (case 'verify'). * */ function _checkColumnType($phptype, $colname, $coltype, $tableInfoOrder, $tableInfo, $mode) { // map of valid types for the current RDBMS $map = $GLOBALS['_DB_TABLE']['valid_type'][$phptype]; // get the column type from tableInfo() $colindex = $tableInfoOrder[$colname]; $type = strtolower($tableInfo[$colindex]['type']); // workaround for possibly wrong detected column type (taken from MDB2) if ($type == 'unknown' && ($phptype == 'mysql' || $phptype == 'mysqli')) { $type = 'decimal'; } // strip size information (e.g. NUMERIC(9,2) => NUMERIC) if given if (($pos = strpos($type, '(')) !== false) { $type = substr($type, 0, $pos); } // is the type valid for the given DB_Table column type? if (in_array($type, (array)$map[$coltype])) { return true; } switch ($mode) { case 'alter': return false; case 'verify': return DB_Table::throwError( DB_TABLE_ERR_VER_COLUMN_TYPE, "(column='$colname', type='$type')" ); } } /** * * Return the index type and the columns belonging to this index. * * @access private * * @param mixed $idx_def The index definition. * * @return mixed Array with the index type and the columns belonging to * this index. * */ function _getIndexTypeAndColumns($idx_def, $idxname) { $type = ''; $cols = ''; if (is_string($idx_def)) { // shorthand for index names: colname => index_type $type = trim($idx_def); $cols = trim($idxname); } elseif (is_array($idx_def)) { // normal: index_name => array('type' => ..., 'cols' => ...) $type = (isset($idx_def['type'])) ? $idx_def['type'] : 'normal'; $cols = (isset($idx_def['cols'])) ? $idx_def['cols'] : null; } return array($type, $cols); } /** * * Check an index name for validity. * * @access private * * @param string $idxname The index name. * * @param string $table The table name. * * @param string $phptype The DB/MDB2 phptype key. * * @param string $type The index type. * * @param mixed $cols The column names for the index. Will become an array * if it is not an array. * * @param mixed $column_set A DB_Table $this->col array. * * @param string $newIdxName The new index name (prefixed with the table * name, suffixed with '_idx'). * * @return bool|object Boolean true if the index name is valid or a * PEAR_Error with a description about the invalidity, otherwise. * */ function _validateIndexName($idxname, $table, $phptype, $type, &$cols, $column_set, &$newIdxName) { // index name cannot be a reserved keyword $reserved = in_array( strtoupper($idxname), $GLOBALS['_DB_TABLE']['reserved'] ); if ($reserved) { return DB_Table::throwError( DB_TABLE_ERR_DECLARE_IDXNAME, "('$idxname')" ); } // are there any columns for the index? if (! $cols) { return DB_Table::throwError( DB_TABLE_ERR_IDX_NO_COLS, "('$idxname')" ); } // are there any CLOB columns, or any columns that are not // in the schema? settype($cols, 'array'); $valid_cols = array_keys($column_set); foreach ($cols as $colname) { if (! in_array($colname, $valid_cols)) { return DB_Table::throwError( DB_TABLE_ERR_IDX_COL_UNDEF, "'$idxname' ('$colname')" ); } if ($column_set[$colname]['type'] == 'clob') { return DB_Table::throwError( DB_TABLE_ERR_IDX_COL_CLOB, "'$idxname' ('$colname')" ); } } // we prefix all index names with the table name, // and suffix all index names with '_idx'. this // is to soothe PostgreSQL, which demands that index // names not collide, even when they indexes are on // different tables. $newIdxName = $table . '_' . $idxname . '_idx'; // MySQL requires the primary key to be named 'primary', therefore let's // ignore the user defined name if (($phptype == 'mysql' || $phptype == 'mysqli') && $type == 'primary') { $newIdxName = 'primary'; } // now check the length; must be under 30 chars to // soothe Oracle. if (strlen($newIdxName) > 30) { return DB_Table::throwError( DB_TABLE_ERR_IDX_STRLEN, "'$idxname' ('$newIdxName')" ); } // check index type if ($type != 'primary' && $type != 'unique' && $type != 'normal') { return DB_Table::throwError( DB_TABLE_ERR_IDX_TYPE, "'$idxname' ('$type')" ); } return true; } /** * * Return all indexes for a table. * * @access public * * @param object &$db A PEAR DB/MDB2 object. * * @param string $table The table name. * * @return mixed Array with all indexes or a PEAR_Error when an error * occurred. * */ function getIndexes(&$db, $table) { if (is_subclass_of($db, 'db_common')) { $backend = 'db'; // workaround for missing index and constraint information methods // in PEAR::DB ==> use adopted code from MDB2's driver classes require_once 'DB/Table/Manager/' . $db->phptype . '.php'; $classname = 'DB_Table_Manager_' . $db->phptype; $dbtm =& new $classname(); $dbtm->_db =& $db; // pass database instance to the 'workaround' class $manager =& $dbtm; $reverse =& $dbtm; } elseif (is_subclass_of($db, 'mdb2_driver_common')) { $backend = 'mdb2'; $manager =& $db->manager; $reverse =& $db->reverse; } $indexes = array('normal' => array(), 'primary' => array(), 'unique' => array() ); // save user defined 'idxname_format' option (MDB2 only) if ($backend == 'mdb2') { $idxname_format = $db->getOption('idxname_format'); $db->setOption('idxname_format', '%s'); } // get table constraints $table_indexes_tmp = $manager->listTableConstraints($table); if (PEAR::isError($table_indexes_tmp)) { // restore user defined 'idxname_format' option (MDB2 only) if ($backend == 'mdb2') { $db->setOption('idxname_format', $idxname_format); } return $table_indexes_tmp; } // get fields of table constraints foreach ($table_indexes_tmp as $table_idx_tmp) { $index_fields = $reverse->getTableConstraintDefinition($table, $table_idx_tmp); if (PEAR::isError($index_fields)) { // restore user defined 'idxname_format' option (MDB2 only) if ($backend == 'mdb2') { $db->setOption('idxname_format', $idxname_format); } return $index_fields; } $index_type = current(array_keys($index_fields)); $indexes[$index_type][$table_idx_tmp] = array_keys($index_fields['fields']); } // get table indexes $table_indexes_tmp = $manager->listTableIndexes($table); if (PEAR::isError($table_indexes_tmp)) { // restore user defined 'idxname_format' option (MDB2 only) if ($backend == 'mdb2') { $db->setOption('idxname_format', $idxname_format); } return $table_indexes_tmp; } // get fields of table indexes foreach ($table_indexes_tmp as $table_idx_tmp) { $index_fields = $reverse->getTableIndexDefinition($table, $table_idx_tmp); if (PEAR::isError($index_fields)) { // restore user defined 'idxname_format' option (MDB2 only) if ($backend == 'mdb2') { $db->setOption('idxname_format', $idxname_format); } return $index_fields; } $indexes['normal'][$table_idx_tmp] = array_keys($index_fields['fields']); } // restore user defined 'idxname_format' option (MDB2 only) if ($backend == 'mdb2') { $db->setOption('idxname_format', $idxname_format); } return $indexes; } /** * * Check whether an index has the right type and has all specified columns. * * @access private * * @param string $idxname The index name. * * @param string $newIdxName The prefixed and suffixed index name. * * @param string $type The index type. * * @param mixed $cols The column names for the index. * * @param mixed $table_indexes Array with all indexes of the table. * * @param string $mode The name of the calling function, this can be either * 'verify' or 'alter'. * * @return bool|object Boolean true if the index has the right type and all * specified columns. Otherwise, either boolean false (case 'alter') or a * PEAR_Error (case 'verify'). * */ function _checkIndex($idxname, $newIdxName, $type, $cols, &$table_indexes, $mode) { $index_found = false; foreach ($table_indexes[$type] as $index_name => $index_fields) { if (strtolower($index_name) == strtolower($newIdxName)) { $index_found = true; array_walk($cols, create_function('&$value,$key', '$value = trim(strtolower($value));')); array_walk($index_fields, create_function('&$value,$key', '$value = trim(strtolower($value));')); foreach ($index_fields as $index_field) { if (($key = array_search($index_field, $cols)) !== false) { unset($cols[$key]); } } break; } } if (!$index_found) { return ($mode == 'alter') ? false : DB_Table::throwError( DB_TABLE_ERR_VER_IDX_MISSING, "'$idxname' ('$newIdxName')" ); } if (count($cols) > 0) { // string of column names $colstring = implode(', ', $cols); return ($mode == 'alter') ? false : DB_Table::throwError( DB_TABLE_ERR_VER_IDX_COL_MISSING, "'$idxname' ($colstring)" ); } return true; } /** * * Create indexes and constraints. * * @access private * * @param object &$db A PEAR DB/MDB2 object. * * @param string $backend The name of the backend ('db' or 'mdb2'). * * @param string $table The table name. * * @param mixed $indexes An array with index and constraint definitions. * * @return bool|object Boolean true on success or a PEAR_Error with a * description about the invalidity, otherwise. * */ function _createIndexesAndConstraints($db, $backend, $table, $indexes) { if ($backend == 'mdb2') { // save user defined 'idxname_format' option $idxname_format = $db->getOption('idxname_format'); $db->setOption('idxname_format', '%s'); // attempt to create the primary key if (!array_key_exists('primary', $indexes)) { $indexes['primary'] = array(); } foreach ($indexes['primary'] as $name => $definition) { $result = $db->manager->createConstraint($table, $name, $definition); if (PEAR::isError($result)) { // restore user defined 'idxname_format' option $db->setOption('idxname_format', $idxname_format); return $result; } } // attempt to create the unique indexes / constraints if (!array_key_exists('unique', $indexes)) { $indexes['unique'] = array(); } foreach ($indexes['unique'] as $name => $definition) { $result = $db->manager->createConstraint($table, $name, $definition); if (PEAR::isError($result)) { // restore user defined 'idxname_format' option $db->setOption('idxname_format', $idxname_format); return $result; } } // attempt to create the normal indexes if (!array_key_exists('normal', $indexes)) { $indexes['normal'] = array(); } foreach ($indexes['normal'] as $name => $definition) { $result = $db->manager->createIndex($table, $name, $definition); if (PEAR::isError($result)) { // restore user defined 'idxname_format' option $db->setOption('idxname_format', $idxname_format); return $result; } } // restore user defined 'idxname_format' option $db->setOption('idxname_format', $idxname_format); } else { // attempt to create the indexes foreach ($indexes as $cmd) { $result = $db->query($cmd); if (PEAR::isError($result)) { return $result; } } } return true; } } /** * List of all reserved words for all supported databases. Yes, this is a * monster of a list. */ if (! isset($GLOBALS['_DB_TABLE']['reserved'])) { $GLOBALS['_DB_TABLE']['reserved'] = array( '_ROWID_', 'ABSOLUTE', 'ACCESS', 'ACTION', 'ADD', 'ADMIN', 'AFTER', 'AGGREGATE', 'ALIAS', 'ALL', 'ALLOCATE', 'ALTER', 'ANALYSE', 'ANALYZE', 'AND', 'ANY', 'ARE', 'ARRAY', 'AS', 'ASC', 'ASENSITIVE', 'ASSERTION', 'AT', 'AUDIT', 'AUTHORIZATION', 'AUTO_INCREMENT', 'AVG', 'BACKUP', 'BDB', 'BEFORE', 'BEGIN', 'BERKELEYDB', 'BETWEEN', 'BIGINT', 'BINARY', 'BIT', 'BIT_LENGTH', 'BLOB', 'BOOLEAN', 'BOTH', 'BREADTH', 'BREAK', 'BROWSE', 'BULK', 'BY', 'CALL', 'CASCADE', 'CASCADED', 'CASE', 'CAST', 'CATALOG', 'CHANGE', 'CHAR', 'CHAR_LENGTH', 'CHARACTER', 'CHARACTER_LENGTH', 'CHECK', 'CHECKPOINT', 'CLASS', 'CLOB', 'CLOSE', 'CLUSTER', 'CLUSTERED', 'COALESCE', 'COLLATE', 'COLLATION', 'COLUMN', 'COLUMNS', 'COMMENT', 'COMMIT', 'COMPLETION', 'COMPRESS', 'COMPUTE', 'CONDITION', 'CONNECT', 'CONNECTION', 'CONSTRAINT', 'CONSTRAINTS', 'CONSTRUCTOR', 'CONTAINS', 'CONTAINSTABLE', 'CONTINUE', 'CONVERT', 'CORRESPONDING', 'COUNT', 'CREATE', 'CROSS', 'CUBE', 'CURRENT', 'CURRENT_DATE', 'CURRENT_PATH', 'CURRENT_ROLE', 'CURRENT_TIME', 'CURRENT_TIMESTAMP', 'CURRENT_USER', 'CURSOR', 'CYCLE', 'DATA', 'DATABASE', 'DATABASES', 'DATE', 'DAY', 'DAY_HOUR', 'DAY_MICROSECOND', 'DAY_MINUTE', 'DAY_SECOND', 'DBCC', 'DEALLOCATE', 'DEC', 'DECIMAL', 'DECLARE', 'DEFAULT', 'DEFERRABLE', 'DEFERRED', 'DELAYED', 'DELETE', 'DENY', 'DEPTH', 'DEREF', 'DESC', 'DESCRIBE', 'DESCRIPTOR', 'DESTROY', 'DESTRUCTOR', 'DETERMINISTIC', 'DIAGNOSTICS', 'DICTIONARY', 'DISCONNECT', 'DISK', 'DISTINCT', 'DISTINCTROW', 'DISTRIBUTED', 'DIV', 'DO', 'DOMAIN', 'DOUBLE', 'DROP', 'DUMMY', 'DUMP', 'DYNAMIC', 'EACH', 'ELSE', 'ELSEIF', 'ENCLOSED', 'END', 'END-EXEC', 'EQUALS', 'ERRLVL', 'ESCAPE', 'ESCAPED', 'EVERY', 'EXCEPT', 'EXCEPTION', 'EXCLUSIVE', 'EXEC', 'EXECUTE', 'EXISTS', 'EXIT', 'EXPLAIN', 'EXTERNAL', 'EXTRACT', 'FALSE', 'FETCH', 'FIELDS', 'FILE', 'FILLFACTOR', 'FIRST', 'FLOAT', 'FOR', 'FORCE', 'FOREIGN', 'FOUND', 'FRAC_SECOND', 'FREE', 'FREETEXT', 'FREETEXTTABLE', 'FREEZE', 'FROM', 'FULL', 'FULLTEXT', 'FUNCTION', 'GENERAL', 'GET', 'GLOB', 'GLOBAL', 'GO', 'GOTO', 'GRANT', 'GROUP', 'GROUPING', 'HAVING', 'HIGH_PRIORITY', 'HOLDLOCK', 'HOST', 'HOUR', 'HOUR_MICROSECOND', 'HOUR_MINUTE', 'HOUR_SECOND', 'IDENTIFIED', 'IDENTITY', 'IDENTITY_INSERT', 'IDENTITYCOL', 'IF', 'IGNORE', 'ILIKE', 'IMMEDIATE', 'IN', 'INCREMENT', 'INDEX', 'INDICATOR', 'INFILE', 'INITIAL', 'INITIALIZE', 'INITIALLY', 'INNER', 'INNODB', 'INOUT', 'INPUT', 'INSENSITIVE', 'INSERT', 'INT', 'INTEGER', 'INTERSECT', 'INTERVAL', 'INTO', 'IO_THREAD', 'IS', 'ISNULL', 'ISOLATION', 'ITERATE', 'JOIN', 'KEY', 'KEYS', 'KILL', 'LANGUAGE', 'LARGE', 'LAST', 'LATERAL', 'LEADING', 'LEAVE', 'LEFT', 'LESS', 'LEVEL', 'LIKE', 'LIMIT', 'LINENO', 'LINES', 'LOAD', 'LOCAL', 'LOCALTIME', 'LOCALTIMESTAMP', 'LOCATOR', 'LOCK', 'LONG', 'LONGBLOB', 'LONGTEXT', 'LOOP', 'LOW_PRIORITY', 'LOWER', 'MAIN', 'MAP', 'MASTER_SERVER_ID', 'MATCH', 'MAX', 'MAXEXTENTS', 'MEDIUMBLOB', 'MEDIUMINT', 'MEDIUMTEXT', 'MIDDLEINT', 'MIN', 'MINUS', 'MINUTE', 'MINUTE_MICROSECOND', 'MINUTE_SECOND', 'MLSLABEL', 'MOD', 'MODE', 'MODIFIES', 'MODIFY', 'MODULE', 'MONTH', 'NAMES', 'NATIONAL', 'NATURAL', 'NCHAR', 'NCLOB', 'NEW', 'NEXT', 'NO', 'NO_WRITE_TO_BINLOG', 'NOAUDIT', 'NOCHECK', 'NOCOMPRESS', 'NONCLUSTERED', 'NONE', 'NOT', 'NOTNULL', 'NOWAIT', 'NULL', 'NULLIF', 'NUMBER', 'NUMERIC', 'OBJECT', 'OCTET_LENGTH', 'OF', 'OFF', 'OFFLINE', 'OFFSET', 'OFFSETS', 'OID', 'OLD', 'ON', 'ONLINE', 'ONLY', 'OPEN', 'OPENDATASOURCE', 'OPENQUERY', 'OPENROWSET', 'OPENXML', 'OPERATION', 'OPTIMIZE', 'OPTION', 'OPTIONALLY', 'OR', 'ORDER', 'ORDINALITY', 'OUT', 'OUTER', 'OUTFILE', 'OUTPUT', 'OVER', 'OVERLAPS', 'PAD', 'PARAMETER', 'PARAMETERS', 'PARTIAL', 'PATH', 'PCTFREE', 'PERCENT', 'PLACING', 'PLAN', 'POSITION', 'POSTFIX', 'PRECISION', 'PREFIX', 'PREORDER', 'PREPARE', 'PRESERVE', 'PRIMARY', 'PRINT', 'PRIOR', 'PRIVILEGES', 'PROC', 'PROCEDURE', 'PUBLIC', 'PURGE', 'RAISERROR', 'RAW', 'READ', 'READS', 'READTEXT', 'REAL', 'RECONFIGURE', 'RECURSIVE', 'REF', 'REFERENCES', 'REFERENCING', 'REGEXP', 'RELATIVE', 'RENAME', 'REPEAT', 'REPLACE', 'REPLICATION', 'REQUIRE', 'RESOURCE', 'RESTORE', 'RESTRICT', 'RESULT', 'RETURN', 'RETURNS', 'REVOKE', 'RIGHT', 'RLIKE', 'ROLE', 'ROLLBACK', 'ROLLUP', 'ROUTINE', 'ROW', 'ROWCOUNT', 'ROWGUIDCOL', 'ROWID', 'ROWNUM', 'ROWS', 'RULE', 'SAVE', 'SAVEPOINT', 'SCHEMA', 'SCOPE', 'SCROLL', 'SEARCH', 'SECOND', 'SECOND_MICROSECOND', 'SECTION', 'SELECT', 'SENSITIVE', 'SEPARATOR', 'SEQUENCE', 'SESSION', 'SESSION_USER', 'SET', 'SETS', 'SETUSER', 'SHARE', 'SHOW', 'SHUTDOWN', 'SIMILAR', 'SIZE', 'SMALLINT', 'SOME', 'SONAME', 'SPACE', 'SPATIAL', 'SPECIFIC', 'SPECIFICTYPE', 'SQL', 'SQL_BIG_RESULT', 'SQL_CALC_FOUND_ROWS', 'SQL_SMALL_RESULT', 'SQL_TSI_DAY', 'SQL_TSI_FRAC_SECOND', 'SQL_TSI_HOUR', 'SQL_TSI_MINUTE', 'SQL_TSI_MONTH', 'SQL_TSI_QUARTER', 'SQL_TSI_SECOND', 'SQL_TSI_WEEK', 'SQL_TSI_YEAR', 'SQLCODE', 'SQLERROR', 'SQLEXCEPTION', 'SQLITE_MASTER', 'SQLITE_TEMP_MASTER', 'SQLSTATE', 'SQLWARNING', 'SSL', 'START', 'STARTING', 'STATE', 'STATEMENT', 'STATIC', 'STATISTICS', 'STRAIGHT_JOIN', 'STRIPED', 'STRUCTURE', 'SUBSTRING', 'SUCCESSFUL', 'SUM', 'SYNONYM', 'SYSDATE', 'SYSTEM_USER', 'TABLE', 'TABLES', 'TEMPORARY', 'TERMINATE', 'TERMINATED', 'TEXTSIZE', 'THAN', 'THEN', 'TIME', 'TIMESTAMP', 'TIMESTAMPADD', 'TIMESTAMPDIFF', 'TIMEZONE_HOUR', 'TIMEZONE_MINUTE', 'TINYBLOB', 'TINYINT', 'TINYTEXT', 'TO', 'TOP', 'TRAILING', 'TRAN', 'TRANSACTION', 'TRANSLATE', 'TRANSLATION', 'TREAT', 'TRIGGER', 'TRIM', 'TRUE', 'TRUNCATE', 'TSEQUAL', 'UID', 'UNDER', 'UNDO', 'UNION', 'UNIQUE', 'UNKNOWN', 'UNLOCK', 'UNNEST', 'UNSIGNED', 'UPDATE', 'UPDATETEXT', 'UPPER', 'USAGE', 'USE', 'USER', 'USER_RESOURCES', 'USING', 'UTC_DATE', 'UTC_TIME', 'UTC_TIMESTAMP', 'VALIDATE', 'VALUE', 'VALUES', 'VARBINARY', 'VARCHAR', 'VARCHAR2', 'VARCHARACTER', 'VARIABLE', 'VARYING', 'VERBOSE', 'VIEW', 'WAITFOR', 'WHEN', 'WHENEVER', 'WHERE', 'WHILE', 'WITH', 'WITHOUT', 'WORK', 'WRITE', 'WRITETEXT', 'XOR', 'YEAR', 'YEAR_MONTH', 'ZEROFILL', 'ZONE', ); } ?> Manager/000077500000000000000000000000001262614675700340175ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package/packagefiles/DB_Table/DB/Tableibase.php000066400000000000000000000360671262614675700356270ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package/packagefiles/DB_Table/DB/Table/Manager * @license http://www.gnu.org/copyleft/lesser.html LGPL * @version $Id: ibase.php,v 1.4 2007/04/03 03:39:42 morse Exp $ */ /** * require DB_Table class */ require_once 'DB/Table.php'; /** * * Index, constraint and alter methods for DB_Table usage with * PEAR::DB as backend. (Code adopted from PEAR::MDB2) * * @category Database * @package DB_Table * @author Mark Wiesemann */ class DB_Table_Manager_ibase { /** * * The PEAR DB object that connects to the database. * * @access private * * @var object * */ var $_db = null; /** * list all indexes in a table * * @param string $table name of table that should be used in method * @return mixed data array on success, a PEAR error on failure * @access public */ function listTableIndexes($table) { $table = strtoupper($table); $query = "SELECT RDB\$INDEX_NAME FROM RDB\$INDICES WHERE UPPER(RDB\$RELATION_NAME)='$table' AND RDB\$UNIQUE_FLAG IS NULL AND RDB\$FOREIGN_KEY IS NULL"; $indexes = $this->_db->getCol($query); if (PEAR::isError($indexes)) { return $indexes; } $result = array(); foreach ($indexes as $index) { $result[trim($index)] = true; } $result = array_change_key_case($result, CASE_LOWER); return array_keys($result); } /** * list all constraints in a table * * @param string $table name of table that should be used in method * @return mixed data array on success, a PEAR error on failure * @access public */ function listTableConstraints($table) { $table = strtoupper($table); $query = "SELECT RDB\$INDEX_NAME FROM RDB\$INDICES WHERE UPPER(RDB\$RELATION_NAME)='$table' AND ( RDB\$UNIQUE_FLAG IS NOT NULL OR RDB\$FOREIGN_KEY IS NOT NULL )"; $constraints = $this->_db->getCol($query); if (PEAR::isError($constraints)) { return $constraints; } $result = array(); foreach ($constraints as $constraint) { $result[trim($constraint)] = true; } $result = array_change_key_case($result, CASE_LOWER); return array_keys($result); } /** * get the structure of an index into an array * * @param string $table name of table that should be used in method * @param string $index_name name of index that should be used in method * @return mixed data array on success, a PEAR error on failure * @access public */ function getTableIndexDefinition($table, $index_name) { $table = strtoupper($table); $index_name = strtoupper($index_name); $query = "SELECT RDB\$INDEX_SEGMENTS.RDB\$FIELD_NAME AS field_name, RDB\$INDICES.RDB\$UNIQUE_FLAG AS unique_flag, RDB\$INDICES.RDB\$FOREIGN_KEY AS foreign_key, RDB\$INDICES.RDB\$DESCRIPTION AS description FROM RDB\$INDEX_SEGMENTS LEFT JOIN RDB\$INDICES ON RDB\$INDICES.RDB\$INDEX_NAME = RDB\$INDEX_SEGMENTS.RDB\$INDEX_NAME LEFT JOIN RDB\$RELATION_CONSTRAINTS ON RDB\$RELATION_CONSTRAINTS.RDB\$INDEX_NAME = RDB\$INDEX_SEGMENTS.RDB\$INDEX_NAME WHERE UPPER(RDB\$INDICES.RDB\$RELATION_NAME)='$table' AND UPPER(RDB\$INDICES.RDB\$INDEX_NAME)='$index_name' AND RDB\$RELATION_CONSTRAINTS.RDB\$CONSTRAINT_TYPE IS NULL ORDER BY RDB\$INDEX_SEGMENTS.RDB\$FIELD_POSITION;"; $result = $this->_db->query($query); if (PEAR::isError($result)) { return $result; } $index = $row = $result->fetchRow(DB_FETCHMODE_ASSOC); $fields = array(); do { $row = array_change_key_case($row, CASE_LOWER); $fields[] = $row['field_name']; } while (is_array($row = $result->fetchRow(DB_FETCHMODE_ASSOC))); $result->free(); $fields = array_map('strtolower', $fields); $definition = array(); $index = array_change_key_case($index, CASE_LOWER); foreach ($fields as $field) { $definition['fields'][$field] = array(); } return $definition; } /** * get the structure of a constraint into an array * * @param string $table name of table that should be used in method * @param string $index_name name of index that should be used in method * @return mixed data array on success, a PEAR error on failure * @access public */ function getTableConstraintDefinition($table, $index_name) { $table = strtoupper($table); $index_name = strtoupper($index_name); $query = "SELECT RDB\$INDEX_SEGMENTS.RDB\$FIELD_NAME AS field_name, RDB\$INDICES.RDB\$UNIQUE_FLAG AS unique_flag, RDB\$INDICES.RDB\$FOREIGN_KEY AS foreign_key, RDB\$INDICES.RDB\$DESCRIPTION AS description, RDB\$RELATION_CONSTRAINTS.RDB\$CONSTRAINT_TYPE AS constraint_type FROM RDB\$INDEX_SEGMENTS LEFT JOIN RDB\$INDICES ON RDB\$INDICES.RDB\$INDEX_NAME = RDB\$INDEX_SEGMENTS.RDB\$INDEX_NAME LEFT JOIN RDB\$RELATION_CONSTRAINTS ON RDB\$RELATION_CONSTRAINTS.RDB\$INDEX_NAME = RDB\$INDEX_SEGMENTS.RDB\$INDEX_NAME WHERE UPPER(RDB\$INDICES.RDB\$RELATION_NAME)='$table' AND UPPER(RDB\$INDICES.RDB\$INDEX_NAME)='$index_name' ORDER BY RDB\$INDEX_SEGMENTS.RDB\$FIELD_POSITION;"; $result = $this->_db->query($query); if (PEAR::isError($result)) { return $result; } $index = $row = $result->fetchRow(DB_FETCHMODE_ASSOC); $fields = array(); do { $row = array_change_key_case($row, CASE_LOWER); $fields[] = $row['field_name']; } while (is_array($row = $result->fetchRow(DB_FETCHMODE_ASSOC))); $result->free(); $fields = array_map('strtolower', $fields); $definition = array(); $index = array_change_key_case($index, CASE_LOWER); if ($index['constraint_type'] == 'PRIMARY KEY') { $definition['primary'] = true; } if ($index['unique_flag']) { $definition['unique'] = true; } foreach ($fields as $field) { $definition['fields'][$field] = array(); } return $definition; } /** * drop existing index * * @param string $table name of table that should be used in method * @param string $name name of the index to be dropped * @return mixed DB_OK on success, a PEAR error on failure * @access public */ function dropIndex($table, $name) { $name = $this->_db->quoteIdentifier($name); return $this->_db->query("DROP INDEX $name"); } /** * drop existing constraint * * @param string $table name of table that should be used in method * @param string $name name of the constraint to be dropped * @return mixed DB_OK on success, a PEAR error on failure * @access public */ function dropConstraint($table, $name) { $table = $this->_db->quoteIdentifier($table); $name = $this->_db->quoteIdentifier($name); return $this->_db->query("ALTER TABLE $table DROP CONSTRAINT $name"); } /** * alter an existing table * * @param string $name name of the table that is intended to be changed. * @param array $changes associative array that contains the details of each type * of change that is intended to be performed. The types of * changes that are currently supported are defined as follows: * * name * * New name for the table. * * add * * Associative array with the names of fields to be added as * indexes of the array. The value of each entry of the array * should be set to another associative array with the properties * of the fields to be added. The properties of the fields should * be the same as defined by the Metabase parser. * * * remove * * Associative array with the names of fields to be removed as indexes * of the array. Currently the values assigned to each entry are ignored. * An empty array should be used for future compatibility. * * rename * * Associative array with the names of fields to be renamed as indexes * of the array. The value of each entry of the array should be set to * another associative array with the entry named name with the new * field name and the entry named Declaration that is expected to contain * the portion of the field declaration already in DBMS specific SQL code * as it is used in the CREATE TABLE statement. * * change * * Associative array with the names of the fields to be changed as indexes * of the array. Keep in mind that if it is intended to change either the * name of a field and any other properties, the change array entries * should have the new names of the fields as array indexes. * * The value of each entry of the array should be set to another associative * array with the properties of the fields to that are meant to be changed as * array entries. These entries should be assigned to the new values of the * respective properties. The properties of the fields should be the same * as defined by the Metabase parser. * * Example * array( * 'name' => 'userlist', * 'add' => array( * 'quota' => array( * 'type' => 'integer', * 'unsigned' => 1 * ) * ), * 'remove' => array( * 'file_limit' => array(), * 'time_limit' => array() * ), * 'change' => array( * 'name' => array( * 'length' => '20', * 'definition' => array( * 'type' => 'text', * 'length' => 20, * ), * ) * ), * 'rename' => array( * 'sex' => array( * 'name' => 'gender', * 'definition' => array( * 'type' => 'text', * 'length' => 1, * 'default' => 'M', * ), * ) * ) * ) * * @param boolean $check (ignored in DB_Table) * @access public * * @return mixed DB_OK on success, a PEAR error on failure */ function alterTable($name, $changes, $check) { foreach ($changes as $change_name => $change) { switch ($change_name) { case 'add': case 'remove': case 'rename': case 'change': break; default: return DB_Table::throwError(DB_TABLE_ERR_ALTER_TABLE_IMPOS); } } $query = ''; if (array_key_exists('add', $changes)) { foreach ($changes['add'] as $field_name => $field) { if ($query) { $query.= ', '; } $query.= 'ADD ' . $field_name . ' ' . $field; } } if (array_key_exists('remove', $changes)) { foreach ($changes['remove'] as $field_name => $field) { if ($query) { $query.= ', '; } $field_name = $this->_db->quoteIdentifier($field_name); $query.= 'DROP ' . $field_name; } } if (array_key_exists('rename', $changes)) { foreach ($changes['rename'] as $field_name => $field) { if ($query) { $query.= ', '; } $field_name = $this->_db->quoteIdentifier($field_name); $query.= 'ALTER ' . $field_name . ' TO ' . $this->_db->quoteIdentifier($field['name']); } } if (array_key_exists('change', $changes)) { // missing support to change DEFAULT and NULLability foreach ($changes['change'] as $field_name => $field) { if ($query) { $query.= ', '; } $field_name = $this->_db->quoteIdentifier($field_name); $query.= 'ALTER ' . $field_name.' TYPE ' . $field['definition']; } } if (!strlen($query)) { return DB_OK; } $name = $this->_db->quoteIdentifier($name); $result = $this->_db->query("ALTER TABLE $name $query"); return $result; } } ?> mysql.php000066400000000000000000000346711262614675700357100ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package/packagefiles/DB_Table/DB/Table/Manager * @license http://www.gnu.org/copyleft/lesser.html LGPL * @version $Id: mysql.php,v 1.4 2007/04/03 03:39:42 morse Exp $ */ /** * require DB_Table class */ require_once 'DB/Table.php'; /** * Index, constraint and alter methods for DB_Table usage with * PEAR::DB as backend. (Code adopted from PEAR::MDB2) * * @category Database * @package DB_Table * @author Mark Wiesemann */ class DB_Table_Manager_mysql { /** * * The PEAR DB object that connects to the database. * * @access private * * @var object * */ var $_db = null; /** * list all indexes in a table * * @param string $table name of table that should be used in method * @return mixed data array on success, a PEAR error on failure * @access public */ function listTableIndexes($table) { $key_name = 'Key_name'; $non_unique = 'Non_unique'; $query = "SHOW INDEX FROM $table"; $indexes = $this->_db->getAll($query, null, DB_FETCHMODE_ASSOC); if (PEAR::isError($indexes)) { return $indexes; } $result = array(); foreach ($indexes as $index_data) { if ($index_data[$non_unique]) { $result[$index_data[$key_name]] = true; } } $result = array_change_key_case($result, CASE_LOWER); return array_keys($result); } /** * list all constraints in a table * * @param string $table name of table that should be used in method * @return mixed data array on success, a PEAR error on failure * @access public */ function listTableConstraints($table) { $key_name = 'Key_name'; $non_unique = 'Non_unique'; $query = "SHOW INDEX FROM $table"; $indexes = $this->_db->getAll($query, null, DB_FETCHMODE_ASSOC); if (PEAR::isError($indexes)) { return $indexes; } $result = array(); foreach ($indexes as $index_data) { if (!$index_data[$non_unique]) { if ($index_data[$key_name] !== 'PRIMARY') { $index = $index_data[$key_name]; } else { $index = 'PRIMARY'; } $result[$index] = true; } } $result = array_change_key_case($result, CASE_LOWER); return array_keys($result); } /** * get the structure of an index into an array * * @param string $table name of table that should be used in method * @param string $index_name name of index that should be used in method * @return mixed data array on success, a PEAR error on failure * @access public */ function getTableIndexDefinition($table, $index_name) { $result = $this->_db->query("SHOW INDEX FROM $table"); if (PEAR::isError($result)) { return $result; } $definition = array(); while (is_array($row = $result->fetchRow(DB_FETCHMODE_ASSOC))) { $row = array_change_key_case($row, CASE_LOWER); $key_name = $row['key_name']; $key_name = strtolower($key_name); if ($index_name == $key_name) { $column_name = $row['column_name']; $column_name = strtolower($column_name); $definition['fields'][$column_name] = array(); if (array_key_exists('collation', $row)) { $definition['fields'][$column_name]['sorting'] = ($row['collation'] == 'A' ? 'ascending' : 'descending'); } } } $result->free(); return $definition; } /** * get the structure of a constraint into an array * * @param string $table name of table that should be used in method * @param string $index_name name of index that should be used in method * @return mixed data array on success, a PEAR error on failure * @access public */ function getTableConstraintDefinition($table, $index_name) { $result = $this->_db->query("SHOW INDEX FROM $table"); if (PEAR::isError($result)) { return $result; } $definition = array(); while (is_array($row = $result->fetchRow(DB_FETCHMODE_ASSOC))) { $row = array_change_key_case($row, CASE_LOWER); $key_name = $row['key_name']; $key_name = strtolower($key_name); if ($index_name == $key_name) { if ($row['key_name'] == 'PRIMARY') { $definition['primary'] = true; } else { $definition['unique'] = true; } $column_name = $row['column_name']; $column_name = strtolower($column_name); $definition['fields'][$column_name] = array(); if (array_key_exists('collation', $row)) { $definition['fields'][$column_name]['sorting'] = ($row['collation'] == 'A' ? 'ascending' : 'descending'); } } } $result->free(); return $definition; } /** * drop existing index * * @param string $table name of table that should be used in method * @param string $name name of the index to be dropped * @return mixed DB_OK on success, a PEAR error on failure * @access public */ function dropIndex($table, $name) { $table = $this->_db->quoteIdentifier($table); $name = $this->_db->quoteIdentifier($name); return $this->_db->query("DROP INDEX $name ON $table"); } /** * drop existing constraint * * @param string $table name of table that should be used in method * @param string $name name of the constraint to be dropped * @return mixed DB_OK on success, a PEAR error on failure * @access public */ function dropConstraint($table, $name) { $table = $this->_db->quoteIdentifier($table); if (strtolower($name) == 'primary') { $query = "ALTER TABLE $table DROP PRIMARY KEY"; } else { $name = $this->_db->quoteIdentifier($name); $query = "ALTER TABLE $table DROP INDEX $name"; } return $this->_db->query($query); } /** * alter an existing table * * @param string $name name of the table that is intended to be changed. * @param array $changes associative array that contains the details of each type * of change that is intended to be performed. The types of * changes that are currently supported are defined as follows: * * name * * New name for the table. * * add * * Associative array with the names of fields to be added as * indexes of the array. The value of each entry of the array * should be set to another associative array with the properties * of the fields to be added. The properties of the fields should * be the same as defined by the Metabase parser. * * * remove * * Associative array with the names of fields to be removed as indexes * of the array. Currently the values assigned to each entry are ignored. * An empty array should be used for future compatibility. * * rename * * Associative array with the names of fields to be renamed as indexes * of the array. The value of each entry of the array should be set to * another associative array with the entry named name with the new * field name and the entry named Declaration that is expected to contain * the portion of the field declaration already in DBMS specific SQL code * as it is used in the CREATE TABLE statement. * * change * * Associative array with the names of the fields to be changed as indexes * of the array. Keep in mind that if it is intended to change either the * name of a field and any other properties, the change array entries * should have the new names of the fields as array indexes. * * The value of each entry of the array should be set to another associative * array with the properties of the fields to that are meant to be changed as * array entries. These entries should be assigned to the new values of the * respective properties. The properties of the fields should be the same * as defined by the Metabase parser. * * Example * array( * 'name' => 'userlist', * 'add' => array( * 'quota' => array( * 'type' => 'integer', * 'unsigned' => 1 * ) * ), * 'remove' => array( * 'file_limit' => array(), * 'time_limit' => array() * ), * 'change' => array( * 'name' => array( * 'length' => '20', * 'definition' => array( * 'type' => 'text', * 'length' => 20, * ), * ) * ), * 'rename' => array( * 'sex' => array( * 'name' => 'gender', * 'definition' => array( * 'type' => 'text', * 'length' => 1, * 'default' => 'M', * ), * ) * ) * ) * * @param boolean $check (ignored in DB_Table) * @access public * * @return mixed DB_OK on success, a PEAR error on failure */ function alterTable($name, $changes, $check) { foreach ($changes as $change_name => $change) { switch ($change_name) { case 'add': case 'remove': case 'change': case 'rename': case 'name': break; default: return DB_Table::throwError(DB_TABLE_ERR_ALTER_TABLE_IMPOS); } } $query = ''; if (array_key_exists('name', $changes)) { $change_name = $this->_db->quoteIdentifier($changes['name']); $query .= 'RENAME TO ' . $change_name; } if (array_key_exists('add', $changes)) { foreach ($changes['add'] as $field_name => $field) { if ($query) { $query.= ', '; } $query.= 'ADD ' . $field_name . ' ' . $field; } } if (array_key_exists('remove', $changes)) { foreach ($changes['remove'] as $field_name => $field) { if ($query) { $query.= ', '; } $field_name = $this->_db->quoteIdentifier($field_name); $query.= 'DROP ' . $field_name; } } $rename = array(); if (array_key_exists('rename', $changes)) { foreach ($changes['rename'] as $field_name => $field) { $rename[$field['name']] = $field_name; } } if (array_key_exists('change', $changes)) { foreach ($changes['change'] as $field_name => $field) { if ($query) { $query.= ', '; } if (isset($rename[$field_name])) { $old_field_name = $rename[$field_name]; unset($rename[$field_name]); } else { $old_field_name = $field_name; } $old_field_name = $this->_db->quoteIdentifier($old_field_name); $query.= "CHANGE $old_field_name " . $field_name . ' ' . $field['definition']; } } if (!empty($rename)) { foreach ($rename as $rename_name => $renamed_field) { if ($query) { $query.= ', '; } $field = $changes['rename'][$renamed_field]; $renamed_field = $this->_db->quoteIdentifier($renamed_field); $query.= 'CHANGE ' . $renamed_field . ' ' . $field['name'] . ' ' . $renamed_field['definition']; } } if (!$query) { return DB_OK; } $name = $this->_db->quoteIdentifier($name); return $this->_db->query("ALTER TABLE $name $query"); } } ?> mysqli.php000066400000000000000000000346711262614675700360610ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package/packagefiles/DB_Table/DB/Table/Manager * @license http://www.gnu.org/copyleft/lesser.html LGPL * @version $Id: mysqli.php,v 1.5 2007/04/03 03:39:42 morse Exp $ */ /** * require DB_Table class */ require_once 'DB/Table.php'; /** * Index, constraint and alter methods for DB_Table usage with * PEAR::DB as backend. (Code adopted from PEAR::MDB2) * * @category Database * @package DB_Table * @author Mark Wiesemann */ class DB_Table_Manager_mysqli { /** * * The PEAR DB object that connects to the database. * * @access private * * @var object * */ var $_db = null; /** * list all indexes in a table * * @param string $table name of table that should be used in method * @return mixed data array on success, a PEAR error on failure * @access public */ function listTableIndexes($table) { $key_name = 'Key_name'; $non_unique = 'Non_unique'; $query = "SHOW INDEX FROM $table"; $indexes = $this->_db->getAll($query, null, DB_FETCHMODE_ASSOC); if (PEAR::isError($indexes)) { return $indexes; } $result = array(); foreach ($indexes as $index_data) { if ($index_data[$non_unique]) { $result[$index_data[$key_name]] = true; } } $result = array_change_key_case($result, CASE_LOWER); return array_keys($result); } /** * list all constraints in a table * * @param string $table name of table that should be used in method * @return mixed data array on success, a PEAR error on failure * @access public */ function listTableConstraints($table) { $key_name = 'Key_name'; $non_unique = 'Non_unique'; $query = "SHOW INDEX FROM $table"; $indexes = $this->_db->getAll($query, null, DB_FETCHMODE_ASSOC); if (PEAR::isError($indexes)) { return $indexes; } $result = array(); foreach ($indexes as $index_data) { if (!$index_data[$non_unique]) { if ($index_data[$key_name] !== 'PRIMARY') { $index = $index_data[$key_name]; } else { $index = 'PRIMARY'; } $result[$index] = true; } } $result = array_change_key_case($result, CASE_LOWER); return array_keys($result); } /** * get the structure of an index into an array * * @param string $table name of table that should be used in method * @param string $index_name name of index that should be used in method * @return mixed data array on success, a PEAR error on failure * @access public */ function getTableIndexDefinition($table, $index_name) { $result = $this->_db->query("SHOW INDEX FROM $table"); if (PEAR::isError($result)) { return $result; } $definition = array(); while (is_array($row = $result->fetchRow(DB_FETCHMODE_ASSOC))) { $row = array_change_key_case($row, CASE_LOWER); $key_name = $row['key_name']; $key_name = strtolower($key_name); if ($index_name == $key_name) { $column_name = $row['column_name']; $column_name = strtolower($column_name); $definition['fields'][$column_name] = array(); if (array_key_exists('collation', $row)) { $definition['fields'][$column_name]['sorting'] = ($row['collation'] == 'A' ? 'ascending' : 'descending'); } } } $result->free(); return $definition; } /** * get the structure of a constraint into an array * * @param string $table name of table that should be used in method * @param string $index_name name of index that should be used in method * @return mixed data array on success, a PEAR error on failure * @access public */ function getTableConstraintDefinition($table, $index_name) { $result = $this->_db->query("SHOW INDEX FROM $table"); if (PEAR::isError($result)) { return $result; } $definition = array(); while (is_array($row = $result->fetchRow(DB_FETCHMODE_ASSOC))) { $row = array_change_key_case($row, CASE_LOWER); $key_name = $row['key_name']; $key_name = strtolower($key_name); if ($index_name == $key_name) { if ($row['key_name'] == 'PRIMARY') { $definition['primary'] = true; } else { $definition['unique'] = true; } $column_name = $row['column_name']; $column_name = strtolower($column_name); $definition['fields'][$column_name] = array(); if (array_key_exists('collation', $row)) { $definition['fields'][$column_name]['sorting'] = ($row['collation'] == 'A' ? 'ascending' : 'descending'); } } } $result->free(); return $definition; } /** * drop existing index * * @param string $table name of table that should be used in method * @param string $name name of the index to be dropped * @return mixed DB_OK on success, a PEAR error on failure * @access public */ function dropIndex($table, $name) { $table = $this->_db->quoteIdentifier($table); $name = $this->_db->quoteIdentifier($name); return $this->_db->query("DROP INDEX $name ON $table"); } /** * drop existing constraint * * @param string $table name of table that should be used in method * @param string $name name of the constraint to be dropped * @return mixed DB_OK on success, a PEAR error on failure * @access public */ function dropConstraint($table, $name) { $table = $this->_db->quoteIdentifier($table); if (strtolower($name) == 'primary') { $query = "ALTER TABLE $table DROP PRIMARY KEY"; } else { $name = $this->_db->quoteIdentifier($name); $query = "ALTER TABLE $table DROP INDEX $name"; } return $this->_db->query($query); } /** * alter an existing table * * @param string $name name of the table that is intended to be changed. * @param array $changes associative array that contains the details of each type * of change that is intended to be performed. The types of * changes that are currently supported are defined as follows: * * name * * New name for the table. * * add * * Associative array with the names of fields to be added as * indexes of the array. The value of each entry of the array * should be set to another associative array with the properties * of the fields to be added. The properties of the fields should * be the same as defined by the Metabase parser. * * * remove * * Associative array with the names of fields to be removed as indexes * of the array. Currently the values assigned to each entry are ignored. * An empty array should be used for future compatibility. * * rename * * Associative array with the names of fields to be renamed as indexes * of the array. The value of each entry of the array should be set to * another associative array with the entry named name with the new * field name and the entry named Declaration that is expected to contain * the portion of the field declaration already in DBMS specific SQL code * as it is used in the CREATE TABLE statement. * * change * * Associative array with the names of the fields to be changed as indexes * of the array. Keep in mind that if it is intended to change either the * name of a field and any other properties, the change array entries * should have the new names of the fields as array indexes. * * The value of each entry of the array should be set to another associative * array with the properties of the fields to that are meant to be changed as * array entries. These entries should be assigned to the new values of the * respective properties. The properties of the fields should be the same * as defined by the Metabase parser. * * Example * array( * 'name' => 'userlist', * 'add' => array( * 'quota' => array( * 'type' => 'integer', * 'unsigned' => 1 * ) * ), * 'remove' => array( * 'file_limit' => array(), * 'time_limit' => array() * ), * 'change' => array( * 'name' => array( * 'length' => '20', * 'definition' => array( * 'type' => 'text', * 'length' => 20, * ), * ) * ), * 'rename' => array( * 'sex' => array( * 'name' => 'gender', * 'definition' => array( * 'type' => 'text', * 'length' => 1, * 'default' => 'M', * ), * ) * ) * ) * * @param boolean $check (ignored in DB_Table) * @access public * * @return mixed DB_OK on success, a PEAR error on failure */ function alterTable($name, $changes, $check) { foreach ($changes as $change_name => $change) { switch ($change_name) { case 'add': case 'remove': case 'change': case 'rename': case 'name': break; default: return DB_Table::throwError(DB_TABLE_ERR_ALTER_TABLE_IMPOS); } } $query = ''; if (array_key_exists('name', $changes)) { $change_name = $this->_db->quoteIdentifier($changes['name']); $query .= 'RENAME TO ' . $change_name; } if (array_key_exists('add', $changes)) { foreach ($changes['add'] as $field_name => $field) { if ($query) { $query.= ', '; } $query.= 'ADD ' . $field_name . ' ' . $field; } } if (array_key_exists('remove', $changes)) { foreach ($changes['remove'] as $field_name => $field) { if ($query) { $query.= ', '; } $field_name = $db->quoteIdentifier($field_name); $query.= 'DROP ' . $field_name; } } $rename = array(); if (array_key_exists('rename', $changes)) { foreach ($changes['rename'] as $field_name => $field) { $rename[$field['name']] = $field_name; } } if (array_key_exists('change', $changes)) { foreach ($changes['change'] as $field_name => $field) { if ($query) { $query.= ', '; } if (isset($rename[$field_name])) { $old_field_name = $rename[$field_name]; unset($rename[$field_name]); } else { $old_field_name = $field_name; } $old_field_name = $this->_db->quoteIdentifier($old_field_name); $query.= "CHANGE $old_field_name " . $field_name . ' ' . $field['definition']; } } if (!empty($rename)) { foreach ($rename as $rename_name => $renamed_field) { if ($query) { $query.= ', '; } $field = $changes['rename'][$renamed_field]; $renamed_field = $this->_db->quoteIdentifier($renamed_field); $query.= 'CHANGE ' . $renamed_field . ' ' . $field['name'] . ' ' . $renamed_field['definition']; } } if (!$query) { return DB_OK; } $name = $this->_db->quoteIdentifier($name); return $this->_db->query("ALTER TABLE $name $query"); } } ?> oci8.php000066400000000000000000000347761262614675700354130ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package/packagefiles/DB_Table/DB/Table/Manager * @license http://www.gnu.org/copyleft/lesser.html LGPL * @version $Id: oci8.php,v 1.4 2007/04/03 03:39:42 morse Exp $ */ /** * require DB_Table class */ require_once 'DB/Table.php'; /** * Index, constraint and alter methods for DB_Table usage with * PEAR::DB as backend. (Code adopted from PEAR::MDB2) * * @category Database * @package DB_Table * @author Mark Wiesemann */ class DB_Table_Manager_oci8 { /** * * The PEAR DB object that connects to the database. * * @access private * * @var object * */ var $_db = null; /** * list all indexes in a table * * @param string $table name of table that should be used in method * @return mixed data array on success, a PEAR error on failure * @access public */ function listTableIndexes($table) { $table = strtoupper($table); $query = "SELECT index_name name FROM user_indexes WHERE table_name='$table'"; $indexes = $this->_db->getCol($query); if (PEAR::isError($indexes)) { return $indexes; } $result = array(); foreach ($indexes as $index) { $result[$index] = true; } $result = array_change_key_case($result, CASE_LOWER); return array_keys($result); } /** * list all constraints in a table * * @param string $table name of table that should be used in method * @return mixed data array on success, a PEAR error on failure * @access public */ function listTableConstraints($table) { $table = strtoupper($table); $query = "SELECT index_name name FROM user_constraints WHERE table_name='$table'"; $constraints = $this->_db->getCol($query); if (PEAR::isError($constraints)) { return $constraints; } $result = array(); foreach ($constraints as $constraint) { $result[$constraint] = true; } $result = array_change_key_case($result, CASE_LOWER); return array_keys($result); } /** * get the structure of an index into an array * * @param string $table name of table that should be used in method * @param string $index_name name of index that should be used in method * @return mixed data array on success, a PEAR error on failure * @access public */ function getTableIndexDefinition($table, $index_name) { $index_name = $this->_db->quoteSmart(strtoupper($index_name)); $table = $this->_db->quoteSmart(strtoupper($table)); $query = "SELECT * FROM user_indexes where table_name = $table AND index_name = $index_name"; $row = $this->_db->getRow($query, null, DB_FETCHMODE_ASSOC); if (PEAR::isError($row)) { return $row; } $definition = array(); if ($row) { $row = array_change_key_case($row, CASE_LOWER); $key_name = $row['index_name']; $key_name = strtolower($key_name); $query = "SELECT * FROM user_ind_columns WHERE index_name = $index_name AND table_name = $table"; $result = $this->_db->query($query); if (PEAR::isError($result)) { return $result; } while ($colrow = $result->fetchRow(DB_FETCHMODE_ASSOC)) { $column_name = $colrow['column_name']; $column_name = strtolower($column_name); $definition['fields'][$column_name] = array(); if (array_key_exists('descend', $colrow)) { $definition['fields'][$column_name]['sorting'] = ($colrow['descend'] == 'ASC' ? 'ascending' : 'descending'); } } $result->free(); } return $definition; } /** * get the structure of a constraint into an array * * @param string $table name of table that should be used in method * @param string $index_name name of index that should be used in method * @return mixed data array on success, a PEAR error on failure * @access public */ function getTableConstraintDefinition($table, $index_name) { $dsn = DB::parseDSN($this->_db->dsn); vd($dsn); $dbName = $this->_db->quoteSmart($dsn['database']); $index_name = $this->_db->quoteSmart($index_name); $table = $this->_db->quoteSmart($table); $query = "SELECT * FROM all_constraints WHERE owner = $dbName AND table_name = $table AND index_name = $index_name"; $result = $this->_db->query($query); if (PEAR::isError($result)) { return $result; } $definition = array(); while (is_array($row = $result->fetchRow(DB_FETCHMODE_ASSOC))) { $row = array_change_key_case($row, CASE_LOWER); $key_name = $row['constraint_name']; $key_name = strtolower($key_name); if ($row) { $definition['primary'] = $row['constraint_type'] == 'P'; $definition['unique'] = $row['constraint_type'] == 'U'; $query = 'SELECT * FROM all_cons_columns WHERE contraint_name = '; $query.= $this->_db->quoteSmart($key_name).' AND table_name = '.$table; $colres = $this->_db->query($query); while ($colrow = $colres->fetchRow(DB_FETCHMODE_ASSOC)) { $column_name = $row['column_name']; $column_name = strtolower($column_name); $definition['fields'][$column_name] = array(); } } } $result->free(); return $definition; } /** * drop existing index * * @param string $table name of table that should be used in method * @param string $name name of the index to be dropped * @return mixed DB_OK on success, a PEAR error on failure * @access public */ function dropIndex($table, $name) { $name = $this->_db->quoteIdentifier($name); return $this->_db->query("DROP INDEX $name"); } /** * drop existing constraint * * @param string $table name of table that should be used in method * @param string $name name of the constraint to be dropped * @return mixed DB_OK on success, a PEAR error on failure * @access public */ function dropConstraint($table, $name) { $table = $this->_db->quoteIdentifier($table); $name = $this->_db->quoteIdentifier($name); return $this->_db->query("ALTER TABLE $table DROP CONSTRAINT $name"); } /** * alter an existing table * * @param string $name name of the table that is intended to be changed. * @param array $changes associative array that contains the details of each type * of change that is intended to be performed. The types of * changes that are currently supported are defined as follows: * * name * * New name for the table. * * add * * Associative array with the names of fields to be added as * indexes of the array. The value of each entry of the array * should be set to another associative array with the properties * of the fields to be added. The properties of the fields should * be the same as defined by the Metabase parser. * * * remove * * Associative array with the names of fields to be removed as indexes * of the array. Currently the values assigned to each entry are ignored. * An empty array should be used for future compatibility. * * rename * * Associative array with the names of fields to be renamed as indexes * of the array. The value of each entry of the array should be set to * another associative array with the entry named name with the new * field name and the entry named Declaration that is expected to contain * the portion of the field declaration already in DBMS specific SQL code * as it is used in the CREATE TABLE statement. * * change * * Associative array with the names of the fields to be changed as indexes * of the array. Keep in mind that if it is intended to change either the * name of a field and any other properties, the change array entries * should have the new names of the fields as array indexes. * * The value of each entry of the array should be set to another associative * array with the properties of the fields to that are meant to be changed as * array entries. These entries should be assigned to the new values of the * respective properties. The properties of the fields should be the same * as defined by the Metabase parser. * * Example * array( * 'name' => 'userlist', * 'add' => array( * 'quota' => array( * 'type' => 'integer', * 'unsigned' => 1 * ) * ), * 'remove' => array( * 'file_limit' => array(), * 'time_limit' => array() * ), * 'change' => array( * 'name' => array( * 'length' => '20', * 'definition' => array( * 'type' => 'text', * 'length' => 20, * ), * ) * ), * 'rename' => array( * 'sex' => array( * 'name' => 'gender', * 'definition' => array( * 'type' => 'text', * 'length' => 1, * 'default' => 'M', * ), * ) * ) * ) * * @param boolean $check (ignored in DB_Table) * @access public * * @return mixed DB_OK on success, a PEAR error on failure */ function alterTable($name, $changes, $check) { foreach ($changes as $change_name => $change) { switch ($change_name) { case 'add': case 'remove': case 'change': case 'name': case 'rename': break; default: return DB_Table::throwError(DB_TABLE_ERR_ALTER_TABLE_IMPOS); } } $name = $this->_db->quoteIdentifier($name); if (array_key_exists('add', $changes)) { $fields = array(); foreach ($changes['add'] as $field_name => $field) { $fields[] = $field_name . ' ' . $field; } $result = $this->_db->query("ALTER TABLE $name ADD (". implode(', ', $fields).')'); if (PEAR::isError($result)) { return $result; } } if (array_key_exists('change', $changes)) { $fields = array(); foreach ($changes['change'] as $field_name => $field) { $fields[] = $field_name. ' ' . $field['definition']; } $result = $this->_db->query("ALTER TABLE $name MODIFY (". implode(', ', $fields).')'); if (PEAR::isError($result)) { return $result; } } if (array_key_exists('rename', $changes)) { foreach ($changes['rename'] as $field_name => $field) { $field_name = $this->_db->quoteIdentifier($field_name); $query = "ALTER TABLE $name RENAME COLUMN $field_name TO ".$this->_db->quoteIdentifier($field['name']); $result = $this->_db->query($query); if (PEAR::isError($result)) { return $result; } } } if (array_key_exists('remove', $changes)) { $fields = array(); foreach ($changes['remove'] as $field_name => $field) { $fields[] = $this->_db->quoteIdentifier($field_name); } $result = $this->_db->query("ALTER TABLE $name DROP COLUMN ". implode(', ', $fields)); if (PEAR::isError($result)) { return $result; } } if (array_key_exists('name', $changes)) { $change_name = $this->_db->quoteIdentifier($changes['name']); $result = $this->_db->query("ALTER TABLE $name RENAME TO ".$change_name); if (PEAR::isError($result)) { return $result; } } return DB_OK; } } ?> pgsql.php000066400000000000000000000364361262614675700356720ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package/packagefiles/DB_Table/DB/Table/Manager * @license http://www.gnu.org/copyleft/lesser.html LGPL * @version $Id: pgsql.php,v 1.4 2007/04/03 03:39:42 morse Exp $ */ /** * require DB_Table class */ require_once 'DB/Table.php'; /** * Index, constraint and alter methods for DB_Table usage with * PEAR::DB as backend. (Code adopted from PEAR::MDB2) * * @category Database * @package DB_Table * @author Mark Wiesemann */ class DB_Table_Manager_pgsql { /** * * The PEAR DB object that connects to the database. * * @access private * * @var object * */ var $_db = null; /** * list all indexes in a table * * @param string $table name of table that should be used in method * @return mixed data array on success, a PEAR error on failure * @access public */ function listTableIndexes($table) { $subquery = "SELECT indexrelid FROM pg_index, pg_class"; $subquery.= " WHERE pg_class.relname='$table' AND pg_class.oid=pg_index.indrelid AND indisunique != 't' AND indisprimary != 't'"; $query = "SELECT relname FROM pg_class WHERE oid IN ($subquery)"; $indexes = $this->_db->getCol($query); if (PEAR::isError($indexes)) { return $indexes; } $result = array(); foreach ($indexes as $index) { $result[$index] = true; } $result = array_change_key_case($result, CASE_LOWER); return array_keys($result); } /** * list all constraints in a table * * @param string $table name of table that should be used in method * @return mixed data array on success, a PEAR error on failure * @access public */ function listTableConstraints($table) { $subquery = "SELECT indexrelid FROM pg_index, pg_class"; $subquery.= " WHERE pg_class.relname='$table' AND pg_class.oid=pg_index.indrelid AND (indisunique = 't' OR indisprimary = 't')"; $query = "SELECT relname FROM pg_class WHERE oid IN ($subquery)"; $constraints = $this->_db->getCol($query); if (PEAR::isError($constraints)) { return $constraints; } $result = array(); foreach ($constraints as $constraint) { $result[$constraint] = true; } $result = array_change_key_case($result, CASE_LOWER); return array_keys($result); } /** * get the structure of an index into an array * * @param string $table name of table that should be used in method * @param string $index_name name of index that should be used in method * @return mixed data array on success, a PEAR error on failure * @access public */ function getTableIndexDefinition($table, $index_name) { $query = "SELECT relname, indkey FROM pg_index, pg_class WHERE pg_class.relname = ".$this->_db->quoteSmart($index_name)." AND pg_class.oid = pg_index.indexrelid AND indisunique != 't' AND indisprimary != 't'"; $row = $this->_db->getRow($query, null, DB_FETCHMODE_ASSOC); if (PEAR::isError($row)) { return $row; } $columns = $this->_listTableFields($table); $definition = array(); $index_column_numbers = explode(' ', $row['indkey']); foreach ($index_column_numbers as $number) { $definition['fields'][$columns[($number - 1)]] = array('sorting' => 'ascending'); } return $definition; } /** * get the structure of a constraint into an array * * @param string $table name of table that should be used in method * @param string $index_name name of index that should be used in method * @return mixed data array on success, a PEAR error on failure * @access public */ function getTableConstraintDefinition($table, $index_name) { $query = "SELECT relname, indisunique, indisprimary, indkey FROM pg_index, pg_class WHERE pg_class.relname = ".$this->_db->quoteSmart($index_name)." AND pg_class.oid = pg_index.indexrelid AND (indisunique = 't' OR indisprimary = 't')"; $row = $this->_db->getRow($query, null, DB_FETCHMODE_ASSOC); if (PEAR::isError($row)) { return $row; } $columns = $this->_listTableFields($table); $definition = array(); if ($row['indisprimary'] == 't') { $definition['primary'] = true; } elseif ($row['indisunique'] == 't') { $definition['unique'] = true; } $index_column_numbers = explode(' ', $row['indkey']); foreach ($index_column_numbers as $number) { $definition['fields'][$columns[($number - 1)]] = array('sorting' => 'ascending'); } return $definition; } /** * list all fields in a tables in the current database * * @param string $table name of table that should be used in method * @return mixed data array on success, a PEAR error on failure * @access private */ function _listTableFields($table) { $table = $this->_db->quoteIdentifier($table); $result2 = $this->_db->query("SELECT * FROM $table"); if (PEAR::isError($result2)) { return $result2; } $columns = array(); $numcols = $result2->numCols(); for ($column = 0; $column < $numcols; $column++) { $column_name = @pg_field_name($result2->result, $column); $columns[$column_name] = $column; } $result2->free(); return array_flip($columns); } /** * drop existing index * * @param string $table name of table that should be used in method * @param string $name name of the index to be dropped * @return mixed DB_OK on success, a PEAR error on failure * @access public */ function dropIndex($table, $name) { $name = $this->_db->quoteIdentifier($name); return $this->_db->query("DROP INDEX $name"); } /** * drop existing constraint * * @param string $table name of table that should be used in method * @param string $name name of the constraint to be dropped * @return mixed DB_OK on success, a PEAR error on failure * @access public */ function dropConstraint($table, $name) { $table = $this->_db->quoteIdentifier($table); $name = $this->_db->quoteIdentifier($name); return $this->_db->query("ALTER TABLE $table DROP CONSTRAINT $name"); } /** * alter an existing table * * @param string $name name of the table that is intended to be changed. * @param array $changes associative array that contains the details of each type * of change that is intended to be performed. The types of * changes that are currently supported are defined as follows: * * name * * New name for the table. * * add * * Associative array with the names of fields to be added as * indexes of the array. The value of each entry of the array * should be set to another associative array with the properties * of the fields to be added. The properties of the fields should * be the same as defined by the Metabase parser. * * * remove * * Associative array with the names of fields to be removed as indexes * of the array. Currently the values assigned to each entry are ignored. * An empty array should be used for future compatibility. * * rename * * Associative array with the names of fields to be renamed as indexes * of the array. The value of each entry of the array should be set to * another associative array with the entry named name with the new * field name and the entry named Declaration that is expected to contain * the portion of the field declaration already in DBMS specific SQL code * as it is used in the CREATE TABLE statement. * * change * * Associative array with the names of the fields to be changed as indexes * of the array. Keep in mind that if it is intended to change either the * name of a field and any other properties, the change array entries * should have the new names of the fields as array indexes. * * The value of each entry of the array should be set to another associative * array with the properties of the fields to that are meant to be changed as * array entries. These entries should be assigned to the new values of the * respective properties. The properties of the fields should be the same * as defined by the Metabase parser. * * Example * array( * 'name' => 'userlist', * 'add' => array( * 'quota' => array( * 'type' => 'integer', * 'unsigned' => 1 * ) * ), * 'remove' => array( * 'file_limit' => array(), * 'time_limit' => array() * ), * 'change' => array( * 'name' => array( * 'length' => '20', * 'definition' => array( * 'type' => 'text', * 'length' => 20, * ), * ) * ), * 'rename' => array( * 'sex' => array( * 'name' => 'gender', * 'definition' => array( * 'type' => 'text', * 'length' => 1, * 'default' => 'M', * ), * ) * ) * ) * * @param boolean $check (ignored in DB_Table) * @access public * * @return mixed DB_OK on success, a PEAR error on failure */ function alterTable($name, $changes, $check) { foreach ($changes as $change_name => $change) { switch ($change_name) { case 'add': case 'remove': case 'change': case 'name': case 'rename': break; default: return DB_Table::throwError(DB_TABLE_ERR_ALTER_TABLE_IMPOS); } } if (array_key_exists('add', $changes)) { foreach ($changes['add'] as $field_name => $field) { $query = 'ADD ' . $field_name . ' ' . $field; $result = $this->_db->query("ALTER TABLE $name $query"); if (PEAR::isError($result)) { return $result; } } } if (array_key_exists('remove', $changes)) { foreach ($changes['remove'] as $field_name => $field) { $field_name = $this->_db->quoteIdentifier($field_name); $query = 'DROP ' . $field_name; $result = $this->_db->query("ALTER TABLE $name $query"); if (PEAR::isError($result)) { return $result; } } } if (array_key_exists('change', $changes)) { foreach ($changes['change'] as $field_name => $field) { $field_name = $this->_db->quoteIdentifier($field_name); if (array_key_exists('type', $field)) { $query = "ALTER $field_name TYPE " . $field['definition']; $result = $this->_db->query("ALTER TABLE $name $query"); if (PEAR::isError($result)) { return $result; } } /* default / notnull changes not (yet) supported in DB_Table if (array_key_exists('default', $field)) { $query = "ALTER $field_name SET DEFAULT ".$db->quote($field['definition']['default'], $field['definition']['type']); $result = $db->exec("ALTER TABLE $name $query"); if (PEAR::isError($result)) { return $result; } } if (array_key_exists('notnull', $field)) { $query.= "ALTER $field_name ".($field['definition']['notnull'] ? "SET" : "DROP").' NOT NULL'; $result = $db->exec("ALTER TABLE $name $query"); if (PEAR::isError($result)) { return $result; } } */ } } if (array_key_exists('rename', $changes)) { foreach ($changes['rename'] as $field_name => $field) { $field_name = $this->_db->quoteIdentifier($field_name); $result = $this->_db->query("ALTER TABLE $name RENAME COLUMN $field_name TO ".$this->_db->quoteIdentifier($field['name'])); if (PEAR::isError($result)) { return $result; } } } $name = $this->_db->quoteIdentifier($name); if (array_key_exists('name', $changes)) { $change_name = $this->_db->quoteIdentifier($changes['name']); $result = $this->_db->query("ALTER TABLE $name RENAME TO ".$change_name); if (PEAR::isError($result)) { return $result; } } return DB_OK; } } ?> sqlite.php000066400000000000000000000334711262614675700360410ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package/packagefiles/DB_Table/DB/Table/Manager * @license http://www.gnu.org/copyleft/lesser.html LGPL * @version $Id: sqlite.php,v 1.4 2007/04/03 03:39:42 morse Exp $ */ /** * Require DB_Table class */ require_once 'DB/Table.php'; /** * Index, constraint and alter methods for DB_Table usage with * PEAR::DB as backend. (Code adopted from PEAR::MDB2) * * @category Database * @package DB_Table * @author Mark Wiesemann */ class DB_Table_Manager_sqlite { /** * * The PEAR DB object that connects to the database. * * @access private * * @var object * */ var $_db = null; /** * list all indexes in a table * * @param string $table name of table that should be used in method * @return mixed data array on success, a PEAR error on failure * @access public */ function listTableIndexes($table) { $query = "SELECT sql FROM sqlite_master WHERE type='index' AND "; $query.= "LOWER(tbl_name)='".strtolower($table)."'"; $query.= " AND sql NOT NULL ORDER BY name"; $indexes = $this->_db->getCol($query); if (PEAR::isError($indexes)) { return $indexes; } $result = array(); foreach ($indexes as $sql) { if (preg_match("/^create index ([^ ]*) on /i", $sql, $tmp)) { $result[$tmp[1]] = true; } } $result = array_change_key_case($result, CASE_LOWER); return array_keys($result); } /** * list all constraints in a table * * @param string $table name of table that should be used in method * @return mixed data array on success, a PEAR error on failure * @access public */ function listTableConstraints($table) { $query = "SELECT sql FROM sqlite_master WHERE type='index' AND "; $query.= "LOWER(tbl_name)='".strtolower($table)."'"; $query.= " AND sql NOT NULL ORDER BY name"; $indexes = $this->_db->getCol($query); if (PEAR::isError($indexes)) { return $indexes; } $result = array(); foreach ($indexes as $sql) { if (preg_match("/^create unique index ([^ ]*) on /i", $sql, $tmp)) { $result[$tmp[1]] = true; } } $result = array_change_key_case($result, CASE_LOWER); return array_keys($result); } /** * get the structure of an index into an array * * @param string $table name of table that should be used in method * @param string $index_name name of index that should be used in method * @return mixed data array on success, a PEAR error on failure * @access public */ function getTableIndexDefinition($table, $index_name) { $query = "SELECT sql FROM sqlite_master WHERE type='index' AND "; $query.= "LOWER(name)='".strtolower($index_name)."' AND LOWER(tbl_name)='".strtolower($table)."'"; $query.= " AND sql NOT NULL ORDER BY name"; $sql = $this->_db->getOne($query); if (PEAR::isError($sql)) { return $sql; } $sql = strtolower($sql); $start_pos = strpos($sql, '('); $end_pos = strrpos($sql, ')'); $column_names = substr($sql, $start_pos+1, $end_pos-$start_pos-1); $column_names = split(',', $column_names); $definition = array(); $count = count($column_names); for ($i=0; $i<$count; ++$i) { $column_name = strtok($column_names[$i]," "); $collation = strtok(" "); $definition['fields'][$column_name] = array(); if (!empty($collation)) { $definition['fields'][$column_name]['sorting'] = ($collation=='ASC' ? 'ascending' : 'descending'); } } return $definition; } /** * get the structure of a constraint into an array * * @param string $table name of table that should be used in method * @param string $index_name name of index that should be used in method * @return mixed data array on success, a PEAR error on failure * @access public */ function getTableConstraintDefinition($table, $index_name) { $query = "SELECT sql FROM sqlite_master WHERE type='index' AND "; $query.= "LOWER(name)='".strtolower($index_name)."' AND LOWER(tbl_name)='".strtolower($table)."'"; $query.= " AND sql NOT NULL ORDER BY name"; $sql = $this->_db->getOne($query); if (PEAR::isError($sql)) { return $sql; } $sql = strtolower($sql); $start_pos = strpos($sql, '('); $end_pos = strrpos($sql, ')'); $column_names = substr($sql, $start_pos+1, $end_pos-$start_pos-1); $column_names = split(',', $column_names); $definition = array(); $definition['unique'] = true; $count = count($column_names); for ($i=0; $i<$count; ++$i) { $column_name = strtok($column_names[$i]," "); $collation = strtok(" "); $definition['fields'][$column_name] = array(); if (!empty($collation)) { $definition['fields'][$column_name]['sorting'] = ($collation=='ASC' ? 'ascending' : 'descending'); } } return $definition; } /** * drop existing index * * @param string $table name of table that should be used in method * @param string $name name of the index to be dropped * @return mixed DB_OK on success, a PEAR error on failure * @access public */ function dropIndex($table, $name) { return $this->_db->query("DROP INDEX $name"); } /** * drop existing constraint * * @param string $table name of table that should be used in method * @param string $name name of the constraint to be dropped * @return mixed DB_OK on success, a PEAR error on failure * @access public */ function dropConstraint($table, $name) { if (strtolower($name) == 'primary') { return DB_Table::throwError( DB_TABLE_ERR_ALTER_INDEX_IMPOS, '(primary)' ); } return $this->_db->query("DROP INDEX $name"); } /** * alter an existing table * * @param string $name name of the table that is intended to be changed. * @param array $changes associative array that contains the details of each type * of change that is intended to be performed. The types of * changes that are currently supported are defined as follows: * * name * * New name for the table. * * add * * Associative array with the names of fields to be added as * indexes of the array. The value of each entry of the array * should be set to another associative array with the properties * of the fields to be added. The properties of the fields should * be the same as defined by the Metabase parser. * * * remove * * Associative array with the names of fields to be removed as indexes * of the array. Currently the values assigned to each entry are ignored. * An empty array should be used for future compatibility. * * rename * * Associative array with the names of fields to be renamed as indexes * of the array. The value of each entry of the array should be set to * another associative array with the entry named name with the new * field name and the entry named Declaration that is expected to contain * the portion of the field declaration already in DBMS specific SQL code * as it is used in the CREATE TABLE statement. * * change * * Associative array with the names of the fields to be changed as indexes * of the array. Keep in mind that if it is intended to change either the * name of a field and any other properties, the change array entries * should have the new names of the fields as array indexes. * * The value of each entry of the array should be set to another associative * array with the properties of the fields to that are meant to be changed as * array entries. These entries should be assigned to the new values of the * respective properties. The properties of the fields should be the same * as defined by the Metabase parser. * * Example * array( * 'name' => 'userlist', * 'add' => array( * 'quota' => array( * 'type' => 'integer', * 'unsigned' => 1 * ) * ), * 'remove' => array( * 'file_limit' => array(), * 'time_limit' => array() * ), * 'change' => array( * 'name' => array( * 'length' => '20', * 'definition' => array( * 'type' => 'text', * 'length' => 20, * ), * ) * ), * 'rename' => array( * 'sex' => array( * 'name' => 'gender', * 'definition' => array( * 'type' => 'text', * 'length' => 1, * 'default' => 'M', * ), * ) * ) * ) * * @param boolean $check (ignored in DB_Table) * @access public * * @return mixed DB_OK on success, a PEAR error on failure */ function alterTable($name, $changes, $check) { $version = $this->_getServerVersion(); foreach ($changes as $change_name => $change) { switch ($change_name) { case 'add': if ($version['major'] >= 3 && $version['minor'] >= 1) { break; } case 'name': if ($version['major'] >= 3 && $version['minor'] >= 1) { break; } case 'remove': case 'change': case 'rename': default: return DB_Table::throwError(DB_TABLE_ERR_ALTER_TABLE_IMPOS); } } $query = ''; if (array_key_exists('name', $changes)) { $change_name = $this->_db->quoteIdentifier($changes['name']); $query .= 'RENAME TO ' . $change_name; } if (array_key_exists('add', $changes)) { foreach ($changes['add'] as $field_name => $field) { if ($query) { $query.= ', '; } $query.= 'ADD COLUMN ' . $field_name . ' ' . $field; } } if (!$query) { return DB_OK; } $name = $this->_db->quoteIdentifier($name); return $this->_db->query("ALTER TABLE $name $query"); } /** * return version information about the server * * @param string $native determines if the raw version string should be returned * @return mixed array/string with version information or MDB2 error object * @access private */ function _getServerVersion($native = false) { if (!function_exists('sqlite_libversion')) { return 0; // error } $server_info = sqlite_libversion(); if (!$native) { $tmp = explode('.', $server_info, 3); $server_info = array( 'major' => isset($tmp[0]) ? $tmp[0] : null, 'minor' => isset($tmp[1]) ? $tmp[1] : null, 'patch' => isset($tmp[2]) ? $tmp[2] : null, 'extra' => null, 'native' => $server_info, ); } return $server_info; } } ?> QuickForm.php000066400000000000000000001020701262614675700350560ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package/packagefiles/DB_Table/DB/Table * @author Mark Wiesemann * * @license http://www.gnu.org/copyleft/lesser.html LGPL * * @version $Id: QuickForm.php,v 1.43 2007/04/03 00:06:54 morse Exp $ * */ /** * Needed to build forms. */ require_once 'HTML/QuickForm.php'; /** * US-English messages for some QuickForm rules. Moritz Heidkamp * suggested this approach for easier i18n. */ if (! isset($GLOBALS['_DB_TABLE']['qf_rules'])) { $GLOBALS['_DB_TABLE']['qf_rules'] = array( 'required' => 'The item %s is required.', 'numeric' => 'The item %s must be numbers only.', 'maxlength' => 'The item %s can have no more than %d characters.' ); } /** * If you want to use an extended HTML_QuickForm object, you can specify the * class name in $_DB_TABLE['qf_class_name']. * ATTENTION: You have to include the class file yourself, DB_Table does * not take care of this! */ if (!isset($GLOBALS['_DB_TABLE']['qf_class_name'])) { $GLOBALS['_DB_TABLE']['qf_class_name'] = 'HTML_QuickForm'; } /** * * DB_Table_QuickForm creates HTML_QuickForm objects from DB_Table properties. * * DB_Table_QuickForm provides HTML form creation facilities based on * DB_Table column definitions transformed into HTML_QuickForm elements. * * @category Database * * @package DB_Table * * @author Paul M. Jones * @author Mark Wiesemann * */ class DB_Table_QuickForm { /** * * Build a form based on DB_Table column definitions. * * @static * * @access public * * @param array $cols A sequential array of DB_Table column definitions * from which to create form elements. * * @param string $arrayName By default, the form will use the names * of the columns as the names of the form elements. If you pass * $arrayName, the column names will become keys in an array named * for this parameter. * * @param array $args An associative array of optional arguments to * pass to the QuickForm object. The keys are... * * 'formName' : String, name of the form; defaults to the name of the * table. * * 'method' : String, form method; defaults to 'post'. * * 'action' : String, form action; defaults to * $_SERVER['REQUEST_URI']. * * 'target' : String, form target target; defaults to '_self' * * 'attributes' : Associative array, extra attributes for * tag; the key is the attribute name and the value is attribute * value. * * 'trackSubmit' : Boolean, whether to track if the form was * submitted by adding a special hidden field * * @param string $clientValidate By default, validation will match * the 'qf_client' value from the column definition. However, * if you set $clientValidate to true or false, this will * override the value from the column definition. * * @param array $formFilters An array with filter function names or * callbacks that will be applied to all form elements. * * @return object HTML_QuickForm * * @see HTML_QuickForm * * @see DB_Table_QuickForm::createForm() * */ function &getForm($cols, $arrayName = null, $args = array(), $clientValidate = null, $formFilters = null) { $form =& DB_Table_QuickForm::createForm($args); DB_Table_QuickForm::addElements($form, $cols, $arrayName); DB_Table_QuickForm::addRules($form, $cols, $arrayName, $clientValidate); DB_Table_QuickForm::addFilters($form, $cols, $arrayName, $formFilters); return $form; } /** * * Creates an empty form object. * * In case you want more control over your form, you can call this function * to create it, then add whatever elements you want. * * @static * * @access public * * @author Ian Eure * * @param array $args An associative array of optional arguments to * pass to the QuickForm object. The keys are... * * 'formName' : String, name of the form; defaults to the name of the * table. * * 'method' : String, form method; defaults to 'post'. * * 'action' : String, form action; defaults to * $_SERVER['REQUEST_URI']. * * 'target' : String, form target target; defaults to '_self' * * 'attributes' : Associative array, extra attributes for * tag; the key is the attribute name and the value is attribute * value. * * 'trackSubmit' : Boolean, whether to track if the form was * submitted by adding a special hidden field * * @return object HTML_QuickForm * */ function &createForm($args = array()) { if (isset($args['formName'])) { $formName = $args['formName']; } elseif (isset($this)) { $formName = $this->table; } else { $formName = '_db_table_form_'; } $method = isset($args['method']) ? $args['method'] : 'post'; $action = isset($args['action']) ? $args['action'] : $_SERVER['REQUEST_URI']; $target = isset($args['target']) ? $args['target'] : '_self'; $attributes = isset($args['attributes']) ? $args['attributes'] : null; $trackSubmit = isset($args['trackSubmit']) ? $args['trackSubmit'] : false; $form =& new $GLOBALS['_DB_TABLE']['qf_class_name']($formName, $method, $action, $target, $attributes, $trackSubmit); return $form; } /** * * Adds DB_Table columns to a pre-existing HTML_QuickForm object. * * @author Ian Eure * * @static * * @access public * * @param object &$form An HTML_QuickForm object. * * @param array $cols A sequential array of DB_Table column definitions * from which to create form elements. * * @param string $arrayName By default, the form will use the names * of the columns as the names of the form elements. If you pass * $arrayName, the column names will become keys in an array named * for this parameter. * * @return void * */ function addElements(&$form, $cols, $arrayName = null) { $elements =& DB_Table_QuickForm::getElements($cols, $arrayName); $cols_keys = array_keys($cols); foreach (array_keys($elements) as $k) { $element =& $elements[$k]; // are we adding a group? if (is_array($element)) { // get the label for the group. have to do it this way // because the group of elements does not itself have a // label, there are only the labels for the individual // elements. $tmp = $cols[$cols_keys[$k]]; if (! isset($tmp['qf_label'])) { $label = $cols_keys[$k]; if ($arrayName) { $label = $arrayName . "[$label]"; } } else { $label = $tmp['qf_label']; } // set the element name if ($arrayName) { $name = $arrayName . '[' . $cols_keys[$k] . ']'; } else { $name = $cols_keys[$k]; } // fix the column definition temporarily to get the separator // for the group $col = $cols[$cols_keys[$k]]; DB_Table_QuickForm::fixColDef($col, $name); // done $group =& $form->addGroup($element, $name, $label, $col['qf_groupsep']); // set default value (if given) for radio elements // (reason: QF "resets" the checked state, when adding a group) if ($tmp['qf_type'] == 'radio' && isset($tmp['qf_setvalue'])) { $form->setDefaults(array($name => $tmp['qf_setvalue'])); } } elseif (is_object($element)) { $form->addElement($element); } } } /** * * Gets controls for a list of columns * * @author Ian Eure * * @static * * @access public * * @param object &$form An HTML_QuickForm object. * * @param array $cols A sequential array of DB_Table column definitions * from which to create form elements. * * @param string $arrayName By default, the form will use the names * of the columns as the names of the form elements. If you pass * $arrayName, the column names will become keys in an array named * for this parameter. * * @return array Form elements * */ function &getElements($cols, $arrayName = null) { $elements = array(); foreach ($cols as $name => $col) { if ($arrayName) { $elemname = $arrayName . "[$name]"; } else { $elemname = $name; } DB_Table_QuickForm::fixColDef($col, $elemname); $elements[] =& DB_Table_QuickForm::getElement($col, $elemname); } return $elements; } /** * * Build a single QuickForm element based on a DB_Table column. * * @static * * @access public * * @param array $col A DB_Table column definition. * * @param string $elemname The name to use for the generated QuickForm * element. * * @return object HTML_QuickForm_Element * */ function &getElement($col, $elemname) { if (isset($col['qf_setvalue'])) { $setval = $col['qf_setvalue']; } switch ($col['qf_type']) { case 'advcheckbox': case 'checkbox': $element =& HTML_QuickForm::createElement( 'advcheckbox', $elemname, $col['qf_label'], isset($col['qf_label_append']) ? $col['qf_label_append'] : null, $col['qf_attrs'], $col['qf_vals'] ); // WARNING: advcheckbox elements in HTML_QuickForm v3.2.2 // and earlier do not honor setChecked(); they will always // be un-checked, unless a POST value sets them. Upgrade // to QF 3.2.3 or later. if (isset($setval) && $setval == true) { $element->setChecked(true); } else { $element->setChecked(false); } break; case 'autocomplete': $element =& HTML_QuickForm::createElement( $col['qf_type'], $elemname, $col['qf_label'], $col['qf_vals'], $col['qf_attrs'] ); if (isset($setval)) { $element->setValue($setval); } break; case 'date': if (! isset($col['qf_opts']['format'])) { $col['qf_opts']['format'] = 'Y-m-d'; } $element =& HTML_QuickForm::createElement( 'date', $elemname, $col['qf_label'], $col['qf_opts'], $col['qf_attrs'] ); if (isset($setval)) { $element->setValue($setval); } break; case 'time': if (! isset($col['qf_opts']['format'])) { $col['qf_opts']['format'] = 'H:i:s'; } $element =& HTML_QuickForm::createElement( 'date', $elemname, $col['qf_label'], $col['qf_opts'], $col['qf_attrs'] ); if (isset($setval)) { $element->setValue($setval); } break; case 'timestamp': if (! isset($col['qf_opts']['format'])) { $col['qf_opts']['format'] = 'Y-m-d H:i:s'; } $element =& HTML_QuickForm::createElement( 'date', $elemname, $col['qf_label'], $col['qf_opts'], $col['qf_attrs'] ); if (isset($setval)) { $element->setValue($setval); } break; case 'hidden': $element =& HTML_QuickForm::createElement( $col['qf_type'], $elemname, null, $col['qf_attrs'] ); if (isset($setval)) { $element->setValue($setval); } break; case 'radio': $element = array(); foreach ((array) $col['qf_vals'] as $btnvalue => $btnlabel) { $element[] =& HTML_QuickForm::createElement( $col['qf_type'], null, // elemname not added because this is a group null, $btnlabel, $btnvalue, $col['qf_attrs'] ); } break; case 'select': $element =& HTML_QuickForm::createElement( $col['qf_type'], $elemname, $col['qf_label'], $col['qf_vals'], $col['qf_attrs'] ); if (isset($setval)) { $element->setSelected($setval); } break; case 'password': case 'text': case 'textarea': if (! isset($col['qf_attrs']['maxlength']) && isset($col['size'])) { $col['qf_attrs']['maxlength'] = $col['size']; } $element =& HTML_QuickForm::createElement( $col['qf_type'], $elemname, $col['qf_label'], $col['qf_attrs'] ); if (isset($setval)) { $element->setValue($setval); } break; case 'static': $element =& HTML_QuickForm::createElement( $col['qf_type'], $elemname, $col['qf_label'], (isset($setval) ? $setval : '') ); break; case 'hierselect': $element =& HTML_QuickForm::createElement( $col['qf_type'], $elemname, $col['qf_label'], $col['qf_attrs'], $col['qf_groupsep'] ); if (isset($setval)) { $element->setValue($setval); } break; case 'jscalendar': $element =& HTML_QuickForm::createElement( $col['qf_type'], $elemname, $col['qf_label'], $col['qf_opts'], $col['qf_attrs'] ); if (isset($setval)) { $element->setValue($setval); } break; case 'header': $element =& HTML_QuickForm::createElement( $col['qf_type'], $elemname ); if (isset($setval)) { $element->setValue($setval); } break; case 'static': $element =& HTML_QuickForm::createElement( $col['qf_type'], $elemname, $col['qf_label'] ); if (isset($setval)) { $element->setValue($setval); } break; case 'reset': case 'submit': $element =& HTML_QuickForm::createElement( $col['qf_type'], $elemname, null, $col['qf_attrs'] ); if (isset($setval)) { $element->setValue($setval); } break; case 'callback': // custom QF elements that need more than // the standard parameters // code from Arne Bippes if (is_callable(array($col['qf_callback'], 'createElement'))) { // Does an object with name from $col['qf_callback'] and // a method with name 'createElement' exist? $ret_value = call_user_func_array( array($col['qf_callback'], 'createElement'), array(&$element, &$col, &$elemname, &$setval)); } elseif (is_callable($col['qf_callback'])) { // Does a method with name from $col['qf_callback'] exist? $ret_value = call_user_func_array( $col['qf_callback'], array(&$element, &$col, &$elemname, &$setval)); } if ($ret_value) { break; } // fall into default block of switch statement: // - if $col['qf_callback'] is ... // - not a valid object // - a valid object, but a method 'createElement' doesn't exist // - not a valid method name // - if an error occurred in 'createElement' or in the method default: /** * @author Moritz Heidkamp */ // not a recognized type. is it registered with QuickForm? if (HTML_QuickForm::isTypeRegistered($col['qf_type'])) { // yes, create it with some minimalist parameters $element =& HTML_QuickForm::createElement( $col['qf_type'], $elemname, $col['qf_label'], $col['qf_attrs'] ); // set its default value, if there is one if (isset($setval)) { $element->setValue($setval); } } else { // element type is not registered with QuickForm. $element = null; } break; } // done return $element; } /** * * Build an array of form elements based from DB_Table columns. * * @static * * @access public * * @param array $cols A sequential array of DB_Table column * definitions from which to create form elements. * * @param string $arrayName By default, the form will use the names * of the columns as the names of the form elements. If you pass * $arrayName, the column names will become keys in an array named * for this parameter. * * @return array An array of HTML_QuickForm_Element objects. * */ function &getGroup($cols, $arrayName = null) { $group = array(); foreach ($cols as $name => $col) { if ($arrayName) { $elemname = $arrayName . "[$name]"; } else { $elemname = $name; } DB_Table_QuickForm::fixColDef($col, $elemname); $group[] =& DB_Table_QuickForm::getElement($col, $elemname); } return $group; } /** * * Adds static form elements like 'header', 'static', 'submit' or 'reset' to * a pre-existing HTML_QuickForm object. * * @static * * @access public * * @param object &$form An HTML_QuickForm object. * * @param array $elements A sequential array of form element definitions. * * @return void * */ function addStaticElements(&$form, $elements) { foreach ($elements as $name => $elemDef) { DB_Table_QuickForm::fixColDef($elemDef, $name); $element =& DB_Table_QuickForm::getElement($elemDef, $name); if (!is_object($element)) { continue; } if (isset($elemDef['before']) && !empty($elemDef['before'])) { $form->insertElementBefore($element, $elemDef['before']); } else { $form->addElement($element); } } } /** * * Adds DB_Table filters to a pre-existing HTML_QuickForm object. * * @static * * @access public * * @param object &$form An HTML_QuickForm object. * * @param array $cols A sequential array of DB_Table column definitions * from which to create form elements. * * @param string $arrayName By default, the form will use the names * of the columns as the names of the form elements. If you pass * $arrayName, the column names will become keys in an array named * for this parameter. * * @param array $formFilters An array with filter function names or * callbacks that will be applied to all form elements. * * @return void * */ function addFilters(&$form, $cols, $arrayName = null, $formFilters = null) { foreach ($cols as $name => $col) { if ($arrayName) { $elemname = $arrayName . "[$name]"; } else { $elemname = $name; } DB_Table_QuickForm::fixColDef($col, $elemname); foreach (array_keys($col['qf_filters']) as $fk) { $form->applyFilter($elemname, $col['qf_filters'][$fk]); } } if (is_array($formFilters)) { foreach (array_keys($formFilters) as $fk) { $form->applyFilter('__ALL__', $formFilters[$fk]); } } } /** * * Adds element rules to a pre-existing HTML_QuickForm object. * * @static * * @access public * * @param object &$form An HTML_QuickForm object. * * @param array $cols A sequential array of DB_Table column definitions * from which to create form elements. * * @param string $arrayName By default, the form will use the names * of the columns as the names of the form elements. If you pass * $arrayName, the column names will become keys in an array named * for this parameter. * * @param string $clientValidate By default, validation will match * the 'qf_client' value from the column definition. However, * if you set $clientValidate to true or false, this will * override the value from the column definition. * * @return void * */ function addRules(&$form, $cols, $arrayName = null, $clientValidate = null) { foreach ($cols as $name => $col) { if ($arrayName) { $elemname = $arrayName . "[$name]"; } else { $elemname = $name; } // make sure all necessary elements are in place DB_Table_QuickForm::fixColDef($col, $elemname); // if clientValidate is specified, override the column // definition. otherwise use the col def as it is. if (! is_null($clientValidate)) { // override if ($clientValidate) { $validate = 'client'; } else { $validate = 'server'; } } else { // use as-is if ($col['qf_client']) { $validate = 'client'; } else { $validate = 'server'; } } // **always** override these rules to make them // server-side only. suggested by Mark Wiesemann, // debugged by Hero Wanders. $onlyServer = array('filename', 'maxfilesize', 'mimetype', 'uploadedfile'); // loop through the rules and add them foreach ($col['qf_rules'] as $type => $opts) { // some rules (e.g. rules for file elements) can only be // checked on the server; therefore, don't use client-side // validation for these rules $ruleValidate = $validate; if (in_array($type, $onlyServer)) { $ruleValidate = 'server'; } switch ($type) { case 'alphanumeric': case 'email': case 'lettersonly': case 'nonzero': case 'nopunctuation': case 'numeric': case 'required': case 'uploadedfile': // $opts is the error message $message = $opts; $format = null; break; case 'filename': case 'maxfilesize': case 'maxlength': case 'mimetype': case 'minlength': case 'regex': // $opts[0] is the message // $opts[1] is the size, mimetype, or regex $message = $opts[0]; $format = $opts[1]; break; default: // by Alex Hoebart: this should allow any registered rule. if (!in_array($type, $form->getRegisteredRules())) { // rule is not registered ==> do not add a rule continue; } if (is_array($opts)) { // $opts[0] is the message // $opts[1] is the size or regex $message = $opts[0]; $format = $opts[1]; } else { // $opts is the error message $message = $opts; $format = null; } break; } switch ($col['qf_type']) { case 'date': case 'time': case 'timestamp': // date "elements" are groups ==> use addGroupRule() $form->addGroupRule($elemname, $message, $type, $format, null, $ruleValidate); break; default: // use addRule() for all other elements $form->addRule($elemname, $message, $type, $format, $ruleValidate); break; } } } } /** * * "Fixes" a DB_Table column definition for QuickForm. * * Makes it so that all the 'qf_*' key constants are populated * with appropriate default values; also checks the 'require' * value (if not set, defaults to false). * * @static * * @access public * * @param array &$col A DB_Table column definition. * * @param string $elemname The name for the target form element. * * @return void * */ function fixColDef(&$col, $elemname) { // always have a "require" value, false if not set if (! isset($col['require'])) { $col['require'] = false; } // array of acceptable values, typically for // 'select' or 'radio' if (! isset($col['qf_vals'])) { $col['qf_vals'] = null; } // are we doing client validation in addition to // server validation? by default, no. if (! isset($col['qf_client'])) { $col['qf_client'] = false; } if (! isset($col['qf_filters'])) { $col['qf_filters'] = array(); } // the element type; if not set, // assigns an element type based on the column type. // by default, the type is 'text' (unless there are // values, in which case the type is 'select') if (! isset($col['qf_type'])) { // if $col['type'] is not set, set it to null // ==> in the switch statement below, the // default case will be used if (!isset($col['type'])) { $col['type'] = null; } switch ($col['type']) { case 'boolean': $col['qf_type'] = 'checkbox'; $col['qf_vals'] = array(0,1); break; case 'date': $col['qf_type'] = 'date'; break; case 'time': $col['qf_type'] = 'time'; break; case 'timestamp': $col['qf_type'] = 'timestamp'; break; case 'clob': $col['qf_type'] = 'textarea'; break; default: if (isset($col['qf_vals'])) { $col['qf_type'] = 'select'; } else { $col['qf_type'] = 'text'; } break; } } // label for the element; defaults to the element // name. adds both quickform label and table-header // label if qf_label is not set. if (! isset($col['qf_label'])) { if (isset($col['label'])) { $col['qf_label'] = $col['label']; } else { $col['qf_label'] = $elemname . ':'; } } // special options for the element, typically used // for 'date' element types if (! isset($col['qf_opts'])) { $col['qf_opts'] = array(); } // array of additional HTML attributes for the element if (! isset($col['qf_attrs'])) { // setting to array() generates an error in HTML_Common $col['qf_attrs'] = null; } // array of QuickForm validation rules to apply if (! isset($col['qf_rules'])) { $col['qf_rules'] = array(); } // if the element is hidden, then we're done // (adding rules to hidden elements is mostly useless) if ($col['qf_type'] == 'hidden') { return; } // code to keep BC for the separator for grouped QF elements if (isset($col['qf_radiosep'])) { $col['qf_groupsep'] = $col['qf_radiosep']; } // add a separator for grouped elements if (!isset($col['qf_groupsep'])) { $col['qf_groupsep'] = '
'; } // $col['qf_set_default_rules'] === false allows to turn off // the automatic creation of QF rules for this "column" // (suggested by Arne Bippes) if (isset($col['qf_set_default_rules']) && $col['qf_set_default_rules'] === false) { return; } // the element is required // ==> set 'uploadedfile' (for file elements) or 'required' (for all // other elements) rule if it is was not already set $req_rule_name = ($col['qf_type'] == 'file') ? 'uploadedfile' : 'required'; if (!isset($col['qf_rules'][$req_rule_name]) && $col['require']) { $col['qf_rules'][$req_rule_name] = sprintf( $GLOBALS['_DB_TABLE']['qf_rules']['required'], $col['qf_label'] ); } // for file elements the 'numeric' and 'maxlength' rules must not be set if ($col['qf_type'] == 'file') { return; } $numeric = array('smallint', 'integer', 'bigint', 'decimal', 'single', 'double'); // the element is numeric if (!isset($col['qf_rules']['numeric']) && isset($col['type']) && in_array($col['type'], $numeric)) { $col['qf_rules']['numeric'] = sprintf( $GLOBALS['_DB_TABLE']['qf_rules']['numeric'], $col['qf_label'] ); } // the element has a maximum length if (!isset($col['qf_rules']['maxlength']) && isset($col['size'])) { $max = $col['size']; $msg = sprintf( $GLOBALS['_DB_TABLE']['qf_rules']['maxlength'], $col['qf_label'], $max ); $col['qf_rules']['maxlength'] = array($msg, $max); } } } ?> Valid.php000066400000000000000000000226621262614675700342250ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package/packagefiles/DB_Table/DB/Table * @author Mark Wiesemann * * @license http://www.gnu.org/copyleft/lesser.html LGPL * * @version $Id: Valid.php,v 1.9 2007/04/03 00:07:32 morse Exp $ * */ /** * DB_Table class for constants and other globals. */ require_once 'DB/Table.php'; /** * validation ranges for integers */ if (! isset($GLOBALS['_DB_TABLE']['valid'])) { $GLOBALS['_DB_TABLE']['valid'] = array( 'smallint' => array(pow(-2, 15), pow(+2, 15) - 1), 'integer' => array(pow(-2, 31), pow(+2, 31) - 1), 'bigint' => array(pow(-2, 63), pow(+2, 63) - 1) ); } /** * * DB_Table_Valid validates values against DB_Table column types. * * @category Database * * @package DB_Table * * @author Paul M. Jones * @author Mark Wiesemann * */ class DB_Table_Valid { /** * * Check if a value validates against the 'boolean' data type. * * @static * * @access public * * @param mixed $value The value to validate. * * @return boolean True if the value is valid for the data type, false * if not. * */ function isBoolean($value) { if ($value === true || $value === false) { return true; } elseif (is_numeric($value) && ($value == 0 || $value == 1)) { return true; } else { return false; } } /** * * Check if a value validates against the 'char' and 'varchar' data type. * * We allow most anything here, only checking that the length is in range. * * @static * * @access public * * @param mixed $value The value to validate. * * @return boolean True if the value is valid for the data type, false * if not. * */ function isChar($value, $colsize) { $is_scalar = (! is_array($value) && ! is_object($value)); $in_range = (strlen($value) <= $colsize); return $is_scalar && $in_range; } /** * * Check if a value validates against the 'smallint' data type. * * @static * * @access public * * @param mixed $value The value to validate. * * @return boolean True if the value is valid for the data type, false * if not. * */ function isSmallint($value) { return is_integer($value) && ($value >= $GLOBALS['_DB_TABLE']['valid']['smallint'][0]) && ($value <= $GLOBALS['_DB_TABLE']['valid']['smallint'][1]); } /** * * Check if a value validates against the 'integer' data type. * * @static * * @access public * * @param mixed $value The value to validate. * * @return boolean True if the value is valid for the data type, false * if not. * */ function isInteger($value) { return is_integer($value) && ($value >= $GLOBALS['_DB_TABLE']['valid']['integer'][0]) && ($value <= $GLOBALS['_DB_TABLE']['valid']['integer'][1]); } /** * * Check if a value validates against the 'bigint' data type. * * @static * * @access public * * @param mixed $value The value to validate. * * @return boolean True if the value is valid for the data type, false * if not. * */ function isBigint($value) { return is_integer($value) && ($value >= $GLOBALS['_DB_TABLE']['valid']['bigint'][0]) && ($value <= $GLOBALS['_DB_TABLE']['valid']['bigint'][1]); } /** * * Check if a value validates against the 'decimal' data type. * * For the column defined "DECIMAL(5,2)" standard SQL requires that * the column be able to store any value with 5 digits and 2 * decimals. In this case, therefore, the range of values that can be * stored in the column is from -999.99 to 999.99. DB_Table attempts * to enforce this behavior regardless of the RDBMS backend behavior. * * @static * * @access public * * @param mixed $value The value to validate. * * @param string $colsize The 'size' to use for validation (to make * sure of min/max and decimal places). * * @param string $colscope The 'scope' to use for validation (to make * sure of min/max and decimal places). * * @return boolean True if the value is valid for the data type, false * if not. * */ function isDecimal($value, $colsize, $colscope) { if (! is_numeric($value)) { return false; } // maximum number of digits allowed to the left // and right of the decimal point. $right_max = $colscope; $left_max = $colsize - $colscope; // ignore negative signs in all validation $value = str_replace('-', '', $value); // find the decimal point, then get the left // and right portions. $pos = strpos($value, '.'); if ($pos === false) { $left = $value; $right = ''; } else { $left = substr($value, 0, $pos); $right = substr($value, $pos+1); } // how long are the left and right portions? $left_len = strlen($left); $right_len = strlen($right); // do the portions exceed their maxes? if ($left_len > $left_max || $right_len > $right_max) { // one or the other exceeds the max lengths return false; } else { // both are within parameters return true; } } /** * * Check if a value validates against the 'single' data type. * * @static * * @access public * * @param mixed $value The value to validate. * * @return boolean True if the value is valid for the data type, false * if not. * */ function isSingle($value) { return is_float($value); } /** * * Check if a value validates against the 'double' data type. * * @static * * @access public * * @param mixed $value The value to validate. * * @return boolean True if the value is valid for the data type, false * if not. * */ function isDouble($value) { return is_float($value); } /** * * Check if a value validates against the 'time' data type. * * @static * * @access public * * @param mixed $value The value to validate. * * @return boolean True if the value is valid for the data type, false * if not. * */ function isTime($value) { // hh:ii:ss // 01234567 $h = substr($value, 0, 2); $s1 = substr($value, 2, 1); $i = substr($value, 3, 2); $s2 = substr($value, 5, 1); $s = substr($value, 6, 2); // time check if (strlen($value) != 8 || ! is_numeric($h) || $h < 0 || $h > 23 || $s1 != ':' || ! is_numeric($i) || $i < 0 || $i > 59 || $s2 != ':' || ! is_numeric($s) || $s < 0 || $s > 59) { return false; } else { return true; } } /** * * Check if a value validates against the 'date' data type. * * @static * * @access public * * @param mixed $value The value to validate. * * @return boolean True if the value is valid for the data type, false * if not. * */ function isDate($value) { // yyyy-mm-dd // 0123456789 $y = substr($value, 0, 4); $s1 = substr($value, 4, 1); $m = substr($value, 5, 2); $s2 = substr($value, 7, 1); $d = substr($value, 8, 2); // date check if (strlen($value) != 10 || $s1 != '-' || $s2 != '-' || ! checkdate($m, $d, $y)) { return false; } else { return true; } } /** * * Check if a value validates against the 'timestamp' data type. * * @static * * @access public * * @param mixed $value The value to validate. * * @return boolean True if the value is valid for the data type, false * if not. * */ function isTimestamp($value) { // yyyy-mm-dd hh:ii:ss // 0123456789012345678 $date = substr($value, 0, 10); $sep = substr($value, 10, 1); $time = substr($value, 11, 8); if (strlen($value) != 19 || $sep != ' ' || ! DB_Table_Valid::isDate($date) || ! DB_Table_Valid::isTime($time)) { return false; } else { return true; } } /** * * Check if a value validates against the 'clob' data type. * * @static * * @access public * * @param mixed $value The value to validate. * * @return boolean True if the value is valid for the data type, false * if not. * */ function isClob($value) { return is_string($value); } } ?> XML.php000066400000000000000000000034161262614675700336220ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package/packagefiles/DB_Table/DB/Table * * @license http://www.gnu.org/copyleft/lesser.html LGPL * * @version $Id: XML.php,v 1.1 2007/06/13 04:53:40 morse Exp $ */ /** * class DB_Table_XML contains a few simple static methods for writing XML * * @category Database * @package DB_Table * @author David Morse * * @version @package_version@ * */ class DB_Table_XML { /** * Returns XML closing tag , increases $indent by 3 spaces * * @static * @param string $tag XML element tag name * @param string $indent current indentation, string of spaces * @return string XML opening tag * @access public */ function openTag($tag, &$indent) { $old_indent = $indent; $indent = $indent . ' '; return $old_indent . "<$tag>"; } /** * Returns XML closing tag , decreases $indent by 3 spaces * * @static * @param string $tag XML element tag name * @param string $indent current indentation, string of spaces * @return string XML closing tag * @access public */ function closeTag($tag, &$indent) { $indent = substr($indent, 0, -3); return $indent . ""; } /** * Returns string single line XML element text * * @static * @param string $tag XML element tag name * @param string $text element contents * @param string $indent current indentation, string of spaces * @return string single-line XML element * @access public */ function lineElement($tag, $text, $indent) { return $indent . "<$tag>$text"; } } ?> php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package/packagefiles/DB_Table/docs/000077500000000000000000000000001262614675700321405ustar00rootroot00000000000000reserved_words/000077500000000000000000000000001262614675700351165ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package/packagefiles/DB_Table/docs_sources.txt000066400000000000000000000007621262614675700375060ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package/packagefiles/DB_Table/docs/reserved_wordsMySQL http://dev.mysql.com/doc/mysql/en/Reserved_words.html SQL-92/FrontBase, SQL-99, PostgreSQL http://www.postgresql.org/docs/7.3/static/sql-keywords-appendix.html MS-SQL http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_ra-rz_9oj7.asp Oci8 (really from Oracle 10.2, but list has been frozen for a long time, free reg. required) http://download-west.oracle.com/docs/cd/B13789_01/server.101/b10759/ap_keywd.htm#i690190 SQLite http://www.sqlite.org/lang.html#keywords all-words.txt000066400000000000000000000103151262614675700375630ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package/packagefiles/DB_Table/docs/reserved_words_ROWID_ ABSOLUTE ACCESS ACTION ADD ADMIN AFTER AGGREGATE ALIAS ALL ALLOCATE ALTER ANALYSE ANALYZE AND ANY ARE ARRAY AS ASC ASENSITIVE ASSERTION AT AUDIT AUTHORIZATION AUTO_INCREMENT AVG BACKUP BDB BEFORE BEGIN BERKELEYDB BETWEEN BIGINT BINARY BIT BIT_LENGTH BLOB BOOLEAN BOTH BREADTH BREAK BROWSE BULK BY CALL CASCADE CASCADED CASE CAST CATALOG CHANGE CHAR CHAR_LENGTH CHARACTER CHARACTER_LENGTH CHECK CHECKPOINT CLASS CLOB CLOSE CLUSTER CLUSTERED COALESCE COLLATE COLLATION COLUMN COLUMNS COMMENT COMMIT COMPLETION COMPRESS COMPUTE CONDITION CONNECT CONNECTION CONSTRAINT CONSTRAINTS CONSTRUCTOR CONTAINS CONTAINSTABLE CONTINUE CONVERT CORRESPONDING COUNT CREATE CROSS CUBE CURRENT CURRENT_DATE CURRENT_PATH CURRENT_ROLE CURRENT_TIME CURRENT_TIMESTAMP CURRENT_USER CURSOR CYCLE DATA DATABASE DATABASES DATE DAY DAY_HOUR DAY_MICROSECOND DAY_MINUTE DAY_SECOND DBCC DEALLOCATE DEC DECIMAL DECLARE DEFAULT DEFERRABLE DEFERRED DELAYED DELETE DENY DEPTH DEREF DESC DESCRIBE DESCRIPTOR DESTROY DESTRUCTOR DETERMINISTIC DIAGNOSTICS DICTIONARY DISCONNECT DISK DISTINCT DISTINCTROW DISTRIBUTED DIV DO DOMAIN DOUBLE DROP DUMMY DUMP DYNAMIC EACH ELSE ELSEIF ENCLOSED END END-EXEC EQUALS ERRLVL ESCAPE ESCAPED EVERY EXCEPT EXCEPTION EXCLUSIVE EXEC EXECUTE EXISTS EXIT EXPLAIN EXTERNAL EXTRACT FALSE FETCH FIELDS FILE FILLFACTOR FIRST FLOAT FOR FORCE FOREIGN FOUND FRAC_SECOND FREE FREETEXT FREETEXTTABLE FREEZE FROM FULL FULLTEXT FUNCTION GENERAL GET GLOB GLOBAL GO GOTO GRANT GROUP GROUPING HAVING HIGH_PRIORITY HOLDLOCK HOST HOUR HOUR_MICROSECOND HOUR_MINUTE HOUR_SECOND IDENTIFIED IDENTITY IDENTITY_INSERT IDENTITYCOL IF IGNORE ILIKE IMMEDIATE IN INCREMENT INDEX INDICATOR INFILE INITIAL INITIALIZE INITIALLY INNER INNODB INOUT INPUT INSENSITIVE INSERT INT INTEGER INTERSECT INTERVAL INTO IO_THREAD IS ISNULL ISOLATION ITERATE JOIN KEY KEYS KILL LANGUAGE LARGE LAST LATERAL LEADING LEAVE LEFT LESS LEVEL LIKE LIMIT LINENO LINES LOAD LOCAL LOCALTIME LOCALTIMESTAMP LOCATOR LOCK LONG LONGBLOB LONGTEXT LOOP LOW_PRIORITY LOWER MAIN MAP MASTER_SERVER_ID MATCH MAX MAXEXTENTS MEDIUMBLOB MEDIUMINT MEDIUMTEXT MIDDLEINT MIN MINUS MINUTE MINUTE_MICROSECOND MINUTE_SECOND MLSLABEL MOD MODE MODIFIES MODIFY MODULE MONTH NAMES NATIONAL NATURAL NCHAR NCLOB NEW NEXT NO NO_WRITE_TO_BINLOG NOAUDIT NOCHECK NOCOMPRESS NONCLUSTERED NONE NOT NOTNULL NOWAIT NULL NULLIF NUMBER NUMERIC OBJECT OCTET_LENGTH OF OFF OFFLINE OFFSET OFFSETS OID OLD ON ONLINE ONLY OPEN OPENDATASOURCE OPENQUERY OPENROWSET OPENXML OPERATION OPTIMIZE OPTION OPTIONALLY OR ORDER ORDINALITY OUT OUTER OUTFILE OUTPUT OVER OVERLAPS PAD PARAMETER PARAMETERS PARTIAL PATH PCTFREE PERCENT PLACING PLAN POSITION POSTFIX PRECISION PREFIX PREORDER PREPARE PRESERVE PRIMARY PRINT PRIOR PRIVILEGES PROC PROCEDURE PUBLIC PURGE RAISERROR RAW READ READS READTEXT REAL RECONFIGURE RECURSIVE REF REFERENCES REFERENCING REGEXP RELATIVE RENAME REPEAT REPLACE REPLICATION REQUIRE RESOURCE RESTORE RESTRICT RESULT RETURN RETURNS REVOKE RIGHT RLIKE ROLE ROLLBACK ROLLUP ROUTINE ROW ROWCOUNT ROWGUIDCOL ROWID ROWNUM ROWS RULE SAVE SAVEPOINT SCHEMA SCOPE SCROLL SEARCH SECOND SECOND_MICROSECOND SECTION SELECT SENSITIVE SEPARATOR SEQUENCE SESSION SESSION_USER SET SETS SETUSER SHARE SHOW SHUTDOWN SIMILAR SIZE SMALLINT SOME SONAME SPACE SPATIAL SPECIFIC SPECIFICTYPE SQL SQL_BIG_RESULT SQL_CALC_FOUND_ROWS SQL_SMALL_RESULT SQL_TSI_DAY SQL_TSI_FRAC_SECOND SQL_TSI_HOUR SQL_TSI_MINUTE SQL_TSI_MONTH SQL_TSI_QUARTER SQL_TSI_SECOND SQL_TSI_WEEK SQL_TSI_YEAR SQLCODE SQLERROR SQLEXCEPTION SQLITE_MASTER SQLITE_TEMP_MASTER SQLSTATE SQLWARNING SSL START STARTING STATE STATEMENT STATIC STATISTICS STRAIGHT_JOIN STRIPED STRUCTURE SUBSTRING SUCCESSFUL SUM SYNONYM SYSDATE SYSTEM_USER TABLE TABLES TEMPORARY TERMINATE TERMINATED TEXTSIZE THAN THEN TIME TIMESTAMP TIMESTAMPADD TIMESTAMPDIFF TIMEZONE_HOUR TIMEZONE_MINUTE TINYBLOB TINYINT TINYTEXT TO TOP TRAILING TRAN TRANSACTION TRANSLATE TRANSLATION TREAT TRIGGER TRIM TRUE TRUNCATE TSEQUAL UID UNDER UNDO UNION UNIQUE UNKNOWN UNLOCK UNNEST UNSIGNED UPDATE UPDATETEXT UPPER USAGE USE USER USER_RESOURCES USING UTC_DATE UTC_TIME UTC_TIMESTAMP VALIDATE VALUE VALUES VARBINARY VARCHAR VARCHAR2 VARCHARACTER VARIABLE VARYING VERBOSE VIEW WAITFOR WHEN WHENEVER WHERE WHILE WITH WITHOUT WORK WRITE WRITETEXT XOR YEAR YEAR_MONTH ZEROFILL ZONE mssql-words.txt000066400000000000000000000023701262614675700401540ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package/packagefiles/DB_Table/docs/reserved_wordsADD ALL ALTER AND ANY AS ASC AUTHORIZATION BACKUP BEGIN BETWEEN BREAK BROWSE BULK BY CASCADE CASE CHECK CHECKPOINT CLOSE CLUSTERED COALESCE COLLATE COLUMN COMMIT COMPUTE CONSTRAINT CONTAINS CONTAINSTABLE CONTINUE CONVERT CREATE CROSS CURRENT CURRENT_DATE CURRENT_TIME CURRENT_TIMESTAMP CURRENT_USER CURSOR DATABASE DBCC DEALLOCATE DECLARE DEFAULT DELETE DENY DESC DISK DISTINCT DISTRIBUTED DOUBLE DROP DUMMY DUMP ELSE END ERRLVL ESCAPE EXCEPT EXEC EXECUTE EXISTS EXIT FETCH FILE FILLFACTOR FOR FOREIGN FREETEXT FREETEXTTABLE FROM FULL FUNCTION GOTO GRANT GROUP HAVING HOLDLOCK IDENTITY IDENTITY_INSERT IDENTITYCOL IF IN INDEX INNER INSERT INTERSECT INTO IS JOIN KEY KILL LEFT LIKE LINENO LOAD NATIONAL NOCHECK NONCLUSTERED NOT NULL NULLIF OF OFF OFFSETS ON OPEN OPENDATASOURCE OPENQUERY OPENROWSET OPENXML OPTION OR ORDER OUTER OVER PERCENT PLAN PRECISION PRIMARY PRINT PROC PROCEDURE PUBLIC RAISERROR READ READTEXT RECONFIGURE REFERENCES REPLICATION RESTORE RESTRICT RETURN REVOKE RIGHT ROLLBACK ROWCOUNT ROWGUIDCOL RULE SAVE SCHEMA SELECT SESSION_USER SET SETUSER SHUTDOWN SOME STATISTICS SYSTEM_USER TABLE TEXTSIZE THEN TO TOP TRAN TRANSACTION TRIGGER TRUNCATE TSEQUAL UNION UNIQUE UPDATE UPDATETEXT USE USER VALUES VARYING VIEW WAITFOR WHEN WHERE WHILE WITH WRITETEXT mysql-words.txt000066400000000000000000000035461262614675700401700ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package/packagefiles/DB_Table/docs/reserved_wordsADD ALL ALTER ANALYZE AND AS ASC ASENSITIVE AUTO_INCREMENT BDB BEFORE BERKELEYDB BETWEEN BIGINT BINARY BLOB BOTH BY CALL CASCADE CASE CHANGE CHAR CHARACTER CHECK COLLATE COLUMN COLUMNS CONDITION CONNECTION CONSTRAINT CONTINUE CREATE CROSS CURRENT_DATE CURRENT_TIME CURRENT_TIMESTAMP CURSOR DATABASE DATABASES DAY_HOUR DAY_MICROSECOND DAY_MINUTE DAY_SECOND DEC DECIMAL DECLARE DEFAULT DELAYED DELETE DESC DESCRIBE DETERMINISTIC DISTINCT DISTINCTROW DIV DOUBLE DROP ELSE ELSEIF ENCLOSED ESCAPED EXISTS EXIT EXPLAIN FALSE FETCH FIELDS FLOAT FOR FORCE FOREIGN FOUND FRAC_SECOND FROM FULLTEXT GRANT GROUP HAVING HIGH_PRIORITY HOUR_MICROSECOND HOUR_MINUTE HOUR_SECOND IF IGNORE IN INDEX INFILE INNER INNODB INOUT INSENSITIVE INSERT INT INTEGER INTERVAL INTO IO_THREAD IS ITERATE JOIN KEY KEYS KILL LEADING LEAVE LEFT LIKE LIMIT LINES LOAD LOCALTIME LOCALTIMESTAMP LOCK LONG LONGBLOB LONGTEXT LOOP LOW_PRIORITY MASTER_SERVER_ID MATCH MEDIUMBLOB MEDIUMINT MEDIUMTEXT MIDDLEINT MINUTE_MICROSECOND MINUTE_SECOND MOD NATURAL NO_WRITE_TO_BINLOG NOT NULL NUMERIC ON OPTIMIZE OPTION OPTIONALLY OR ORDER OUT OUTER OUTFILE PRECISION PRIMARY PRIVILEGES PROCEDURE PURGE READ REAL REFERENCES REGEXP RENAME REPEAT REPLACE REQUIRE RESTRICT RETURN REVOKE RIGHT RLIKE SECOND_MICROSECOND SELECT SENSITIVE SEPARATOR SET SHOW SMALLINT SOME SONAME SPATIAL SPECIFIC SQL SQL_BIG_RESULT SQL_CALC_FOUND_ROWS SQL_SMALL_RESULT SQL_TSI_DAY SQL_TSI_FRAC_SECOND SQL_TSI_HOUR SQL_TSI_MINUTE SQL_TSI_MONTH SQL_TSI_QUARTER SQL_TSI_SECOND SQL_TSI_WEEK SQL_TSI_YEAR SQLEXCEPTION SQLSTATE SQLWARNING SSL STARTING STRAIGHT_JOIN STRIPED TABLE TABLES TERMINATED THEN TIMESTAMPADD TIMESTAMPDIFF TINYBLOB TINYINT TINYTEXT TO TRAILING TRUE UNDO UNION UNIQUE UNLOCK UNSIGNED UPDATE USAGE USE USER_RESOURCES USING UTC_DATE UTC_TIME UTC_TIMESTAMP VALUES VARBINARY VARCHAR VARCHARACTER VARYING WHEN WHERE WHILE WITH WRITE XOR YEAR_MONTH ZEROFILL oci8-words.txt000066400000000000000000000013041262614675700376530ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package/packagefiles/DB_Table/docs/reserved_wordsACCESS ADD ALL ALTER AND ANY AS ASC AUDIT BETWEEN BY CHAR CHECK CLUSTER COLUMN COMMENT COMPRESS CONNECT CREATE CURRENT DATE DECIMAL DEFAULT DELETE DESC DISTINCT DROP ELSE EXCLUSIVE EXISTS FILE FLOAT FOR FROM GRANT GROUP HAVING IDENTIFIED IMMEDIATE IN INCREMENT INDEX INITIAL INSERT INTEGER INTERSECT INTO IS LEVEL LIKE LOCK LONG MAXEXTENTS MINUS MLSLABEL MODE MODIFY NOAUDIT NOCOMPRESS NOT NOWAIT NULL NUMBER OF OFFLINE ON ONLINE OPTION OR ORDER PCTFREE PRIOR PRIVILEGES PUBLIC RAW RENAME RESOURCE REVOKE ROW ROWID ROWNUM ROWS SELECT SESSION SET SHARE SIZE SMALLINT START SUCCESSFUL SYNONYM SYSDATE TABLE THEN TO TRIGGER UID UNION UNIQUE UPDATE USER VALIDATE VALUES VARCHAR VARCHAR2 VIEW WHENEVER WHERE WITH pgsql-words.txt000066400000000000000000000011341262614675700401400ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package/packagefiles/DB_Table/docs/reserved_wordsALL ANALYSE ANALYZE AND ANY AS ASC AUTHORIZATION BETWEEN BINARY BOTH CASE CAST CHECK COLLATE COLUMN CONSTRAINT CREATE CROSS CURRENT_DATE CURRENT_TIME CURRENT_TIMESTAMP CURRENT_USER DEFAULT DEFERRABLE DESC DISTINCT DO ELSE END EXCEPT FALSE FOR FOREIGN FREEZE FROM FULL GRANT GROUP HAVING ILIKE IN INITIALLY INNER INTERSECT INTO IS ISNULL JOIN LEADING LEFT LIKE LIMIT LOCALTIME LOCALTIMESTAMP NATURAL NEW NOT NOTNULL NULL OFF OFFSET OLD ON ONLY OR ORDER OUTER OVERLAPS PLACING PRIMARY REFERENCES RIGHT SELECT SESSION_USER SIMILAR SOME TABLE THEN TO TRAILING TRUE UNION UNIQUE USER USING VERBOSE WHEN WHERE sql92-words.txt000066400000000000000000000031511262614675700377650ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package/packagefiles/DB_Table/docs/reserved_wordsABSOLUTE ACTION ADD ALL ALLOCATE ALTER AND ANY ARE AS ASC ASSERTION AT AUTHORIZATION AVG BEGIN BETWEEN BIT BIT_LENGTH BOTH BY CASCADE CASCADED CASE CAST CATALOG CHAR CHARACTER CHARACTER_LENGTH CHAR_LENGTH CHECK CLOSE COALESCE COLLATE COLLATION COLUMN COMMIT CONNECT CONNECTION CONSTRAINT CONSTRAINTS CONTINUE CONVERT CORRESPONDING COUNT CREATE CROSS CURRENT CURRENT_DATE CURRENT_TIME CURRENT_TIMESTAMP CURRENT_USER CURSOR DATE DAY DEALLOCATE DEC DECIMAL DECLARE DEFAULT DEFERRABLE DEFERRED DELETE DESC DESCRIBE DESCRIPTOR DIAGNOSTICS DISCONNECT DISTINCT DOMAIN DOUBLE DROP ELSE END END-EXEC ESCAPE EXCEPT EXCEPTION EXEC EXECUTE EXISTS EXTERNAL EXTRACT FALSE FETCH FIRST FLOAT FOR FOREIGN FOUND FROM FULL GET GLOBAL GO GOTO GRANT GROUP HAVING HOUR IDENTITY IMMEDIATE IN INDICATOR INITIALLY INNER INPUT INSENSITIVE INSERT INT INTEGER INTERSECT INTERVAL INTO IS ISOLATION JOIN KEY LANGUAGE LAST LEADING LEFT LEVEL LIKE LOCAL LOWER MATCH MAX MIN MINUTE MODULE MONTH NAMES NATIONAL NATURAL NCHAR NEXT NO NOT NULL NULLIF NUMERIC OCTET_LENGTH OF ON ONLY OPEN OPTION OR ORDER OUTER OUTPUT OVERLAPS PAD PARTIAL POSITION PRECISION PREPARE PRESERVE PRIMARY PRIOR PRIVILEGES PROCEDURE PUBLIC READ REAL REFERENCES RELATIVE RESTRICT REVOKE RIGHT ROLLBACK ROWS SCHEMA SCROLL SECOND SECTION SELECT SESSION SESSION_USER SET SIZE SMALLINT SOME SPACE SQL SQLCODE SQLERROR SQLSTATE SUBSTRING SUM SYSTEM_USER TABLE TEMPORARY THEN TIME TIMESTAMP TIMEZONE_HOUR TIMEZONE_MINUTE TO TRAILING TRANSACTION TRANSLATE TRANSLATION TRIM TRUE UNION UNIQUE UNKNOWN UPDATE UPPER USAGE USER USING VALUE VALUES VARCHAR VARYING VIEW WHEN WHENEVER WHERE WITH WORK WRITE YEAR ZONE sql99-words.txt000066400000000000000000000042011262614675700377710ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package/packagefiles/DB_Table/docs/reserved_wordsABSOLUTE ACTION ADD ADMIN AFTER AGGREGATE ALIAS ALL ALLOCATE ALTER AND ANY ARE ARRAY AS ASC ASSERTION AT AUTHORIZATION BEFORE BEGIN BINARY BIT BLOB BOOLEAN BOTH BREADTH BY CALL CASCADE CASCADED CASE CAST CATALOG CHAR CHARACTER CHECK CLASS CLOB CLOSE COLLATE COLLATION COLUMN COMMIT COMPLETION CONNECT CONNECTION CONSTRAINT CONSTRAINTS CONSTRUCTOR CONTINUE CORRESPONDING CREATE CROSS CUBE CURRENT CURRENT_DATE CURRENT_PATH CURRENT_ROLE CURRENT_TIME CURRENT_TIMESTAMP CURRENT_USER CURSOR CYCLE DATA DATE DAY DEALLOCATE DEC DECIMAL DECLARE DEFAULT DEFERRABLE DEFERRED DELETE DEPTH DEREF DESC DESCRIBE DESCRIPTOR DESTROY DESTRUCTOR DETERMINISTIC DIAGNOSTICS DICTIONARY DISCONNECT DISTINCT DOMAIN DOUBLE DROP DYNAMIC EACH ELSE END END-EXEC EQUALS ESCAPE EVERY EXCEPT EXCEPTION EXEC EXECUTE EXTERNAL FALSE FETCH FIRST FLOAT FOR FOREIGN FOUND FREE FROM FULL FUNCTION GENERAL GET GLOBAL GO GOTO GRANT GROUP GROUPING HAVING HOST HOUR IDENTITY IGNORE IMMEDIATE IN INDICATOR INITIALIZE INITIALLY INNER INOUT INPUT INSERT INT INTEGER INTERSECT INTERVAL INTO IS ISOLATION ITERATE JOIN KEY LANGUAGE LARGE LAST LATERAL LEADING LEFT LESS LEVEL LIKE LIMIT LOCAL LOCALTIME LOCALTIMESTAMP LOCATOR MAP MATCH MINUTE MODIFIES MODIFY MODULE MONTH NAMES NATIONAL NATURAL NCHAR NCLOB NEW NEXT NO NONE NOT NULL NUMERIC OBJECT OF OFF OLD ON ONLY OPEN OPERATION OPTION OR ORDER ORDINALITY OUT OUTER OUTPUT PAD PARAMETER PARAMETERS PARTIAL PATH POSTFIX PRECISION PREFIX PREORDER PREPARE PRESERVE PRIMARY PRIOR PRIVILEGES PROCEDURE PUBLIC READ READS REAL RECURSIVE REF REFERENCES REFERENCING RELATIVE RESTRICT RESULT RETURN RETURNS REVOKE RIGHT ROLE ROLLBACK ROLLUP ROUTINE ROW ROWS SAVEPOINT SCHEMA SCOPE SCROLL SEARCH SECOND SECTION SELECT SEQUENCE SESSION SESSION_USER SET SETS SIZE SMALLINT SOME SPACE SPECIFIC SPECIFICTYPE SQL SQLEXCEPTION SQLSTATE SQLWARNING START STATE STATEMENT STATIC STRUCTURE SYSTEM_USER TABLE TEMPORARY TERMINATE THAN THEN TIME TIMESTAMP TIMEZONE_HOUR TIMEZONE_MINUTE TO TRAILING TRANSACTION TRANSLATION TREAT TRIGGER TRUE UNDER UNION UNIQUE UNKNOWN UNNEST UPDATE USAGE USER USING VALUE VALUES VARCHAR VARIABLE VARYING VIEW WHEN WHENEVER WHERE WITH WITHOUT WORK WRITE YEAR ZONE sqlite-words.txt000066400000000000000000000006151262614675700403160ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package/packagefiles/DB_Table/docs/reserved_words_ROWID_ ALL AND AS BETWEEN BY CASE CHECK COLLATE COMMIT CONSTRAINT CREATE DEFAULT DEFERRABLE DELETE DISTINCT DROP ELSE EXCEPT FOREIGN FROM GLOB GROUP HAVING IN INDEX INSERT INTERSECT INTO IS ISNULL JOIN LIKE LIMIT MAIN NOT NOTNULL NULL OID ON OR ORDER PRIMARY REFERENCES ROLLBACK ROWID SELECT SET SQLITE_MASTER SQLITE_TEMP_MASTER TABLE THEN TRANSACTION UNION UNIQUE UPDATE USING VALUES WHEN WHERE package.xml000066400000000000000000000203421262614675700332470ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package/packagefiles/DB_Table DB_Table pear.php.net An object oriented interface to, and model of, a database. Integrates with HTML_QuickForm. The DB_Table package provides an object oriented interface to a database. Each instance of the core DB_Table class contains the schema for a table, defined using abstract data types. The class provides a portable api for insert, update, delete, and select SQL commands, and can validate data types upon insertion and updating. It provides methods to automatically create or verify a database table. DB_Table also provides methods (using PEAR HTML_QuickForm) to generate input forms that match the column definitions. Each instance of the DB_Table_Database class contains a model of relationships between tables in a database, in which each table is represented by an instance of DB_Table. DB_Table_Database provides a method for automatic construction of join conditions for inner joins involving any number of tables, optional php validation of foreign key validity, and optional php emulation of actions triggered on delete or update of referenced rows, such as cascading deletes. The DB_Table_Generator class auto-generates the php code necessary to create an interface to an existing database. Paul M. Jones pmjones pmjones@php.net no David Morse morse morse@php.net yes Mark Wiesemann wiesemann wiesemann@php.net yes 2007-06-14 1.5.0RC3 1.5.0 beta beta LGPL - Added complete documentation in the PEAR manual. - new DB_Table_Base class added. This is a parent class for DB_Table and DB_Table_Database that contains methods and properties common to both classes. - The DB_Table::select*() and DB_Table::buildSQL() methods, which are now inherited from the DB_Table_Base class, now accept either a query array or (as before) a key of the $sql property array as a first argument. - Added DB_Table_Database::onDeleteAction() and DB_Table_Database::onUpdateAction() methods, which implement referentially triggered actions (e.g., cascading deletes). This code had previously been part of the DB_Table_Database insert() and update() methods. - Changed behavior of DB_Table::insert() and DB_Table::update() method for a DB_Table object that is part of a DB_Table_Database instance: If a parent DB_Table_Database object exists, these methods can now validate foreign keys and implement ON DELETE and ON UPDATE actions, if these behaviors are enabled in the parent DB_Table_Database object. The behaviors of the DB_Table and DB_Table_Database insert and update methods are now identical. (This is a BC break with 1.5.0RC1 and 1.5.0RC2 beta releases, but not with earlier stable releases.) - Disable automatic foreign key validation by default (BC break with releases 1.5.0RC1 and 1.5.0RC2). - Added buildFilter() method to the DB_Table_Base class. This a simplified version of the DB_Table_Database::buildFilter() method of previous 1.5.0RC* releases. (BC break with 1.5.0RC1 and 1.5.0RC2) - Added a private DB_Table_Database::_buildForeignKeyFilter() for more specialized uses of the old buildFilter() method, which are used internally to construct queries. - Changed return value of DB_Table_Database::validForeignKey on failure from boolean false to PEAR_Error. Changed related error codes. - Changed 'autoinc' element of XML output to 'autoincrement' for consistency with MDB2 XML schema. - Simplified unit tests for DB_Table_Database by adding a parent DatabaseTest unit test class. 4.3.0 1.5.0 HTML_QuickForm pear.php.net DB pear.php.net 1.7.11 MDB2 pear.php.net 2.4.1 php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package/packagefiles/DB_Table/tests/000077500000000000000000000000001262614675700323525ustar00rootroot00000000000000bogotest.php000066400000000000000000000060771262614675700346440ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package/packagefiles/DB_Table/tests array( 'type' => 'varchar', 'size' => '64' ), */ 'xvarchar' => array( 'type' => 'varchar', 'size' => 128, 'require' => false, 'qf_type' => 'radio', 'qf_radiosep' => '
', 'qf_vals' => array( 'another', 'other', 'that', 'this' ) ), 'xbool' => array( 'type' => 'boolean' ), 'xchar' => array( 'type' => 'char', 'size' => 10, 'require' => true ), 'xclob' => array( 'type' => 'clob', 'require' => false ), 'xsmint' => array( 'type' => 'smallint', 'require' => false, 'qf_client' => true ), 'xint' => array( 'type' => 'integer', 'require' => true ), 'xbigint' => array( 'type' => 'bigint', 'require' => false ), 'xdecimal' => array( 'type' => 'decimal', 'size' => 5, 'scope' => 2, 'require' => false ), 'xsingle' => array( 'type' => 'single', 'require' => false ), 'xdouble' => array( 'type' => 'double', 'require' => false ), 'xdate' => array( 'type' => 'date', 'default' => "'0001-01-01'", 'require' => false ), 'xtime' => array( 'type' => 'time', 'default' => "'00:00:00'", 'require' => false ), 'xtimestamp' => array( 'type' => 'timestamp' ), ); var $idx = array( 'id' => array( 'type' => 'unique', 'cols' => array('xint') ), 'multi' => array( 'type' => 'normal', 'cols' => array('xdate', 'xtime', 'xchar') ) ); var $sql = array( 'list' => array( 'select' => '*', 'get' => 'row' ) ); } $opts = parse_ini_file('setup.ini', true); $db = DB::Connect($opts['dsn']); $example =& new example( $db, $opts['example']['table'], $opts['example']['create'] ); if ($example->error) { Var_Dump::display($example->error); die(); } if ($opts['example']['display']) { Var_Dump::display($example); } if ($opts['example']['fetch']) { $example->fetchmode = DB_FETCHMODE_ASSOC; $result = $example->select('list'); Var_Dump::display($result); } $form =& $example->getForm(null, 'mydata', null); $form->addElement('submit', 'op', 'Submit'); //Var_dump::display($form); echo "bogotest\n"; // test recasting $values = $form->exportValues(); $example->recast($values['mydata']); Var_Dump::display($values); // test validation and insert if ($form->validate()) { $values = $form->exportValues(); Var_Dump::display($values['mydata']); $result = $example->insert($values['mydata']); Var_Dump::display($result); } $form->display(); echo "\n
\n"; $example->fetchmode = DB_FETCHMODE_ASSOC; $list = $example->select('list'); Var_Dump::display($list); $result = $example->insert(array( 'xvarchar' => null, 'xchar' => 'a', 'xdecimal' => '', 'xsingle' => null, 'xdouble' => null, 'xint' => 1, )); Var_Dump::display($result); echo "\n"; ?>config.php-dist000066400000000000000000000025101262614675700352100ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package/packagefiles/DB_Table/testsgetMessage()."\n"; die; } } elseif ($backend == 'MDB2') { require_once 'MDB2.php'; $conn =& MDB2::factory($dsn); if (PEAR::isError($conn)) { print "\n" . "Failure to connect by MDB2"; print "\n" . $conn->getMessage(); die; } } ?> database/000077500000000000000000000000001262614675700340375ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package/packagefiles/DB_Table/testsAutoJoinTest.php000066400000000000000000000105331262614675700371420ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package/packagefiles/DB_Table/tests/databaseverbose > -1) { print "\n" . ">testJoin1"; } $db =& $this->db; $success = true; $cols = array(); $cols[] = 'Street'; $cols[] = 'FirstName'; $cols[] = 'LastName'; $cols[] = 'PhoneNumber'; $cols[] = 'Building'; $cols[] = 'City'; $report = $db->autoJoin($cols); if (PEAR::isError($report)) { print "\n" . $report->getMessage(); $this->assertTrue(false); } $result = $db->buildSQL($report, "City = 'MINNETONKA'"); if (PEAR::isError($result)) { print "\n" . $result->getMessage(); $this->assertTrue(false); } else { $expect = <<verbose > 1) { print "\n" . $result; } } $this->assertEquals($result, $expect); } function testJoin2() { if ($this->verbose > -1) { print "\n" . ">testJoin2"; } $db =& $this->db; $success = true; $cols = array(); $cols[] = 'PersonID'; $cols[] = 'FirstName'; $cols[] = 'LastName'; $tables = array(); $tables[] = 'PersonPhone'; $report = $db->autoJoin($cols, $tables); if (PEAR::isError($report)) { print "\n" . $report->getMessage(); $this->assertTrue(false); } $result = $db->buildSQL($report); if (PEAR::isError($result)) { print "\n" . $result->getMessage(); $this->assertTrue(false); } else { $expect = <<verbose > 1) { print "\n" . $result; } } $this->assertEquals($result, $expect); } function testJoin3() { if ($this->verbose > -1) { print "\n" . ">testJoin3"; } $db =& $this->db; $success = true; $cols = array(); $cols[] = 'LastName'; $cols[] = 'FirstName'; $cols[] = 'PhoneNumber'; $cols[] = 'Building'; $cols[] = 'Street'; $cols[] = 'City'; $cols[] = 'ZipCode'; $report = $this->db->autoJoin($cols); if (PEAR::isError($report)) { print "\n" . $report->getMessage(); $this->assertTrue(false); return; } $result = $db->buildSQL($report, "Street.City = 'MINNETONKA'"); if (PEAR::isError($result)) { print "\n" . $result->getMessage(); $this->assertTrue(false); } else { $expect = <<verbose > 1) { print "\n" . $result; } } $this->assertEquals($result, $expect); } } ?> DatabaseTest.php000066400000000000000000000053621262614675700371220ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package/packagefiles/DB_Table/tests/databaseinsert) { require 'db1/insert.php'; } else { require 'db1/define.php'; } $db->setTableSubclassPath('db1'); $this->name = $db_name; $this->conn =& $conn; $this->db =& $db; $this->db_conn = $db_conn; $this->verbose = $verbose; if ($this->db->backend == 'mdb2') { $this->fetchmode_assoc = MDB2_FETCHMODE_ASSOC; $this->fetchmode_order = MDB2_FETCHMODE_ORDERED; } else { $this->fetchmode_assoc = DB_FETCHMODE_ASSOC; $this->fetchmode_order = DB_FETCHMODE_ORDERED; } // Copy expected values of properties of $db foreach ($properties as $property_name) { $this->$property_name = $$property_name; } // Copy arrays containing contents of tables of $db if ($this->insert) { foreach ($table_arrays as $table_name => $array) { $this->$table_name = $array; } } } function tearDown() { if ($this->insert) { if (!$this->db_conn) { // print "\nDropping Database"; $this->conn->query("DROP DATABASE {$this->name}"); } else { $tables = $this->db->getTable(); foreach ($tables as $table) { $name = $table->table; $this->conn->query("DROP Table $name"); } $this->conn->query("DROP Table DataFile"); $this->conn->query("DROP Table Person_seq"); $this->conn->query("DROP Table Address_seq"); $this->conn->query("DROP Table Phone_seq"); } // print "\nDisconnecting"; $this->conn->disconnect(); } } function print_result($result, $name) { if ($this->verbose > 1) { if ($name) { print "\nContents of $name"; } foreach ($result as $row) { $s = array(); foreach ($row as $key => $value){ $s[] = "$value"; } print "\n" . implode(', ',$s); } } } } ?> DeleteTest.php000066400000000000000000000352031262614675700366150ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package/packagefiles/DB_Table/tests/databaseverbose > -1) { print "\n" . ">testDeleteRef1"; } if ($this->verbose > 0) { print "\n" . "Delete reference Address => Street"; } $db =& $this->db; $result = $db->deleteRef('Address', 'Street'); if (PEAR::isError($result)) { print $result->getMessage(); $this->assertTrue(false); return; } $ref = $db->getRef(); if (PEAR::isError($ref)) { print $ref->getMessage(); $this->assertTrue(false); return; } if ($this->verbose > 0) { print "\n\nRef:"; foreach ($ref as $ftable => $references) { foreach ($references as $rtable => $ref) { print "\n$ftable => $rtable"; } } } $ref_to = $db->getRefTo(); if (PEAR::isError($ref_to)) { print $ref_to->getMessage(); $this->assertTrue(false); return; } if ($this->verbose > 0) { print "\n\nRefTo:"; foreach ($ref_to as $rtable => $references) { $s = array(); foreach ($references as $ftable) { $s[] = $ftable; } print "\n$rtable <= (" . implode(', ', $s) . ')'; } } $link = $db->getLink(); if (PEAR::isError($link)) { print $link->getMessage(); $this->assertTrue(false); return; } if ($this->verbose > 0) { print "\n\nLink:"; foreach ($link as $table1 => $list) { foreach ($list as $table2 => $links) { $s = array(); foreach ($links as $link_table) { $s[] = $link_table; } print "\n$table1, $table2 : (" . implode(', ', $s) . ')'; } } } } function testDeleteRef2() { if ($this->verbose > -1) { print "\n" . ">testDeleteRef2"; } if ($this->verbose > 0) { print "\n" . "Delete reference PersonAddress => Person"; } $db =& $this->db; $result = $db->deleteRef('PersonAddress', 'Person'); if (PEAR::isError($result)) { print $result->getMessage(); $this->assertTrue(false); return; } $ref = $db->getRef(); if (PEAR::isError($ref)) { print $ref->getMessage(); $this->assertTrue(false); return; } if ($this->verbose > 0) { print "\n\nRef:"; foreach ($ref as $ftable => $references) { foreach ($references as $rtable => $ref) { print "\n$ftable => $rtable"; } } } $ref_to = $db->getRefTo(); if (PEAR::isError($ref_to)) { print $ref_to->getMessage(); $this->assertTrue(false); return; } if ($this->verbose > 0) { print "\n\nRefTo:"; foreach ($ref_to as $rtable => $references) { $s = array(); foreach ($references as $ftable) { $s[] = $ftable; } print "\n$rtable <= (" . implode(', ', $s) . ')'; } } $link = $db->getLink(); if (PEAR::isError($link)) { print $link->getMessage(); $this->assertTrue(false); return; } if ($this->verbose > 0) { print "\n\nLink:"; foreach ($link as $table1 => $list) { foreach ($list as $table2 => $links) { $s = array(); foreach ($links as $link_table) { $s[] = $link_table; } print "\n$table1, $table2 : (" . implode(', ', $s) . ')'; } } } } function testDeleteTable1() { if ($this->verbose > -1) { print "\n" . ">testDeleteTable1"; } if ($this->verbose > 0) { print "\n" . "Delete Table Person"; } $db =& $this->db; $result = $db->deleteTable('Person'); if (PEAR::isError($result)) { print $result->getMessage(); $this->assertTrue(false); return; } $table = $db->getTable(); if (PEAR::isError($table)) { print $table->getMessage(); $this->assertTrue(false); return; } print "\n\nTable: "; $s = array(); foreach ($table as $name => $def) { $s[] = $name; } print implode(', ', $s); $col = $db->getCol(); if (PEAR::isError($col)) { print $col->getMessage(); $this->assertTrue(false); return; } if ($this->verbose > 0) { print "\n\nCol:"; foreach ($col as $column => $tables) { $s = array(); foreach ($tables as $table) { $s[] = $table; } print "\n$column : (" . implode(', ', $s) . ')'; } } $foreign_col = $db->getForeignCol(); if (PEAR::isError($foreign_col)) { print $col->getMessage(); $this->assertTrue(false); return; } if ($this->verbose > 0) { print "\n\nForeignCol:"; foreach ($foreign_col as $column => $tables) { $s = array(); foreach ($tables as $table) { $s[] = $table; } print "\n$column : (" . implode(', ', $s) . ')'; } } $ref = $db->getRef(); if (PEAR::isError($ref)) { print $ref->getMessage(); $this->assertTrue(false); return; } if ($this->verbose > 0) { print "\n\nRef:"; foreach ($ref as $ftable => $references) { foreach ($references as $rtable => $ref) { print "\n$ftable => $rtable"; } } } $ref_to = $db->getRefTo(); if (PEAR::isError($ref_to)) { print $ref_to->getMessage(); $this->assertTrue(false); return; } if ($this->verbose > 0) { print "\n\nRefTo:"; foreach ($ref_to as $rtable => $references) { $s = array(); foreach ($references as $ftable) { $s[] = $ftable; } print "\n$rtable <= (" . implode(', ', $s) . ')'; } } $link = $db->getLink(); if (PEAR::isError($link)) { print $link->getMessage(); $this->assertTrue(false); return; } if ($this->verbose > 0) { print "\n\nLink:"; foreach ($link as $table1 => $list) { foreach ($list as $table2 => $links) { $s = array(); foreach ($links as $link_table) { $s[] = $link_table; } print "\n$table1, $table2 : (" . implode(', ', $s) . ')'; } } } } function testDeleteTable2() { if ($this->verbose > -1) { print "\n" . ">testDeleteTable2"; } if ($this->verbose > 0) { print "\n" . "Delete Table PersonAddress"; } $db =& $this->db; $result = $db->deleteTable('PersonAddress'); if (PEAR::isError($result)) { print $result->getMessage(); $this->assertTrue(false); return; } $table = $db->getTable(); if (PEAR::isError($table)) { print $table->getMessage(); $this->assertTrue(false); return; } print "\n\nTable: "; $s = array(); foreach ($table as $name => $def) { $s[] = $name; } print implode(', ', $s); $col = $db->getCol(); if (PEAR::isError($col)) { print $col->getMessage(); $this->assertTrue(false); return; } if ($this->verbose > 0) { print "\n\nCol:"; foreach ($col as $column => $tables) { $s = array(); foreach ($tables as $table) { $s[] = $table; } print "\n$column : (" . implode(', ', $s) . ')'; } } $foreign_col = $db->getForeignCol(); if (PEAR::isError($foreign_col)) { print $col->getMessage(); $this->assertTrue(false); return; } if ($this->verbose > 0) { print "\n\nForeignCol:"; foreach ($foreign_col as $column => $tables) { $s = array(); foreach ($tables as $table) { $s[] = $table; } print "\n$column : (" . implode(', ', $s) . ')'; } } $ref = $db->getRef(); if (PEAR::isError($ref)) { print $ref->getMessage(); $this->assertTrue(false); return; } if ($this->verbose > 0) { print "\n\nRef:"; foreach ($ref as $ftable => $references) { foreach ($references as $rtable => $ref) { print "\n$ftable => $rtable"; } } } $ref_to = $db->getRefTo(); if (PEAR::isError($ref_to)) { print $ref_to->getMessage(); $this->assertTrue(false); return; } if ($this->verbose > 0) { print "\n\nRefTo:"; foreach ($ref_to as $rtable => $references) { $s = array(); foreach ($references as $ftable) { $s[] = $ftable; } print "\n$rtable <= (" . implode(', ', $s) . ')'; } } $link = $db->getLink(); if (PEAR::isError($link)) { print $link->getMessage(); $this->assertTrue(false); return; } if ($this->verbose > 0) { print "\n\nLink:"; foreach ($link as $table1 => $list) { foreach ($list as $table2 => $links) { $s = array(); foreach ($links as $link_table) { $s[] = $link_table; } print "\n$table1, $table2 : (" . implode(', ', $s) . ')'; } } } } function testDeleteTable3() { if ($this->verbose > -1) { print "\n" . ">testDeleteTable3"; } if ($this->verbose > 0) { print "\n" . "Delete Table Address"; } $db =& $this->db; $result = $db->deleteTable('Address'); if (PEAR::isError($result)) { print $result->getMessage(); $this->assertTrue(false); return; } $table = $db->getTable(); if (PEAR::isError($table)) { print $table->getMessage(); $this->assertTrue(false); return; } print "\n\nTable: "; $s = array(); foreach ($table as $name => $def) { $s[] = $name; } print implode(', ', $s); $col = $db->getCol(); if (PEAR::isError($col)) { print $col->getMessage(); $this->assertTrue(false); return; } if ($this->verbose > 0) { print "\n\nCol:"; foreach ($col as $column => $tables) { $s = array(); foreach ($tables as $table) { $s[] = $table; } print "\n$column : (" . implode(', ', $s) . ')'; } } $foreign_col = $db->getForeignCol(); if (PEAR::isError($foreign_col)) { print $col->getMessage(); $this->assertTrue(false); return; } if ($this->verbose > 0) { print "\n\nForeignCol:"; foreach ($foreign_col as $column => $tables) { $s = array(); foreach ($tables as $table) { $s[] = $table; } print "\n$column : (" . implode(', ', $s) . ')'; } } $ref = $db->getRef(); if (PEAR::isError($ref)) { print $ref->getMessage(); $this->assertTrue(false); return; } if ($this->verbose > 0) { print "\n\nRef:"; foreach ($ref as $ftable => $references) { foreach ($references as $rtable => $ref) { print "\n$ftable => $rtable"; } } } $ref_to = $db->getRefTo(); if (PEAR::isError($ref_to)) { print $ref_to->getMessage(); $this->assertTrue(false); return; } if ($this->verbose > 0) { print "\n\nRefTo:"; foreach ($ref_to as $rtable => $references) { $s = array(); foreach ($references as $ftable) { $s[] = $ftable; } print "\n$rtable <= (" . implode(', ', $s) . ')'; } } $link = $db->getLink(); if (PEAR::isError($link)) { print $link->getMessage(); $this->assertTrue(false); return; } if ($this->verbose > 0) { print "\n\nLink:"; foreach ($link as $table1 => $list) { foreach ($list as $table2 => $links) { $s = array(); foreach ($links as $link_table) { $s[] = $link_table; } print "\n$table1, $table2 : (" . implode(', ', $s) . ')'; } } } } } ?> GetTest.php000066400000000000000000000405061262614675700361340ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package/packagefiles/DB_Table/tests/databaseverbose > -1) { print "\n" . ">testGetTable1"; } $db =& $this->db; $table = $db->getTable(); if (PEAR::isError($table)) { $success = false; print $table->getMessage(); } else { $success = is_array($table); if (!$success) { print "Table is not an array in testGetTable1"; } } $this->assertTrue($success); } function testGetTable2() { // Test get of entire $table['Person'] property if ($this->verbose > -1) { print "\n" . ">testGetTable2"; } $db =& $this->db; $table = $db->getTable('Person'); if (PEAR::isError($table)) { $success = false; print $table->getMessage(); } else { $success = is_a($table, 'DB_Table'); if (!$success) { print "Table is not a DB_Table object in testGetTable2"; } } $this->assertTrue($success); } function testGetTable3() { // Test get of invalid table name if ($this->verbose > -1) { print "\n" . ">testGetTable3"; } $db =& $this->db; $table = $db->getTable('Thwack'); if (PEAR::isError($table)) { $success = true; if ($this->verbose > 0) { print "\n".$table->getMessage(); } } else { $success = false; } $this->assertTrue($success); } function testGetPrimaryKey1() { // Test get of entire $primary_key property if ($this->verbose > -1) { print "\n" . ">testGetPrimaryKey1"; } $db =& $this->db; $primary_key = $db->getPrimaryKey(); if (PEAR::isError($primary_key)) { $success = false; print "\n" . $primary_key->getMessage(); $this->assertTrue($success); return; } else { $success = is_array($primary_key); if (!$success) { print "\nPrimaryKey is not an array in testGetPrimaryKey1"; $this->assertTrue($success); return; } else { $this->assertEquals($primary_key, $this->primary_key); } } } function testGetPrimaryKey2() { // Test get of $primary_key['Person'] if ($this->verbose > -1) { print "\n" . ">testGetPrimaryKey2"; } $db =& $this->db; $primary_key = $db->getPrimaryKey('Person'); if (PEAR::isError($primary_key)) { $success = false; print $primary_key->getMessage(); $this->assertTrue($success); return; } else { $success = is_string($primary_key); if (!$success) { print "PrimaryKey['Person'] is not a string in testGetPrimaryKey2"; $this->assertTrue($success); return; } else { $this->assertEquals($primary_key, $this->primary_key['Person']); } } } function testGetPrimaryKey3() { // Test get of $primary_key with invalid Table name if ($this->verbose > -1) { print "\n" . ">testGetPrimaryKey3"; } $db =& $this->db; $primary_key = $db->getPrimaryKey('Thwack'); if (PEAR::isError($primary_key)) { $success = true; if ($this->verbose > 0) { print "\n" . $primary_key->getMessage(); } } else { $success = false; } $this->assertTrue($success); } function testTableSubclass1() { // Test get of entire $table_subclass property if ($this->verbose > -1) { print "\n" . ">testGetTableSubclass1"; } $db =& $this->db; $table_subclass = $db->getTableSubclass(); if (PEAR::isError($table_subclass)) { $success = false; print "\n" . $table_subclass->getMessage(); $this->assertTrue($success); return; } else { $success = is_array($table_subclass); if (!$success) { print "\nTableSubclass is not an array in testGetTableSubclass1"; $this->assertTrue($success); return; } else { $this->assertEquals($table_subclass, $this->table_subclass); } } } function testGetRef1() { if ($this->verbose > -1) { print "\n" . ">testGetRef1"; } $db =& $this->db; $ref = $db->getRef(); if (PEAR::isError($ref)) { $success = false; print $ref->getMessage(); $this->assertTrue($success); return; } else { $success = is_array($ref); if (!$success) { print "\nRef is not an array in testGetRef1"; $this->assertTrue($success); return; } else { $this->assertEquals($ref, $this->ref); } } } function testGetRef2() { // Test get of $ref['PersonAddress'], which should be an array if ($this->verbose > -1) { print "\n" . ">testGetRef2"; } $db =& $this->db; $ref = $db->getRef('PersonAddress'); if (PEAR::isError($ref)) { $success = false; print $ref->getMessage(); $this->assertTrue($success); return; } else { $success = is_array($ref); if (!$success) { print "\nRef is not an array in testGetRef2"; $this->assertTrue($success); return; } else { $this->assertEquals($ref, $this->ref['PersonAddress']); } } } function testGetRef3() { // Test get of $ref['Person'], which should return null if ($this->verbose > -1) { print "\n" . ">testGetRef3"; } $db =& $this->db; $ref = $db->getRef('Person'); if (PEAR::isError($ref)) { $success = false; print "\n" . $ref->getMessage() . '- in GetRef3'; } else { $success = is_null($ref); } $this->assertTrue($success); } function testGetRef4() { // Test get of $ref['PersonAddress']['Person'], which should be an array if ($this->verbose > -1) { print "\n" . ">testGetRef4"; } $db =& $this->db; $ref = $db->getRef('PersonAddress', 'Person'); if (PEAR::isError($ref)) { $success = false; print "\n" . $ref->getMessage() . " - in testGetRef4"; $this->assertTrue($success); return; } else { $success = is_array($ref); if (!$success) { print "\n" . "Ref is not an array in testGetRef4"; $this->assertTrue($success); return; } else { $this->assertEquals($ref, $this->ref['PersonAddress']['Person']); } } } function testGetRefTo1() { if ($this->verbose > -1) { print "\n" . ">testGetRefTo1"; } $db =& $this->db; $ref_to = $db->getRefTo(); if (PEAR::isError($ref_to)) { $success = false; print $ref_to->getMessage(); $this->assertTrue($success); return; } else { $success = is_array($ref_to); if (!$success) { print "\n" . "RefTo is not an array in testGetRefTo1"; $this->assertTrue($success); return; } else { $this->assertEquals($ref_to, $this->ref_to); } } } function testGetRefTo2() { // Test get of $ref_to['Person'], which should be an array if ($this->verbose > -1) { print "\n" . ">testGetRefTo2"; } $db =& $this->db; $ref_to = $db->getRefTo('Person'); if (PEAR::isError($ref_to)) { $success = false; print $ref_to->getMessage(); $this->assertTrue($success); return; } else { $success = is_array($ref_to); if (!$success) { print "\n" . "RefTo is not an array in testGetRefTo2"; $this->assertTrue($success); return; } else { $this->assertEquals($ref_to, $this->ref_to['Person']); } } } function testGetRefTo3() { // Test get of $ref_to['PersonAddress'], which should return null if ($this->verbose > -1) { print "\n" . ">testGetRefTo3"; } $db =& $this->db; $ref_to = $db->getRefTo('PersonAddress'); if (PEAR::isError($ref_to)) { $success = false; print "\n" . $ref_to->getMessage()."- in GetRefTo3"; } else { $success = is_null($ref_to); } $this->assertTrue($success); } function testGetLink1() { if ($this->verbose > -1) { print "\n" . ">testGetLink1"; } $db =& $this->db; $link = $db->getLink(); if (PEAR::isError($link)) { $success = false; print $link->getMessage(); $this->assertTrue($success); return; } else { $success = is_array($link); if (!$success) { print "\n" . 'Link is not an array in testGetLink1'; $this->assertTrue($success); return; } else { $this->assertEquals($link, $this->link); } } } function testGetLink2() { // Test get of $link['Person'], which should be an array if ($this->verbose > -1) { print "\n" . '>testGetLink2'; } $db =& $this->db; $link = $db->getLink('Person'); if (PEAR::isError($link)) { $success = false; print $link->getMessage(); $this->assertTrue($success); return; } else { $success = is_array($link); if (!$success) { print "\n" . "Link is not an array in testGetLink2"; $this->assertTrue($success); return; } else { $this->assertEquals($link, $this->link['Person']); } } } function testGetLink3() { // Test get of $link['PersonAddress'], which should return null if ($this->verbose > -1) { print "\n" . '>testGetLink3'; } $db =& $this->db; $link = $db->getLink('PersonAddress'); if (PEAR::isError($link)) { $success = false; print "\n" . $link->getMessage()."- in GetLink3"; } else { $success = is_null($link); } $this->assertTrue($success); } function testGetLink4() { // Test get of $link['Person']['Address'], which should be an array if ($this->verbose > -1) { print "\n" . ">testGetLink4"; } $db =& $this->db; $link = $db->getLink('Person', 'Address'); if (PEAR::isError($link)) { $success = false; print "\n" . $link->getMessage() . " - in testGetLink4"; $this->assertTrue($success); return; } else { $success = is_array($link); if (!$success) { print "\n" . "Link is not an array in testGetLink4"; $this->assertTrue($success); return; } else { $this->assertEquals($link, $this->link['Person']['Address']); } } } function testGetCol1() { // Test get of entire column property if ($this->verbose > -1) { print "\n" . ">testGetCol1"; } $db =& $this->db; $col = $db->getCol(); $this->assertEquals($col, $this->col); } function testGetCol2() { // Test get of col['Building'] if ($this->verbose > -1) { print "\n" . ">testGetCol2"; } $db =& $this->db; $col = $db->getCol('Building'); $this->assertEquals($col, $this->col['Building']); } function testGetForeignCol1() { // Test get of entire column property if ($this->verbose > -1) { print "\n" . ">testGetForeignCol1"; } $db =& $this->db; $foreign_col = $db->getForeignCol(); $this->assertEquals($foreign_col, $this->foreign_col); } function testGetForeignCol2() { // Test get of entire column property if ($this->verbose > -1) { print "\n" . ">testGetForeignCol2"; } $db =& $this->db; $foreign_col = $db->getForeignCol('PersonID'); $this->assertEquals($foreign_col, $this->foreign_col['PersonID']); } function testValidCol1() { // Test validCol('Building') if ($this->verbose > -1) { print "\n" . ">testValidCol1"; } $db =& $this->db; $name = implode('.', $db->validCol('Building')); $this->assertEquals('Address.Building', $name); } function testValidCol1b() { // Test validCol('Building') if ($this->verbose > -1) { print "\n" . ">testValidCol1b"; } $db =& $this->db; $from = array('Address'); $name = implode('.', $db->validCol('City', $from)); $this->assertEquals('Address.City', $name); } function testValidCol2() { if ($this->verbose > -1) { print "\n" . ">testValidCol2"; } $db =& $this->db; $name = implode('.', $db->validCol('PersonID')); $this->assertEquals('Person.PersonID', $name); } function testValidCol2b() { if ($this->verbose > -1) { print "\n" . ">testValidCol2b"; } $db =& $this->db; $from = array('PersonPhone'); $name = implode('.', $db->validCol('PersonID', $from)); $this->assertEquals('PersonPhone.PersonID', $name); } function testValidCol3() { if ($this->verbose > -1) { print "\n" . ">testValidCol3"; } $db =& $this->db; $name = implode('.', $db->validCol('PersonID2')); $this->assertEquals('PersonAddress.PersonID2', $name); } function testValidCol4() { if ($this->verbose > -1) { print "\n" . ">testValidCol4"; } $db =& $this->db; $name = implode('.', $db->validCol('Person.FirstName')); $this->assertEquals('Person.FirstName', $name); } function testValidCol5() { // validCol('Thwack.Building') if ($this->verbose > -1) { print "\n" . ">testValidCol5"; } $db =& $this->db; $result = $db->validCol('Person.Thingy'); $success = false; if (PEAR::isError($result)) { $success = true; if ($this->verbose > 0) { print "\n" . $result->getMessage(); } } $this->assertTrue($success); } function testValidCol6() { // validCol('Thwack.Building') if ($this->verbose > -1) { print "\n" . ">testValidCol6"; } $db =& $this->db; $result = $db->validCol('Thwack.Building'); $success = false; if (PEAR::isError($result)) { $success = true; if ($this->verbose > 0) { print "\n" . $result->getMessage(); } } $this->assertTrue($success); } function testValidCol7() { if ($this->verbose > -1) { print "\n" . ">testValidCol7"; } $db =& $this->db; $result = $db->validCol('Street'); if (PEAR::isError($result)) { print "\n" . $result->getMessage(); $this->assertTrue(false); } $name = implode('.', $result); $this->assertEquals('Street.Street', $name); } } ?> ModifyTest.php000066400000000000000000000760621262614675700366520ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package/packagefiles/DB_Table/tests/database $v1) { # # } # } function testValidForeignKeys1() { if ($this->verbose > -1) { print "\n" . ">testValidForeignKeys1"; } if ($this->verbose > 0) { print "\n" . "Test FKs of PersonPhone row (18,2) with valid FKs"; } $data = array(); $data['PersonID'] = 18; $data['PhoneID'] = 2; $result = $this->db->ValidForeignKeys('PersonPhone',$data); if (PEAR::isError($result)){ print "\n" . $result->getMessage(); $this->assertTrue(false); } if (!is_bool($result)) { $this->assertTrue(false); } $this->assertTrue($result); } function testValidForeignKeys2() { if ($this->verbose > -1) { print "\n" . ">testValidForeignKeys2"; } if ($this->verbose > 0) { print "\n" . "Test FKs of Address with valid multi-column FK"; } $data = array(); $data['Building'] = '1357'; $data['Street'] = 'NORMAN DR'; $data['City'] = 'MINNETONKA'; $data['StateAbb'] = 'MN'; $data['ZipCode'] = '55345'; $result = $this->db->ValidForeignKeys('Address',$data); // Check that $result is boolean true if (PEAR::isError($result)){ print "\n" . $result->getMessage(); $this->assertTrue(false); } if (!is_bool($result)) { $this->assertTrue(false); } $this->assertTrue($result); } function testValidForeignKeys3() { if ($this->verbose > -1) { print "\n" . ">testValidForeignKeys3"; } if ($this->verbose > 0) { print "\n" . "Test FKs of PersonPhone row (18,38) with invalid FK"; } $data = array(); $data['PersonID'] = 18; $data['PhoneID'] = 38; $result = $this->db->ValidForeignKeys('PersonPhone',$data); // Check that $result is a PEAR_Error object if (PEAR::isError($result)){ print "\n" . $result->getMessage(); $this->assertTrue(true); } else { $this->assertTrue(false); } } function testValidForeignKeys4() { if ($this->verbose > -1) { print "\n" . ">testValidForeignKeys4"; } if ($this->verbose > 0) { print "\n" . "Test FKs of Address with invalid multi-column FK"; } $data = array(); $data['Building'] = '1357'; $data['Street'] = 'NORMAL DR'; // Invalid: Should be 'NORMAN DR' $data['City'] = 'MINNETONKA'; $data['StateAbb'] = 'MN'; $data['ZipCode'] = '55345'; $result = $this->db->ValidForeignKeys('Address',$data); // Check that $result is a PEAR_Error object if (PEAR::isError($result)){ print "\n" . $result->getMessage(); $this->assertTrue(true); } else { $this->assertTrue(false); } } function testInsert1() { if ($this->verbose > -1) { print "\n" . ">testInsert1"; } if ($this->verbose > 0) { print "\n" . "Insert row with valid integer FKs in PersonPhone"; } // Insert new row into PersonPhone $data = array(); $data['PersonID'] = 18; $data['PhoneID'] = 2; $result = $this->db->insert('PersonPhone', $data); if (PEAR::isError($result)){ print "\n Error during insertion:"; print "\n" . $result->getMessage(); $this->assertTrue(false); } $expect = true ; $this->assertEquals($result, $expect); // Inspect PersonPhone $report = array('select' => '*', 'from' => 'PersonPhone', 'fetchmode' => $this->fetchmode_assoc ); $result = $this->db->select($report); if (PEAR::isError($result)) { print "\n Error during inspection of PersonPhone:"; print "\n" . $result->getMessage(); $this->assertTrue(false); return; } // Check number of items $this->assertEquals(count($result), count($this->PersonPhone)+1); // Search for added row $data['PersonID'] = '18'; $data['PhoneID'] = '2'; $found = false; foreach ($result as $row) { if ($row == $data) { $found = true; } } if (!$found) { print "\nError during search for missing row - not found"; var_export($result); } $this->assertTrue($found); } function testInsert2() { if ($this->verbose > -1) { print "\n" . ">testInsert2"; } if ($this->verbose > 0) { print "\n" . "Insert row with valid multi-column FK into Address"; } $data = array(); $data['Building'] = '1357'; $data['Street'] = 'NORMAN DR'; $data['City'] = 'MINNETONKA'; $data['StateAbb'] = 'MN'; $data['ZipCode'] = '55345'; $result = $this->db->insert('Address', $data); if (PEAR::isError($result)) { if ($this->verbose > 0) { print "\n" . $result->getMessage(); } $this->assertTrue(false); } else { $this->assertEquals($result, true); } // Inspect Address $report = array('select' => '*', 'from' => 'Address', 'fetchmode' => $this->fetchmode_assoc ); $result = $this->db->select($report); if (PEAR::isError($result)) { print "\n" . $result->getMessage(); $this->assertTrue(false); return; } // Check number of items $this->assertEquals(count($result), count($this->Address)+1); // Search for added row $found = false; $newID = (string) count($this->Address)+1; foreach ($result as $row) { if ($row['AddressID'] == $newID) { $found = true; foreach ($data as $key => $value) { if ($row[$key] != $value) { $this->assertTrue(false); return; } } } } if (!$found) { print 'New row not found in testInsert'; } $this->assertTrue($found); } function testInsertForeignKeyCheck1() { if ($this->verbose > -1) { print "\n" . ">testInsertForeignKeyCheck1"; } if ($this->verbose > 0) { print "\n" . "Attempt insert with invalid FK integer PhoneID in PersonPhone"; } $assoc = array(); $assoc['PersonID'] = 17; $assoc['PhoneID'] = 28; // Beyond range available in Phone $result = $this->db->insert('PersonPhone', $assoc); if (PEAR::isError($result)){ if ($this->verbose > 0) { print "\n" . $result->getMessage(); } $this->assertTrue(true); } else { $this->assertTrue(false); } } function testInsertForeignKeyCheck2() { if ($this->verbose > -1) { print "\n" . ">testInsertForeignKeyCheck2"; } if ($this->verbose > 0) { print "\n" . "Attempt insert with invalid multi-column FK in Address"; } $data = array(); $data['Building'] = '1357'; $data['Street'] = 'EASY ST'; // No such street in Street table $data['City'] = 'MINNETONKA'; $data['StateAbb'] = 'MN'; $data['ZipCode'] = '12345'; $result = $this->db->insert('Address',$data); if (PEAR::isError($result)){ if ($this->verbose > 0) { print "\n" . $result->getMessage(); } $this->assertTrue(true); } else { $this->assertTrue(false); } } function testDeleteCascade1() { if ($this->verbose > -1) { print "\n" . ">testDeleteCascade1"; } if ($this->verbose > 0) { print "\n" . 'Cascading delete with integer referenced key from Person'; } $where = 'PersonID = 15'; $result = $this->db->delete('Person',$where); if (PEAR::isError($result)) { print "\n" . $result->getMessage(); $this->assertTrue(false); return; } // Inspect PersonPhone $report = array('select' => '*', 'from' => 'PersonPhone', 'fetchmode' => $this->fetchmode_assoc ); $result = $this->db->select($report); if (PEAR::isError($result)) { print "\n" . $result->getMessage(); $this->assertTrue(false); return; } // Check number of items $this->assertEquals(count($result), count($this->PersonPhone)-1); // Check that no PersonID == '15' exists foreach ($result as $row) { if ($row['PersonID'] == '15') { $this->assertTrue(false); return; } } $this->print_result($result, 'PersonPhone'); // Inspect PersonAddress $report = array('select' => '*', 'from' => 'PersonAddress', 'fetchmode' => $this->fetchmode_assoc ); $result = $this->db->select($report); if (PEAR::isError($result)) { print "\n" . $result->getMessage(); $this->assertTrue(false); return; } // Check number of items $this->assertEquals(count($result),count($this->PersonAddress)-1); // Check that no row with PersonID2 == 15 still exists foreach ($result as $row) { if ($row['PersonID2'] == '15') { $this->assertTrue(false); return; } } $this->print_result($result, 'PersonAddress'); } function testDeleteCascade2() { if ($this->verbose > -1) { print "\n" . ">testDeleteCascade2"; } if ($this->verbose > 0) { print "\n" . "Cascading delete with multi-column referenced key from Street"; } $where = "Street = 'NORMAN DR'"; $result = $this->db->delete('Street',$where); if (PEAR::isError($result)) { print "\n" . $result->getMessage(); $this->assertTrue(false); return; } // Inspect Street $report = array('select' => '*', 'from' => 'Street', 'fetchmode' => $this->fetchmode_assoc ); $count = $this->db->selectCount($report); $this->assertEquals($count, '16'); if ($this->verbose > 1) { print "\n" . "$count rows remaining in Street"; } // Inspect Address $report = array('select' => 'AddressID, Building, Street, City', 'from' => 'Address', 'fetchmode' => $this->fetchmode_assoc ); $result = $this->db->select($report); $this->assertEquals(count($result),count($this->Address)-2); $this->print_result($result, 'Address'); // Inspect PersonAddress $report = array('select' => 'PersonID2, AddressID', 'from' => 'PersonAddress', 'fetchmode' => $this->fetchmode_assoc ); $result = $this->db->select($report); $this->assertEquals(count($result),count($this->PersonAddress)-2); $this->print_result($result, 'PersonAddress'); } function testDeleteNullify1() { if ($this->verbose > -1) { print "\n" . ">testDeleteNullify1"; } if ($this->verbose > 0) { print "\n" . 'Nullifying delete with integer referenced key from Person'; } $this->db->setOnDelete('PersonPhone', 'Person', 'set null'); $this->db->SetOnUpdate('PersonPhone', 'Person', 'set null'); $where = 'PersonID = 15'; $result = $this->db->delete('Person',$where); if (PEAR::isError($result)) { print "\n" . $result->getMessage(); $this->assertTrue(false); return; } // Inspect PersonPhone $report = array('select' => '*', 'from' => 'PersonPhone', 'fetchmode' => $this->fetchmode_assoc ); $result = $this->db->select($report); if (PEAR::isError($result)) { print "\n" . $result->getMessage(); $this->assertTrue(false); return; } $this->assertEquals(count($result),count($this->PersonPhone)); foreach ($result as $row) { if ($row['PhoneID'] == '13') { $this->assertEquals($row['PersonID'],null); } } $this->print_result($result, 'PersonPhone'); // Inspect PersonAddress $report = array('select' => '*', 'from' => 'PersonAddress', 'fetchmode' => $this->fetchmode_assoc ); $result = $this->db->select($report); if (PEAR::isError($result)) { print "\n" . $result->getMessage(); $this->assertTrue(false); return; } $this->assertEquals(count($result),count($this->PersonAddress)-1); foreach ($result as $row) { if ($row['PersonID2'] == '15') { $this->assertTrue(false); return; } } $this->print_result($result, 'PersonAddress'); } function testDeleteNullify2() { if ($this->verbose > -1) { print "\n" . ">testDeleteNullify2"; } if ($this->verbose > 0) { print "\n" . "Nullifying delete with multi-column referenced key from Street"; } $this->db->setOnDelete('Address', 'Street', 'set null'); $this->db->SetOnUpdate('Address', 'Street', 'set null'); $where = "Street = 'NORMAN DR'"; $result = $this->db->delete('Street',$where); if (PEAR::isError($result)) { print "\n" . $result->getMessage(); $this->assertTrue(false); return; } // Inspect Street $report = array('select' => '*', 'from' => 'Street', 'fetchmode' => $this->fetchmode_assoc ); $result = $this->db->select($report); if (PEAR::isError($result)) { print "\n" . $result->getMessage(); $this->assertTrue(false); return; } $this->assertEquals(count($result),count($this->Street)-1); $this->print_result($result, 'Street'); // Inspect Address $report = array('select' => 'AddressID, Building, Street, City', 'from' => 'Address', 'fetchmode' => $this->fetchmode_assoc ); $result = $this->db->select($report); if (PEAR::isError($result)) { print "\n" . $result->getMessage(); $this->assertTrue(false); return; } $this->print_result($result, 'Address'); // Inspect PersonAddress $report = array('select' => 'PersonID2, AddressID', 'from' => 'PersonAddress', 'fetchmode' => $this->fetchmode_assoc ); $result = $this->db->select($report); $this->print_result($result, 'PersonAddress'); } function testDeleteDefault1() { if ($this->verbose > -1) { print "\n" . ">testDeleteDefault1"; } if ($this->verbose > 0) { print "\n" . 'Nullifying delete with integer referenced key from Person'; } $this->db->setOnDelete('PersonPhone', 'Person', 'set default'); $this->db->SetOnUpdate('PersonPhone', 'Person', 'set default'); $where = 'PersonID = 15'; $result = $this->db->delete('Person',$where); if (PEAR::isError($result)) { print "\n" . $result->getMessage(); $this->assertTrue(false); return; } // Inspect PersonPhone $report = array('select' => '*', 'from' => 'PersonPhone', 'fetchmode' => $this->fetchmode_assoc ); $result = $this->db->select($report); $this->print_result($result, 'PersonPhone'); // Inspect PersonAddress $report = array('select' => '*', 'from' => 'PersonAddress', 'fetchmode' => $this->fetchmode_assoc ); $result = $this->db->select($report); $this->print_result($result, 'PersonAddress'); $this->assertTrue(true); } function testDeleteDefault2() { if ($this->verbose > -1) { print "\n" . ">testDeleteDefault2"; } if ($this->verbose > 0) { print "\n" . "Delete multi-col key from Street with on default"; } $this->db->setOnDelete('Address', 'Street', 'set default'); $this->db->SetOnUpdate('Address', 'Street', 'set default'); $where = "Street = 'NORMAN DR'"; $result = $this->db->delete('Street',$where); if (PEAR::isError($result)) { print "\n" . $result->getMessage(); $this->assertTrue(false); return; } if ($this->verbose > 1) { // Inspect Street $report = array('select' => '*', 'from' => 'Street', 'fetchmode' => $this->fetchmode_assoc ); $count = $this->db->selectCount($report); print "\n" . "$count rows remaining in Street"; // Inspect Address $report = array('select' => 'AddressID, Building, Street, City', 'from' => 'Address', 'fetchmode' => $this->fetchmode_assoc ); $result = $this->db->select($report); $this->print_result($result, "Address (ID, Building, Street, City):"); // Inspect PersonAddress $report = array('select' => '*', 'from' => 'PersonAddress', 'fetchmode' => $this->fetchmode_assoc ); $result = $this->db->select($report); $this->print_result($result, 'PersonAddress'); } $this->assertTrue(true); } function testDeleteRestrict1() { if ($this->verbose > -1) { print "\n" . ">testDeleteRestrict1"; } if ($this->verbose > 0) { print "\n" . 'Restricted delete with integer referenced key from Person'; } $this->db->setOnDelete('PersonPhone', 'Person', 'restrict'); $this->db->SetOnUpdate('PersonPhone', 'Person', 'restrict'); $where = 'PersonID = 15'; $result = $this->db->delete('Person',$where); if (PEAR::isError($result)) { if ($this->verbose > 0) { print "\n" . $result->getMessage(); } $this->assertTrue(true); return; } else { $this->assertTrue(false); } } function testDeleteRestrict2() { if ($this->verbose > -1) { print "\n" . ">testDeleteRestrict2"; } if ($this->verbose > 0) { print "\n" . "Restricted delete with multi-col key from Street"; } $this->db->setOnDelete('Address', 'Street', 'restrict'); $this->db->SetOnUpdate('Address', 'Street', 'restrict'); $where = "Street = 'NORMAN DR'"; $result = $this->db->delete('Street',$where); if (PEAR::isError($result)) { if ($this->verbose > 0) { print "\n" . $result->getMessage(); } $this->assertTrue(true); } else { $this->assertTrue(false); } } function testUpdate() { if ($this->verbose > -1) { print "\n" . ">testUpdate"; } if ($this->verbose > 0) { print "\n" . "Allowed update of integer foreign key of PersonPhone"; } $assoc = array(); $assoc['PhoneID'] = 9; $where = 'PhoneID = 18'; $result = $this->db->update('PersonPhone',$assoc,$where); if (PEAR::isError($result)){ print "\n" . $result->getMessage(); $this->assertTrue(false); return; } if ($this->verbose > 1) { $report = array('select' => '*', 'from' => 'PersonPhone', 'fetchmode' => $this->fetchmode_assoc ); $result = $this->db->select($report); $this->print_result($result, 'PersonPhone'); } $this->assertTrue(true); } function testUpdateForeignKeyCheck() { if ($this->verbose > -1) { print "\n" . ">testUpdateForeignKeyCheck"; } if ($this->verbose > 0) { print "\n" . "Attempt update with invalid integer foreign key"; } $assoc = array(); $assoc['PhoneID'] = 28; // beyond range of valid values $where = 'PhoneID = 18'; $result = $this->db->update('PersonPhone',$assoc,$where); if (PEAR::isError($result)){ if ($this->verbose > 0) { print "\n" . $result->getMessage(); } $this->assertTrue(true); } else { print "\n" . 'Error: Success of invalid update'; $this->assertTrue(false); } } function testUpdateCascade1() { if ($this->verbose > -1) { print "\n" . ">testUpdateCascade1"; } if ($this->verbose > 0) { print "\n" . "Cascading update of integer primary key of Person"; } $where = 'PersonID = 13'; $assoc = array('PersonID' => 38); $result = $this->db->update('Person',$assoc,$where); if (PEAR::isError($result)){ print "\n" . $result->getMessage(); $this->assertTrue(false); return; } else { if ($this->verbose > 1) { print "Contents of PersonPhone:"; $report = array('select' => '*', 'from' => 'PersonPhone', 'fetchmode' => $this->fetchmode_assoc ); $result = $this->db->select($report); $this->print_result($result, 'PersonPhone'); print "\nContents of PersonAddress:"; $report = array('select' => '*', 'from' => 'PersonAddress', 'fetchmode' => $this->fetchmode_assoc ); $result = $this->db->select($report); $this->print_result($result, 'PersonAddress'); } } $this->assertTrue(true); } function testUpdateCascade2() { if ($this->verbose > -1) { print "\n" . ">testUpdateCascade2"; } if ($this->verbose > 0) { print "\n" ."Cascading update of multi-column referenced key from Street"; } $where = "Street = 'NORMAN DR'"; $data = array('Street' => 'NOX BOULEVARD', 'City' => 'ANYTOWN'); $result = $this->db->update('Street',$data,$where); if (PEAR::isError($result)) { print "\n" . $result->getMessage(); $this->assertTrue(false); } else { if ($this->verbose > 1) { $report = array('select' => 'AddressID, Building, Street, City', 'from' => 'Address', 'fetchmode' => $this->fetchmode_assoc ); $result = $this->db->select($report); $this->print_result($result, 'Address(ID, Building, Street, City)'); } $this->assertTrue(true); } } function testUpdateNullify1() { if ($this->verbose > -1) { print "\n" . ">testUpdateNullify1"; } if ($this->verbose > 0) { print "\n" . "Nullifying update of integer primary key of Person"; } $this->db->setOnDelete('PersonPhone', 'Person', 'set null'); $this->db->SetOnUpdate('PersonPhone', 'Person', 'set null'); $where = 'PersonID = 13'; $assoc = array('PersonID' => 38); $result = $this->db->update('Person',$assoc,$where); if (PEAR::isError($result)){ print "\n" . $result->getMessage(); $this->assertTrue(false); return; } if ($this->verbose > 1) { // Inspect PersonPhone $report = array('select' => '*', 'from' => 'PersonPhone', 'fetchmode' => $this->fetchmode_assoc ); $result = $this->db->select($report); $this->print_result($result, 'PersonPhone'); // Inspect PersonAddress $report = array('select' => '*', 'from' => 'PersonAddress', 'fetchmode' => $this->fetchmode_assoc ); $result = $this->db->select($report); $this->print_result($result, 'PersonAddress'); } $this->assertTrue(true); } function testUpdateNullify2() { if ($this->verbose > -1) { print "\n" . ">testUpdateNullify2"; } if ($this->verbose > 0) { print "\n" ."Nullifying update of multi-column referenced key from Street"; } $this->db->setOnDelete('Address', 'Street', 'set null'); $this->db->SetOnUpdate('Address', 'Street', 'set null'); $where = "Street = 'NORMAN DR'"; $data = array('Street' => 'NOX BOULEVARD', 'City' => 'ANYTOWN'); $result = $this->db->update('Street',$data,$where); if (PEAR::isError($result)) { print "\n" . $result->getMessage(); $this->assertTrue(false); } else { if ($this->verbose > 1) { $report = array('select' => 'AddressID, Building, Street, City', 'from' => 'Address', 'fetchmode' => $this->fetchmode_assoc ); $result = $this->db->select($report); $this->print_result($result, 'Address (ID, Building, Street, City)'); } $this->assertTrue(true); } } function testUpdateDefault1() { if ($this->verbose > -1) { print "\n" . ">testUpdateDefault1"; } if ($this->verbose > 0) { print "\n" . "Set default on Update of integer primary key of Person"; } $this->db->setOnDelete('PersonPhone', 'Person', 'set default'); $this->db->SetOnUpdate('PersonPhone', 'Person', 'set default'); $where = 'PersonID = 13'; $assoc = array('PersonID' => 38); $result = $this->db->update('Person',$assoc,$where); if (PEAR::isError($result)){ print "\n" . $result->getMessage(); $this->assertTrue(false); return; } else { if ($this->verbose > 1) { $report = array('select' => '*', 'from' => 'PersonPhone', 'fetchmode' => $this->fetchmode_assoc ); $result = $this->db->select($report); $this->print_result($result, 'PersonPhone'); $report = array('select' => '*', 'from' => 'PersonAddress', 'fetchmode' => $this->fetchmode_assoc ); $result = $this->db->select($report); $this->print_result($result, 'PersonAddress'); } } $this->assertTrue(true); } function testUpdateDefault2() { if ($this->verbose > -1) { print "\n" . ">testUpdateDefault2"; } if ($this->verbose > 0) { print "\n" ."Nullifying update of multi-column referenced key from Street"; } $this->db->setOnDelete('Address', 'Street', 'set default'); $this->db->SetOnUpdate('Address', 'Street', 'set default'); $where = "Street = 'NORMAN DR'"; $data = array('Street' => 'NOX BOULEVARD', 'City' => 'ANYTOWN'); $result = $this->db->update('Street',$data,$where); if (PEAR::isError($result)) { print "\n" . $result->getMessage(); $this->assertTrue(false); } else { if ($this->verbose > 1) { $report = array('select' => 'AddressID, Building, Street, City, StateAbb', 'from' => 'Address', 'fetchmode' => $this->fetchmode_assoc ); $result = $this->db->select($report); $this->print_result($result, 'Address(ID, Building, Street, City, StateAbb)'); } $this->assertTrue(true); } } function testUpdateRestrict1() { if ($this->verbose > -1) { print "\n" . ">testUpdateRestrict1"; } if ($this->verbose > 0) { print "\n" . "Restricted update of integer primary key of Person"; } $this->db->setOnDelete('PersonPhone', 'Person', 'restrict'); $this->db->SetOnUpdate('PersonPhone', 'Person', 'restrict'); $where = 'PersonID = 13'; $assoc = array('PersonID' => 38); $result = $this->db->update('Person',$assoc,$where); if (PEAR::isError($result)){ if ($this->verbose > 0) { print "\n" . $result->getMessage(); } $this->assertTrue(true); } else { $this->assertTrue(false); } } function testUpdateRestrict2() { if ($this->verbose > -1) { print "\n" . ">testUpdateRestrict2"; } if ($this->verbose > 0) { print "\n" ."Restricted update of multi-column referenced key from Street"; } $this->db->setOnDelete('Address', 'Street', 'restrict'); $this->db->SetOnUpdate('Address', 'Street', 'restrict'); $where = "Street = 'NORMAN DR'"; $data = array('Street' => 'NOX BOULEVARD', 'City' => 'ANYTOWN'); $result = $this->db->update('Street',$data,$where); if (PEAR::isError($result)) { if ($this->verbose > 0) { print "\n" . $result->getMessage(); } $this->assertTrue(true); } else { $this->assertTrue(false); } } } ?> README000066400000000000000000000042421262614675700347210ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package/packagefiles/DB_Table/tests/database This directory contains unit tests, which use the PHPUnit2 framework (for PHP 5) or PHPUnit (for PHP 4). All of the Unit test classes extent a base class DatabaseClass. As distributed, the tests are set up to use PHPUnit2, but can be converted to PHPUnit 4 by changing two lines in the DatabaseClass.php file - the require_once line for the test framework, and the class definition line, which includes the name of the generic unit test class that is being extended. In both cases, the line required for PHP 4 PHPUnit framework is commented out. The tests are not yet fully automated - determination of correctness of some of the tests requires either inspection of the results, or comparison to the results of a previous run (i.e., simple regression testing). Successful outputs are thus provided with each test. Fully automated versions of these tests will be provided in a future release. Short instructions ------------------ To run PHPUnit2 unit tests for DB_Table_Database: 1) Install PHPUnit2 or PHPUnit. If using the PHP 4 PHPUnit class modify DatabaseClass as described above. 2) Copy the DB_Table/tests/config.php-dist file to DB_Table/tests/databse/config.php in this directory, and edit the the parts of the DSN in DB_Table/tests/database/config.php file to allow connection to your RDBMS server. If using a database other than MySQL, some other changes in this file and to the setup and teardown methods of the DatabaseTest class may be required (see below). The verbosity of the output can be changed by changing the variable $verbose in the the config.php file. 3) cd into the DB_Table/tests/database directory (this directory). For each file named TestName_Test.php in this directory, issue the command "phpunit TestName" from the command line. 4) If the tests all run successfully, diff the output against the corresponding *.out file. The only difference should be the line reporting the amount of time required by the test. config.php file --------------- The tests will repeatedly create and tear down a database named $db_name. In the distributed version, this database in named 'Test_DB1' by default. SQLTest.php000066400000000000000000000225241262614675700360540ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package/packagefiles/DB_Table/tests/databaseverbose > -1) { print "\n" . ">testQuoteString"; } $result = $this->conn->quote("This is not a number"); if ($this->verbose > 0) { print "\n" . $result; } $this->assertEquals($result, "'This is not a number'"); } function testQuoteInteger() { if ($this->verbose > -1) { print "\n" . ">testQuoteInteger"; } $result = $this->db->quote(256); if ($this->verbose > 0) { print "\n" . $result; } $this->assertEquals($result, "256"); } function testQuoteFloat() { if ($this->verbose > -1) { print "\n" . ">testQuoteFloat"; } $result = $this->db->quote(2.56); if ($this->verbose > 0) { print "\n" . $result; } $this->assertEquals($result, "2.56"); } function testQuoteBooleanFalse() { if ($this->verbose > -1) { print "\n" . ">testQuoteBooleanFalse"; } $result = $this->db->quote(false); if ($this->verbose > 0) { print "\n" . $result; } $this->assertEquals($result, "0"); } function testQuoteNull() { if ($this->verbose > -1) { print "\n" . ">testQuoteNull"; } $result = $this->db->quote(null); if ($this->verbose > 0) { print "\n" . $result; } $this->assertEquals($result, "NULL"); } function testBuildFilter1() { if ($this->verbose > -1) { print "\n" . ">testBuildFilter1"; } $data['col1'] = 1; $data['col2'] = false; $data['col3'] = 'anyold string'; $result = $this->db->buildFilter($data); $expect = "col1 = 1 AND col2 = 0 AND col3 = 'anyold string'"; if ($this->verbose > 0) { print "\n" . $result; } $this->assertEquals($result, $expect); } function testBuildFilter2() { if ($this->verbose > -1) { print "\n" . ">testBuildFilter2"; } $data['col1'] = 1; $data['col2'] = false; $data['col3'] = 'anyold string'; $data['col4'] = null; $result = $this->db->buildFilter($data); $expect = ''; if ($this->verbose > 0) { print "\n" . $result; } $this->assertEquals($result, $expect); } function testBuildFKeyFilter1() { if ($this->verbose > -1) { print "\n" . ">testBuildFKeyFilter1"; } $data['col1'] = 1; $data['col2'] = false; $data['col3'] = 'anyold string'; $data_key = 'col3'; $result = $this->db->_buildFKeyFilter($data, $data_key); $expect = "col3 = 'anyold string'"; if ($this->verbose > 0) { print "\n" . $result; } $this->assertEquals($result, $expect); } function testBuildFKeyFilter2() { if ($this->verbose > -1) { print "\n" . ">testBuildFKeyFilter3"; } $data['col1'] = 1; $data['col2'] = false; $data['col3'] = 'anyold string'; $data_key = array('col1', 'col3'); $result = $this->db->_buildFKeyFilter($data, $data_key); $expect = "col1 = 1 AND col3 = 'anyold string'"; if ($this->verbose > 0) { print "\n" . $result; } $this->assertEquals($result, $expect); } function testBuildFKeyFilter4() { if ($this->verbose > -1) { print "\n" . ">testBuildFKeyFilter4"; } $data['col1'] = 1; $data['col2'] = false; $data['col3'] = 'anyold string'; $data['col4'] = null; $data_key = 'col3'; $filt_key = 'COL3'; $result = $this->db->_buildFKeyFilter($data, $data_key, $filt_key); $expect = "COL3 = 'anyold string'"; if ($this->verbose > 0) { print "\n" . $result; } $this->assertEquals($result, $expect); } function testBuildFKeyFilter5() { if ($this->verbose > -1) { print "\n" . ">testBuildFKeyFilter5"; } $data['col1'] = 1; $data['col2'] = false; $data['col3'] = 'anyold string'; $data['col4'] = null; $data_key = array('col1', 'col3'); $filt_key = array('COL1', 'COL3'); $result = $this->db->_buildFKeyFilter($data, $data_key, $filt_key); $expect = "COL1 = 1 AND COL3 = 'anyold string'"; if ($this->verbose > 0) { print "\n" . $result; } $this->assertEquals($result, $expect); } function testBuildFKeyFilter7() { if ($this->verbose > -1) { print "\n" . ">testBuildFKeyFilter7"; } $data['col1'] = 1; $data['col2'] = false; $data['col3'] = 'anyold string'; $data['col4'] = null; $result = $this->db->_buildFKeyFilter($data, null, null, 'partial'); $expect = "col1 = 1 AND col2 = 0 AND col3 = 'anyold string'"; if ($this->verbose > 0) { print "\n" . $result; } $this->assertEquals($result, $expect); } /* function testBuildFKeyFilter8() { if ($this->verbose > -1) { print "\n" . ">testBuildFKeyFilter8"; } $data['col1'] = 1; $data['col2'] = false; $data['col3'] = 'anyold string'; $data['col4'] = null; $result = $this->db->_buildFKeyFilter($data, null, null, 'full'); if (PEAR::isError($result)) { $this->assertTrue(true); } else { if ($this->verbose > 0) { print "\n" . $result; print "\n" . $result; } } } */ function testBuildFKeyFilter9() { if ($this->verbose > -1) { print "\n" . ">testBuildFKeyFilter9"; } $data['col1'] = 1; $data['col2'] = false; $data['col3'] = 'anyold string'; $data['col4'] = null; $data_key = 'col4'; $result = $this->db->_buildFKeyFilter($data, $data_key); $expect = ''; if ($this->verbose > 0) { print "\n" . $result; } $this->assertEquals($result, $expect); } function testBuildFKeyFilter10() { if ($this->verbose > -1) { print "\n" . ">testBuildFKeyFilter10"; } $data['col1'] = 1; $data['col2'] = false; $data['col3'] = 'anyold string'; $data['col4'] = null; $data_key = array('col2', 'col4'); $result = $this->db->_buildFKeyFilter($data, $data_key); $expect = ''; if ($this->verbose > 0) { print "\n" . $result; } $this->assertEquals($result, $expect); } function testBuildFKeyFilter11() { if ($this->verbose > -1) { print "\n" . ">testBuildFKeyFilter11"; } $data['col1'] = 1; $data['col2'] = false; $data['col3'] = 'anyold string'; $data['col4'] = null; $data_key = array('col1', 'col4'); $filt_key = array('COL1', 'COL4'); $result = $this->db->_buildFKeyFilter($data, $data_key, $filt_key); $expect = ''; if ($this->verbose > 0) { print "\n" . $result; } $this->assertEquals($result, $expect); } function testBuildSQL1() { if ($this->verbose > -1) { print "\n" . ">testBuildSQL1"; } $db =& $this->db; $query = array( 'select' => 'FirstName, LastName, Building, Street, City', 'from' => 'Person, Address', 'where' => 'Person.PersonID = Address.PersonID2'); $db->sql['test2'] = $query; $result = $db->buildSQL($query, "City = 'MINNETONKA'", 'City'); if ($this->verbose > 0) { print "\n" . $result; } $this->assertTrue(true); } function testBuildSQL2() { if ($this->verbose > -1) { print "\n" . ">testBuildSQL2"; } $db =& $this->db; $query = array( 'select' => 'Street, count(Building)', 'from' => 'Address', 'group' => 'Street', 'having' => "City = 'MINNETONKA'", 'order' => 'Street' ); $result = $db->buildSQL($query); if ($this->verbose > 0) { print "\n" . $result; } $this->assertTrue(true); } function testBuildSQL3() { if ($this->verbose > -1) { print "\n" . ">testBuildSQL3"; } $db =& $this->db; $result = $db->buildSQL(1); if (PEAR::isError($result)){ print "\n" . $result->getMessage(); $this->assertTrue(true); } else { $this->assertTrue(false); } } function testBuildSQL4() { if ($this->verbose > -1) { print "\n" . ">testBuildSQL4"; } $db =& $this->db; $result = $db->buildSQL('not_a_key'); if (PEAR::isError($result)){ print "\n" . $result->getMessage(); $this->assertTrue(true); } else { $this->assertTrue(false); } } } ?> SelectTest.php000066400000000000000000000251221262614675700366310ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package/packagefiles/DB_Table/tests/databasetestSelect1"; // Loop over tables $success = true; $tables = $this->db->getTable(); foreach ($tables as $table_name => $table_obj) { $sql = array('select' => '*', 'from' => $table_name, 'fetchmode' => $this->fetchmode_assoc ); $result = $this->db->select($sql); if (PEAR::isError($result)){ print $result->getMessage(); $this->assertTrue(false); return; } $n_result = count($result); $n_table = count($this->$table_name); if ($this->verbose > 0) { if ($this->verbose == 1) { print "\n" . "$table_name $n_result $n_table"; } else { print "\nTable $table_name:"; print "\n\nQuery:\n" . $this->db->buildSQL($sql) . "\n"; foreach ($result as $row){ $s = array(); foreach ($row as $key => $value){ $s[] = "$key => $value"; } print "\n" . implode(', ', $s); } print "\n\n" . "Count $n_result, $n_table \n"; } } if ($n_result != $n_table) { $success = false; } } // end loop over tables $this->assertTrue($success); } function testSelect2() { print "\n" . ">testSelect2"; $cols = array(); $cols[] = 'LastName'; $cols[] = 'FirstName'; $cols[] = 'PhoneNumber'; $cols[] = 'Building'; $cols[] = 'Street'; $cols[] = 'City'; $cols[] = 'ZipCode'; $report = $this->db->autoJoin($cols); if (PEAR::isError($report)) { print "\n" . $report->getMessage(); print_r($this->db->getLink()); $this->assertTrue(false); return; } $report['order'] = 'LastName'; $filter = "Street.City = 'MINNETONKA'"; $result = $this->db->select($report, $filter); if (PEAR::isError($result)) { print "\n" . $result->getMessage(); $this->assertTrue(false); return; } if ($this->verbose > 0) { print "\n\nQuery:\n" . $this->db->buildSQL($report, $filter) . "\n"; foreach ($result as $row){ $s = array(); foreach ($row as $key => $value){ $s[] = (string) $value; } print "\n" . implode(',', $s); } print "\n"; } $this->assertEquals(count($result), 10); } function testSelect3() { print "\n" . ">testSelect3"; $cols = array(); $cols[] = 'LastName'; $cols[] = 'FirstName'; $cols[] = 'PhoneNumber'; $cols[] = 'Building'; $cols[] = 'Street'; $cols[] = 'City'; $cols[] = 'ZipCode'; $report = $this->db->autoJoin($cols); if (PEAR::isError($report)) { print "\n" . $report->getMessage(); $this->assertTrue(false); return; } $this->db->sql['report'] = $report; $result = $this->db->select('report', "Street.City = 'MINNETONKA'", 'FirstName'); if (PEAR::isError($result)) { print "\n" . $result->getMessage(); $this->assertTrue(false); return; } if ($this->verbose > 0) { print "\n\nQuery:\n" . $this->db->buildSQL('report', "Street.City = 'MINNETONKA'", 'FirstName') . "\n"; foreach ($result as $row){ $s = array(); foreach ($row as $key => $value){ $s[] = (string) $value; } print "\n" . implode(',', $s); } print "\n"; } $this->assertEquals(count($result), 10); } function testSelect4() { if ($this->verbose > -1) { print "\n" . ">testSelect4"; } $db =& $this->db; $result = $db->select(1); if (PEAR::isError($result)){ print "\n" . $result->getMessage(); $this->assertTrue(true); } else { $this->assertTrue(false); } } function testSelect5() { if ($this->verbose > -1) { print "\n" . ">testSelect5"; } $db =& $this->db; $result = $db->select('not_a_key'); if (PEAR::isError($result)){ print "\n" . $result->getMessage(); $this->assertTrue(true); } else { $this->assertTrue(false); } } function testSelectResult1() { print "\n" . ">testSelectResult1"; $cols = array(); $cols[] = 'LastName'; $cols[] = 'FirstName'; $cols[] = 'PhoneNumber'; $cols[] = 'Building'; $cols[] = 'Street'; $cols[] = 'City'; $cols[] = 'ZipCode'; $report = $this->db->autoJoin($cols); if (PEAR::isError($report)) { print "\n" . $report->getMessage(); $this->assertTrue(false); return; } $report['order'] = 'LastName'; $result = $this->db->selectResult($report, "Street.City = 'MINNETONKA'"); if (PEAR::isError($result)) { print "\n" . $result->getMessage(); $this->assertTrue(false); return; } if ($this->verbose > 0) { print "\n\nQuery:\n" . $this->db->buildSQL($report, "Street.City = 'MINNETONKA'") . "\n"; $i = 0; while ($row = $result->fetchRow()) { $s = array(); foreach ($row as $key => $value){ $s[] = (string) $value; } print "\n" . implode(',', $s); $i = $i + 1; } print "\n"; } $this->assertEquals($i,10); } function testSelectResult2() { print "\n" . ">testSelectResult2"; $cols = array(); $cols[] = 'LastName'; $cols[] = 'FirstName'; $cols[] = 'PhoneNumber'; $cols[] = 'Building'; $cols[] = 'Street'; $cols[] = 'City'; $cols[] = 'ZipCode'; $report = $this->db->autoJoin($cols); if (PEAR::isError($report)) { print "\n" . $report->getMessage(); $this->assertTrue(false); return; } $report['order'] = 'LastName'; $this->db->sql['report'] = $report; $result = $this->db->selectResult('report', "Street.City = 'MINNETONKA'"); if (PEAR::isError($result)) { print "\n" . $result->getMessage(); $this->assertTrue(false); return; } $i = 0; if ($this->verbose > 0) { print "\n\nQuery:\n" . $this->db->buildSQL('report', "Street.City = 'MINNETONKA'") . "\n"; while ($row = $result->fetchRow()) { $s = array(); foreach ($row as $key => $value){ $s[] = (string) $value; } print "\n" . implode(',', $s); $i = $i + 1; } print "\n"; } $this->assertEquals($i,10); } function testSelectResult3() { if ($this->verbose > -1) { print "\n" . ">testSelectResult3"; } $db =& $this->db; $result = $db->selectResult(1); if (PEAR::isError($result)){ print "\n" . $result->getMessage(); $this->assertTrue(true); } else { $this->assertTrue(false); } } function testSelectResult4() { if ($this->verbose > -1) { print "\n" . ">testSelectResult4"; } $db =& $this->db; $result = $db->selectResult('not_a_key'); if (PEAR::isError($result)){ print "\n" . $result->getMessage(); $this->assertTrue(true); } else { $this->assertTrue(false); } } function testSelectCount1() { print "\n" . ">testSelectCount1"; $cols = array(); $cols[] = 'LastName'; $cols[] = 'FirstName'; $cols[] = 'PhoneNumber'; $cols[] = 'Building'; $cols[] = 'Street'; $cols[] = 'City'; $cols[] = 'ZipCode'; $report = $this->db->autoJoin($cols); if (PEAR::isError($report)) { print "\n" . $report->getMessage(); $this->assertTrue(false); return; } $report['order'] = 'LastName'; $result = $this->db->selectCount($report, "Street.City = 'MINNETONKA'"); if (PEAR::isError($result)) { print "\n" . $result->getMessage(); $this->assertTrue(false); return; } if ($this->verbose > 0) { print "\n\nQuery:\n" . $this->db->buildSQL($report, "Street.City = 'MINNETONKA'") . "\n"; print "\nCount = $result\n"; } $this->assertEquals($result, '10'); } function testSelectCount2() { print "\n" . ">testSelectCount2"; $cols = array(); $cols[] = 'LastName'; $cols[] = 'FirstName'; $cols[] = 'PhoneNumber'; $cols[] = 'Building'; $cols[] = 'Street'; $cols[] = 'City'; $cols[] = 'ZipCode'; $report = $this->db->autoJoin($cols); if (PEAR::isError($report)) { print "\n" . $report->getMessage(); $this->assertTrue(false); return; } $result = $this->db->selectCount($report, "Street.City = 'EDEN PRAIRIE'"); if (PEAR::isError($result)) { print "\n" . $result->getMessage(); $this->assertTrue(false); return; } if ($this->verbose > 0) { print "\n\nQuery:\n" . $this->db->buildSQL($report, "Street.City = 'EDEN PRAIRIE'") . "\n"; print "\nCount = $result\n"; } $this->assertEquals($result, '8'); } } ?> SerialTest.php000066400000000000000000000103351262614675700366310ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package/packagefiles/DB_Table/tests/databasedb); unset($this->db); $this->db = unserialize($serial_string); } function testGetTable1() { // Test get of entire $table property print "\n" . ">testGetTable1"; $db =& $this->db; $table = $db->getTable(); if (PEAR::isError($table)) { $success = false; print $table->getMessage(); } else { $success = is_array($table); if (!$success) { print "Table is not an array in testGetTable1"; } } $this->assertTrue($success); } function testGetPrimaryKey1() { // Test get of entire $primary_key property print "\n" . ">testGetPrimaryKey1"; $db =& $this->db; $primary_key = $db->getPrimaryKey(); if (PEAR::isError($primary_key)) { $success = false; print $primary_key->getMessage(); $this->assertTrue($success); return; } else { $success = is_array($primary_key); if (!$success) { print "PrimaryKey is not an array in testGetPrimaryKey1"; $this->assertTrue($success); return; } else { $this->assertEquals($primary_key, $this->primary_key); } } } function testGetRef1() { print "\n" . ">testGetRef1"; $db =& $this->db; $ref = $db->getRef(); if (PEAR::isError($ref)) { $success = false; print $ref->getMessage(); $this->assertTrue($success); return; } else { $success = is_array($ref); if (!$success) { print "\nRef is not an array in testGetRef1"; $this->assertTrue($success); return; } else { $this->assertEquals($ref, $this->ref); } } } function testGetRefTo1() { print "\n" . ">testGetRefTo1"; $db =& $this->db; $ref_to = $db->getRefTo(); if (PEAR::isError($ref_to)) { $success = false; print $ref_to->getMessage(); $this->assertTrue($success); return; } else { $success = is_array($ref_to); if (!$success) { print "\n" . "RefTo is not an array in testGetRefTo1"; $this->assertTrue($success); return; } else { $this->assertEquals($ref_to, $this->ref_to); } } } function testGetLink1() { print "\n" . ">testGetLink1"; $db =& $this->db; $link = $db->getLink(); if (PEAR::isError($link)) { $success = false; print $link->getMessage(); $this->assertTrue($success); return; } else { $success = is_array($link); if (!$success) { print "\n" . 'Link is not an array in testGetLink1'; $this->assertTrue($success); return; } else { $this->assertEquals($link, $this->link); } } } function testGetCol1() { // Test get of entire column property print "\n" . ">testGetCol1"; $db =& $this->db; $col = $db->getCol(); /* foreach ($col as $column => $tables) { print "\n" . "$column" . implode(', ', $tables); } */ $this->assertEquals($col, $this->col); } function testGetForeignCol1() { // Test get of entire column property print "\n" . ">testGetForeignCol1"; $db =& $this->db; $foreign_col = $db->getForeignCol(); $this->assertEquals($foreign_col, $this->foreign_col); } } ?> XMLTest.php000066400000000000000000000013411262614675700360470ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package/packagefiles/DB_Table/tests/databaseverbose > -1) { print "\n" . ">Test toXML() method"; } $xml_string = $this->db->toXML(); if ($this->verbose > 1) { print "\n" . $xml_string; } } function testToAndFromXML() { if ($this->verbose > -1) { print "\n" . ">Test round-trip toXML() -> fromXML"; } $first_string = $this->db->toXML(); $db_obj =& DB_Table_Database::fromXML($first_string,$this->conn); $second_string = $db_obj->toXML(); $this->assertEquals($second_string, $first_string); } } ?> db1/000077500000000000000000000000001262614675700345055ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package/packagefiles/DB_Table/tests/databasePersonPhone_Table.php000066400000000000000000000006161262614675700405700ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package/packagefiles/DB_Table/tests/database/db1 array('type' => 'integer', 'default' => 75), 'PhoneID' => array('type' => 'integer', 'require' => true) ); var $idx = array( 'PersonID' => array('cols' => 'PersonID', 'type' => 'normal'), 'PhoneID' => array('cols' => 'PhoneID', 'type' => 'normal') ); } ?> create.php000066400000000000000000000017061262614675700364650ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package/packagefiles/DB_Table/tests/database/db1query("CREATE DATABASE $db_name"); if (PEAR::isError($result)) { print $result->getMessage()."\n"; } } // Set default database (MySQL specific code) $result = $conn->query("USE $db_name"); if (PEAR::isError($result)){ print $result->getMessage()."\n"; } // create all tables in $db $result = $db->createTables('drop'); if (PEAR::isError($result)){ print "Error during creation of tables of {$db->name}.\n"; print $result->getMessage()."\n"; #} else { # print "Database {$db->name} successfully created\n"; } // Create table DataFile $result = $DataFile->create('drop'); if (PEAR::isError($result)) { print "Error during creation of table {$DataFile->table}.\n"; print $result->getMessage()."\n"; #} else { # print "Table {$DataFile->table} successfully created\n"; } ?> data.php000066400000000000000000000156661262614675700361450ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package/packagefiles/DB_Table/tests/database/db1 'ANTOINETTE', 'MiddleName' => 'MARIE', 'LastName' => 'ARLAND', 'NameSuffix' => null, 'Building' => '13188', 'Street' => 'CARDINAL CREEK RD', 'UnitType' => null, 'Unit' => null, 'City' => 'EDEN PRAIRIE', 'StateAbb' => 'MN', 'ZipCode' => '55346', 'PhoneNumber' => '9528940424', ); $data[] = array( 'FirstName' => 'MACHEL', 'MiddleName' => 'KAY', 'LastName' => 'WHITMORE', 'NameSuffix' => null, 'Building' => '5037', 'Street' => 'NORMAN DR', 'UnitType' => null, 'Unit' => null, 'City' => 'MINNETONKA', 'StateAbb' => 'MN', 'ZipCode' => '55345', 'PhoneNumber' => '9529745279', ); $data[] = array( 'FirstName' => 'ANTHONY', 'MiddleName' => 'DAVID', 'LastName' => 'WESTVEER', 'NameSuffix' => null, 'Building' => '14409', 'Street' => 'GRENIER RD', 'UnitType' => null, 'Unit' => null, 'City' => 'MINNETONKA', 'StateAbb' => 'MN', 'ZipCode' => '55345', 'PhoneNumber' => '9529499236', ); $data[] = array( 'FirstName' => 'JODY', 'MiddleName' => 'JEAN', 'LastName' => 'LARSON', 'NameSuffix' => null, 'Building' => '13411', 'Street' => 'MAYWOOD CURV', 'UnitType' => null, 'Unit' => null, 'City' => 'MINNETONKA', 'StateAbb' => 'MN', 'ZipCode' => '55345', 'PhoneNumber' => '6513346195', ); $data[] = array( 'FirstName' => 'JOSEPH', 'MiddleName' => 'FRANCISCO', 'LastName' => 'CRUZ', 'NameSuffix' => null, 'Building' => '14408', 'Street' => 'WOODHILL CIR', 'UnitType' => null, 'Unit' => null, 'City' => 'MINNETONKA', 'StateAbb' => 'MN', 'ZipCode' => '55345', 'PhoneNumber' => '9529450055', ); $data[] = array( 'FirstName' => 'CHRISTINE', 'MiddleName' => 'MICHELLE', 'LastName' => 'KAPSNER', 'NameSuffix' => null, 'Building' => '6135', 'Street' => 'CHASEWOOD PKWY', 'UnitType' => 'APT', 'Unit' => '204', 'City' => 'MINNETONKA', 'StateAbb' => 'MN', 'ZipCode' => '55343', 'PhoneNumber' => '9529310051', ); $data[] = array( 'FirstName' => 'JEVENY', 'MiddleName' => null, 'LastName' => 'HAMMER', 'NameSuffix' => null, 'Building' => '16335', 'Street' => 'TEMPLE DR S', 'UnitType' => null, 'Unit' => null, 'City' => 'MINNETONKA', 'StateAbb' => 'MN', 'ZipCode' => '55345', 'PhoneNumber' => '9529300438', ); $data[] = array( 'FirstName' => 'JOHNNIE', 'MiddleName' => 'ESPINOZA', 'LastName' => 'MARTINEZ', 'NameSuffix' => null, 'Building' => '10995', 'Street' => 'MELS WAY', 'UnitType' => null, 'Unit' => null, 'City' => 'EDEN PRAIRIE', 'StateAbb' => 'MN', 'ZipCode' => '55344', 'PhoneNumber' => null, ); $data[] = array( 'FirstName' => 'STEWART', 'MiddleName' => 'CHARLES', 'LastName' => 'SCHENCK', 'NameSuffix' => null, 'Building' => '17168', 'Street' => 'PADONS DR', 'UnitType' => null, 'Unit' => null, 'City' => 'EDEN PRAIRIE', 'StateAbb' => 'MN', 'ZipCode' => '55346', 'PhoneNumber' => '9529349246', ); $data[] = array( 'FirstName' => 'ANN', 'MiddleName' => null, 'LastName' => 'GOLDBERG', 'NameSuffix' => null, 'Building' => '7610', 'Street' => 'SMETANA LN', 'UnitType' => 'UNIT', 'Unit' => '103', 'City' => 'EDEN PRAIRIE', 'StateAbb' => 'MN', 'ZipCode' => '55344', 'PhoneNumber' => '9528942288', ); $data[] = array( 'FirstName' => 'CHAD', 'MiddleName' => 'GERALD', 'LastName' => 'FLIES', 'NameSuffix' => null, 'Building' => '16379', 'Street' => 'MANOR RD S', 'UnitType' => null, 'Unit' => null, 'City' => 'EDEN PRAIRIE', 'StateAbb' => 'MN', 'ZipCode' => '55346', 'PhoneNumber' => '9529496790', ); $data[] = array( 'FirstName' => 'STEPHANIE', 'MiddleName' => 'ANN', 'LastName' => 'WRIGHT', 'NameSuffix' => null, 'Building' => '17439', 'Street' => 'RUSTIC HILLS DR', 'UnitType' => null, 'Unit' => null, 'City' => 'EDEN PRAIRIE', 'StateAbb' => 'MN', 'ZipCode' => '55346', 'PhoneNumber' => null, ); $data[] = array( 'FirstName' => 'JEAN', 'MiddleName' => 'ADELE', 'LastName' => 'KALIL', 'NameSuffix' => null, 'Building' => '5403', 'Street' => 'POMPANO DR', 'UnitType' => null, 'Unit' => null, 'City' => 'MINNETONKA', 'StateAbb' => 'MN', 'ZipCode' => '55343', 'PhoneNumber' => '9529385751', ); $data[] = array( 'FirstName' => 'JEFFREY', 'MiddleName' => 'DAVID', 'LastName' => 'KUTSCHEID', 'NameSuffix' => null, 'Building' => '6415', 'Street' => 'GRAND VIEW DR', 'UnitType' => null, 'Unit' => null, 'City' => 'EDEN PRAIRIE', 'StateAbb' => 'MN', 'ZipCode' => '55346', 'PhoneNumber' => '9529755977', ); $data[] = array( 'FirstName' => 'JENNIFER', 'MiddleName' => 'JEAN', 'LastName' => 'MACKENTHUN', 'NameSuffix' => null, 'Building' => '6425', 'Street' => 'CITY WEST PKWY', 'UnitType' => 'APT', 'Unit' => '3314', 'City' => 'EDEN PRAIRIE', 'StateAbb' => 'MN', 'ZipCode' => '55344', 'PhoneNumber' => '9529743785', ); $data[] = array( 'FirstName' => 'MICHAEL', 'MiddleName' => 'JOHN', 'LastName' => 'SELANDER', 'NameSuffix' => null, 'Building' => '5978', 'Street' => 'CHASEWOOD PKWY', 'UnitType' => 'APT', 'Unit' => '003', 'City' => 'MINNETONKA', 'StateAbb' => 'MN', 'ZipCode' => '55343', 'PhoneNumber' => '9529331534', ); $data[] = array( 'FirstName' => 'SARAH', 'MiddleName' => 'JANE', 'LastName' => 'TENNES', 'NameSuffix' => null, 'Building' => '13700', 'Street' => 'VALLEY VIEW RD', 'UnitType' => 'APT', 'Unit' => '107', 'City' => 'EDEN PRAIRIE', 'StateAbb' => 'MN', 'ZipCode' => '55344', 'PhoneNumber' => '9529492390', ); $data[] = array( 'FirstName' => 'ANDREW', 'MiddleName' => 'PAUL', 'LastName' => 'WUKMIR', 'NameSuffix' => null, 'Building' => '17460', 'Street' => 'RUSTIC HILLS DR', 'UnitType' => null, 'Unit' => null, 'City' => 'EDEN PRAIRIE', 'StateAbb' => 'MN', 'ZipCode' => '55346', 'PhoneNumber' => '9529344367', ); $data[] = array( 'FirstName' => 'SHERRY', 'MiddleName' => 'MARIE', 'LastName' => 'CHAPMAN', 'NameSuffix' => null, 'Building' => '10721', 'Street' => 'SMETANA RD', 'UnitType' => 'APT', 'Unit' => '103', 'City' => 'MINNETONKA', 'StateAbb' => 'MN', 'ZipCode' => '55343', 'PhoneNumber' => '9529350387', ); $data[] = array( 'FirstName' => 'JEFFREY', 'MiddleName' => 'LEE', 'LastName' => 'WHITMORE', 'NameSuffix' => null, 'Building' => '5037', 'Street' => 'NORMAN DR', 'UnitType' => null, 'Unit' => null, 'City' => 'MINNETONKA', 'StateAbb' => 'MN', 'ZipCode' => '55345', 'PhoneNumber' => '9529745079', ); ?> define.php000066400000000000000000000213071262614675700364530ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package/packagefiles/DB_Table/tests/database/db1col['PersonID'] = array('type' => 'integer', 'require' =>true); $Person->col['FirstName'] = array('type' => 'char', 'size' => 32, 'require' =>true); $Person->col['MiddleName'] = array('type' => 'char', 'size' => 32); $Person->col['LastName'] = array('type' => 'char', 'size' => 64, 'require' =>true); $Person->col['NameSuffix'] = array('type' => 'char', 'size' => 16); $Person->idx['PersonID'] = array('cols' => 'PersonID', 'type' => 'primary'); $Person->idx['Name'] = array( 'cols' =>array('LastName', 'FirstName', 'MiddleName', 'NameSuffix'), 'type' => 'normal'); $Person->auto_inc_col = 'PersonID'; $Address = new DB_Table($conn, 'Address'); $Address->col['AddressID'] = array('type' => 'integer', 'require' =>true); $Address->col['Building'] = array('type' => 'char', 'size' => 16); $Address->col['Street'] = array('type' => 'char', 'size' => 64, 'default' => 'AnyStreet'); $Address->col['UnitType'] = array('type' => 'char', 'size' => 16); $Address->col['Unit'] = array('type' => 'char', 'size' => 16); $Address->col['City'] = array('type' => 'char', 'size' => 64, 'default' => 'AnyCity'); $Address->col['StateAbb'] = array('type' => 'char', 'size' => 2); $Address->col['ZipCode'] = array('type' => 'char', 'size' => 16); $Address->idx['AddressID'] = array('cols' => 'AddressID', 'type' => 'primary'); $Address->idx['StreetAddress'] = array('cols' =>array('City', 'Street', 'Building', 'Unit'), 'type' => 'unique'); $Address->auto_inc_col = 'AddressID'; $Phone = new DB_Table($conn, 'Phone'); $Phone->col['PhoneID'] = array('type' => 'integer', 'require' =>true); $Phone->col['PhoneNumber'] = array('type' => 'char', 'size' => 16, 'require' => true); $Phone->idx['PhoneID'] = array('cols' => 'PhoneID', 'type' => 'primary'); $Phone->idx['PhoneNumber'] = array('cols' => 'PhoneNumber', 'type' => 'unique'); $Phone->auto_inc_col = 'PhoneID'; $PersonAddress = new DB_Table($conn, 'PersonAddress'); $PersonAddress->col['PersonID2'] = array('type' => 'integer', 'default' => 50); $PersonAddress->col['AddressID'] = array('type' => 'integer', 'require' => true); $PersonAddress->idx['PersonID2'] = array('cols' => 'PersonID2', 'type' => 'normal'); $PersonAddress->idx['AddressID'] = array('cols' => 'AddressID', 'type' => 'normal'); /* $PersonPhone = new DB_Table($conn, 'PersonPhone'); $PersonPhone->col['PersonID'] = array('type' => 'integer', 'default' => 75); $PersonPhone->col['PhoneID'] = array('type' => 'integer', 'require' => true); $PersonPhone->idx['PersonID'] = array('cols' => 'PersonID', 'type' => 'normal'); $PersonPhone->idx['PhoneID'] = array('cols' => 'PhoneID', 'type' => 'normal'); */ require_once 'db1/PersonPhone_Table.php'; $PersonPhone = new PersonPhone_Table($conn, 'PersonPhone'); $Street = new DB_Table($conn, 'Street'); $Street->col['Street'] = array('type' => 'char', 'size' => 64); $Street->col['City'] = array('type' => 'char', 'size' => 64); $Street->col['StateAbb'] = array('type' => 'char', 'size' => 2); $Street->col['Sunny'] = array('type' => 'boolean'); $Street->idx['Street'] = array('cols' => array('Street', 'City', 'StateAbb'), 'type' => 'primary'); // Instantiate new DB_Table_Database object $db = new DB_Table_Database($conn, $db_name); // Add all tables to it $db->addTable($Person); $db->addTable($Address); $db->addTable($Phone); $db->addTable($PersonAddress); $db->addTable($PersonPhone); $db->addTable($Street); // Add references to DB_Table_Database object $db->addRef('PersonAddress', 'PersonID2', 'Person', null, 'cascade', 'cascade'); $db->addRef('PersonAddress', 'AddressID', 'Address', null, 'cascade', 'cascade'); $db->addRef('PersonPhone', 'PersonID', 'Person', null, 'cascade', 'cascade'); $db->addRef('PersonPhone', 'PhoneID', 'Phone', null, 'cascade', 'cascade'); $db->addRef('Address', array('Street', 'City', 'StateAbb'), 'Street', array('Street', 'City', 'StateAbb'), 'cascade', 'cascade'); // Add links PersonPhone and PersonAddress $db->addAllLinks(); // Enable foreign key validation by PHP layer $db->setCheckFKey(true); # List of tables in database $table = array($Person, $Address, $Phone, $PersonAddress, $PersonPhone, $Street); // Expected property array values after finalization $primary_key = array(); $primary_key['Person'] = 'PersonID'; $primary_key['Address'] = 'AddressID'; $primary_key['Phone'] = 'PhoneID'; $primary_key['PersonAddress'] = null; $primary_key['PersonPhone'] = null; $primary_key['Street'] = array('Street', 'City', 'StateAbb'); $table_subclass = array(); $table_subclass['Person'] = null; $table_subclass['Address'] = null; $table_subclass['Phone'] = null; $table_subclass['PersonAddress'] = null; $table_subclass['PersonPhone'] = 'PersonPhone_Table'; $table_subclass['Street'] = null; $ref = array(); $ref['PersonAddress'] = array(); $ref['PersonPhone'] = array(); $ref['PersonAddress']['Person'] = array( 'fkey' => 'PersonID2', 'rkey' => 'PersonID', 'on_delete' => 'cascade', 'on_update' => 'cascade'); $ref['PersonAddress']['Address'] = array( 'fkey' => 'AddressID', 'rkey' => 'AddressID', 'on_delete' => 'cascade', 'on_update' => 'cascade'); $ref['PersonPhone']['Person'] = array( 'fkey' => 'PersonID', 'rkey' => 'PersonID', 'on_delete' => 'cascade', 'on_update' => 'cascade'); $ref['PersonPhone']['Phone'] = array( 'fkey' => 'PhoneID', 'rkey' => 'PhoneID', 'on_delete' => 'cascade', 'on_update' => 'cascade'); $ref['Address']['Street'] = array( 'fkey' =>array('Street', 'City', 'StateAbb'), 'rkey' =>array('Street', 'City', 'StateAbb'), 'on_delete' => 'cascade', 'on_update' => 'cascade'); $col = array(); $col['PersonID'] = array('Person', 'PersonPhone'); $col['FirstName'] = array('Person'); $col['MiddleName'] = array('Person'); $col['LastName'] = array('Person'); $col['NameSuffix'] = array('Person'); $col['AddressID'] = array('Address', 'PersonAddress'); $col['Building'] = array('Address'); $col['UnitType'] = array('Address'); $col['Unit'] = array('Address'); $col['ZipCode'] = array('Address'); $col['PhoneID'] = array('Phone', 'PersonPhone'); $col['PhoneNumber'] = array('Phone'); $col['Street'] = array('Address', 'Street'); $col['City'] = array('Address', 'Street'); $col['StateAbb'] = array('Address', 'Street'); $col['PersonID2'] = array('PersonAddress'); $col['Sunny'] = array('Street'); $foreign_col = array(); $foreign_col['PersonID2'] = array('PersonAddress'); $foreign_col['AddressID'] = array('PersonAddress'); $foreign_col['PersonID'] = array('PersonPhone'); $foreign_col['PhoneID'] = array('PersonPhone'); $foreign_col['Street'] = array('Address'); $foreign_col['City'] = array('Address'); $foreign_col['StateAbb'] = array('Address'); $ref_to = array(); $ref_to['Person'] = array('PersonAddress', 'PersonPhone'); $ref_to['Address'] = array('PersonAddress'); $ref_to['Phone'] = array('PersonPhone'); $ref_to['Street'] = array('Address'); $link = array(); $link['Person'] = array(); $link['Phone'] = array(); $link['Address'] = array(); $link['Person']['Address'] = array('PersonAddress'); $link['Address']['Person'] = array('PersonAddress'); $link['Person']['Phone'] = array('PersonPhone'); $link['Phone']['Person'] = array('PersonPhone'); $properties = array('table', 'primary_key', 'table_subclass', 'ref', 'col', 'foreign_col', 'ref_to', 'link'); #----------------------------------------------------------------------- # Schema for array of example data in data.php #----------------------------------------------------------------------- $DataFile = new DB_Table($conn, 'DataFile'); $DataFile->col['FirstName'] = array('type' => 'varchar', 'size' => 255); $DataFile->col['MiddleName'] = array('type' => 'varchar', 'size' => 255); $DataFile->col['LastName'] = array('type' => 'varchar', 'size' => 255); $DataFile->col['NameSuffix'] = array('type' => 'varchar', 'size' => 255); $DataFile->col['Building'] = array('type' => 'varchar', 'size' => 255); $DataFile->col['Street'] = array('type' => 'varchar', 'size' => 255); $DataFile->col['UnitType'] = array('type' => 'varchar', 'size' => 255); $DataFile->col['Unit'] = array('type' => 'varchar', 'size' => 255); $DataFile->col['City'] = array('type' => 'varchar', 'size' => 255); $DataFile->col['StateAbb'] = array('type' => 'varchar', 'size' => 255); $DataFile->col['ZipCode'] = array('type' => 'varchar', 'size' => 255); $DataFile->col['PhoneNumber'] = array('type' => 'varchar', 'size' => 255); ?> insert.php000066400000000000000000000075721262614675700365350ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package/packagefiles/DB_Table/tests/database/db1insert($data_row); if (PEAR::isError($result)){ print $result->getMessage()."\n"; } // Create and insert Person record $person_row = array(); foreach ( $Person->col as $col => $col_def ){ if ( key_exists($col, $DataFile->col)) { $person_row[$col] = $data_row[$col]; } else { $person_row[$col]=null; } } $PersonID = $PersonID + 1; $result = $db->insert('Person', $person_row); $person_row['PersonID'] = $PersonID; $person[] = $person_row; if (PEAR::isError($result)){ print $result->getMessage()."\n"; } else { // Create and insert Street record $street_row = array(); foreach ( $Street->col as $col => $col_def ){ if ( key_exists($col, $data_row)) { $street_row[$col]=$data_row[$col]; } } $street_id = "{$street_row['Street']}_{$street_row['City']}_{$street_row['StateAbb']}"; if (!in_array($street_id, $street_ids)) { $StreetID = $StreetID + 1; $result = $db->insert('Street', $street_row); $street[] = $street_row; $street_ids[] = $street_id; } // Create and insert Address record $address_row = array(); foreach ( $Address->col as $col => $col_def ){ if ( key_exists($col, $data_row)) { $address_row[$col] = $data_row[$col]; #} else { # $address_row[$col]=null; } } $AddressID = $AddressID + 1; $result = $db->insert('Address', $address_row); $address_row['AddressID'] = $AddressID; $address[] = $address_row; if (PEAR::isError($result)){ print $result->getMessage()."\n"; } else { $assoc = array(); $assoc['PersonID2'] = $PersonID; $assoc['AddressID'] = $AddressID; $result = $db->insert('PersonAddress', $assoc); $person_address[] = $assoc; if (PEAR::isError($result)){ print $result->getMessage()."\n"; } } // Create and insert Phone record $phone_row = array(); foreach ( $Phone->col as $col => $col_def ){ if ( key_exists($col, $data_row)) { $phone_row[$col]=$data_row[$col]; #} else { # $phone_row[$col]=null; } } if (!is_null($phone_row['PhoneNumber'])) { $PhoneID = $PhoneID + 1; $result = $db->insert('Phone', $phone_row); $phone_row['PhoneId'] = $PhoneID; $phone[] = $phone_row; if (PEAR::isError($result)){ print $result->getMessage()."\n"; } else { // Insert PersonPhone Row $assoc = array(); $assoc['PersonID'] = $PersonID; $assoc['PhoneID'] = $PhoneID; $result = $db->insert('PersonPhone', $assoc); $person_phone[] = $assoc; if (PEAR::isError($result)){ print $result->getMessage()."\n"; } } } } } $table_arrays = array('Person' => $person, 'Address' => $address, 'Phone' => $phone, 'PersonAddress' => $person_address, 'PersonPhone' => $person_phone, 'Street' => $street); ?> out/000077500000000000000000000000001262614675700346465ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package/packagefiles/DB_Table/tests/databaseAutoJoinTest.out000066400000000000000000000023671262614675700377770ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package/packagefiles/DB_Table/tests/database/out PHPUnit 2.3.6 by Sebastian Bergmann. >testJoin1 SELECT Street.Street, Person.FirstName, Person.LastName, Phone.PhoneNumber, Address.Building, Street.City FROM Street, Person, Phone, Address, PersonAddress, PersonPhone WHERE ( Address.Street = Street.Street AND Address.City = Street.City AND Address.StateAbb = Street.StateAbb AND PersonAddress.PersonID2 = Person.PersonID AND PersonAddress.AddressID = Address.AddressID AND PersonPhone.PhoneID = Phone.PhoneID AND PersonPhone.PersonID = Person.PersonID ) AND ( City = 'MINNETONKA' ). >testJoin2 SELECT PersonPhone.PersonID, Person.FirstName, Person.LastName FROM PersonPhone, Person WHERE PersonPhone.PersonID = Person.PersonID. >testJoin3 SELECT Person.LastName, Person.FirstName, Phone.PhoneNumber, Address.Building, Street.Street, Street.City, Address.ZipCode FROM Person, Phone, Address, Street, PersonPhone, PersonAddress WHERE ( PersonPhone.PhoneID = Phone.PhoneID AND PersonPhone.PersonID = Person.PersonID AND PersonAddress.AddressID = Address.AddressID AND PersonAddress.PersonID2 = Person.PersonID AND Address.Street = Street.Street AND Address.City = Street.City AND Address.StateAbb = Street.StateAbb ) AND ( Street.City = 'MINNETONKA' ). Time: 0.29648089408875 OK (3 tests) DeleteTest.out000066400000000000000000000056471262614675700374550ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package/packagefiles/DB_Table/tests/database/outPHPUnit 2.3.6 by Sebastian Bergmann. >testDeleteRef1 Delete reference Address => Street Ref: PersonAddress => Person PersonAddress => Address PersonPhone => Person PersonPhone => Phone RefTo: Person <= (PersonAddress, PersonPhone) Address <= (PersonAddress) Phone <= (PersonPhone) Link: Person, Address : (PersonAddress) Person, Phone : (PersonPhone) Address, Person : (PersonAddress) Phone, Person : (PersonPhone). >testDeleteRef2 Delete reference PersonAddress => Person Ref: PersonAddress => Address PersonPhone => Person PersonPhone => Phone Address => Street RefTo: Person <= (PersonPhone) Address <= (PersonAddress) Phone <= (PersonPhone) Street <= (Address) Link: Person, Phone : (PersonPhone) Phone, Person : (PersonPhone). >testDeleteTable1 Delete Table Person Table: Address, Phone, PersonAddress, PersonPhone, Street Col: PersonID : (PersonPhone) AddressID : (Address, PersonAddress) Building : (Address) Street : (Address, Street) UnitType : (Address) Unit : (Address) City : (Address, Street) StateAbb : (Address, Street) ZipCode : (Address) PhoneID : (Phone, PersonPhone) PhoneNumber : (Phone) PersonID2 : (PersonAddress) Sunny : (Street) ForeignCol: AddressID : (PersonAddress) PhoneID : (PersonPhone) Street : (Address) City : (Address) StateAbb : (Address) Ref: PersonAddress => Address PersonPhone => Phone Address => Street RefTo: Address <= (PersonAddress) Phone <= (PersonPhone) Street <= (Address) Link:. >testDeleteTable2 Delete Table PersonAddress Table: Person, Address, Phone, PersonPhone, Street Col: PersonID : (Person, PersonPhone) FirstName : (Person) MiddleName : (Person) LastName : (Person) NameSuffix : (Person) AddressID : (Address) Building : (Address) Street : (Address, Street) UnitType : (Address) Unit : (Address) City : (Address, Street) StateAbb : (Address, Street) ZipCode : (Address) PhoneID : (Phone, PersonPhone) PhoneNumber : (Phone) Sunny : (Street) ForeignCol: PersonID : (PersonPhone) PhoneID : (PersonPhone) Street : (Address) City : (Address) StateAbb : (Address) Ref: PersonPhone => Person PersonPhone => Phone Address => Street RefTo: Person <= (PersonPhone) Phone <= (PersonPhone) Street <= (Address) Link: Person, Phone : (PersonPhone) Phone, Person : (PersonPhone). >testDeleteTable3 Delete Table Address Table: Person, Phone, PersonAddress, PersonPhone, Street Col: PersonID : (Person, PersonPhone) FirstName : (Person) MiddleName : (Person) LastName : (Person) NameSuffix : (Person) AddressID : (PersonAddress) Street : (Street) City : (Street) StateAbb : (Street) PhoneID : (Phone, PersonPhone) PhoneNumber : (Phone) PersonID2 : (PersonAddress) Sunny : (Street) ForeignCol: PersonID2 : (PersonAddress) PersonID : (PersonPhone) PhoneID : (PersonPhone) Ref: PersonAddress => Person PersonPhone => Person PersonPhone => Phone RefTo: Person <= (PersonAddress, PersonPhone) Phone <= (PersonPhone) Link: Person, Phone : (PersonPhone) Phone, Person : (PersonPhone). Time: 0.37969398498535 OK (5 tests) GetTest.out000066400000000000000000000017261262614675700367640ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package/packagefiles/DB_Table/tests/database/outPHPUnit 2.3.6 by Sebastian Bergmann. >testGetTable1. >testGetTable2. >testGetTable3 DB_TABLE_DATABASE ERROR - Table does not exist in database. Method, Table = getTable, Thwack. >testGetPrimaryKey1. >testGetPrimaryKey2. >testGetPrimaryKey3 DB_TABLE_DATABASE ERROR - Table does not exist in database. Method, Table = getPrimaryKey, Thwack. >testGetTableSubclass1. >testGetRef1. >testGetRef2. >testGetRef3. >testGetRef4. >testGetRefTo1. >testGetRefTo2. >testGetRefTo3. >testGetLink1. >testGetLink2. >testGetLink3. >testGetLink4. >testGetCol1. >testGetCol2. >testGetForeignCol1. >testGetForeignCol2. >testValidCol1. >testValidCol1b. >testValidCol2. >testValidCol2b. >testValidCol3. >testValidCol4. >testValidCol5 DB_TABLE_DATABASE ERROR - In validCol, column does not exist in specified table. Column Person.Thingy. >testValidCol6 DB_TABLE_DATABASE ERROR - Table does not exist in database. Method, Table = validCol, Thwack. >testValidCol7. Time: 1.3387479782104 OK (31 tests) ModifyTest.out000066400000000000000000000234721262614675700374760ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package/packagefiles/DB_Table/tests/database/out PHPUnit 2.3.6 by Sebastian Bergmann. >testValidForeignKeys1 Test FKs of PersonPhone row (18,2) with valid FKs. >testValidForeignKeys2 Test FKs of Address with valid multi-column FK. >testValidForeignKeys3 Test FKs of PersonPhone row (18,38) with invalid FK. >testValidForeignKeys4 Test FKs of Address with invalid multi-column FK. >testInsert1 Insert row with valid integer FKs in PersonPhone. >testInsert2 Insert row with valid multi-column FK into Address. >testInsertForeignKeyCheck1 Attempt insert with invalid FK integer PhoneID in PersonPhone DB_TABLE_DATABASE ERROR - Foreign key does not reference any rows on insertion into table PersonPhone. >testInsertForeignKeyCheck2 Attempt insert with invalid multi-column FK in Address DB_TABLE_DATABASE ERROR - Foreign key does not reference any rows on insertion into table Address. >testDeleteCascade1 Cascading delete with integer referenced key from Person Contents of PersonPhone 1, 1 2, 2 3, 3 4, 4 5, 5 6, 6 7, 7 9, 8 10, 9 11, 10 13, 11 14, 12 16, 14 17, 15 18, 16 19, 17 20, 18 Contents of PersonAddress 1, 1 2, 2 3, 3 4, 4 5, 5 6, 6 7, 7 8, 8 9, 9 10, 10 11, 11 12, 12 13, 13 14, 14 16, 16 17, 17 18, 18 19, 19 20, 20. >testDeleteCascade2 Cascading delete with multi-column referenced key from Street 16 rows remaining in Street Contents of Address 1, 13188, CARDINAL CREEK RD, EDEN PRAIRIE 3, 14409, GRENIER RD, MINNETONKA 4, 13411, MAYWOOD CURV, MINNETONKA 5, 14408, WOODHILL CIR, MINNETONKA 6, 6135, CHASEWOOD PKWY, MINNETONKA 7, 16335, TEMPLE DR S, MINNETONKA 8, 10995, MELS WAY, EDEN PRAIRIE 9, 17168, PADONS DR, EDEN PRAIRIE 10, 7610, SMETANA LN, EDEN PRAIRIE 11, 16379, MANOR RD S, EDEN PRAIRIE 12, 17439, RUSTIC HILLS DR, EDEN PRAIRIE 13, 5403, POMPANO DR, MINNETONKA 14, 6415, GRAND VIEW DR, EDEN PRAIRIE 15, 6425, CITY WEST PKWY, EDEN PRAIRIE 16, 5978, CHASEWOOD PKWY, MINNETONKA 17, 13700, VALLEY VIEW RD, EDEN PRAIRIE 18, 17460, RUSTIC HILLS DR, EDEN PRAIRIE 19, 10721, SMETANA RD, MINNETONKA Contents of PersonAddress 1, 1 3, 3 4, 4 5, 5 6, 6 7, 7 8, 8 9, 9 10, 10 11, 11 12, 12 13, 13 14, 14 15, 15 16, 16 17, 17 18, 18 19, 19. >testDeleteNullify1 Nullifying delete with integer referenced key from Person Contents of PersonPhone 1, 1 2, 2 3, 3 4, 4 5, 5 6, 6 7, 7 9, 8 10, 9 11, 10 13, 11 14, 12 , 13 16, 14 17, 15 18, 16 19, 17 20, 18 Contents of PersonAddress 1, 1 2, 2 3, 3 4, 4 5, 5 6, 6 7, 7 8, 8 9, 9 10, 10 11, 11 12, 12 13, 13 14, 14 16, 16 17, 17 18, 18 19, 19 20, 20. >testDeleteNullify2 Nullifying delete with multi-column referenced key from Street Contents of Street CARDINAL CREEK RD, EDEN PRAIRIE, MN, GRENIER RD, MINNETONKA, MN, MAYWOOD CURV, MINNETONKA, MN, WOODHILL CIR, MINNETONKA, MN, CHASEWOOD PKWY, MINNETONKA, MN, TEMPLE DR S, MINNETONKA, MN, MELS WAY, EDEN PRAIRIE, MN, PADONS DR, EDEN PRAIRIE, MN, SMETANA LN, EDEN PRAIRIE, MN, MANOR RD S, EDEN PRAIRIE, MN, RUSTIC HILLS DR, EDEN PRAIRIE, MN, POMPANO DR, MINNETONKA, MN, GRAND VIEW DR, EDEN PRAIRIE, MN, CITY WEST PKWY, EDEN PRAIRIE, MN, VALLEY VIEW RD, EDEN PRAIRIE, MN, SMETANA RD, MINNETONKA, MN, Contents of Address 1, 13188, CARDINAL CREEK RD, EDEN PRAIRIE 2, 5037, , 3, 14409, GRENIER RD, MINNETONKA 4, 13411, MAYWOOD CURV, MINNETONKA 5, 14408, WOODHILL CIR, MINNETONKA 6, 6135, CHASEWOOD PKWY, MINNETONKA 7, 16335, TEMPLE DR S, MINNETONKA 8, 10995, MELS WAY, EDEN PRAIRIE 9, 17168, PADONS DR, EDEN PRAIRIE 10, 7610, SMETANA LN, EDEN PRAIRIE 11, 16379, MANOR RD S, EDEN PRAIRIE 12, 17439, RUSTIC HILLS DR, EDEN PRAIRIE 13, 5403, POMPANO DR, MINNETONKA 14, 6415, GRAND VIEW DR, EDEN PRAIRIE 15, 6425, CITY WEST PKWY, EDEN PRAIRIE 16, 5978, CHASEWOOD PKWY, MINNETONKA 17, 13700, VALLEY VIEW RD, EDEN PRAIRIE 18, 17460, RUSTIC HILLS DR, EDEN PRAIRIE 19, 10721, SMETANA RD, MINNETONKA 20, 5037, , Contents of PersonAddress 1, 1 2, 2 3, 3 4, 4 5, 5 6, 6 7, 7 8, 8 9, 9 10, 10 11, 11 12, 12 13, 13 14, 14 15, 15 16, 16 17, 17 18, 18 19, 19 20, 20. >testDeleteDefault1 Nullifying delete with integer referenced key from Person Contents of PersonPhone 1, 1 2, 2 3, 3 4, 4 5, 5 6, 6 7, 7 9, 8 10, 9 11, 10 13, 11 14, 12 75, 13 16, 14 17, 15 18, 16 19, 17 20, 18 Contents of PersonAddress 1, 1 2, 2 3, 3 4, 4 5, 5 6, 6 7, 7 8, 8 9, 9 10, 10 11, 11 12, 12 13, 13 14, 14 16, 16 17, 17 18, 18 19, 19 20, 20. >testDeleteDefault2 Delete multi-col key from Street with on default 16 rows remaining in Street Contents of Address (ID, Building, Street, City): 1, 13188, CARDINAL CREEK RD, EDEN PRAIRIE 2, 5037, AnyStreet, AnyCity 3, 14409, GRENIER RD, MINNETONKA 4, 13411, MAYWOOD CURV, MINNETONKA 5, 14408, WOODHILL CIR, MINNETONKA 6, 6135, CHASEWOOD PKWY, MINNETONKA 7, 16335, TEMPLE DR S, MINNETONKA 8, 10995, MELS WAY, EDEN PRAIRIE 9, 17168, PADONS DR, EDEN PRAIRIE 10, 7610, SMETANA LN, EDEN PRAIRIE 11, 16379, MANOR RD S, EDEN PRAIRIE 12, 17439, RUSTIC HILLS DR, EDEN PRAIRIE 13, 5403, POMPANO DR, MINNETONKA 14, 6415, GRAND VIEW DR, EDEN PRAIRIE 15, 6425, CITY WEST PKWY, EDEN PRAIRIE 16, 5978, CHASEWOOD PKWY, MINNETONKA 17, 13700, VALLEY VIEW RD, EDEN PRAIRIE 18, 17460, RUSTIC HILLS DR, EDEN PRAIRIE 19, 10721, SMETANA RD, MINNETONKA 20, 5037, AnyStreet, AnyCity Contents of PersonAddress 1, 1 2, 2 3, 3 4, 4 5, 5 6, 6 7, 7 8, 8 9, 9 10, 10 11, 11 12, 12 13, 13 14, 14 15, 15 16, 16 17, 17 18, 18 19, 19 20, 20. >testDeleteRestrict1 Restricted delete with integer referenced key from Person DB_TABLE_DATABASE ERROR - Referentially trigger restrict of delete from table Person. >testDeleteRestrict2 Restricted delete with multi-col key from Street DB_TABLE_DATABASE ERROR - Referentially trigger restrict of delete from table Street. >testUpdate Allowed update of integer foreign key of PersonPhone Contents of PersonPhone 1, 1 2, 2 3, 3 4, 4 5, 5 6, 6 7, 7 9, 8 10, 9 11, 10 13, 11 14, 12 15, 13 16, 14 17, 15 18, 16 19, 17 20, 9. >testUpdateForeignKeyCheck Attempt update with invalid integer foreign key DB_TABLE_DATABASE ERROR - Foreign key does not reference any rows on update of table PersonPhone. >testUpdateCascade1 Cascading update of integer primary key of PersonContents of PersonPhone: Contents of PersonPhone 1, 1 2, 2 3, 3 4, 4 5, 5 6, 6 7, 7 9, 8 10, 9 11, 10 38, 11 14, 12 15, 13 16, 14 17, 15 18, 16 19, 17 20, 18 Contents of PersonAddress: Contents of PersonAddress 1, 1 2, 2 3, 3 4, 4 5, 5 6, 6 7, 7 8, 8 9, 9 10, 10 11, 11 12, 12 38, 13 14, 14 15, 15 16, 16 17, 17 18, 18 19, 19 20, 20. >testUpdateCascade2 Cascading update of multi-column referenced key from Street Contents of Address(ID, Building, Street, City) 1, 13188, CARDINAL CREEK RD, EDEN PRAIRIE 2, 5037, NOX BOULEVARD, ANYTOWN 3, 14409, GRENIER RD, MINNETONKA 4, 13411, MAYWOOD CURV, MINNETONKA 5, 14408, WOODHILL CIR, MINNETONKA 6, 6135, CHASEWOOD PKWY, MINNETONKA 7, 16335, TEMPLE DR S, MINNETONKA 8, 10995, MELS WAY, EDEN PRAIRIE 9, 17168, PADONS DR, EDEN PRAIRIE 10, 7610, SMETANA LN, EDEN PRAIRIE 11, 16379, MANOR RD S, EDEN PRAIRIE 12, 17439, RUSTIC HILLS DR, EDEN PRAIRIE 13, 5403, POMPANO DR, MINNETONKA 14, 6415, GRAND VIEW DR, EDEN PRAIRIE 15, 6425, CITY WEST PKWY, EDEN PRAIRIE 16, 5978, CHASEWOOD PKWY, MINNETONKA 17, 13700, VALLEY VIEW RD, EDEN PRAIRIE 18, 17460, RUSTIC HILLS DR, EDEN PRAIRIE 19, 10721, SMETANA RD, MINNETONKA 20, 5037, NOX BOULEVARD, ANYTOWN. >testUpdateNullify1 Nullifying update of integer primary key of Person Contents of PersonPhone 1, 1 2, 2 3, 3 4, 4 5, 5 6, 6 7, 7 9, 8 10, 9 11, 10 , 11 14, 12 15, 13 16, 14 17, 15 18, 16 19, 17 20, 18 Contents of PersonAddress 1, 1 2, 2 3, 3 4, 4 5, 5 6, 6 7, 7 8, 8 9, 9 10, 10 11, 11 12, 12 38, 13 14, 14 15, 15 16, 16 17, 17 18, 18 19, 19 20, 20. >testUpdateNullify2 Nullifying update of multi-column referenced key from Street Contents of Address (ID, Building, Street, City) 1, 13188, CARDINAL CREEK RD, EDEN PRAIRIE 2, 5037, , 3, 14409, GRENIER RD, MINNETONKA 4, 13411, MAYWOOD CURV, MINNETONKA 5, 14408, WOODHILL CIR, MINNETONKA 6, 6135, CHASEWOOD PKWY, MINNETONKA 7, 16335, TEMPLE DR S, MINNETONKA 8, 10995, MELS WAY, EDEN PRAIRIE 9, 17168, PADONS DR, EDEN PRAIRIE 10, 7610, SMETANA LN, EDEN PRAIRIE 11, 16379, MANOR RD S, EDEN PRAIRIE 12, 17439, RUSTIC HILLS DR, EDEN PRAIRIE 13, 5403, POMPANO DR, MINNETONKA 14, 6415, GRAND VIEW DR, EDEN PRAIRIE 15, 6425, CITY WEST PKWY, EDEN PRAIRIE 16, 5978, CHASEWOOD PKWY, MINNETONKA 17, 13700, VALLEY VIEW RD, EDEN PRAIRIE 18, 17460, RUSTIC HILLS DR, EDEN PRAIRIE 19, 10721, SMETANA RD, MINNETONKA 20, 5037, , . >testUpdateDefault1 Set default on Update of integer primary key of Person Contents of PersonPhone 1, 1 2, 2 3, 3 4, 4 5, 5 6, 6 7, 7 9, 8 10, 9 11, 10 75, 11 14, 12 15, 13 16, 14 17, 15 18, 16 19, 17 20, 18 Contents of PersonAddress 1, 1 2, 2 3, 3 4, 4 5, 5 6, 6 7, 7 8, 8 9, 9 10, 10 11, 11 12, 12 38, 13 14, 14 15, 15 16, 16 17, 17 18, 18 19, 19 20, 20. >testUpdateDefault2 Nullifying update of multi-column referenced key from Street Contents of Address(ID, Building, Street, City, StateAbb) 1, 13188, CARDINAL CREEK RD, EDEN PRAIRIE, MN 2, 5037, AnyStreet, AnyCity, 3, 14409, GRENIER RD, MINNETONKA, MN 4, 13411, MAYWOOD CURV, MINNETONKA, MN 5, 14408, WOODHILL CIR, MINNETONKA, MN 6, 6135, CHASEWOOD PKWY, MINNETONKA, MN 7, 16335, TEMPLE DR S, MINNETONKA, MN 8, 10995, MELS WAY, EDEN PRAIRIE, MN 9, 17168, PADONS DR, EDEN PRAIRIE, MN 10, 7610, SMETANA LN, EDEN PRAIRIE, MN 11, 16379, MANOR RD S, EDEN PRAIRIE, MN 12, 17439, RUSTIC HILLS DR, EDEN PRAIRIE, MN 13, 5403, POMPANO DR, MINNETONKA, MN 14, 6415, GRAND VIEW DR, EDEN PRAIRIE, MN 15, 6425, CITY WEST PKWY, EDEN PRAIRIE, MN 16, 5978, CHASEWOOD PKWY, MINNETONKA, MN 17, 13700, VALLEY VIEW RD, EDEN PRAIRIE, MN 18, 17460, RUSTIC HILLS DR, EDEN PRAIRIE, MN 19, 10721, SMETANA RD, MINNETONKA, MN 20, 5037, AnyStreet, AnyCity, . >testUpdateRestrict1 Restricted update of integer primary key of Person DB_TABLE_DATABASE ERROR - Referentially trigger restrict of update of table Person. >testUpdateRestrict2 Restricted update of multi-column referenced key from Street DB_TABLE_DATABASE ERROR - Referentially trigger restrict of update of table Street. Time: 88.905245065689 OK (26 tests) SQLTest.out000066400000000000000000000016201262614675700366750ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package/packagefiles/DB_Table/tests/database/outPHPUnit 2.3.6 by Sebastian Bergmann. >testQuoteString 'This is not a number'. >testQuoteInteger 256. >testQuoteFloat 2.56. >testQuoteBooleanFalse 0. >testQuoteNull NULL. >testBuildFilter1 col1 = 1 AND col2 = 0 AND col3 = 'anyold string'. >testBuildFilter2 col3 = 'anyold string'. >testBuildFilter3 col1 = 1 AND col3 = 'anyold string'. >testBuildFilter4 COL3 = 'anyold string'. >testBuildFilter5 COL1 = 1 AND COL3 = 'anyold string'. >testBuildFilter6 . >testBuildFilter7 col1 = 1 AND col2 = 0 AND col3 = 'anyold string'. >testBuildFilter9 . >testBuildFilter10 . >testBuildFilter11 . >testBuildSQL1 SELECT FirstName, LastName, Building, Street, City FROM Person, Address WHERE Person.PersonID = Address.PersonID2 AND City = 'MINNETONKA' ORDER BY City. >testBuildSQL2 SELECT Street, count(Building) FROM Address GROUP BY Street HAVING City = 'MINNETONKA' ORDER BY Street. Time: 0.80171084403992 OK (17 tests) SelectTest.out000066400000000000000000000341621262614675700374640ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package/packagefiles/DB_Table/tests/database/out PHPUnit 2.3.6 by Sebastian Bergmann. >testSelect1 Table Person: Query: SELECT * FROM Person PersonID => 1, FirstName => ANTOINETTE, MiddleName => MARIE, LastName => ARLAND, NameSuffix => PersonID => 2, FirstName => MACHEL, MiddleName => KAY, LastName => WHITMORE, NameSuffix => PersonID => 3, FirstName => ANTHONY, MiddleName => DAVID, LastName => WESTVEER, NameSuffix => PersonID => 4, FirstName => JODY, MiddleName => JEAN, LastName => LARSON, NameSuffix => PersonID => 5, FirstName => JOSEPH, MiddleName => FRANCISCO, LastName => CRUZ, NameSuffix => PersonID => 6, FirstName => CHRISTINE, MiddleName => MICHELLE, LastName => KAPSNER, NameSuffix => PersonID => 7, FirstName => JEVENY, MiddleName => , LastName => HAMMER, NameSuffix => PersonID => 8, FirstName => JOHNNIE, MiddleName => ESPINOZA, LastName => MARTINEZ, NameSuffix => PersonID => 9, FirstName => STEWART, MiddleName => CHARLES, LastName => SCHENCK, NameSuffix => PersonID => 10, FirstName => ANN, MiddleName => , LastName => GOLDBERG, NameSuffix => PersonID => 11, FirstName => CHAD, MiddleName => GERALD, LastName => FLIES, NameSuffix => PersonID => 12, FirstName => STEPHANIE, MiddleName => ANN, LastName => WRIGHT, NameSuffix => PersonID => 13, FirstName => JEAN, MiddleName => ADELE, LastName => KALIL, NameSuffix => PersonID => 14, FirstName => JEFFREY, MiddleName => DAVID, LastName => KUTSCHEID, NameSuffix => PersonID => 15, FirstName => JENNIFER, MiddleName => JEAN, LastName => MACKENTHUN, NameSuffix => PersonID => 16, FirstName => MICHAEL, MiddleName => JOHN, LastName => SELANDER, NameSuffix => PersonID => 17, FirstName => SARAH, MiddleName => JANE, LastName => TENNES, NameSuffix => PersonID => 18, FirstName => ANDREW, MiddleName => PAUL, LastName => WUKMIR, NameSuffix => PersonID => 19, FirstName => SHERRY, MiddleName => MARIE, LastName => CHAPMAN, NameSuffix => PersonID => 20, FirstName => JEFFREY, MiddleName => LEE, LastName => WHITMORE, NameSuffix => Count 20, 20 Table Address: Query: SELECT * FROM Address AddressID => 1, Building => 13188, Street => CARDINAL CREEK RD, UnitType => , Unit => , City => EDEN PRAIRIE, StateAbb => MN, ZipCode => 55346 AddressID => 2, Building => 5037, Street => NORMAN DR, UnitType => , Unit => , City => MINNETONKA, StateAbb => MN, ZipCode => 55345 AddressID => 3, Building => 14409, Street => GRENIER RD, UnitType => , Unit => , City => MINNETONKA, StateAbb => MN, ZipCode => 55345 AddressID => 4, Building => 13411, Street => MAYWOOD CURV, UnitType => , Unit => , City => MINNETONKA, StateAbb => MN, ZipCode => 55345 AddressID => 5, Building => 14408, Street => WOODHILL CIR, UnitType => , Unit => , City => MINNETONKA, StateAbb => MN, ZipCode => 55345 AddressID => 6, Building => 6135, Street => CHASEWOOD PKWY, UnitType => APT, Unit => 204, City => MINNETONKA, StateAbb => MN, ZipCode => 55343 AddressID => 7, Building => 16335, Street => TEMPLE DR S, UnitType => , Unit => , City => MINNETONKA, StateAbb => MN, ZipCode => 55345 AddressID => 8, Building => 10995, Street => MELS WAY, UnitType => , Unit => , City => EDEN PRAIRIE, StateAbb => MN, ZipCode => 55344 AddressID => 9, Building => 17168, Street => PADONS DR, UnitType => , Unit => , City => EDEN PRAIRIE, StateAbb => MN, ZipCode => 55346 AddressID => 10, Building => 7610, Street => SMETANA LN, UnitType => UNIT, Unit => 103, City => EDEN PRAIRIE, StateAbb => MN, ZipCode => 55344 AddressID => 11, Building => 16379, Street => MANOR RD S, UnitType => , Unit => , City => EDEN PRAIRIE, StateAbb => MN, ZipCode => 55346 AddressID => 12, Building => 17439, Street => RUSTIC HILLS DR, UnitType => , Unit => , City => EDEN PRAIRIE, StateAbb => MN, ZipCode => 55346 AddressID => 13, Building => 5403, Street => POMPANO DR, UnitType => , Unit => , City => MINNETONKA, StateAbb => MN, ZipCode => 55343 AddressID => 14, Building => 6415, Street => GRAND VIEW DR, UnitType => , Unit => , City => EDEN PRAIRIE, StateAbb => MN, ZipCode => 55346 AddressID => 15, Building => 6425, Street => CITY WEST PKWY, UnitType => APT, Unit => 3314, City => EDEN PRAIRIE, StateAbb => MN, ZipCode => 55344 AddressID => 16, Building => 5978, Street => CHASEWOOD PKWY, UnitType => APT, Unit => 003, City => MINNETONKA, StateAbb => MN, ZipCode => 55343 AddressID => 17, Building => 13700, Street => VALLEY VIEW RD, UnitType => APT, Unit => 107, City => EDEN PRAIRIE, StateAbb => MN, ZipCode => 55344 AddressID => 18, Building => 17460, Street => RUSTIC HILLS DR, UnitType => , Unit => , City => EDEN PRAIRIE, StateAbb => MN, ZipCode => 55346 AddressID => 19, Building => 10721, Street => SMETANA RD, UnitType => APT, Unit => 103, City => MINNETONKA, StateAbb => MN, ZipCode => 55343 AddressID => 20, Building => 5037, Street => NORMAN DR, UnitType => , Unit => , City => MINNETONKA, StateAbb => MN, ZipCode => 55345 Count 20, 20 Table Phone: Query: SELECT * FROM Phone PhoneID => 1, PhoneNumber => 9528940424 PhoneID => 2, PhoneNumber => 9529745279 PhoneID => 3, PhoneNumber => 9529499236 PhoneID => 4, PhoneNumber => 6513346195 PhoneID => 5, PhoneNumber => 9529450055 PhoneID => 6, PhoneNumber => 9529310051 PhoneID => 7, PhoneNumber => 9529300438 PhoneID => 8, PhoneNumber => 9529349246 PhoneID => 9, PhoneNumber => 9528942288 PhoneID => 10, PhoneNumber => 9529496790 PhoneID => 11, PhoneNumber => 9529385751 PhoneID => 12, PhoneNumber => 9529755977 PhoneID => 13, PhoneNumber => 9529743785 PhoneID => 14, PhoneNumber => 9529331534 PhoneID => 15, PhoneNumber => 9529492390 PhoneID => 16, PhoneNumber => 9529344367 PhoneID => 17, PhoneNumber => 9529350387 PhoneID => 18, PhoneNumber => 9529745079 Count 18, 18 Table PersonAddress: Query: SELECT * FROM PersonAddress PersonID2 => 1, AddressID => 1 PersonID2 => 2, AddressID => 2 PersonID2 => 3, AddressID => 3 PersonID2 => 4, AddressID => 4 PersonID2 => 5, AddressID => 5 PersonID2 => 6, AddressID => 6 PersonID2 => 7, AddressID => 7 PersonID2 => 8, AddressID => 8 PersonID2 => 9, AddressID => 9 PersonID2 => 10, AddressID => 10 PersonID2 => 11, AddressID => 11 PersonID2 => 12, AddressID => 12 PersonID2 => 13, AddressID => 13 PersonID2 => 14, AddressID => 14 PersonID2 => 15, AddressID => 15 PersonID2 => 16, AddressID => 16 PersonID2 => 17, AddressID => 17 PersonID2 => 18, AddressID => 18 PersonID2 => 19, AddressID => 19 PersonID2 => 20, AddressID => 20 Count 20, 20 Table PersonPhone: Query: SELECT * FROM PersonPhone PersonID => 1, PhoneID => 1 PersonID => 2, PhoneID => 2 PersonID => 3, PhoneID => 3 PersonID => 4, PhoneID => 4 PersonID => 5, PhoneID => 5 PersonID => 6, PhoneID => 6 PersonID => 7, PhoneID => 7 PersonID => 9, PhoneID => 8 PersonID => 10, PhoneID => 9 PersonID => 11, PhoneID => 10 PersonID => 13, PhoneID => 11 PersonID => 14, PhoneID => 12 PersonID => 15, PhoneID => 13 PersonID => 16, PhoneID => 14 PersonID => 17, PhoneID => 15 PersonID => 18, PhoneID => 16 PersonID => 19, PhoneID => 17 PersonID => 20, PhoneID => 18 Count 18, 18 Table Street: Query: SELECT * FROM Street Street => CARDINAL CREEK RD, City => EDEN PRAIRIE, StateAbb => MN, Sunny => Street => NORMAN DR, City => MINNETONKA, StateAbb => MN, Sunny => Street => GRENIER RD, City => MINNETONKA, StateAbb => MN, Sunny => Street => MAYWOOD CURV, City => MINNETONKA, StateAbb => MN, Sunny => Street => WOODHILL CIR, City => MINNETONKA, StateAbb => MN, Sunny => Street => CHASEWOOD PKWY, City => MINNETONKA, StateAbb => MN, Sunny => Street => TEMPLE DR S, City => MINNETONKA, StateAbb => MN, Sunny => Street => MELS WAY, City => EDEN PRAIRIE, StateAbb => MN, Sunny => Street => PADONS DR, City => EDEN PRAIRIE, StateAbb => MN, Sunny => Street => SMETANA LN, City => EDEN PRAIRIE, StateAbb => MN, Sunny => Street => MANOR RD S, City => EDEN PRAIRIE, StateAbb => MN, Sunny => Street => RUSTIC HILLS DR, City => EDEN PRAIRIE, StateAbb => MN, Sunny => Street => POMPANO DR, City => MINNETONKA, StateAbb => MN, Sunny => Street => GRAND VIEW DR, City => EDEN PRAIRIE, StateAbb => MN, Sunny => Street => CITY WEST PKWY, City => EDEN PRAIRIE, StateAbb => MN, Sunny => Street => VALLEY VIEW RD, City => EDEN PRAIRIE, StateAbb => MN, Sunny => Street => SMETANA RD, City => MINNETONKA, StateAbb => MN, Sunny => Count 17, 17 . >testSelect2 Query: SELECT Person.LastName, Person.FirstName, Phone.PhoneNumber, Address.Building, Street.Street, Street.City, Address.ZipCode FROM Person, Phone, Address, Street, PersonPhone, PersonAddress WHERE ( PersonPhone.PhoneID = Phone.PhoneID AND PersonPhone.PersonID = Person.PersonID AND PersonAddress.AddressID = Address.AddressID AND PersonAddress.PersonID2 = Person.PersonID AND Address.Street = Street.Street AND Address.City = Street.City AND Address.StateAbb = Street.StateAbb ) AND ( Street.City = 'MINNETONKA' ) ORDER BY LastName CHAPMAN,SHERRY,9529350387,10721,SMETANA RD,MINNETONKA,55343 CRUZ,JOSEPH,9529450055,14408,WOODHILL CIR,MINNETONKA,55345 HAMMER,JEVENY,9529300438,16335,TEMPLE DR S,MINNETONKA,55345 KALIL,JEAN,9529385751,5403,POMPANO DR,MINNETONKA,55343 KAPSNER,CHRISTINE,9529310051,6135,CHASEWOOD PKWY,MINNETONKA,55343 LARSON,JODY,6513346195,13411,MAYWOOD CURV,MINNETONKA,55345 SELANDER,MICHAEL,9529331534,5978,CHASEWOOD PKWY,MINNETONKA,55343 WESTVEER,ANTHONY,9529499236,14409,GRENIER RD,MINNETONKA,55345 WHITMORE,JEFFREY,9529745079,5037,NORMAN DR,MINNETONKA,55345 WHITMORE,MACHEL,9529745279,5037,NORMAN DR,MINNETONKA,55345 . >testSelect3 Query: SELECT Person.LastName, Person.FirstName, Phone.PhoneNumber, Address.Building, Street.Street, Street.City, Address.ZipCode FROM Person, Phone, Address, Street, PersonPhone, PersonAddress WHERE ( PersonPhone.PhoneID = Phone.PhoneID AND PersonPhone.PersonID = Person.PersonID AND PersonAddress.AddressID = Address.AddressID AND PersonAddress.PersonID2 = Person.PersonID AND Address.Street = Street.Street AND Address.City = Street.City AND Address.StateAbb = Street.StateAbb ) AND ( Street.City = 'MINNETONKA' ) ORDER BY FirstName WESTVEER,ANTHONY,9529499236,14409,GRENIER RD,MINNETONKA,55345 KAPSNER,CHRISTINE,9529310051,6135,CHASEWOOD PKWY,MINNETONKA,55343 KALIL,JEAN,9529385751,5403,POMPANO DR,MINNETONKA,55343 WHITMORE,JEFFREY,9529745079,5037,NORMAN DR,MINNETONKA,55345 HAMMER,JEVENY,9529300438,16335,TEMPLE DR S,MINNETONKA,55345 LARSON,JODY,6513346195,13411,MAYWOOD CURV,MINNETONKA,55345 CRUZ,JOSEPH,9529450055,14408,WOODHILL CIR,MINNETONKA,55345 WHITMORE,MACHEL,9529745279,5037,NORMAN DR,MINNETONKA,55345 SELANDER,MICHAEL,9529331534,5978,CHASEWOOD PKWY,MINNETONKA,55343 CHAPMAN,SHERRY,9529350387,10721,SMETANA RD,MINNETONKA,55343 . >testSelect4 DB_TABLE_DATABASE Error - Query is neither an array nor a string. >testSelect5 DB_TABLE_DATABASE Error - Query string is not a key of $sql property array. Key is not_a_key. >testSelectResult1 Query: SELECT Person.LastName, Person.FirstName, Phone.PhoneNumber, Address.Building, Street.Street, Street.City, Address.ZipCode FROM Person, Phone, Address, Street, PersonPhone, PersonAddress WHERE ( PersonPhone.PhoneID = Phone.PhoneID AND PersonPhone.PersonID = Person.PersonID AND PersonAddress.AddressID = Address.AddressID AND PersonAddress.PersonID2 = Person.PersonID AND Address.Street = Street.Street AND Address.City = Street.City AND Address.StateAbb = Street.StateAbb ) AND ( Street.City = 'MINNETONKA' ) ORDER BY LastName CHAPMAN,SHERRY,9529350387,10721,SMETANA RD,MINNETONKA,55343 CRUZ,JOSEPH,9529450055,14408,WOODHILL CIR,MINNETONKA,55345 HAMMER,JEVENY,9529300438,16335,TEMPLE DR S,MINNETONKA,55345 KALIL,JEAN,9529385751,5403,POMPANO DR,MINNETONKA,55343 KAPSNER,CHRISTINE,9529310051,6135,CHASEWOOD PKWY,MINNETONKA,55343 LARSON,JODY,6513346195,13411,MAYWOOD CURV,MINNETONKA,55345 SELANDER,MICHAEL,9529331534,5978,CHASEWOOD PKWY,MINNETONKA,55343 WESTVEER,ANTHONY,9529499236,14409,GRENIER RD,MINNETONKA,55345 WHITMORE,JEFFREY,9529745079,5037,NORMAN DR,MINNETONKA,55345 WHITMORE,MACHEL,9529745279,5037,NORMAN DR,MINNETONKA,55345 . >testSelectResult2 Query: SELECT Person.LastName, Person.FirstName, Phone.PhoneNumber, Address.Building, Street.Street, Street.City, Address.ZipCode FROM Person, Phone, Address, Street, PersonPhone, PersonAddress WHERE ( PersonPhone.PhoneID = Phone.PhoneID AND PersonPhone.PersonID = Person.PersonID AND PersonAddress.AddressID = Address.AddressID AND PersonAddress.PersonID2 = Person.PersonID AND Address.Street = Street.Street AND Address.City = Street.City AND Address.StateAbb = Street.StateAbb ) AND ( Street.City = 'MINNETONKA' ) ORDER BY LastName CHAPMAN,SHERRY,9529350387,10721,SMETANA RD,MINNETONKA,55343 CRUZ,JOSEPH,9529450055,14408,WOODHILL CIR,MINNETONKA,55345 HAMMER,JEVENY,9529300438,16335,TEMPLE DR S,MINNETONKA,55345 KALIL,JEAN,9529385751,5403,POMPANO DR,MINNETONKA,55343 KAPSNER,CHRISTINE,9529310051,6135,CHASEWOOD PKWY,MINNETONKA,55343 LARSON,JODY,6513346195,13411,MAYWOOD CURV,MINNETONKA,55345 SELANDER,MICHAEL,9529331534,5978,CHASEWOOD PKWY,MINNETONKA,55343 WESTVEER,ANTHONY,9529499236,14409,GRENIER RD,MINNETONKA,55345 WHITMORE,JEFFREY,9529745079,5037,NORMAN DR,MINNETONKA,55345 WHITMORE,MACHEL,9529745279,5037,NORMAN DR,MINNETONKA,55345 . >testSelectResult3 DB_TABLE_DATABASE Error - Query is neither an array nor a string. >testSelectResult4 DB_TABLE_DATABASE Error - Query string is not a key of $sql property array. Key is not_a_key. >testSelectCount1 Query: SELECT Person.LastName, Person.FirstName, Phone.PhoneNumber, Address.Building, Street.Street, Street.City, Address.ZipCode FROM Person, Phone, Address, Street, PersonPhone, PersonAddress WHERE ( PersonPhone.PhoneID = Phone.PhoneID AND PersonPhone.PersonID = Person.PersonID AND PersonAddress.AddressID = Address.AddressID AND PersonAddress.PersonID2 = Person.PersonID AND Address.Street = Street.Street AND Address.City = Street.City AND Address.StateAbb = Street.StateAbb ) AND ( Street.City = 'MINNETONKA' ) ORDER BY LastName Count = 10 . >testSelectCount2 Query: SELECT Person.LastName, Person.FirstName, Phone.PhoneNumber, Address.Building, Street.Street, Street.City, Address.ZipCode FROM Person, Phone, Address, Street, PersonPhone, PersonAddress WHERE ( PersonPhone.PhoneID = Phone.PhoneID AND PersonPhone.PersonID = Person.PersonID AND PersonAddress.AddressID = Address.AddressID AND PersonAddress.PersonID2 = Person.PersonID AND Address.Street = Street.Street AND Address.City = Street.City AND Address.StateAbb = Street.StateAbb ) AND ( Street.City = 'EDEN PRAIRIE' ) Count = 8 . Time: 61.179705142975 OK (11 tests) SerialTest.out000066400000000000000000000003021262614675700374510ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package/packagefiles/DB_Table/tests/database/outPHPUnit 2.3.6 by Sebastian Bergmann. >testGetTable1. >testGetPrimaryKey1. >testGetRef1. >testGetRefTo1. >testGetLink1. >testGetCol1. >testGetForeignCol1. Time: 0.51314806938171 OK (7 tests) XMLTest.out000066400000000000000000000156371262614675700367130ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package/packagefiles/DB_Table/tests/database/out PHPUnit 2.3.6 by Sebastian Bergmann. >Test toXML() method Person PersonID integer 1 1 FirstName char 32 1 MiddleName char 32 LastName char 64 1 NameSuffix char 16 PersonID 1 PersonID Name LastName FirstName MiddleName NameSuffix
Address AddressID integer 1 1 Building char 16 Street char 64 UnitType char 16 Unit char 16 City char 64 StateAbb char 2 ZipCode char 16 AddressID 1 AddressID StreetAddress 1 City Street Building Unit Street City StateAbb
Street
Street City StateAbb cascade cascade Phone PhoneID integer 1 1 PhoneNumber char 16 1 PhoneID 1 PhoneID PhoneNumber 1 PhoneNumber
PersonAddress PersonID2 integer AddressID integer 1 PersonID2 PersonID2 AddressID AddressID PersonID2
Person
PersonID cascade cascade AddressID Address
AddressID
cascade cascade
PersonPhone PersonID integer PhoneID integer 1 PersonID PersonID PhoneID PhoneID PersonID
Person
PersonID cascade cascade PhoneID Phone
PhoneID
cascade cascade
Street Street char 64 City char 64 StateAbb char 2 Sunny boolean Street 1 Street City StateAbb
. >Test round-trip toXML() -> fromXML. Time: 0.37030982971191 OK (2 tests) generator/000077500000000000000000000000001262614675700342615ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package/packagefiles/DB_Table/testsREADME000066400000000000000000000031351262614675700351430ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package/packagefiles/DB_Table/tests/generator To test the DB_Table_Generator class: 1) Copy the DB_Table/tests/config.php-dist file, in the parent directory to DB_Table/tests/generator/config.php, in this directory. 2) Edit the parts of the DSN string in the config.php file to connect to your server 3) Change $db_name in config.php to the name of an existing database 4) Run 'php test.php' from the command line within this directory Upon completion, you should have a new subdirectory of DB_Table/tests/generator for which the directory name is the name $db_name of the database. In it should be a DB_Table subclass definition for each table in the database, and a file named 'Database.php'. Look at the 'Database.php' file: It should contain code to include all of the DB_Table subclass definitions, to connect to the database server, to create one instance of each DB_Table subclass, and to create a parent DB_Table_Database parent object. The creation of the DSN within the Database.php file must be edited so as to allow a connection your database server before the file can be used. The Database.php file is not included by any other auto-generated file, and so can be renamed with no ill effects. Including the Database.php file in another php script will give the script access to the auto-generated DB_Table infrastructure. The generator tries guess information about foreign key references from the column names. The resulting calls to ->addRef should be checked for accuracy, and corrected as necessary. The generator does not declare linking tables, so these should be added, if needed, by editing the 'Database.php' file. test.php000066400000000000000000000011631262614675700357520ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package/packagefiles/DB_Table/tests/generatorquery("USE $db_name"); if (PEAR::isError($result)){ print $result->getMessage()."\n"; } } require_once 'DB/Table/Generator.php'; $generator = new DB_Table_Generator($conn, $db_name); $generator->class_write_path = $db_name; #$generator->getTableNames(); $return = $generator->generateTableClassFiles(); if (PEAR::isError($return)) { print $return->getMessage(); die; } $generator->generateDatabaseFile(); if (PEAR::isError($return)) { print $return->getMessage(); die; } ?> setup.ini-dist000066400000000000000000000002411262614675700350720ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package/packagefiles/DB_Table/tests[dsn] phptype = mysql username = USERNAME password = PASSWORD hostspec = localhost database = test [example] table = example create = drop display = 0 fetch = 0php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package/packagefiles/equivv1.xml000066400000000000000000000057371262614675700317520ustar00rootroot00000000000000 fakebar fakebar foo hi there single person joe@example.com lead 1.9.0 2004-11-27 PHP License stable here are the multi-line release notes xmlrpc Console_Getopt 1.3.3 2004-10-28 stable 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 1.3.2 2004-10-28 stable 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 php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package/packagefiles/fakebar.xml000066400000000000000000000077731262614675700317470ustar00rootroot00000000000000 fakebar pear.php.net foo foo hi there person single joe@example.com yes 1.9.0 1.9.0 stable stable PHP License here are the multi-line release notes 4.3.0 6.0.0 1.4.0a1 Console_Getopt pear.php.net 1.2 1.2 xmlrpc 1.0 * 1.3.3 1.3.3 stable stable 2004-10-28 PHP License 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 1.3.2 1.3.2 stable stable 2004-10-28 PHP License 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 php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package/packagefiles/foo.php000066400000000000000000000000301262614675700311010ustar00rootroot00000000000000 php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package/packagefiles/foo1.php000066400000000000000000000000111262614675700311610ustar00rootroot00000000000000 packageinvalidv1.xml000066400000000000000000000057421262614675700335000ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package/packagefiles foo foo foo hi there single person joe@example.com lead 1.2.0a1 2004-11-27 PHP License alpha here are the multi-line release notes xmlrpc Console_Getopt 1.3.3 2004-10-28 stable 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 1.3.2 2004-10-28 stable 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 packageinvalidv2.xml000066400000000000000000000100341262614675700334670ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package/packagefiles fakebar pear.php.net foo foo hi there person single joe@example.com yes 2004-12-25 1.9.0 1.9.0 stable stable PHP License here are the multi-line release notes 4.3.0 6.0.0 1.4.0a1 Console_Getopt pear.php.net 1.2 1.2 xmlrpc 1.0 * 1.3.3 1.3.3 stable stable 2004-10-28 PHP License 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 1.3.2 1.3.2 stable stable 2004-10-28 PHP License 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 php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package/packagefiles/sunger/000077500000000000000000000000001262614675700311175ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package/packagefiles/sunger/foo.dat000066400000000000000000000000321262614675700323670ustar00rootroot00000000000000 php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package/packagefiles/test.php000066400000000000000000000000271262614675700313030ustar00rootroot00000000000000 php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package/packagefiles/v1.xml000066400000000000000000000057061262614675700306740ustar00rootroot00000000000000 foo foo hi there single person joe@example.com lead 1.2.0a1 2004-11-27 PHP License alpha here are the multi-line release notes xmlrpc Console_Getopt 1.3.3 2004-10-28 stable 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 1.3.2 2004-10-28 stable 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 php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package/packagefiles/validfakebar.xml000066400000000000000000000100321262614675700327450ustar00rootroot00000000000000 fakebar pear.php.net fakebar foo hi there person single joe@example.com yes 2004-12-25 1.9.0 1.9.0 stable stable PHP License here are the multi-line release notes 4.3.0 6.0.0 1.4.0a1 Console_Getopt pear.php.net 1.2 1.2 xmlrpc 1.0 * 1.3.3 1.3.3 stable stable 2004-10-28 PHP License 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 1.3.2 1.3.2 stable stable 2004-10-28 PHP License 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 php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package/packagefiles/validv1.xml000066400000000000000000000057371262614675700317200ustar00rootroot00000000000000 foo foo foo hi there single person joe@example.com lead 1.2.0a1 2004-11-27 PHP License alpha here are the multi-line release notes xmlrpc Console_Getopt 1.3.3 2004-10-28 stable 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 1.3.2 2004-10-28 stable 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 validwarnfakebar.xml000066400000000000000000000100241262614675700335570ustar00rootroot00000000000000php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package/packagefiles fakebar pear.php.net foo foo hi there person single joe@example.com yes 2004-12-25 1.9.0 1.9.0 stable stable PHP License here are the multi-line release notes 4.3.0 6.0.0 1.4.0a1 Console_Getopt pear.php.net 1.2 1.2 xmlrpc 1.0 * 1.3.3 1.3.3 stable stable 2004-10-28 PHP License 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 1.3.2 1.3.2 stable stable 2004-10-28 PHP License 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 php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package/packagefiles/validwarnv1.xml000066400000000000000000000057361262614675700326070ustar00rootroot00000000000000 foo foo foo hi there single person joe@example.com lead 1.2.0a1 2004-11-27 PHP License alpha here are the multi-line release notes xmlrpc Console_Getopt 1.3.3 2004-10-28 stable 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 1.3.2 2004-10-28 stable 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 php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package/test_bug11318.phpt000066400000000000000000000061311262614675700303060ustar00rootroot00000000000000--TEST-- package command, bug #11317 --SKIPIF-- --FILE-- run('package', array('nocompress' => true), array()); $phpunit->assertErrors(array( array('package' => 'PEAR_PackageFile_v2', 'message' => 'Channel validator warning: field "date" - Release Date "2007-06-14" is not today'), array('package' => 'PEAR_PackageFile_v2', 'message' => 'Channel validator warning: field "date" - Release Date "2007-06-14" is not today'), ), 'after'); $fakelog->getLog(); $p = new PEAR_PackageFile($config); $pf = $p->fromTgzFile(dirname(__FILE__) . '/packagefiles/DB_Table/DB_Table-1.5.0RC3.tar', PEAR_VALIDATE_DOWNLOADING); $phpunit->showAll(); $phpunit->assertEquals('- Added complete documentation in the PEAR manual. - new DB_Table_Base class added. This is a parent class for DB_Table and DB_Table_Database that contains methods and properties common to both classes. - The DB_Table::select*() and DB_Table::buildSQL() methods, which are now inherited from the DB_Table_Base class, now accept either a query array or (as before) a key of the $sql property array as a first argument. - Added DB_Table_Database::onDeleteAction() and DB_Table_Database::onUpdateAction() methods, which implement referentially triggered actions (e.g., cascading deletes). This code had previously been part of the DB_Table_Database insert() and update() methods. - Changed behavior of DB_Table::insert() and DB_Table::update() method for a DB_Table object that is part of a DB_Table_Database instance: If a parent DB_Table_Database object exists, these methods can now validate foreign keys and implement ON DELETE and ON UPDATE actions, if these behaviors are enabled in the parent DB_Table_Database object. The behaviors of the DB_Table and DB_Table_Database insert and update methods are now identical. (This is a BC break with 1.5.0RC1 and 1.5.0RC2 beta releases, but not with earlier stable releases.) - Disable automatic foreign key validation by default (BC break with releases 1.5.0RC1 and 1.5.0RC2). - Added buildFilter() method to the DB_Table_Base class. This a simplified version of the DB_Table_Database::buildFilter() method of previous 1.5.0RC* releases. (BC break with 1.5.0RC1 and 1.5.0RC2) - Added a private DB_Table_Database::_buildForeignKeyFilter() for more specialized uses of the old buildFilter() method, which are used internally to construct queries. - Changed return value of DB_Table_Database::validForeignKey on failure from boolean false to PEAR_Error. Changed related error codes. - Changed \'autoinc\' element of XML output to \'autoincrement\' for consistency with MDB2 XML schema. - Simplified unit tests for DB_Table_Database by adding a parent DatabaseTest unit test class.', $pf->getNotes(), 'notes'); echo 'tests done'; ?> --CLEAN-- --EXPECT-- tests done php-pear-1.10.1+submodules+notgz/tests/PEAR_Command_Package/package/test_fail.phpt000066400000000000000000000130711262614675700300470ustar00rootroot00000000000000--TEST-- package command failure --SKIPIF-- --FILE-- run('package', array(), array($temp_path . DIRECTORY_SEPARATOR . 'bloob.xml')); $phpunit->assertErrors(array( array('package' => 'PEAR_PackageFile', 'message' => 'package.xml "' . $temp_path . DIRECTORY_SEPARATOR . 'bloob.xml" has no package.xml version'), array('package' => 'PEAR_Error', 'message' => 'Cannot package, errors in package file'), array('package' => 'PEAR_Error', 'message' => 'Cannot package, errors in package file'), ), 'ret 1'); $phpunit->assertIsa('PEAR_Error', $ret, 'bloob.xml'); if (version_compare(phpversion(), '5.0.0', '>=')) { if (version_compare(phpversion(), '5.0.3', '>=')) { $errmsg = 'XML error: Invalid document end at line 1'; } else { $errmsg = 'XML error: XML_ERR_DOCUMENT_END at line 1'; } } else { $errmsg = 'XML error: no element found at line 1'; } $phpunit->assertEquals(array ( 0 => array ( 0 => $errmsg, 1 => true, ), ), $fakelog->getLog(), 'log'); // v2 with invalid $ret = $command->run('package', array(), array(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'packagefiles' . DIRECTORY_SEPARATOR . 'fakebar.xml')); $phpunit->assertErrors(array( array('package' => 'PEAR_PackageFile_v2', 'message' => 'Invalid tag order in , found