summaryrefslogtreecommitdiff
path: root/pear
diff options
context:
space:
mode:
Diffstat (limited to 'pear')
-rw-r--r--pear/Archive/Tar.php1111
-rwxr-xr-xpear/CMD.php286
-rw-r--r--pear/CODING_STANDARDS8
-rw-r--r--pear/Console/Getopt.php232
-rw-r--r--pear/DB.php872
-rw-r--r--pear/HTTP.php172
-rw-r--r--pear/ITX.xml21
-rw-r--r--pear/Mail.php186
-rw-r--r--pear/Makefile.in190
-rw-r--r--pear/PEAR.php794
-rw-r--r--pear/PEAR/Autoloader.php167
-rw-r--r--pear/PEAR/Common.php430
-rw-r--r--pear/PEAR/Config.php222
-rw-r--r--pear/PEAR/Dependency.php247
-rw-r--r--pear/PEAR/Installer.php363
-rw-r--r--pear/PEAR/Packager.php162
-rw-r--r--pear/PEAR/Registry.php187
-rw-r--r--pear/PEAR/Remote.php124
-rw-r--r--pear/PEAR/Uploader.php61
-rw-r--r--pear/PEAR/WebInstaller.php631
-rw-r--r--pear/README37
-rw-r--r--pear/System.php354
-rw-r--r--pear/TODO20
-rw-r--r--pear/catalog1
-rw-r--r--pear/install-pear.txt11
-rw-r--r--pear/package.dtd81
-rw-r--r--pear/pear.m489
-rw-r--r--pear/scripts/pear-get.in58
-rwxr-xr-xpear/scripts/pear.bat31
-rw-r--r--pear/scripts/pear.in58
-rw-r--r--pear/scripts/pearcmd-common.php197
-rw-r--r--pear/scripts/pearcmd-help.php9
-rw-r--r--pear/scripts/pearcmd-info.php9
-rw-r--r--pear/scripts/pearcmd-install.php33
-rw-r--r--pear/scripts/pearcmd-list.php20
-rw-r--r--pear/scripts/pearcmd-package.php15
-rw-r--r--pear/scripts/pearcmd-remote-list.php24
-rw-r--r--pear/scripts/pearcmd-show-config.php16
-rw-r--r--pear/scripts/pearcmd-uninstall.php26
-rw-r--r--pear/scripts/pearize.in225
-rw-r--r--pear/scripts/pearwin.php150
-rw-r--r--pear/scripts/php-config.in26
-rwxr-xr-xpear/scripts/phpextdist27
-rw-r--r--pear/scripts/phpize.in31
-rwxr-xr-xpear/scripts/phptar.in236
-rw-r--r--pear/tests/pear1.phpt87
-rw-r--r--pear/tests/pear_autoloader.phpt80
-rw-r--r--pear/tests/pear_config.phpt72
-rw-r--r--pear/tests/pear_error.phpt153
-rw-r--r--pear/tests/pear_error2.phpt24
-rw-r--r--pear/tests/pear_error3.phpt40
-rw-r--r--pear/tests/pear_error4.phpt89
-rw-r--r--pear/tests/pear_registry.phpt92
-rw-r--r--pear/tests/php.ini2
-rw-r--r--pear/tests/system.input1
-rw-r--r--pear/tests/user.input0
56 files changed, 0 insertions, 8890 deletions
diff --git a/pear/Archive/Tar.php b/pear/Archive/Tar.php
deleted file mode 100644
index 0390339a09..0000000000
--- a/pear/Archive/Tar.php
+++ /dev/null
@@ -1,1111 +0,0 @@
-<?php
-/* vim: set ts=4 sw=4: */
-// +----------------------------------------------------------------------+
-// | PHP Version 4 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2002 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.02 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Authors: Vincent Blavet <vincent@blavet.net> |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-
-require_once 'PEAR.php';
-
-/**
-* Creates a (compressed) Tar archive
-*
-* @author Vincent Blavet <vincent@blavet.net>
-* @version $Revision$
-* @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 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 compressed TAR file.
- *
- * @param string $p_tarname The name of the tar archive to create
- * @param boolean $p_compress if true, the archive will be gezip(ped)
- * @access public
- */
- function Archive_Tar($p_tarname, $p_compress = false)
- {
- $this->PEAR();
- $this->_tarname = $p_tarname;
- if ($p_compress) { // assert zlib extension support
- $extname = 'zlib';
- if (!extension_loaded($extname)) {
- $dlext = (OS_WINDOWS) ? '.dll' : '.so';
- @dl($extname . $dlext);
- }
- if (!extension_loaded($extname)) {
- die("The extension '$extname' couldn't be loaded. ".
- 'Probably you don\'t have support in your PHP '.
- 'to this extension');
- return false;
- }
- }
- $this->_compress = $p_compress;
- }
- // }}}
-
- // {{{ 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 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.
- *
- * @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()
- 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);
- return(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(" ", $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.
- * 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.
- *
- * @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(" ", $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;
- }
- // }}}
-
- // {{{ 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;
- }
- // }}}
-
- // {{{ 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(" ", $p_filelist);
- else {
- $this->_error('Invalid string list');
- return false;
- }
-
- if ($v_result = $this->_openRead()) {
- $v_result = $this->_extractList($p_path, $v_list_detail, "complete", $v_list, $p_remove_path);
- $this->_close();
- }
-
- 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)
- $this->_file = @gzopen($this->_tarname, "w");
- else
- $this->_file = @fopen($this->_tarname, "w");
-
- 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)
- $this->_file = @gzopen($v_filename, "rb");
- else
- $this->_file = @fopen($v_filename, "rb");
-
- if ($this->_file == 0) {
- $this->_error('Unable to open in read mode \''.$v_filename.'\'');
- return false;
- }
-
- return true;
- }
- // }}}
-
- // {{{ _openReadWrite()
- function _openReadWrite()
- {
- if ($this->_compress)
- $this->_file = @gzopen($this->_tarname, "r+b");
- else
- $this->_file = @fopen($this->_tarname, "r+b");
-
- 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 ($this->_compress)
- @gzclose($this->_file);
- else
- @fclose($this->_file);
-
- $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;
- }
- // }}}
-
- // {{{ _writeFooter()
- function _writeFooter()
- {
- if ($this->_file) {
- // ----- Write the last 0 filled block for end of archive
- $v_binary_data = pack("a512", '');
- if ($this->_compress)
- @gzputs($this->_file, $v_binary_data);
- else
- @fputs($this->_file, $v_binary_data);
- }
- return true;
- }
- // }}}
-
- // {{{ _addList()
- function _addList($p_list, $p_add_dir, $p_remove_dir)
- {
- $v_result=true;
- $v_header = array();
-
- if (!$this->_file) {
- $this->_error('Invalid file descriptor');
- return false;
- }
-
- if (sizeof($p_list) == 0)
- return true;
-
- for ($j=0; ($j<count($p_list)) && ($v_result); $j++) {
- $v_filename = $p_list[$j];
-
- // ----- Skip the current tar name
- if ($v_filename == $this->_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 ($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
- $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));
- }
- 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;
- }
-
- if (strlen($v_stored_filename) > 99) {
- $this->_warning("Stored file name is too long (max. 99) : '$v_stored_filename'");
- fclose($v_file);
- return true;
- }
-
- 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");
- if ($this->_compress)
- @gzputs($this->_file, $v_binary_data);
- else
- @fputs($this->_file, $v_binary_data);
- }
-
- fclose($v_file);
-
- } else {
- // ----- Only header for dir
- if (!$this->_writeHeader($p_filename, $v_stored_filename))
- return false;
- }
-
- 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);
-
- $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
- if ($this->_compress)
- @gzputs($this->_file, $v_binary_data_first, 148);
- else
- @fputs($this->_file, $v_binary_data_first, 148);
-
- // ----- Write the calculated checksum
- $v_checksum = sprintf("%6s ", DecOct($v_checksum));
- $v_binary_data = pack("a8", $v_checksum);
- if ($this->_compress)
- @gzputs($this->_file, $v_binary_data, 8);
- else
- @fputs($this->_file, $v_binary_data, 8);
-
- // ----- Write the last 356 bytes of the header in the archive
- if ($this->_compress)
- @gzputs($this->_file, $v_binary_data_last, 356);
- else
- @fputs($this->_file, $v_binary_data_last, 356);
-
- 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 : '.$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;
- }
- // }}}
-
- // {{{ _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;
-
- // ----- Look for removing the WINDOW '\'
- if (OS_WINDOWS && strpos($p_path, '\\')) {
- str_replace('\\', '/', $p_path);
- }
-
- if ($p_path == '' || (substr($p_path, 0, 1) != '/' && substr($p_path, 0, 3) != "../" && !strpos($p_path, ':'))) {
- $p_path = "./".$p_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 (!($v_end_of_file = ($this->_compress?@gzeof($this->_file):@feof($this->_file))))
- {
- $v_extract_file = FALSE;
- $v_extraction_stopped = 0;
-
- if ($this->_compress)
- $v_binary_data = @gzread($this->_file, 512);
- else
- $v_binary_data = @fread($this->_file, 512);
-
- if (!$this->_readHeader($v_binary_data, $v_header))
- return false;
-
- if ($v_header['filename'] == '')
- continue;
-
- 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<sizeof($p_file_list); $i++) {
- // ----- Look if it is a directory
- if (substr($p_file_list[$i], -1) == '/') {
- // ----- Look if the directory is in the filename path
- if ((strlen($v_header['filename']) > 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++) {
- if ($this->_compress)
- $v_content = @gzread($this->_file, 512);
- else
- $v_content = @fread($this->_file, 512);
- fwrite($v_dest_file, $v_content, 512);
- }
- if (($v_header['size'] % 512) != 0) {
- if ($this->_compress)
- $v_content = @gzread($this->_file, 512);
- else
- $v_content = @fread($this->_file, 512);
- 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 {
- // ----- Jump to next file
- if ($this->_compress)
- @gzseek($this->_file, @gztell($this->_file)+(ceil(($v_header['size']/512))*512));
- else
- @fseek($this->_file, @ftell($this->_file)+(ceil(($v_header['size']/512))*512));
- }
- } else {
- // ----- Jump to next file
- if ($this->_compress)
- @gzseek($this->_file, @gztell($this->_file)+(ceil(($v_header['size']/512))*512));
- else
- @fseek($this->_file, @ftell($this->_file)+(ceil(($v_header['size']/512))*512));
- }
-
- 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;
- }
- // }}}
-
- // {{{ _append()
- function _append($p_filelist, $p_add_dir='', $p_remove_dir='')
- {
- 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 (($v_temp_tar = @gzopen($this->_tarname.".tmp", "rb")) == 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;
- }
-
- $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");
- @gzputs($this->_file, $v_binary_data);
- $v_buffer = @gzread($v_temp_tar, 512);
-
- } while (!@gzeof($v_temp_tar));
- }
-
- if ($this->_addList($p_filelist, $p_add_dir, $p_remove_dir))
- $this->_writeFooter();
-
- $this->_close();
- @gzclose($v_temp_tar);
-
- if (!@unlink($this->_tarname.".tmp")) {
- $this->_error('Error while deleting temporary file \''.$this->_tarname.'.tmp\'');
- }
-
- return true;
- }
-
- // ----- 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);
-
- if ($this->_addList($p_filelist, $p_add_dir, $p_remove_dir))
- $this->_writeFooter();
-
- $this->_close();
-
- return true;
- }
- // }}}
-
- // {{{ _dirCheck()
- 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()
- 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:'');
- }
- }
- }
- return $v_result;
- }
- // }}}
-
-}
-?> \ No newline at end of file
diff --git a/pear/CMD.php b/pear/CMD.php
deleted file mode 100755
index a1cfa57545..0000000000
--- a/pear/CMD.php
+++ /dev/null
@@ -1,286 +0,0 @@
-<?php
-//
-// +----------------------------------------------------------------------+
-// | PHP Version 4 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2002 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.02 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Authors: Anders Johannsen <anders@johannsen.com> |
-// | |
-// +----------------------------------------------------------------------+
-//
-define('CMD_RCSID', '$Id$');
-
-/**
- * The Cmd:: class implements an abstraction for various ways
- * of executing commands (directly using the backtick operator,
- * as a background task after the script has terminated using
- * register_shutdown_function() or as a detached process using nohup).
- *
- * @author Anders Johannsen <anders@johannsen.com>
- * @version $Revision$
- **/
-
-require_once 'PEAR.php';
-
-
-class Cmd extends PEAR
-{
- var $arrSetting = array();
- var $arrConstant = array();
- var $arrCommand = array();
-
- /**
- * Class constructor
- *
- * Defines all necessary constants and sets defaults
- *
- * @author Anders Johannsen <anders@johannsen.com>
- *
- * @access public
- *
- **/
-
- function Cmd ()
- {
- // Defining constants
- $this->arrConstant = array ("CMD_SEQUENCE",
- "CMD_SHUTDOWN",
- "CMD_SHELL",
- "CMD_OUTPUT",
- "CMD_NOHUP",
- "CMD_VERBOSE"
- );
-
- foreach ($this->arrConstant as $key => $value) {
- if (!defined($value)) {
- define($value, $key);
- }
- }
-
- // Setting default values
- $this->arrSetting[CMD_SEQUENCE] = true;
- $this->arrSetting[CMD_SHUTDOWN] = false;
- $this->arrSetting[CMD_OUTPUT] = false;
- $this->arrSetting[CMD_NOHUP] = false;
- $this->arrSetting[CMD_VERBOSE] = false;
-
- $arrShell = array ("sh", "bash", "zsh", "tcsh", "csh", "ash", "sash", "esh", "ksh");
-
- foreach ($arrShell as $shell) {
- if ($this->arrSetting[CMD_SHELL] = $this->which($shell)) {
- break;
- }
- }
-
- if (empty($this->arrSetting[CMD_SHELL])) {
- $this->raiseError("No shell found");
- }
- }
-
- /**
- * Sets any option
- *
- * The options are currently:
- * CMD_SHUTDOWN : Execute commands via a shutdown function
- * CMD_SHELL : Path to shell
- * CMD_OUTPUT : Output stdout from process
- * CMD_NOHUP : Use nohup to detach process
- * CMD_VERBOSE : Print errors to stdout
- *
- * @param $option is a constant, which corresponds to the
- * option that should be changed
- *
- * @param $setting is the value of the option currently
- * being toggled.
- *
- * @return bool true if succes, else false
- *
- * @access public
- *
- * @author Anders Johannsen <anders@johannsen.com>
- *
- **/
-
- function setOption ($option, $setting)
- {
- if (empty($this->arrConstant[$option])) {
- $this->raiseError("No such option: $option");
- return false;
- }
-
-
- switch ($option) {
- case CMD_OUTPUT:
- case CMD_SHUTDOWN:
- case CMD_VERBOSE:
- case CMD_SEQUENCE:
- $this->arrSetting[$option] = $setting;
- return true;
- break;
-
- case CMD_SHELL:
- if (is_executable($setting)) {
- $this->arrSetting[$option] = $setting;
- return true;
- } else {
- $this->raiseError("No such shell: $setting");
- return false;
- }
- break;
-
-
- case CMD_NOHUP:
- if (empty($setting)) {
- $this->arrSetting[$option] = false;
-
- } else if ($location = $this->which("nohup")) {
- $this->arrSetting[$option] = true;
-
- } else {
- $this->raiseError("Nohup was not found on your system");
- return false;
- }
- break;
-
- }
- }
-
- /**
- * Add command for execution
- *
- * @param $command accepts both arrays and regular strings
- *
- * @return bool true if succes, else false
- *
- * @access public
- *
- * @author Anders Johannsen <anders@johannsen.com>
- *
- **/
-
- function command($command)
- {
- if (is_array($command)) {
- foreach ($command as $key => $value) {
- $this->arrCommand[] = $value;
- }
- return true;
-
- } else if (is_string($command)) {
- $this->arrCommand[] = $command;
- return true;
- }
-
- $this->raiseError("Argument not valid");
- return false;
- }
-
- /**
- * Executes the code according to given options
- *
- * @return bool true if succes, else false
- *
- * @access public
- *
- * @author Anders Johannsen <anders@johannsen.com>
- *
- **/
-
- function exec()
- {
- // Warning about impossible mix of options
- if (!empty($this->arrSetting[CMD_OUTPUT])) {
- if (!empty($this->arrSetting[CMD_SHUTDOWN]) || !empty($this->arrSetting[CMD_NOHUP])) {
- $this->raiseError("Error: Commands executed via shutdown functions or nohup cannot return output");
- return false;
- }
- }
-
- // Building command
- $strCommand = implode(";", $this->arrCommand);
-
- $strExec = "echo '$strCommand' | ".$this->arrSetting[CMD_SHELL];
-
- if (empty($this->arrSetting[CMD_OUTPUT])) {
- $strExec = $strExec . ' > /dev/null';
- }
-
- if (!empty($this->arrSetting[CMD_NOHUP])) {
- $strExec = 'nohup ' . $strExec;
- }
-
- // Executing
- if (!empty($this->arrSetting[CMD_SHUTDOWN])) {
- $line = "system(\"$strExec\");";
- $function = create_function('', $line);
- register_shutdown_function($function);
- return true;
- } else {
- return `$strExec`;
- }
- }
-
- /**
- * Errorhandler. If option CMD_VERBOSE is true,
- * the error is printed to stdout, otherwise it
- * is avaliable in lastError
- *
- * @return bool always returns true
- *
- * @access private
- *
- * @author Anders Johannsen <anders@johannsen.com>
- **/
-
- function raiseError($strError)
- {
- if (!empty($this->arrSetting[CMD_VERBOSE])) {
- echo $strError;
- } else {
- $this->lastError = $strError;
- }
-
- return true;
- }
-
- /**
- * Functionality similiar to unix 'which'. Searches the path
- * for the specified program.
- *
- * @param $cmd name of the executable to search for
- *
- * @return string returns the full path if found,
- * false if not
- *
- * @access private
- *
- * @author Anders Johannsen <anders@johannsen.com>
- **/
-
- function which($cmd)
- {
- global $HTTP_ENV_VARS;
-
- $arrPath = explode(":", $HTTP_ENV_VARS['PATH']);
-
- foreach ($arrPath as $path) {
- $location = $path . "/" . $cmd;
-
- if (is_executable($location)) {
- return $location;
- }
- }
- return false;
- }
-}
-
-?>
diff --git a/pear/CODING_STANDARDS b/pear/CODING_STANDARDS
deleted file mode 100644
index b42a70fbb8..0000000000
--- a/pear/CODING_STANDARDS
+++ /dev/null
@@ -1,8 +0,0 @@
-===========================================================================
-|| PEAR Coding Standards ||
-===========================================================================
-
-$Id$
-
-This document is no longer maintained, see
-http://pear.php.net/manual/ instead.
diff --git a/pear/Console/Getopt.php b/pear/Console/Getopt.php
deleted file mode 100644
index 5b96cdcfdf..0000000000
--- a/pear/Console/Getopt.php
+++ /dev/null
@@ -1,232 +0,0 @@
-<?php
-
-/* vim: set expandtab tabstop=4 shiftwidth=4: */
-// +----------------------------------------------------------------------+
-// | PHP Version 4 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.0 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Authors: Andrei Zmievski <andrei@ispi.net> |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-
-require_once 'PEAR.php';
-
-/**
- * Command-line options parsing class.
- *
- * @author Andrei Zmievski <andrei@ispi.net>
- *
- */
-class Console_Getopt {
- /**
- * Parses the command-line options.
- *
- * The first parameter to this function should be the list of command-line
- * arguments without the leading reference to the running program.
- *
- * The second parameter is a string of allowed short options. Each of the
- * option letters can be followed by a colon ':' to specify that the option
- * requires an argument, or a double colon '::' to specify that the option
- * takes an optional argument.
- *
- * The third argument is an optional array of allowed long options. The
- * leading '--' should not be included in the option name. Options that
- * require an argument should be followed by '=', and options that take an
- * option argument should be followed by '=='.
- *
- * The return value is an array of two elements: the list of parsed
- * options and the list of non-option command-line arguments. Each entry in
- * the list of parsed options is a pair of elements - the first one
- * specifies the option, and the second one specifies the option argument,
- * if there was one.
- *
- * Long and short options can be mixed.
- *
- * Most of the semantics of this function are based on GNU getopt_long().
- *
- * @param array $args an array of command-line arguments
- * @param string $short_options specifies the list of allowed short options
- * @param array $long_options specifies the list of allowed long options
- *
- * @return array two-element array containing the list of parsed options and
- * the non-option arguments
- *
- * @access public
- *
- */
- function getopt($args, $short_options, $long_options = null)
- {
- // in case you pass directly readPHPArgv() as the first arg
- if (PEAR::isError($args)) {
- return $args;
- }
- $opts = array();
- $non_opts = array();
-
- settype($args, 'array');
-
- if ($long_options)
- sort($long_options);
-
- reset($args);
- while (list($i, $arg) = each($args)) {
-
- /* The special element '--' means explicit end of
- options. Treat the rest of the arguments as non-options
- and end the loop. */
- if ($arg == '--') {
- $non_opts = array_merge($non_opts, array_slice($args, $i + 1));
- break;
- }
-
- if ($arg{0} != '-' || (strlen($arg) > 1 && $arg{1} == '-' && !$long_options)) {
- $non_opts[] = $arg;
- //$non_opts = array_merge($non_opts, array_slice($args, $i));
- //break;
- } elseif (strlen($arg) > 1 && $arg{1} == '-') {
- $error = Console_Getopt::_parseLongOption(substr($arg, 2), $long_options, $opts, $args);
- if (PEAR::isError($error))
- return $error;
- } else {
- $error = Console_Getopt::_parseShortOption(substr($arg, 1), $short_options, $opts, $args);
- if (PEAR::isError($error))
- return $error;
- }
- }
-
- return array($opts, $non_opts);
- }
-
- /**
- * @access private
- *
- */
- function _parseShortOption($arg, $short_options, &$opts, &$args)
- {
- for ($i = 0; $i < strlen($arg); $i++) {
- $opt = $arg{$i};
- $opt_arg = null;
-
- /* Try to find the short option in the specifier string. */
- if (($spec = strstr($short_options, $opt)) === false || $arg{$i} == ':')
- {
- return new Getopt_Error("unrecognized option -- $opt\n");
- }
-
- if (strlen($spec) > 1 && $spec{1} == ':') {
- if (strlen($spec) > 2 && $spec{2} == ':') {
- if ($i + 1 < strlen($arg)) {
- /* Option takes an optional argument. Use the remainder of
- the arg string if there is anything left. */
- $opts[] = array($opt, substr($arg, $i + 1));
- break;
- }
- } else {
- /* Option requires an argument. Use the remainder of the arg
- string if there is anything left. */
- if ($i + 1 < strlen($arg)) {
- $opts[] = array($opt, substr($arg, $i + 1));
- break;
- } else if (list(, $opt_arg) = each($args))
- /* Else use the next argument. */;
- else
- return new Getopt_Error("option requires an argument -- $opt\n");
- }
- }
-
- $opts[] = array($opt, $opt_arg);
- }
- }
-
- /**
- * @access private
- *
- */
- function _parseLongOption($arg, $long_options, &$opts, &$args)
- {
- @list($opt, $opt_arg) = explode('=', $arg);
- $opt_len = strlen($opt);
-
- for ($i = 0; $i < count($long_options); $i++) {
- $long_opt = $long_options[$i];
- $opt_start = substr($long_opt, 0, $opt_len);
-
- /* Option doesn't match. Go on to the next one. */
- if ($opt_start != $opt)
- continue;
-
- $opt_rest = substr($long_opt, $opt_len);
-
- /* Check that the options uniquely matches one of the allowed
- options. */
- if ($opt_rest != '' && $opt{0} != '=' &&
- $i + 1 < count($long_options) &&
- $opt == substr($long_options[$i+1], 0, $opt_len)) {
- return new Getopt_Error("option --$opt is ambiguous\n");
- }
-
- if (substr($long_opt, -1) == '=') {
- if (substr($long_opt, -2) != '==') {
- /* Long option requires an argument.
- Take the next argument if one wasn't specified. */;
- if (!$opt_arg && !(list(, $opt_arg) = each($args))) {
- return new Getopt_Error("option --$opt requires an argument\n");
- }
- }
- } else if ($opt_arg) {
- return new Getopt_Error("option --$opt doesn't allow an argument\n");
- }
-
- $opts[] = array('--' . $opt, $opt_arg);
- return;
- }
-
- return new Getopt_Error("unrecognized option --$opt\n");
- }
-
- /**
- * Safely read the $argv PHP array across different PHP configurations.
- * Will take care on register_globals and register_argc_argv ini directives
- *
- * @access public
- * @return mixed the $argv PHP array or PEAR error if not registered
- */
- function readPHPArgv()
- {
- global $argv;
- if (!is_array($argv)) {
- if (!is_array($_SERVER['argv'])) {
- if (!is_array($HTTP_SERVER_VARS['argv'])) {
- return new Getopt_Error("Could not read cmd args (register_argc_argv=Off?)\n");
- }
- return $HTTP_SERVER_VARS['argv'];
- }
- return $_SERVER['argv'];
- }
- return $argv;
- }
-
-}
-
-
-class Getopt_Error extends PEAR_Error {
- var $classname = 'Getopt';
- var $error_message_prepend = 'Error in Getopt';
-
- function Getopt_Error($message, $code = 0, $mode = PEAR_ERROR_RETURN, $level = E_USER_NOTICE)
- {
- $this->PEAR_Error($message, $code, $mode, $level);
- }
-}
-
-?>
diff --git a/pear/DB.php b/pear/DB.php
deleted file mode 100644
index cd89cf75d0..0000000000
--- a/pear/DB.php
+++ /dev/null
@@ -1,872 +0,0 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4: */
-// +----------------------------------------------------------------------+
-// | PHP Version 4 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2002 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.02 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Authors: Stig Bakken <ssb@fast.no> |
-// | Tomas V.V.Cox <cox@idecnet.com> |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-//
-// Database independent query interface.
-//
-
-require_once "PEAR.php";
-
-/*
- * The method mapErrorCode in each DB_dbtype implementation maps
- * native error codes to one of these.
- *
- * If you add an error code here, make sure you also add a textual
- * version of it in DB::errorMessage().
- */
-
-define("DB_OK", 1);
-define("DB_ERROR", -1);
-define("DB_ERROR_SYNTAX", -2);
-define("DB_ERROR_CONSTRAINT", -3);
-define("DB_ERROR_NOT_FOUND", -4);
-define("DB_ERROR_ALREADY_EXISTS", -5);
-define("DB_ERROR_UNSUPPORTED", -6);
-define("DB_ERROR_MISMATCH", -7);
-define("DB_ERROR_INVALID", -8);
-define("DB_ERROR_NOT_CAPABLE", -9);
-define("DB_ERROR_TRUNCATED", -10);
-define("DB_ERROR_INVALID_NUMBER", -11);
-define("DB_ERROR_INVALID_DATE", -12);
-define("DB_ERROR_DIVZERO", -13);
-define("DB_ERROR_NODBSELECTED", -14);
-define("DB_ERROR_CANNOT_CREATE", -15);
-define("DB_ERROR_CANNOT_DELETE", -16);
-define("DB_ERROR_CANNOT_DROP", -17);
-define("DB_ERROR_NOSUCHTABLE", -18);
-define("DB_ERROR_NOSUCHFIELD", -19);
-define("DB_ERROR_NEED_MORE_DATA", -20);
-define("DB_ERROR_NOT_LOCKED", -21);
-define("DB_ERROR_VALUE_COUNT_ON_ROW", -22);
-define("DB_ERROR_INVALID_DSN", -23);
-define("DB_ERROR_CONNECT_FAILED", -24);
-define("DB_ERROR_EXTENSION_NOT_FOUND",-25);
-
-/*
- * Warnings are not detected as errors by DB::isError(), and are not
- * fatal. You can detect whether an error is in fact a warning with
- * DB::isWarning().
- */
-
-define('DB_WARNING', -1000);
-define('DB_WARNING_READ_ONLY', -1001);
-
-/*
- * These constants are used when storing information about prepared
- * statements (using the "prepare" method in DB_dbtype).
- *
- * The prepare/execute model in DB is mostly borrowed from the ODBC
- * extension, in a query the "?" character means a scalar parameter.
- * There are two extensions though, a "&" character means an opaque
- * parameter. An opaque parameter is simply a file name, the real
- * data are in that file (useful for putting uploaded files into your
- * database and such). The "!" char means a parameter that must be
- * left as it is.
- * They modify the quote behavoir:
- * DB_PARAM_SCALAR (?) => 'original string quoted'
- * DB_PARAM_OPAQUE (&) => 'string from file quoted'
- * DB_PARAM_MISC (!) => original string
- */
-
-define('DB_PARAM_SCALAR', 1);
-define('DB_PARAM_OPAQUE', 2);
-define('DB_PARAM_MISC', 3);
-
-/*
- * These constants define different ways of returning binary data
- * from queries. Again, this model has been borrowed from the ODBC
- * extension.
- *
- * DB_BINMODE_PASSTHRU sends the data directly through to the browser
- * when data is fetched from the database.
- * DB_BINMODE_RETURN lets you return data as usual.
- * DB_BINMODE_CONVERT returns data as well, only it is converted to
- * hex format, for example the string "123" would become "313233".
- */
-
-define('DB_BINMODE_PASSTHRU', 1);
-define('DB_BINMODE_RETURN', 2);
-define('DB_BINMODE_CONVERT', 3);
-
-/**
- * This is a special constant that tells DB the user hasn't specified
- * any particular get mode, so the default should be used.
- */
-
-define('DB_FETCHMODE_DEFAULT', 0);
-
-/**
- * Column data indexed by numbers, ordered from 0 and up
- */
-
-define('DB_FETCHMODE_ORDERED', 1);
-
-/**
- * Column data indexed by column names
- */
-
-define('DB_FETCHMODE_ASSOC', 2);
-
-/**
-* Column data as object properties
-*/
-
-define('DB_FETCHMODE_OBJECT', 3);
-
-/**
- * For multi-dimensional results: normally the first level of arrays
- * is the row number, and the second level indexed by column number or name.
- * DB_FETCHMODE_FLIPPED switches this order, so the first level of arrays
- * is the column name, and the second level the row number.
- */
-
-define('DB_FETCHMODE_FLIPPED', 4);
-
-/* for compatibility */
-
-define('DB_GETMODE_ORDERED', DB_FETCHMODE_ORDERED);
-define('DB_GETMODE_ASSOC', DB_FETCHMODE_ASSOC);
-define('DB_GETMODE_FLIPPED', DB_FETCHMODE_FLIPPED);
-
-/**
- * these are constants for the tableInfo-function
- * they are bitwised or'ed. so if there are more constants to be defined
- * in the future, adjust DB_TABLEINFO_FULL accordingly
- */
-
-define('DB_TABLEINFO_ORDER', 1);
-define('DB_TABLEINFO_ORDERTABLE', 2);
-define('DB_TABLEINFO_FULL', 3);
-
-
-/**
- * The main "DB" class is simply a container class with some static
- * methods for creating DB objects as well as some utility functions
- * common to all parts of DB.
- *
- * The object model of DB is as follows (indentation means inheritance):
- *
- * DB The main DB class. This is simply a utility class
- * with some "static" methods for creating DB objects as
- * well as common utility functions for other DB classes.
- *
- * DB_common The base for each DB implementation. Provides default
- * | implementations (in OO lingo virtual methods) for
- * | the actual DB implementations as well as a bunch of
- * | query utility functions.
- * |
- * +-DB_mysql The DB implementation for MySQL. Inherits DB_common.
- * When calling DB::factory or DB::connect for MySQL
- * connections, the object returned is an instance of this
- * class.
- *
- * @package DB
- * @version 2
- * @author Stig Bakken <ssb@fast.no>
- * @since PHP 4.0
- */
-
-class DB
-{
- /**
- * Create a new DB connection object for the specified database
- * type
- *
- * @param string $type database type, for example "mysql"
- *
- * @return mixed a newly created DB object, or a DB error code on
- * error
- *
- * access public
- */
-
- function &factory($type)
- {
- @include_once("DB/${type}.php");
-
- $classname = "DB_${type}";
-
- if (!class_exists($classname)) {
- return PEAR::raiseError(null, DB_ERROR_NOT_FOUND,
- null, null, null, 'DB_Error', true);
- }
-
- @$obj =& new $classname;
-
- return $obj;
- }
-
- /**
- * Create a new DB connection object and connect to the specified
- * database
- *
- * @param mixed $dsn "data source name", see the DB::parseDSN
- * method for a description of the dsn format. Can also be
- * specified as an array of the format returned by DB::parseDSN.
- *
- * @param mixed $options An associative array of option names and
- * their values. For backwards compatibility, this parameter may
- * also be a boolean that tells whether the connection should be
- * persistent. See DB_common::setOption for more information on
- * connection options.
- *
- * @return mixed a newly created DB connection object, or a DB
- * error object on error
- *
- * @see DB::parseDSN
- * @see DB::isError
- * @see DB_common::setOption
- */
- function &connect($dsn, $options = false)
- {
- if (is_array($dsn)) {
- $dsninfo = $dsn;
- } else {
- $dsninfo = DB::parseDSN($dsn);
- }
- $type = $dsninfo["phptype"];
-
- if (is_array($options) && isset($options["debug"]) &&
- $options["debug"] >= 2) {
- // expose php errors with sufficient debug level
- include_once "DB/${type}.php";
- } else {
- @include_once "DB/${type}.php";
- }
-
- $classname = "DB_${type}";
- if (!class_exists($classname)) {
- return PEAR::raiseError(null, DB_ERROR_NOT_FOUND,
- null, null, null, 'DB_Error', true);
- }
-
- @$obj =& new $classname;
-
- if (is_array($options)) {
- foreach ($options as $option => $value) {
- $test = $obj->setOption($option, $value);
- if (DB::isError($test)) {
- return $test;
- }
- }
- } else {
- $obj->setOption('persistent', $options);
- }
- $err = $obj->connect($dsninfo, $obj->getOption('persistent'));
-
- if (DB::isError($err)) {
- $err->addUserInfo($dsn);
- return $err;
- }
-
- return $obj;
- }
-
- /**
- * Return the DB API version
- *
- * @return int the DB API version number
- *
- * @access public
- */
- function apiVersion()
- {
- return 2;
- }
-
- /**
- * Tell whether a result code from a DB method is an error
- *
- * @param $value int result code
- *
- * @return bool whether $value is an error
- *
- * @access public
- */
- function isError($value)
- {
- return (is_object($value) &&
- (get_class($value) == 'db_error' ||
- is_subclass_of($value, 'db_error')));
- }
-
- /**
- * Tell whether a query is a data manipulation query (insert,
- * update or delete) or a data definition query (create, drop,
- * alter, grant, revoke).
- *
- * @access public
- *
- * @param string $query the query
- *
- * @return boolean whether $query is a data manipulation query
- */
- function isManip($query)
- {
- $manips = 'INSERT|UPDATE|DELETE|'.'REPLACE|CREATE|DROP|'.
- 'ALTER|GRANT|REVOKE|'.'LOCK|UNLOCK';
- if (preg_match('/^\s*"?('.$manips.')\s+/i', $query)) {
- return true;
- }
- return false;
- }
-
- /**
- * Tell whether a result code from a DB method is a warning.
- * Warnings differ from errors in that they are generated by DB,
- * and are not fatal.
- *
- * @param mixed $value result value
- *
- * @return boolean whether $value is a warning
- *
- * @access public
- */
- function isWarning($value)
- {
- return (is_object($value) &&
- (get_class($value) == "db_warning" ||
- is_subclass_of($value, "db_warning")));
- }
-
- /**
- * Return a textual error message for a DB error code
- *
- * @param integer $value error code
- *
- * @return string error message, or false if the error code was
- * not recognized
- */
- function errorMessage($value)
- {
- static $errorMessages;
- if (!isset($errorMessages)) {
- $errorMessages = array(
- DB_ERROR => 'unknown error',
- DB_ERROR_ALREADY_EXISTS => 'already exists',
- DB_ERROR_CANNOT_CREATE => 'can not create',
- DB_ERROR_CANNOT_DELETE => 'can not delete',
- DB_ERROR_CANNOT_DROP => 'can not drop',
- DB_ERROR_CONSTRAINT => 'constraint violation',
- DB_ERROR_DIVZERO => 'division by zero',
- DB_ERROR_INVALID => 'invalid',
- DB_ERROR_INVALID_DATE => 'invalid date or time',
- DB_ERROR_INVALID_NUMBER => 'invalid number',
- DB_ERROR_MISMATCH => 'mismatch',
- DB_ERROR_NODBSELECTED => 'no database selected',
- DB_ERROR_NOSUCHFIELD => 'no such field',
- DB_ERROR_NOSUCHTABLE => 'no such table',
- DB_ERROR_NOT_CAPABLE => 'DB backend not capable',
- DB_ERROR_NOT_FOUND => 'not found',
- DB_ERROR_NOT_LOCKED => 'not locked',
- DB_ERROR_SYNTAX => 'syntax error',
- DB_ERROR_UNSUPPORTED => 'not supported',
- DB_ERROR_VALUE_COUNT_ON_ROW => 'value count on row',
- DB_ERROR_INVALID_DSN => 'invalid DSN',
- DB_ERROR_CONNECT_FAILED => 'connect failed',
- DB_OK => 'no error',
- DB_WARNING => 'unknown warning',
- DB_WARNING_READ_ONLY => 'read only',
- DB_ERROR_NEED_MORE_DATA => 'insufficient data supplied',
- DB_ERROR_EXTENSION_NOT_FOUND=> 'extension not found'
- );
- }
-
- if (DB::isError($value)) {
- $value = $value->getCode();
- }
-
- return isset($errorMessages[$value]) ? $errorMessages[$value] : $errorMessages[DB_ERROR];
- }
-
- /**
- * Parse a data source name
- *
- * A array with the following keys will be returned:
- * phptype: Database backend used in PHP (mysql, odbc etc.)
- * dbsyntax: Database used with regards to SQL syntax etc.
- * protocol: Communication protocol to use (tcp, unix etc.)
- * hostspec: Host specification (hostname[:port])
- * database: Database to use on the DBMS server
- * username: User name for login
- * password: Password for login
- *
- * The format of the supplied DSN is in its fullest form:
- *
- * phptype(dbsyntax)://username:password@protocol+hostspec/database
- *
- * Most variations are allowed:
- *
- * phptype://username:password@protocol+hostspec:110//usr/db_file.db
- * phptype://username:password@hostspec/database_name
- * phptype://username:password@hostspec
- * phptype://username@hostspec
- * phptype://hostspec/database
- * phptype://hostspec
- * phptype(dbsyntax)
- * phptype
- *
- * @param string $dsn Data Source Name to be parsed
- *
- * @return array an associative array
- *
- * @author Tomas V.V.Cox <cox@idecnet.com>
- */
- function parseDSN($dsn)
- {
- if (is_array($dsn)) {
- return $dsn;
- }
-
- $parsed = array(
- 'phptype' => false,
- 'dbsyntax' => false,
- 'username' => false,
- 'password' => false,
- 'protocol' => false,
- 'hostspec' => false,
- 'port' => false,
- 'socket' => false,
- 'database' => false
- );
-
- // Find phptype and dbsyntax
- if (($pos = strpos($dsn, '://')) !== false) {
- $str = substr($dsn, 0, $pos);
- $dsn = substr($dsn, $pos + 3);
- } else {
- $str = $dsn;
- $dsn = NULL;
- }
-
- // Get phptype and dbsyntax
- // $str => phptype(dbsyntax)
- if (preg_match('|^(.+?)\((.*?)\)$|', $str, $arr)) {
- $parsed['phptype'] = $arr[1];
- $parsed['dbsyntax'] = (empty($arr[2])) ? $arr[1] : $arr[2];
- } else {
- $parsed['phptype'] = $str;
- $parsed['dbsyntax'] = $str;
- }
-
- if (empty($dsn)) {
- return $parsed;
- }
-
- // Get (if found): username and password
- // $dsn => username:password@protocol+hostspec/database
- if (($at = strrpos($dsn,'@')) !== false) {
- $str = substr($dsn, 0, $at);
- $dsn = substr($dsn, $at + 1);
- if (($pos = strpos($str, ':')) !== false) {
- $parsed['username'] = urldecode(substr($str, 0, $pos));
- $parsed['password'] = urldecode(substr($str, $pos + 1));
- } else {
- $parsed['username'] = urldecode($str);
- }
- }
-
- // Find protocol and hostspec
-
- // $dsn => proto(proto_opts)/database
- if (preg_match('|^(.+?)\((.*?)\)/?(.*?)$|', $dsn, $match)) {
- $proto = $match[1];
- $proto_opts = (!empty($match[2])) ? $match[2] : false;
- $dsn = $match[3];
-
- // $dsn => protocol+hostspec/database (old format)
- } else {
- if (strpos($dsn, '+') !== false) {
- list($proto, $dsn) = explode('+', $dsn, 2);
- }
- if (strpos($dsn, '/') !== false) {
- list($proto_opts, $dsn) = explode('/', $dsn, 2);
- } else {
- $proto_opts = $dsn;
- $dsn = null;
- }
- }
-
- // process the different protocol options
- $parsed['protocol'] = (!empty($proto)) ? $proto : 'tcp';
- $proto_opts = urldecode($proto_opts);
- if ($parsed['protocol'] == 'tcp') {
- if (strpos($proto_opts, ':') !== false) {
- list($parsed['hostspec'], $parsed['port']) = explode(':', $proto_opts);
- } else {
- $parsed['hostspec'] = $proto_opts;
- }
- } elseif ($parsed['protocol'] == 'unix') {
- $parsed['socket'] = $proto_opts;
- }
-
- // Get dabase if any
- // $dsn => database
- if (!empty($dsn)) {
- // /database
- if (($pos = strpos($dsn, '?')) === false) {
- $parsed['database'] = $dsn;
- // /database?param1=value1&param2=value2
- } else {
- $parsed['database'] = substr($dsn, 0, $pos);
- $dsn = substr($dsn, $pos + 1);
- if (strpos($dsn, '&') !== false) {
- $opts = explode('&', $dsn);
- } else { // database?param1=value1
- $opts = array($dsn);
- }
- foreach ($opts as $opt) {
- list($key, $value) = explode('=', $opt);
- if (!isset($parsed[$key])) { // don't allow params overwrite
- $parsed[$key] = urldecode($value);
- }
- }
- }
- }
-
- return $parsed;
- }
-
- /**
- * Load a PHP database extension if it is not loaded already.
- *
- * @access public
- *
- * @param string $name the base name of the extension (without the .so or
- * .dll suffix)
- *
- * @return boolean true if the extension was already or successfully
- * loaded, false if it could not be loaded
- */
- function assertExtension($name)
- {
- if (!extension_loaded($name)) {
- $dlext = OS_WINDOWS ? '.dll' : '.so';
- @dl($name . $dlext);
- }
- return extension_loaded($name);
- }
-}
-
-/**
- * DB_Error implements a class for reporting portable database error
- * messages.
- *
- * @package DB
- * @author Stig Bakken <ssb@fast.no>
- */
-class DB_Error extends PEAR_Error
-{
- /**
- * DB_Error constructor.
- *
- * @param mixed $code DB error code, or string with error message.
- * @param integer $mode what "error mode" to operate in
- * @param integer $level what error level to use for $mode & PEAR_ERROR_TRIGGER
- * @param smixed $debuginfo additional debug info, such as the last query
- *
- * @access public
- *
- * @see PEAR_Error
- */
-
- function DB_Error($code = DB_ERROR, $mode = PEAR_ERROR_RETURN,
- $level = E_USER_NOTICE, $debuginfo = null)
- {
- if (is_int($code)) {
- $this->PEAR_Error('DB Error: ' . DB::errorMessage($code), $code, $mode, $level, $debuginfo);
- } else {
- $this->PEAR_Error("DB Error: $code", DB_ERROR, $mode, $level, $debuginfo);
- }
- }
-}
-
-/**
- * DB_Warning implements a class for reporting portable database
- * warning messages.
- *
- * @package DB
- * @author Stig Bakken <ssb@fast.no>
- */
-class DB_Warning extends PEAR_Error
-{
- /**
- * DB_Warning constructor.
- *
- * @param mixed $code DB error code, or string with error message.
- * @param integer $mode what "error mode" to operate in
- * @param integer $level what error level to use for $mode == PEAR_ERROR_TRIGGER
- * @param mmixed $debuginfo additional debug info, such as the last query
- *
- * @access public
- *
- * @see PEAR_Error
- */
-
- function DB_Warning($code = DB_WARNING, $mode = PEAR_ERROR_RETURN,
- $level = E_USER_NOTICE, $debuginfo = null)
- {
- if (is_int($code)) {
- $this->PEAR_Error('DB Warning: ' . DB::errorMessage($code), $code, $mode, $level, $debuginfo);
- } else {
- $this->PEAR_Error("DB Warning: $code", 0, $mode, $level, $debuginfo);
- }
- }
-}
-
-/**
- * This class implements a wrapper for a DB result set.
- * A new instance of this class will be returned by the DB implementation
- * after processing a query that returns data.
- *
- * @package DB
- * @author Stig Bakken <ssb@fast.no>
- */
-
-class DB_result
-{
- var $dbh;
- var $result;
- var $row_counter = null;
- /**
- * for limit queries, the row to start fetching
- * @var integer
- */
- var $limit_from = null;
-
- /**
- * for limit queries, the number of rows to fetch
- * @var integer
- */
- var $limit_count = null;
-
- /**
- * DB_result constructor.
- * @param resource $dbh DB object reference
- * @param resource $result result resource id
- */
-
- function DB_result(&$dbh, $result)
- {
- $this->dbh = &$dbh;
- $this->result = $result;
- }
-
- /**
- * Fetch and return a row of data (it uses driver->fetchInto for that)
- * @param int $fetchmode format of fetched row
- * @param int $rownum the row number to fetch
- *
- * @return array a row of data, NULL on no more rows or PEAR_Error on error
- *
- * @access public
- */
- function fetchRow($fetchmode = DB_FETCHMODE_DEFAULT, $rownum=null)
- {
- if ($fetchmode === DB_FETCHMODE_DEFAULT) {
- $fetchmode = $this->dbh->fetchmode;
- }
- if ($fetchmode === DB_FETCHMODE_OBJECT) {
- $fetchmode = DB_FETCHMODE_ASSOC;
- $object_class = $this->dbh->fetchmode_object_class;
- }
- if ($this->limit_from !== null) {
- if ($this->row_counter === null) {
- $this->row_counter = $this->limit_from;
- // For Interbase
- if ($this->dbh->features['limit'] == false) {
- $i = 0;
- while ($i++ < $this->limit_from) {
- $this->dbh->fetchInto($this->result, $arr, $fetchmode);
- }
- }
- }
- if ($this->row_counter >= (
- $this->limit_from + $this->limit_count))
- {
- return null;
- }
- if ($this->dbh->features['limit'] == 'emulate') {
- $rownum = $this->row_counter;
- }
-
- $this->row_counter++;
- }
- $res = $this->dbh->fetchInto($this->result, $arr, $fetchmode, $rownum);
- if ($res !== DB_OK) {
- return $res;
- }
- if (isset($object_class)) {
- // default mode specified in DB_common::fetchmode_object_class property
- if ($object_class == 'stdClass') {
- $ret = (object) $arr;
- } else {
- $ret =& new $object_class($arr);
- }
- return $ret;
- }
- return $arr;
- }
-
- /**
- * Fetch a row of data into an existing variable.
- *
- * @param mixed $arr reference to data containing the row
- * @param integer $fetchmode format of fetched row
- * @param integer $rownum the row number to fetch
- *
- * @return mixed DB_OK on success, NULL on no more rows or
- * a DB_Error object on error
- *
- * @access public
- */
- function fetchInto(&$arr, $fetchmode = DB_FETCHMODE_DEFAULT, $rownum=null)
- {
- if ($fetchmode === DB_FETCHMODE_DEFAULT) {
- $fetchmode = $this->dbh->fetchmode;
- }
- if ($fetchmode === DB_FETCHMODE_OBJECT) {
- $fetchmode = DB_FETCHMODE_ASSOC;
- $object_class = $this->dbh->fetchmode_object_class;
- }
- if ($this->limit_from !== null) {
- if ($this->row_counter === null) {
- $this->row_counter = $this->limit_from;
- // For Interbase
- if ($this->dbh->features['limit'] == false) {
- $i = 0;
- while ($i++ < $this->limit_from) {
- $this->dbh->fetchInto($this->result, $arr, $fetchmode);
- }
- }
- }
- if ($this->row_counter >= (
- $this->limit_from + $this->limit_count))
- {
- return null;
- }
- if ($this->dbh->features['limit'] == 'emulate') {
- $rownum = $this->row_counter;
- }
-
- $this->row_counter++;
- }
- $res = $this->dbh->fetchInto($this->result, $arr, $fetchmode, $rownum);
- if (($res === DB_OK) && isset($object_class)) {
- // default mode specified in DB_common::fetchmode_object_class property
- if ($object_class == 'stdClass') {
- $arr = (object) $arr;
- } else {
- $arr = new $object_class($arr);
- }
- }
- return $res;
- }
-
- /**
- * Get the the number of columns in a result set.
- *
- * @return int the number of columns, or a DB error
- *
- * @access public
- */
- function numCols()
- {
- return $this->dbh->numCols($this->result);
- }
-
- /**
- * Get the number of rows in a result set.
- *
- * @return int the number of rows, or a DB error
- *
- * @access public
- */
- function numRows()
- {
- return $this->dbh->numRows($this->result);
- }
-
- /**
- * Get the next result if a batch of queries was executed.
- *
- * @return bool true if a new result is available or false if not.
- *
- * @access public
- */
- function nextResult()
- {
- return $this->dbh->nextResult($this->result);
- }
-
- /**
- * Frees the resources allocated for this result set.
- * @return int error code
- *
- * @access public
- */
- function free()
- {
- $err = $this->dbh->freeResult($this->result);
- if(DB::isError($err)) {
- return $err;
- }
- $this->result = false;
- return true;
- }
-
- /**
- * @deprecated
- */
- function tableInfo($mode = null)
- {
- return $this->dbh->tableInfo($this->result, $mode);
- }
-
- /**
- * returns the actual rows number
- * @return integer
- */
- function getRowCounter()
- {
- return $this->row_counter;
- }
-}
-
-/**
-* Pear DB Row Object
-* @see DB_common::setFetchMode()
-*/
-class DB_row
-{
- /**
- * constructor
- *
- * @param resource row data as array
- */
- function DB_row(&$arr)
- {
- for (reset($arr); $key = key($arr); next($arr)) {
- $this->$key = &$arr[$key];
- }
- }
-}
-
-?>
diff --git a/pear/HTTP.php b/pear/HTTP.php
deleted file mode 100644
index b03a1e446b..0000000000
--- a/pear/HTTP.php
+++ /dev/null
@@ -1,172 +0,0 @@
-<?php
-//
-// +----------------------------------------------------------------------+
-// | PHP Version 4 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2002 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.02 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Authors: Stig Bakken <ssb@fast.no> |
-// | |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-//
-// HTTP utility functions.
-//
-
-if (!empty($GLOBALS['USED_PACKAGES']['HTTP'])) return;
-$GLOBALS['USED_PACKAGES']['HTTP'] = true;
-
-class HTTP {
- /**
- * Format a RFC compliant HTTP header. This function
- * honors the "y2k_compliance" php.ini directive.
- *
- * @param $time int UNIX timestamp
- *
- * @return HTTP date string, or false for an invalid timestamp.
- *
- * @author Stig Bakken <ssb@fast.no>
- * @author Sterling Hughes <sterling@php.net>
- */
- function Date($time) {
- /* If we're y2k compliant, use the newer, reccomended RFC 822
- format */
- if (ini_get("y2k_compliance") == true) {
- return gmdate("D, d M Y H:i:s \G\M\T", $time);
- }
- /* Use RFC-850 which supports two character year numbers */
- else {
- return gmdate("F, d-D-y H:i:s \G\M\T", $time);
- }
- }
-
- /**
- * Negotiate language with the user's browser through the
- * Accept-Language HTTP header or the user's host address.
- * Language codes are generally in the form "ll" for a language
- * spoken in only one country, or "ll_CC" for a language spoken in
- * a particular country. For example, U.S. English is "en_US",
- * while British English is "en_UK". Portugese as spoken in
- * Portugal is "pt_PT", while Brazilian Portugese is "pt_BR".
- * Two-letter country codes can be found in the ISO 3166 standard.
- *
- * Quantities in the Accept-Language: header are supported, for
- * example:
- *
- * Accept-Language: en_UK;q=0.7, en_US;q=0.6, no;q=1.0, dk;q=0.8
- *
- * @param $supported an associative array indexed by language
- * codes (country codes) supported by the application. Values
- * must evaluate to true.
- *
- * @param $default the default language to use if none is found
- * during negotiation, defaults to "en_US" for U.S. English
- *
- * @author Stig Bakken <ssb@fast.no>
- */
- function negotiateLanguage(&$supported, $default = 'en_US') {
- global $HTTP_SERVER_VARS;
-
- /* If the client has sent an Accept-Language: header, see if
- * it contains a language we support.
- */
- if (isset($HTTP_SERVER_VARS['HTTP_ACCEPT_LANGUAGE'])) {
- $accepted = split(',[[:space:]]*', $HTTP_SERVER_VARS['HTTP_ACCEPT_LANGUAGE']);
- for ($i = 0; $i < count($accepted); $i++) {
- if (eregi('^([a-z]+);[[:space:]]*q=([0-9\.]+)', $accepted[$i], $arr)) {
- $q = (double)$arr[2];
- $l = $arr[1];
- } else {
- $q = 42;
- $l = $accepted[$i];
- }
-
- if (!empty($supported[$l]) && ($q > 0.0)) {
- if ($q == 42) {
- return $l;
- }
- $candidates[$l] = $q;
- }
- }
- if (isset($candidates)) {
- arsort($candidates);
- reset($candidates);
- return key($candidates);
- }
- }
-
- /* Check for a valid language code in the top-level domain of
- * the client's host address.
- */
- if (ereg("\.[^\.]+$", $HTTP_SERVER_VARS['REMOTE_HOST'], $arr)) {
- $lang = strtolower($arr[1]);
- if (!empty($supported[$lang])) {
- return $lang;
- }
- }
-
- return $default;
- }
-
- /**
- * Sends a "HEAD" HTTP command to a server and returns the headers
- * as an associative array. Example output could be:
- * Array
- * (
- * [response_code] => 200 // The HTTP response code
- * [response] => HTTP/1.1 200 OK // The full HTTP response string
- * [Date] => Fri, 11 Jan 2002 01:41:44 GMT
- * [Server] => Apache/1.3.20 (Unix) PHP/4.1.1
- * [X-Powered-By] => PHP/4.1.1
- * [Connection] => close
- * [Content-Type] => text/html
- * )
- *
- * @param string $url A valid url, for ex: http://pear.php.net/credits.php
- * @return mixed Assoc array or PEAR error on no conection
- *
- * @author Tomas V.V.Cox <cox@idecnet.com>
- */
- function head($url)
- {
- $purl = parse_url($url);
- $port = (isset($purl['port'])) ? $purl['port'] : 80;
- $fp = fsockopen($purl['host'], $port, $errno, $errstr, 10);
- if (!$fp) {
- return PEAR::raiseError("HTTP::head Error $errstr ($erno)");
- }
- $path = (!empty($purl['path'])) ? $purl['path'] : '/';
-
- fputs($fp, "HEAD $path HTTP/1.0\r\n");
- fputs($fp, "Host: " . $purl['host'] . "\r\n\r\n");
-
- $response = rtrim(fgets($fp, 4096));
- if(preg_match("|^HTTP/[^\s]*\s(.*?)\s|", $response, $status)) {
- $headers['response_code'] = $status[1];
- }
- $headers['response'] = $response;
-
- while ($line = fgets($fp, 4096)) {
- if (!trim($line)) {
- break;
- }
- if (($pos = strpos($line, ':')) !== false) {
- $header = substr($line, 0, $pos);
- $value = trim(substr($line, $pos + 1));
- $headers[$header] = $value;
- }
- }
- fclose($fp);
- return $headers;
- }
-}
-?> \ No newline at end of file
diff --git a/pear/ITX.xml b/pear/ITX.xml
deleted file mode 100644
index e484e69852..0000000000
--- a/pear/ITX.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE Package SYSTEM "F:\cvs\php4\pear\package.dtd">
-<Package Type="Source">
- <Name>IT[X] Template</Name>
- <Summary>Easy to use preg_* based template system.</Summary>
- <Maintainer>
- <Initials>uw</Initials>
- <Name>Ulf Wendel</Name>
- <Email>ulf.wendel@phpdoc.de</Email>
- </Maintainer>
- <Release>
- <Version>1.1</Version>
- <Date>2001/03/27</Date>
- <Notes>some IT[X] methods seem to be broken</Notes>
- </Release>
- <FileList>
- <File>HTML/IT.php</File>
- <File>HTML/ITX.php</File>
- <File>HTML/IT_Error.php</File>
- </FileList>
-</Package>
diff --git a/pear/Mail.php b/pear/Mail.php
deleted file mode 100644
index 0141faaecb..0000000000
--- a/pear/Mail.php
+++ /dev/null
@@ -1,186 +0,0 @@
-<?php
-//
-// +----------------------------------------------------------------------+
-// | PHP Version 4 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2002 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.02 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Authors: Chuck Hagenbuch <chuck@horde.org> |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-
-require_once 'PEAR.php';
-
-/**
- * PEAR's Mail:: interface. Defines the interface for implementing
- * mailers under the PEAR hierarchy, and provides supporting functions
- * useful in multiple mailer backends.
- *
- * @access public
- * @version $Revision$
- * @package Mail
- */
-class Mail extends PEAR
-{
- /**
- * Provides an interface for generating Mail:: objects of various
- * types
- *
- * @param string $driver The kind of Mail:: object to instantiate.
- * @param array $params The parameters to pass to the Mail:: object.
- * @return object Mail a instance of the driver class or if fails a PEAR Error
- * @access public
- */
- function factory($driver, $params = array())
- {
- $driver = strtolower($driver);
- @include_once 'Mail/' . $driver . '.php';
- $class = 'Mail_' . $driver;
- if (class_exists($class)) {
- return new $class($params);
- } else {
- return PEAR::raiseError('Unable to find class for driver ' . $driver);
- }
- }
-
- /**
- * Implements Mail::send() function using php's built-in mail()
- * command.
- *
- * @param mixed $recipients Either a comma-seperated list of recipients
- * (RFC822 compliant), or an array of recipients,
- * each RFC822 valid. This may contain recipients not
- * specified in the headers, for Bcc:, resending
- * messages, etc.
- *
- * @param array $headers The array of headers to send with the mail, in an
- * associative array, where the array key is the
- * header name (ie, 'Subject'), and the array value
- * is the header value (ie, 'test'). The header
- * produced from those values would be 'Subject:
- * test'.
- *
- * @param string $body The full text of the message body, including any
- * Mime parts, etc.
- *
- * @return mixed Returns true on success, or a PEAR_Error
- * containing a descriptive error message on
- * failure.
- * @access public
- * @deprecated use Mail_mail::send instead
- */
- function send($recipients, $headers, $body)
- {
- // if we're passed an array of recipients, implode it.
- if (is_array($recipients)) {
- $recipients = implode(', ', $recipients);
- }
-
- // get the Subject out of the headers array so that we can
- // pass it as a seperate argument to mail().
- $subject = '';
- if (isset($headers['Subject'])) {
- $subject = $headers['Subject'];
- unset($headers['Subject']);
- }
-
- // flatten the headers out.
- list(,$text_headers) = Mail::prepareHeaders($headers);
-
- return mail($recipients, $subject, $body, $text_headers);
-
- }
-
- /**
- * Take an array of mail headers and return a string containing
- * text usable in sending a message.
- *
- * @param array $headers The array of headers to prepare, in an associative
- * array, where the array key is the header name (ie,
- * 'Subject'), and the array value is the header
- * value (ie, 'test'). The header produced from those
- * values would be 'Subject: test'.
- *
- * @return mixed Returns false if it encounters a bad address,
- * otherwise returns an array containing two
- * elements: Any From: address found in the headers,
- * and the plain text version of the headers.
- * @access private
- */
- function prepareHeaders($headers)
- {
- // Look out for the From: value to use along the way.
- $text_headers = ''; // text representation of headers
- $from = null;
-
- foreach ($headers as $key => $val) {
- if ($key == 'From') {
- include_once 'Mail/RFC822.php';
-
- $from_arr = Mail_RFC822::parseAddressList($val, 'localhost', false);
- $from = $from_arr[0]->mailbox . '@' . $from_arr[0]->host;
- if (strstr($from, ' ')) {
- // Reject outright envelope From addresses with spaces.
- return false;
- }
- $text_headers .= $key . ': ' . $val . "\n";
- } else if ($key == 'Received') {
- // put Received: headers at the top, since Receieved:
- // after Subject: in the header order is somtimes used
- // as a spam trap.
- $text_headers = $key . ': ' . $val . "\n" . $text_headers;
- } else {
- $text_headers .= $key . ': ' . $val . "\n";
- }
- }
-
- return array($from, $text_headers);
- }
-
- /**
- * Take a set of recipients and parse them, returning an array of
- * bare addresses (forward paths) that can be passed to sendmail
- * or an smtp server with the rcpt to: command.
- *
- * @param mixed Either a comma-seperated list of recipients
- * (RFC822 compliant), or an array of recipients,
- * each RFC822 valid.
- *
- * @return array An array of forward paths (bare addresses).
- * @access private
- */
- function parseRecipients($recipients)
- {
- include_once 'Mail/RFC822.php';
-
- // if we're passed an array, assume addresses are valid and
- // implode them before parsing.
- if (is_array($recipients)) {
- $recipients = implode(', ', $recipients);
- }
-
- // Parse recipients, leaving out all personal info. This is
- // for smtp recipients, etc. All relevant personal information
- // should already be in the headers.
- $addresses = Mail_RFC822::parseAddressList($recipients, 'localhost', false);
- $recipients = array();
- if (is_array($addresses)) {
- foreach ($addresses as $ob) {
- $recipients[] = $ob->mailbox . '@' . $ob->host;
- }
- }
-
- return $recipients;
- }
-
-}
-?> \ No newline at end of file
diff --git a/pear/Makefile.in b/pear/Makefile.in
deleted file mode 100644
index f253155a55..0000000000
--- a/pear/Makefile.in
+++ /dev/null
@@ -1,190 +0,0 @@
-
-install_targets = \
- install-data-local \
- install-headers \
- install-build \
- install-programs
-
-include $(top_srcdir)/build/rules.mk
-
-peardir=$(PEAR_INSTALLDIR)
-
-PEAR_SUBDIRS = \
- Archive \
- Console \
- Crypt \
- Date \
- DB \
- File \
- HTML \
- HTTP \
- Image \
- Mail \
- Net \
- PEAR \
- Schedule \
- XML
-
-PEAR_FILES = \
- Archive/Tar.php \
- Console/Getopt.php \
- Crypt/CBC.php \
- Crypt/HCEMD5.php \
- Date/Calc.php \
- Date/Human.php \
- DB.php \
- DB/common.php \
- DB/fbsql.php \
- DB/ibase.php \
- DB/ifx.php \
- DB/msql.php \
- DB/mssql.php \
- DB/mysql.php \
- DB/oci8.php \
- DB/odbc.php \
- DB/pgsql.php \
- DB/storage.php \
- DB/sybase.php \
- File/Find.php \
- File/Passwd.php \
- File/SearchReplace.php \
- HTML/Common.php \
- HTML/Form.php \
- HTML/IT.php \
- HTML/ITX.php \
- HTML/IT_Error.php \
- HTML/Page.php \
- HTML/Processor.php \
- HTML/Select.php \
- HTML/Table.php \
- HTTP.php \
- HTTP/Compress.php \
- Image/Remote.php \
- Mail.php \
- Mail/RFC822.php \
- Mail/sendmail.php \
- Mail/smtp.php \
- Mail/mime.php \
- Net/Curl.php \
- Net/Dig.php \
- Net/SMTP.php \
- Net/Socket.php \
- PEAR.php \
- PEAR/Autoloader.php \
- PEAR/Common.php \
- PEAR/Config.php \
- PEAR/Dependency.php \
- PEAR/Installer.php \
- PEAR/Packager.php \
- PEAR/Registry.php \
- PEAR/Remote.php \
- PEAR/Uploader.php \
- Schedule/At.php \
- System.php \
- XML/Parser.php
-
-PEAR_COMMAND_LIBS = \
- pearcmd-common.php \
- pearcmd-help.php \
- pearcmd-info.php \
- pearcmd-install.php \
- pearcmd-list.php \
- pearcmd-package.php \
- pearcmd-remote-list.php \
- pearcmd-show-config.php \
- pearcmd-uninstall.php
-
-install-data-local:
- @if $(mkinstalldirs) $(INSTALL_ROOT)$(peardir); then \
- for i in $(PEAR_SUBDIRS); do \
- $(mkinstalldirs) $(INSTALL_ROOT)$(peardir)/$$i; \
- done; \
- for i in $(PEAR_FILES); do \
- echo "Installing $$i"; \
- dir=`echo $$i|sed 's%[^/][^/]*$$%%'`; \
- $(INSTALL_DATA) $(srcdir)/$$i $(INSTALL_ROOT)$(peardir)/$$dir; \
- done; \
- else \
- cat $(srcdir)/install-pear.txt; \
- exit 5; \
- fi
-
-phpincludedir = $(includedir)/php
-phpbuilddir = $(prefix)/lib/php/build
-
-BUILD_FILES = \
- pear/pear.m4 \
- build/fastgen.sh \
- build/library.mk \
- build/ltlib.mk \
- build/mkdep.awk \
- build/program.mk \
- build/rules.mk \
- build/rules_common.mk \
- build/rules_pear.mk \
- build/dynlib.mk \
- build/shtool \
- dynlib.m4 \
- acinclude.m4
-
-bin_SCRIPTS = phpize php-config pear pear-get pearize phptar
-
-install-build:
- @echo "Installing build environment"
- @$(mkinstalldirs) $(INSTALL_ROOT)$(phpbuilddir) $(INSTALL_ROOT)$(bindir) && \
- (cd $(top_srcdir) && cp $(BUILD_FILES) $(INSTALL_ROOT)$(phpbuilddir))
-
-install-programs:
- @for prog in $(bin_SCRIPTS); do \
- echo "Installing program: $$prog"; \
- $(INSTALL) -m 755 scripts/$$prog $(INSTALL_ROOT)$(bindir)/$$prog; \
- done; \
- for prog in phpextdist; do \
- echo "Installing program: $$prog"; \
- $(INSTALL) -m 755 $(srcdir)/scripts/$$prog $(INSTALL_ROOT)$(bindir)/$$prog; \
- done; \
- for lib in $(PEAR_COMMAND_LIBS); do \
- echo "Installing program library: $$lib"; \
- $(INSTALL) -m 644 $(srcdir)/scripts/$$lib $(INSTALL_ROOT)$(bindir)/$$lib; \
- done
-
-HEADER_DIRS = \
- / \
- Zend \
- TSRM \
- ext/standard \
- ext/session \
- ext/xml \
- ext/xml/expat/xmlparse \
- ext/xml/expat/xmltok \
- main \
- regex
-
-install-headers:
- -@for i in $(HEADER_DIRS); do \
- paths="$$paths $(INSTALL_ROOT)$(phpincludedir)/$$i"; \
- done; \
- $(mkinstalldirs) $$paths && \
- echo "Installing header files" && \
- for i in $(HEADER_DIRS); do \
- (cd $(top_srcdir)/$$i && cp -p *.h $(INSTALL_ROOT)$(phpincludedir)/$$i; \
- cd $(top_builddir)/$$i && cp -p *.h $(INSTALL_ROOT)$(phpincludedir)/$$i) 2>/dev/null || true; \
- done
-
-scripts/pear: scripts/pear.in $(top_builddir)/config.status
- (cd ..;CONFIG_FILES=pear/scripts/pear CONFIG_HEADERS= $(top_builddir)/config.status)
-
-scripts/pear-get: scripts/pear-get.in $(top_builddir)/config.status
- (cd ..;CONFIG_FILES=pear/scripts/pear-get CONFIG_HEADERS= $(top_builddir)/config.status)
-
-scripts/phpize: scripts/phpize.in $(top_builddir)/config.status
- (cd ..;CONFIG_FILES=pear/scripts/phpize CONFIG_HEADERS= $(top_builddir)/config.status)
-
-scripts/phptar: scripts/phptar.in $(top_builddir)/config.status
- (cd ..;CONFIG_FILES=pear/scripts/phptar CONFIG_HEADERS= $(top_builddir)/config.status)
-
-scripts/pearize: scripts/pearize.in $(top_builddir)/config.status
- (cd ..;CONFIG_FILES=pear/scripts/pearize CONFIG_HEADERS= $(top_builddir)/config.status)
-
-scripts/php-config: scripts/php-config.in $(top_builddir)/config.status
- (cd ..;CONFIG_FILES=pear/scripts/php-config CONFIG_HEADERS= $(top_builddir)/config.status)
diff --git a/pear/PEAR.php b/pear/PEAR.php
deleted file mode 100644
index e67a48b794..0000000000
--- a/pear/PEAR.php
+++ /dev/null
@@ -1,794 +0,0 @@
-<?php
-//
-// +----------------------------------------------------------------------+
-// | PHP Version 4 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2002 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.0 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Authors: Sterling Hughes <sterling@php.net> |
-// | Stig Bakken <ssb@fast.no> |
-// | Tomas V.V.Cox <cox@idecnet.com> |
-// | |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-//
-
-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);
-
-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_default_error_callback'] = '';
-$GLOBALS['_PEAR_destructor_object_list'] = array();
-
-//
-// Tests needed: - PEAR inheritance
-//
-
-/**
- * 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.
- *
- * @since PHP 4.0.2
- * @author Stig Bakken <ssb@fast.no>
- */
-class PEAR
-{
- // {{{ properties
-
- /**
- * 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();
-
- // }}}
-
- // {{{ constructor
-
- /**
- * Constructor. Registers this object in
- * $_PEAR_destructor_object_list for destructor emulation if a
- * destructor object exists.
- *
- * @param string (optional) which class to use for error objects,
- * defaults to PEAR_Error.
- * @access public
- * @return void
- */
- function PEAR($error_class = null)
- {
- $classname = get_class($this);
- if ($this->_debug) {
- print "PEAR constructor called, class=$classname\n";
- }
- if ($error_class !== null) {
- $this->_error_class = $error_class;
- }
- while ($classname) {
- $destructor = "_$classname";
- if (method_exists($this, $destructor)) {
- global $_PEAR_destructor_object_list;
- $_PEAR_destructor_object_list[] = &$this;
- break;
- } else {
- $classname = get_parent_class($classname);
- }
- }
- }
-
- // }}}
- // {{{ destructor
-
- /**
- * 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", get_class($this));
- }
- }
-
- // }}}
- // {{{ isError()
-
- /**
- * Tell whether a value is a PEAR error.
- *
- * @param mixed the value to test
- * @access public
- * @return bool true if parameter is an error
- */
- function isError($data) {
- return (bool)(is_object($data) &&
- (get_class($data) == 'pear_error' ||
- is_subclass_of($data, 'pear_error')));
- }
-
- // }}}
- // {{{ setErrorHandling()
-
- /**
- * Sets how errors generated by this DB 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 int $mode
- * One of PEAR_ERROR_RETURN, PEAR_ERROR_PRINT,
- * PEAR_ERROR_TRIGGER, PEAR_ERROR_DIE or
- * PEAR_ERROR_CALLBACK.
- *
- * @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
- *
- * @since PHP 4.0.5
- */
-
- function setErrorHandling($mode = null, $options = null)
- {
- if (isset($this)) {
- $setmode = &$this->_default_error_mode;
- $setoptions = &$this->_default_error_options;
- //$setcallback = &$this->_default_error_callback;
- } else {
- $setmode = &$GLOBALS['_PEAR_default_error_mode'];
- $setoptions = &$GLOBALS['_PEAR_default_error_options'];
- //$setcallback = &$GLOBALS['_PEAR_default_error_callback'];
- }
-
- switch ($mode) {
- 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;
- if ((is_string($options) && function_exists($options)) ||
- (is_array($options) && method_exists(@$options[0], @$options[1])))
- {
- $setoptions = $options;
- } else {
- trigger_error("invalid error callback", E_USER_WARNING);
- }
- break;
-
- default:
- trigger_error("invalid error mode", E_USER_WARNING);
- break;
- }
- }
-
- // }}}
- // {{{ expectError()
-
- /**
- * 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.
- *
- * @param mixed a single error code or an array of error codes
- * to expect
- *
- * @return int the new depth of the "expected errors" stack
- */
- function expectError($code = "*")
- {
- if (is_array($code)) {
- array_push($this->_expected_errors, $code);
- } else {
- array_push($this->_expected_errors, array($code));
- }
- return sizeof($this->_expected_errors);
- }
-
- // }}}
- // {{{ popExpect()
-
- /**
- * 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);
- }
-
- // }}}
- // {{{ raiseError()
-
- /**
- * 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 $message a text error message or a PEAR error object
- *
- * @param $code a numeric error code (it is up to your class
- * to define these if you want to use codes)
- *
- * @param $mode One of PEAR_ERROR_RETURN, PEAR_ERROR_PRINT,
- * PEAR_ERROR_TRIGGER, PEAR_ERROR_DIE or
- * PEAR_ERROR_CALLBACK.
- *
- * @param $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 $userinfo If you need to pass along for example debug
- * information, this parameter is meant for that.
- *
- * @param $error_class The returned error object will be instantiated
- * from this class, if specified.
- *
- * @param $skipmsg If true, raiseError will only pass error codes,
- * the error message parameter will be dropped.
- *
- * @access public
- * @return object a PEAR error object
- * @see PEAR::setErrorHandling
- * @since PHP 4.0.5
- */
- function &raiseError($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 = $message->getMessage();
- }
-
- if (isset($this) && isset($this->_expected_errors) && sizeof($this->_expected_errors) > 0 && sizeof($exp = end($this->_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;
- }
- }
-
- if ($mode === null) {
- if (isset($this) && isset($this->_default_error_mode)) {
- $mode = $this->_default_error_mode;
- } else {
- $mode = $GLOBALS['_PEAR_default_error_mode'];
- }
- }
-
- if ($mode == PEAR_ERROR_TRIGGER && $options === null) {
- if (isset($this)) {
- if (isset($this->_default_error_options)) {
- $options = $this->_default_error_options;
- }
- } else {
- $options = $GLOBALS['_PEAR_default_error_options'];
- }
- }
-
- if ($mode == PEAR_ERROR_CALLBACK) {
- if (!is_string($options) &&
- !(is_array($options) && sizeof($options) == 2 &&
- is_object($options[0]) && is_string($options[1])))
- {
- if (isset($this) && isset($this->_default_error_options)) {
- $options = $this->_default_error_options;
- } else {
- $options = $GLOBALS['_PEAR_default_error_options'];
- }
- }
- } else {
- if ($options === null) {
- if (isset($this)) {
- if (isset($this->_default_error_options)) {
- $options = $this->_default_error_options;
- }
- } else {
- $options = $GLOBALS['_PEAR_default_error_options'];
- }
- }
- }
- if ($error_class !== null) {
- $ec = $error_class;
- } elseif (isset($this) && isset($this->_error_class)) {
- $ec = $this->_error_class;
- } else {
- $ec = 'PEAR_Error';
- }
- if ($skipmsg) {
- return new $ec($code, $mode, $options, $userinfo);
- } else {
- return new $ec($message, $code, $mode, $options, $userinfo);
- }
- }
-
- // }}}
- // {{{ pushErrorHandling()
-
- /**
- * Push a new error handler on top of the error handler options stack. With this
- * you can easely override the actual error handler for some code and restore
- * it later with popErrorHandling.
- *
- * @param $mode mixed (same as setErrorHandling)
- * @param $options mixed (same as setErrorHandling)
- *
- * @return bool Always true
- *
- * @see PEAR::setErrorHandling
- */
- function pushErrorHandling($mode, $options = null)
- {
- $stack = &$GLOBALS['_PEAR_error_handler_stack'];
- if (!is_array($stack)) {
- if (isset($this)) {
- $def_mode = &$this->_default_error_mode;
- $def_options = &$this->_default_error_options;
- // XXX Used anywhere?
- //$def_callback = &$this->_default_error_callback;
- } else {
- $def_mode = &$GLOBALS['_PEAR_default_error_mode'];
- $def_options = &$GLOBALS['_PEAR_default_error_options'];
- // XXX Used anywhere?
- //$def_callback = &$GLOBALS['_PEAR_default_error_callback'];
- }
- $stack = array();
- $stack[] = array($def_mode, $def_options);
- }
-
- if (isset($this)) {
- $this->setErrorHandling($mode, $options);
- } else {
- PEAR::setErrorHandling($mode, $options);
- }
- $stack[] = array($mode, $options);
- return true;
- }
-
- // }}}
- // {{{ popErrorHandling()
-
- /**
- * Pop the last error handler used
- *
- * @return bool Always true
- *
- * @see PEAR::pushErrorHandling
- */
- function popErrorHandling()
- {
- $stack = &$GLOBALS['_PEAR_error_handler_stack'];
- array_pop($stack);
- list($mode, $options) = $stack[sizeof($stack) - 1];
- if (isset($this)) {
- $this->setErrorHandling($mode, $options);
- } else {
- PEAR::setErrorHandling($mode, $options);
- }
- return true;
- }
-
- // }}}
-}
-
-// {{{ _PEAR_call_destructors()
-
-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);
- 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();
- }
-}
-
-// }}}
-
-class PEAR_Error
-{
- // {{{ properties
-
- var $error_message_prefix = '';
- var $mode = PEAR_ERROR_RETURN;
- var $level = E_USER_NOTICE;
- var $code = -1;
- var $message = '';
- var $userinfo = '';
-
- // Wait until we have a stack-groping function in PHP.
- //var $file = '';
- //var $line = 0;
-
-
- // }}}
- // {{{ constructor
-
- /**
- * PEAR_Error constructor
- *
- * @param $message error message
- *
- * @param $code (optional) error code
- *
- * @param $mode (optional) error mode, one of: PEAR_ERROR_RETURN,
- * PEAR_ERROR_PRINT, PEAR_ERROR_DIE, PEAR_ERROR_TRIGGER or
- * PEAR_ERROR_CALLBACK
- *
- * @param $level (optional) error level, _OR_ in the case of
- * PEAR_ERROR_CALLBACK, the callback function or object/method
- * tuple.
- *
- * @access public
- *
- */
- function PEAR_Error($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;
- 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) {
- if (is_string($this->callback) && strlen($this->callback)) {
- call_user_func($this->callback, $this);
- } elseif (is_array($this->callback) &&
- sizeof($this->callback) == 2 &&
- is_object($this->callback[0]) &&
- is_string($this->callback[1]) &&
- strlen($this->callback[1])) {
- @call_user_method($this->callback[1], $this->callback[0],
- $this);
- }
- }
- }
-
- // }}}
- // {{{ getMode()
-
- /**
- * Get the error mode from an error object.
- *
- * @return int error mode
- * @access public
- */
- function getMode() {
- return $this->mode;
- }
-
- // }}}
- // {{{ getCallback()
-
- /**
- * Get the callback function/method from an error object.
- *
- * @return mixed callback function or object/method array
- * @access public
- */
- function getCallback() {
- return $this->callback;
- }
-
- // }}}
- // {{{ getMessage()
-
-
- /**
- * Get the error message from an error object.
- *
- * @return string full error message
- * @access public
- */
- function getMessage ()
- {
- return ($this->error_message_prefix . $this->message);
- }
-
-
- // }}}
- // {{{ getCode()
-
- /**
- * Get error code from an error object
- *
- * @return int error code
- * @access public
- */
- function getCode()
- {
- return $this->code;
- }
-
- // }}}
- // {{{ getType()
-
- /**
- * Get the name of this error/exception.
- *
- * @return string error/exception name (type)
- * @access public
- */
- function getType ()
- {
- return get_class($this);
- }
-
- // }}}
- // {{{ getUserInfo()
-
- /**
- * Get additional user-supplied information.
- *
- * @return string user-supplied information
- * @access public
- */
- function getUserInfo ()
- {
- return $this->userinfo;
- }
-
- // }}}
- // {{{ getDebugInfo()
-
- /**
- * Get additional debug information supplied by the application.
- *
- * @return string debug information
- * @access public
- */
- function getDebugInfo ()
- {
- return $this->getUserInfo();
- }
-
- // }}}
- // {{{ addUserInfo()
-
- function addUserInfo($info)
- {
- if (empty($this->userinfo)) {
- $this->userinfo = $info;
- } else {
- $this->userinfo .= " ** $info";
- }
- }
-
- // }}}
- // {{{ toString()
-
- /**
- * 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 = get_class($this->callback[0]) . '::' .
- $this->callback[1];
- } else {
- $callback = $this->callback;
- }
- return sprintf('[%s: message="%s" code=%d mode=callback '.
- 'callback=%s prefix="%s" info="%s"]',
- get_class($this), $this->message, $this->code,
- $callback, $this->error_message_prefix,
- $this->userinfo);
- }
- if ($this->mode & PEAR_ERROR_CALLBACK) {
- $modes[] = 'callback';
- }
- 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"]',
- get_class($this), $this->message, $this->code,
- implode("|", $modes), $levels[$this->level],
- $this->error_message_prefix,
- $this->userinfo);
- }
-
- // }}}
-}
-
-register_shutdown_function("_PEAR_call_destructors");
-
-/*
- * Local Variables:
- * mode: php
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
-?>
diff --git a/pear/PEAR/Autoloader.php b/pear/PEAR/Autoloader.php
deleted file mode 100644
index bc24dbb470..0000000000
--- a/pear/PEAR/Autoloader.php
+++ /dev/null
@@ -1,167 +0,0 @@
-<?php
-
-if (!extension_loaded("overload")) {
- // die hard without ext/overload
- die("Rebuild PHP with the `overload' extension to use PEAR_Autoloader");
-}
-
-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.
- *
- * @author Stig Sæther Bakken <ssb@fast.no>
- */
-class PEAR_Autoloader extends PEAR
-{
- /**
- * 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();
-
- /**
- * 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)) {
- $this->_autoload_map = array_merge($this->_autoload_map, $method);
- } else {
- $this->_autoload_map[$method] = $classname;
- }
- }
-
- /**
- * 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)
- {
- $ok = isset($this->_autoload_map[$method]);
- unset($this->_autoload_map[$method]);
- return $ok;
- }
-
- /**
- * 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;
- }
- }
- }
-
- /**
- * 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 (get_class($obj) == $classname) {
- unset($this->_method_map[$method]);
- $ok = true;
- }
- }
- return $ok;
- }
-
- /**
- * 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)
- {
- 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");
-
-?>
diff --git a/pear/PEAR/Common.php b/pear/PEAR/Common.php
deleted file mode 100644
index b6414e72b7..0000000000
--- a/pear/PEAR/Common.php
+++ /dev/null
@@ -1,430 +0,0 @@
-<?php
-//
-// +----------------------------------------------------------------------+
-// | PHP Version 4 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2002 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.02 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Authors: Stig Bakken <ssb@fast.no> |
-// | Tomas V.V.Cox <cox@idecnet.com> |
-// | |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-
-require_once 'PEAR.php';
-require_once 'Archive/Tar.php';
-require_once 'System.php';
-
-/**
- * TODO:
- * - check in inforFromDescFile that the minimal data needed is present
- * (pack name, version, files, others?)
- * - inherance of dir attribs to files may fail under certain circumstances
- */
-class PEAR_Common extends PEAR
-{
- // {{{ properties
-
- /** 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();
-
- /** list of temporary files created by this object */
- var $_tempfiles = array();
-
- /** assoc with information about a package */
- var $pkginfo = array();
-
- /**
- * Permitted maintainer roles
- * @var array
- */
- var $maintainer_roles = array('lead','developer','contributor','helper');
-
- /**
- * Permitted release states
- * @var array
- */
- var $releases_states = array('alpha','beta','stable','snapshot');
-
- // }}}
-
- // {{{ constructor
-
- function PEAR_Common()
- {
- $GLOBALS['_PEAR_Common_tempfiles'] = array();
- $this->_tempfiles =& $GLOBALS['_PEAR_Common_tempfiles'];
- $this->PEAR();
- }
-
- // }}}
- // {{{ destructor
-
- function _PEAR_Common()
- {
- // doesn't work due to bug #14744
- //$tempfiles = $this->_tempfiles;
- $tempfiles =& $GLOBALS['_PEAR_Common_tempfiles'];
- while (is_array($tempfiles) &&
- $file = array_shift($tempfiles))
- {
- if (@is_dir($file)) {
- System::rm("-rf $file");
- } elseif (file_exists($file)) {
- unlink($file);
- }
- }
- }
-
- // }}}
- // {{{ addTempFile()
-
- function addTempFile($file)
- {
- $this->_tempfiles[] = $file;
- }
-
- // }}}
- // {{{ mkDirHier()
-
- function mkDirHier($dir)
- {
- $this->log(2, "+ create dir $dir");
- return System::mkDir("-p $dir");
- }
-
- // }}}
- // {{{ log()
-
- function log($level, $msg)
- {
- if ($this->debug >= $level) {
- print "$msg\n";
- }
- }
-
- // }}}
- // {{{ mkTempDir()
-
- function mkTempDir()
- {
- $tmpdir = System::mktemp('-d pear');
- if (PEAR::isError($tmpdir)) {
- return $tmpdir;
- }
- $this->addTempFile($tmpdir);
- return $tmpdir;
- }
-
- // }}}
- // {{{ _element_start()
-
- function _element_start($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 (isset($this->dir_names)) {
- $this->dir_names[] = $attribs['name'];
- } else {
- // Don't add the root dir
- $this->dir_names = array();
- }
- if (isset($attribs['baseinstalldir'])) {
- $this->dir_install = $attribs['baseinstalldir'];
- }
- if (isset($attribs['role'])) {
- $this->dir_role = $attribs['role'];
- }
- break;
- case 'libfile':
- $this->lib_atts = $attribs;
- $this->lib_atts['role'] = 'extension';
- break;
- case 'maintainers':
- $this->pkginfo['maintainers'] = array();
- $this->m_i = 0; // maintainers array index
- break;
- case 'maintainer':
- // compatibility check
- if (!isset($this->pkginfo['maintainers'])) {
- $this->pkginfo['maintainers'] = array();
- $this->m_i = 0;
- }
- $this->pkginfo['maintainers'][$this->m_i] = array();
- $this->current_maintainer =& $this->pkginfo['maintainers'][$this->m_i];
- break;
- case 'changelog':
- $this->pkginfo['changelog'] = array();
- $this->c_i = 0; // changelog array index
- $this->in_changelog = true;
- break;
- case 'release':
- if ($this->in_changelog) {
- $this->pkginfo['changelog'][$this->c_i] = array();
- $this->current_release =& $this->pkginfo['changelog'][$this->c_i];
- }
- break;
- case 'deps':
- $this->pkginfo['release_deps'] = array();
- break;
- case 'dep':
- // dependencies array index
- $this->d_i = (isset($this->d_i)) ? $this->d_i + 1 : 0;
- $this->pkginfo['release_deps'][$this->d_i] = $attribs;
- break;
- }
- }
-
- // }}}
- // {{{ _element_end()
-
- function _element_end($xp, $name)
- {
- $data = trim($this->cdata);
- switch ($name) {
- case 'name':
- switch ($this->prev_element) {
- case 'package':
- $this->pkginfo['package'] = ereg_replace('[^a-zA-Z0-9._]', '_', $data);
- break;
- case 'maintainer':
- $this->current_maintainer['name'] = $data;
- break;
- }
- break;
- case 'summary':
- $this->pkginfo['summary'] = $data;
- break;
- case 'description':
- $this->pkginfo['description'] = $data;
- break;
- case 'user':
- $this->current_maintainer['handle'] = $data;
- break;
- case 'email':
- $this->current_maintainer['email'] = $data;
- break;
- case 'role':
- if (!in_array($data, $this->maintainer_roles)) {
- trigger_error("The maintainer role: '$data' is not valid", E_USER_WARNING);
- } else {
- $this->current_maintainer['role'] = $data;
- }
- break;
- case 'version':
- $data = ereg_replace ('[^a-zA-Z0-9._\-]', '_', $data);
- if ($this->in_changelog) {
- $this->current_release['version'] = $data;
- } else {
- $this->pkginfo['version'] = $data;
- }
- break;
- case 'date':
- if ($this->in_changelog) {
- $this->current_release['release_date'] = $data;
- } else {
- $this->pkginfo['release_date'] = $data;
- }
- break;
- case 'notes':
- if ($this->in_changelog) {
- $this->current_release['release_notes'] = $data;
- } else {
- $this->pkginfo['release_notes'] = $data;
- }
- break;
- case 'state':
- if (!in_array($data, $this->releases_states)) {
- trigger_error("The release state: '$data' is not valid", E_USER_WARNING);
- } elseif ($this->in_changelog) {
- $this->current_release['release_state'] = $data;
- } else {
- $this->pkginfo['release_state'] = $data;
- }
- break;
- case 'license':
- $this->pkginfo['release_license'] = $data;
- break;
- case 'sources':
- $this->lib_sources[] = $data;
- break;
- case 'dep':
- if ($data = trim($data)) {
- $this->pkginfo['release_deps'][$this->d_i]['name'] = $data;
- }
- break;
- case 'dir':
- array_pop($this->dir_names);
- break;
- case 'file':
- $this->current_file = $data;
- $path = '';
- if (!empty($this->dir_names)) {
- foreach ($this->dir_names as $dir) {
- $path .= $dir . DIRECTORY_SEPARATOR;
- }
- }
- $path .= $this->current_file;
- $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 'libfile':
- $this->lib_name = $data;
- $path = '';
- if (!empty($this->dir_names)) {
- foreach ($this->dir_names as $dir) {
- $path .= $dir . DIRECTORY_SEPARATOR;
- }
- }
- $path .= $this->lib_name;
- $this->filelist[$path] = $this->lib_atts;
- // 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;
- }
- if (isset($this->lib_sources)) {
- $this->filelist[$path]['sources'] = $this->lib_sources;
- }
- unset($this->lib_atts);
- unset($this->lib_sources);
- break;
- case 'maintainer':
- $this->m_i++;
- break;
- case 'release':
- if ($this->in_changelog) {
- $this->c_i++;
- }
- break;
- case 'changelog':
- $this->in_changelog = false;
- break;
- case 'summary':
- $this->pkginfo['summary'] = $data;
- break;
- }
- array_pop($this->element_stack);
- $spos = sizeof($this->element_stack) - 1;
- $this->current_element = ($spos > 0) ? $this->element_stack[$spos] : '';
- }
-
- // }}}
- // {{{ _pkginfo_cdata()
-
- function _pkginfo_cdata($xp, $data)
- {
- $this->cdata .= $data;
- }
-
- // }}}
- // {{{ infoFromDescriptionFile()
-
- function infoFromDescriptionFile($descfile)
- {
- if (!@is_file($descfile) || !is_readable($descfile) ||
- (!$fp = @fopen($descfile, 'r'))) {
- return $this->raiseError("Unable to open $descfile");
- }
- $xp = @xml_parser_create();
- if (!$xp) {
- return $this->raiseError('Unable to create XML parser');
- }
- xml_set_object($xp, $this);
- xml_set_element_handler($xp, '_element_start', '_element_end');
- xml_set_character_data_handler($xp, '_pkginfo_cdata');
- xml_parser_set_option($xp, XML_OPTION_CASE_FOLDING, false);
-
- $this->element_stack = array();
- $this->pkginfo = array();
- $this->current_element = false;
- $this->destdir = '';
- $this->pkginfo['filelist'] = array();
- $this->filelist =& $this->pkginfo['filelist'];
- $this->in_changelog = false;
-
- // read the whole thing so we only get one cdata callback
- // for each block of cdata
- $data = fread($fp, filesize($descfile));
- if (!xml_parse($xp, $data, 1)) {
- $msg = sprintf("XML error: %s at line %d",
- xml_error_string(xml_get_error_code($xp)),
- xml_get_current_line_number($xp));
- xml_parser_free($xp);
- return $this->raiseError($msg);
- }
-
- xml_parser_free($xp);
-
- foreach ($this->pkginfo as $k => $v) {
- if (!is_array($v)) {
- $this->pkginfo[$k] = trim($v);
- }
- }
- return $this->pkginfo;
- }
- // }}}
- // {{{ infoFromTgzFile()
-
- /**
- * Returns info from a tgz pear package
- */
- function infoFromTgzFile($file)
- {
- if (!@is_file($file)) {
- return $this->raiseError('tgz :: could not open file');
- }
- $tar = new Archive_Tar($file, true);
- $content = $tar->listContent();
- if (!is_array($content)) {
- return $this->raiseError('tgz :: could not get contents of package');
- }
- $xml = null;
- foreach ($content as $file) {
- $name = $file['filename'];
- if (ereg('^.*/package.xml$', $name, $match)) {
- $xml = $match[0];
- }
- }
- $tmpdir = System::mkTemp('-d pear');
- $this->addTempFile($tmpdir);
- if (!$xml || !$tar->extractList($xml, $tmpdir)) {
- return $this->raiseError('tgz :: could not extract the package.xml file');
- }
- return $this->infoFromDescriptionFile("$tmpdir/$xml");
-
- // }}}
- }
-}
-?> \ No newline at end of file
diff --git a/pear/PEAR/Config.php b/pear/PEAR/Config.php
deleted file mode 100644
index 9e002f6bc1..0000000000
--- a/pear/PEAR/Config.php
+++ /dev/null
@@ -1,222 +0,0 @@
-<?php
-//
-// +----------------------------------------------------------------------+
-// | PHP Version 4 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2002 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.02 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Authors: Stig Bakken <ssb@fast.no> |
-// | |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-
-require_once 'PEAR.php';
-
-/**
- * This is a class for storing simple configuration values keeping
- * track of which are system-defined (defaulted) and which are
- * user-defined. By default, only user-defined settings are stored
- * back to the user's configuration file.
- *
- * Configuration member is a simple associative array. Used keys:
- *
- * master_server which server to query for mirror lists etc.
- * server which server/mirror we're currently using
- * username PEAR username
- * password PEAR password (stored base64-encoded)
- * php_dir Where to install .php files
- * ext_dir Directory to install compiled libs in
- * doc_dir Directory to install documentation in
- *
- */
-class PEAR_Config extends PEAR
-{
- // {{{ properties
-
- var $defaults_file = '';
-
- var $config_file = '';
-
- var $configuration = array();
-
- var $defaulted = array();
-
- // }}}
-
- // {{{ PEAR_Config([file], [defaults_file])
-
- function PEAR_Config($file = '', $defaults_file = '')
- {
- $this->PEAR();
- $this->config_file = $file;
- $this->defaults_file = $defaults_file;
- if ($file && file_exists($file)) {
- $this->readConfigFile($file);
- }
- if ($defaults_file && file_exists($defaults_file)) {
- $this->mergeConfigFile($defaults_file, false, true);
- }
- }
-
- // }}}
-
- // {{{ readConfigFile([file], [defaults])
-
- function readConfigFile($file = null, $defaults = false)
- {
- if ($file === null) {
- $file = $this->config_file;
- }
- $fp = @fopen($file, "r");
- if (!$fp) {
- return $this->raiseError($php_errormsg);
- }
- $size = filesize($file);
- $contents = fread($fp, $size);
- $data = unserialize($contents);
- if ($data === false && $size > 1) {
- return $this->raiseError("PEAR_Config::readConfigFile: bad data");
- }
- $this->configuration = $data;
- if ($defaults) {
- foreach ($data as $key => $value) {
- $this->defaulted[$key] = true;
- }
- }
- }
-
- // }}}
- // {{{ mergeConfigFile(file, [override], [defaults])
-
- function mergeConfigFile($file, $override = true, $defaults = false)
- {
- $fp = @fopen($file, "r");
- if (!$fp) {
- return $this->raiseError($php_errormsg);
- }
- $contents = fread($fp, filesize($file));
- $data = unserialize($contents);
- if ($data === false) {
- return $this->raiseError("PEAR_Config::mergeConfigFile: bad data");
- }
- foreach ($data as $key => $value) {
- if (isset($this->configuration[$key]) && !$override) {
- continue;
- }
- if ($defaults) {
- $this->defaulted[$key] = true;
- }
- $this->configuration[$key] = $value;
- }
- }
-
- // }}}
- // {{{ writeConfigFile([file], [what_keys])
-
- function writeConfigFile($file = null, $what_keys = 'userdefined')
- {
- if ($what_keys == 'both') {
- $this->writeConfigFile($file, 'userdefined');
- $this->writeConfigFile($file, 'default');
- return;
- }
- if ($file === null) {
- if ($what_keys == 'default') {
- $file = $this->defaults_file;
- } else {
- $file = $this->config_file;
- }
- }
- if ($what_keys == 'default') {
- $keys_to_store = array_intersect(array_keys($this->configuration),
- array_keys($this->defaulted));
- } elseif ($what_keys == 'all') {
- $keys_to_store = array_keys($this->configuration);
- } else { // user-defined keys
- $keys_to_store = array_diff(array_keys($this->configuration),
- array_keys($this->defaulted));
- }
- $data = array();
- foreach ($keys_to_store as $key) {
- $data[$key] = $this->configuration[$key];
- }
- $fp = @fopen($file, "w");
- if (!$fp) {
- return $this->raiseError("PEAR_Config::writeConfigFile fopen('$file','w') failed");
- }
- if (!@fwrite($fp, serialize($data))) {
- return $this->raiseError("PEAR_Config::writeConfigFile serialize failed");
- }
- return true;
- }
-
- // }}}
- // {{{ get(key)
-
- function get($key)
- {
- return @$this->configuration[$key];
- }
-
- // }}}
- // {{{ set(key, value, [default])
-
- function set($key, $value, $default = false)
- {
- $this->configuration[$key] = $value;
- if ($default) {
- $this->defaulted[$key] = true;
- } elseif (isset($this->defaulted[$key])) {
- unset($this->defaulted[$key]);
- }
- }
-
- // }}}
- // {{{ getKeys()
-
- function getKeys()
- {
- return array_keys($this->configuration);
- }
-
- // }}}
- // {{{ toDefault(key)
-
- function toDefault($key)
- {
- if (file_exists($this->defaults_file)) {
- // re-reads the defaults file each time, but hey it works
- unset($this->configuration[$key]);
- $this->mergeConfigFile($this->defaults_file, false, true);
- }
- }
-
- // }}}
- // {{{ isDefaulted(key)
-
- function isDefaulted($key)
- {
- return isset($this->defaulted[$key]);
- }
-
- // }}}
- // {{{ isDefined(key)
-
- function isDefined($key)
- {
- return isset($this->configuration[$key]);
- }
-
- // }}}
-}
-
-?> \ No newline at end of file
diff --git a/pear/PEAR/Dependency.php b/pear/PEAR/Dependency.php
deleted file mode 100644
index 4949f1d7f1..0000000000
--- a/pear/PEAR/Dependency.php
+++ /dev/null
@@ -1,247 +0,0 @@
-<?php
-//
-// +----------------------------------------------------------------------+
-// | PHP Version 4 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2002 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.02 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Authors: Tomas V.V.Cox <cox@idecnet.com> |
-// | Stig Bakken <ssb@fast.no> |
-// | |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-
-/**
-* Methods for dependencies check. Based on Stig's dependencies RFC
-* at http://cvs.php.net/cvs.php/pearweb/rfc
-* (requires php >= 4.1)
-*/
-
-require_once "PEAR.php";
-
-class PEAR_Dependency
-{
-
- /**
- * This method maps the xml dependency definition to the
- * PEAR_dependecy one
- *
- * $opts => Array
- * (
- * [type] => pkg
- * [rel] => ge
- * [version] => 3.4
- * [name] => HTML_Common
- * )
- */
- function callCheckMethod($opts)
- {
- $rel = isset($opts['rel']) ? $opts['rel'] : 'has';
- if (isset($opts['version'])) {
- $req = $opts['version'];
- $rel = 'v.' . $rel;
- } else {
- $req = null;
- }
- $name = isset($opts['name']) ? $opts['name'] : null;
- switch ($opts['type']) {
- case 'pkg':
- return $this->checkPackage($name, $req, $rel);
- break;
- case 'ext':
- return $this->checkExtension($name, $req, $rel);
- break;
- case 'php':
- return $this->checkPHP($req, $rel);
- break;
- case 'prog':
- return $this->checkProgram($name);
- break;
- case 'os':
- return $this->checkOS($name);
- break;
- case 'sapi':
- return $this->checkSAPI($name);
- break;
- default:
- return "'{$opts['type']}' dependencie type not supported";
- }
- }
-
- /**
- * Package dependencies check method
- *
- * @param string $name Name of the package to test
- * @param string $version The package version required
- * @param string $relation How to compare versions with eachother
- *
- * @return mixed bool false if no error or the error string
- */
- function checkPackage($name, $req = null, $relation = 'has')
- {
- if (empty($this->registry)) {
- $this->registry = new PEAR_Registry;
- }
- if (!$this->registry->packageExists($name)) {
- return "'$name' PEAR package is not installed";
- }
- if (substr($relation, 0, 2) == 'v.') {
- $pkg_ver = $this->registry->packageInfo($name, 'version');
- $operator = substr($relation, 2);
- if (!version_compare($pkg_ver, $req, $operator)) {
- return "'$name' PEAR package version " .
- $this->signOperator($operator) . " $req is required";
- }
- return false;
- }
- return "Relation '$relation' with requirement '$req' is not supported";
- }
-
- /**
- * Extension dependencies check method
- *
- * @param string $name Name of the extension to test
- * @param string $req_ext_ver Required extension version to compare with
- * @param string $relation How to compare versions with eachother
- *
- * @return mixed bool false if no error or the error string
- */
- function checkExtension($name, $req = null, $relation = 'has')
- {
- // XXX (ssb): could we avoid loading the extension here?
- if (!extension_loaded($name)) {
- $dlext = OS_WINDOWS ? '.dll' : '.so';
- if (!@dl($name . $dlext)) {
- return "'$name' PHP extension is not installed";
- }
- }
- if ($relation == 'has') {
- return false;
- }
- if (substr($relation, 0, 2) == 'v.') {
- $ext_ver = phpversion($name);
- $operator = substr($relation, 2);
- if (!version_compare($ext_ver, $req, $operator)) {
- return "'$name' PHP extension version " .
- $this->signOperator($operator) . " $req is required";
- }
- }
- return false;
- }
-
- /**
- * Operating system dependencies check method
- *
- * @param string $os Name of the operating system
- *
- * @return mixed bool false if no error or the error string
- */
- function checkOS($os)
- {
- // XXX Fixme: Implement a more flexible way, like
- // comma separated values or something similar to PEAR_OS
-
- // only 'has' relation is supported
- if ($os == PHP_OS) {
- return false;
- }
- return "'$os' operating system not supported";
- }
-
- /**
- * PHP version check method
- *
- * @param string $req which version to compare
- * @param string $relation how to compare the version
- *
- * @return mixed bool false if no error or the error string
- */
- function checkPHP($req, $relation = 'v.ge')
- {
- if (substr($relation, 0, 2) == 'v.') {
- $php_ver = phpversion();
- $operator = substr($relation, 2);
- if (!version_compare($php_ver, $req, $operator)) {
- return "PHP version " . $this->signOperator($operator) .
- " $req is required";
- }
- }
- return false;
- }
-
- /**
- * External program check method. Looks for executable files in
- * directories listed in the PATH environment variable.
- *
- * @param string $program which program to look for
- *
- * @return mixed bool false if no error or the error string
- */
- function checkProgram($program)
- {
- // XXX FIXME honor safe mode
- $path_delim = OS_WINDOWS ? ';' : ':';
- $exe_suffix = OS_WINDOWS ? '.exe' : '';
- $path_elements = explode($path_delim, getenv('PATH'));
- foreach ($path_elements as $dir) {
- $file = $dir . DIRECTORY_SEPARATOR . $program . $exe_suffix;
- if (@file_exists($file) && @is_executable($file)) {
- return false;
- }
- }
- return "'$program' program is not present in the PATH";
- }
-
- /**
- * SAPI backend check method. Version comparison is not yet
- * available here.
- *
- * @param string $name name of SAPI backend
- * @param string $req which version to compare
- * @param string $relation how to compare versions (currently
- * hardcoded to 'has')
- * @return mixed bool false if no error or the error string
- */
- function checkSAPI($name, $req = null, $relation = 'has')
- {
- // XXX Fixme: There is no way to know if the user has or
- // not other SAPI backends installed than the installer one
-
- $sapi_backend = php_sapi_name();
- // Version comparisons not supported, sapi backends don't have
- // version information yet.
- if ($sapi_backend == $name) {
- return false;
- }
- return "'$sapi_backend' SAPI backend not supported";
- }
-
- /**
- * Converts text comparing operators to them sign equivalents
- * ex: 'ge' to '>='
- */
- 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;
- }
- }
-}
-
-?> \ No newline at end of file
diff --git a/pear/PEAR/Installer.php b/pear/PEAR/Installer.php
deleted file mode 100644
index 007ba39def..0000000000
--- a/pear/PEAR/Installer.php
+++ /dev/null
@@ -1,363 +0,0 @@
-<?php
-//
-// +----------------------------------------------------------------------+
-// | PHP Version 4 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2002 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.02 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Authors: Stig Bakken <ssb@fast.no> |
-// | Tomas V.V.Cox <cox@idecnet.com> |
-// | |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-
-require_once 'PEAR/Common.php';
-require_once 'PEAR/Registry.php';
-require_once 'PEAR/Dependency.php';
-
-/**
- * Administration class used to install PEAR packages and maintain the
- * installed package database.
- *
- * TODO:
- * - Install the "role=doc" files in a central pear doc dir
- * - kill FIXME's
- *
- * @since PHP 4.0.2
- * @author Stig Bakken <ssb@fast.no>
- */
-class PEAR_Installer extends PEAR_Common
-{
- // {{{ properties
-
- /** name of the package directory, for example Foo-1.0 */
- var $pkgdir;
-
- /** directory where PHP code files go */
- var $phpdir;
-
- /** directory where PHP extension files go */
- var $extdir;
-
- /** directory where documentation goes */
- var $docdir;
-
- /** directory where the package wants to put files, relative
- * to one of the three previous dirs
- */
- var $destdir = '';
-
- /** debug level (integer) */
- var $debug = 1;
-
- /** temporary directory */
- var $tmpdir;
-
- /** PEAR_Registry object used by the installer */
- var $registry;
-
- // }}}
-
- // {{{ constructor
-
- function PEAR_Installer($phpdir = PEAR_INSTALL_DIR,
- $extdir = PEAR_EXTENSION_DIR,
- $docdir = null)
- {
- $this->PEAR();
- $this->phpdir = $phpdir;
- $this->extdir = $extdir;
- if ($docdir === null) {
- $docdir = PHP_DATADIR . DIRECTORY_SEPARATOR . 'pear' .
- DIRECTORY_SEPARATOR . 'doc';
- }
- $this->docdir = $docdir;
- }
-
- // }}}
-
- // {{{ _deletePackageFiles()
-
- function _deletePackageFiles($package)
- {
- $info = $this->registry->packageInfo($package);
- if ($info == null) {
- return $this->raiseError("$package not installed");
- }
- foreach ($info['filelist'] as $file => $props) {
- $path = $props['installed_as'];
- // XXX TODO: do a "rmdir -p dirname($path)" to maintain clean the fs
- if (!@unlink($path)) {
- $this->log(2, "unable to delete: $path");
- } else {
- $this->log(2, "+ deleted file: $path");
- }
- }
- }
-
- // }}}
- // {{{ _installFile()
-
- function _installFile($file, $atts, $tmp_path)
- {
- $type = strtolower($atts['role']);
- switch ($type) {
- case 'test':
- // don't install test files for now
- $this->log(2, "+ Test file $file won't be installed yet");
- return true;
- break;
- case 'doc':
- $dest_dir = $this->docdir . DIRECTORY_SEPARATOR .
- $this->pkginfo['package'];
- break;
- case 'php':
- default: {
- $dest_dir = $this->phpdir;
- if (isset($atts['baseinstalldir'])) {
- $dest_dir .= DIRECTORY_SEPARATOR . $atts['baseinstalldir'];
- }
- if (dirname($file) != '.') {
- $dest_dir .= DIRECTORY_SEPARATOR . dirname($file);
- }
- break;
- }
- }
- $dest_file = $dest_dir . DIRECTORY_SEPARATOR . basename($file);
- if (!@is_dir($dest_dir)) {
- if (!$this->mkDirHier($dest_dir)) {
- $this->log(0, "failed to mkdir $dest_dir");
- return false;
- }
- $this->log(2, "+ created dir $dest_dir");
- }
- $orig_file = $tmp_path . DIRECTORY_SEPARATOR . $file;
- $orig_perms = fileperms($orig_file);
- if (!@copy($orig_file, $dest_file)) {
- $this->log(0, "failed to copy $orig_file to $dest_file");
- return false;
- }
- chmod($dest_file, $orig_perms);
- $this->log(2, "+ copy $orig_file to $dest_file");
-
- // Store the full path where the file was installed for easy unistall
- $this->pkginfo['filelist'][$file]['installed_as'] = $dest_file;
-
- $this->log(1, "installed file $dest_file");
- return true;
- }
-
- // }}}
- // {{{ install()
-
- /**
- * Installs the files within the package file specified.
- *
- * @param $pkgfile path to the package file
- *
- * @return bool true if successful, false if not
- */
-
- function install($pkgfile, $options = array(), $config = null)
- {
- // recognized options:
- // - register_only : update registry but don't install files
- // - upgrade : upgrade existing install
- //
- if (empty($this->registry)) {
- $this->registry = new PEAR_Registry($this->phpdir);
- }
- $oldcwd = getcwd();
- $need_download = false;
- if (preg_match('#^(http|ftp)://#', $pkgfile)) {
- $need_download = true;
- } elseif (!@is_file($pkgfile)) {
- if (preg_match('/^[A-Z][A-Za-z0-9_]+$/', $pkgfile)) {
- // valid package name
- if ($config === null) {
- $pkgfile = "http://pear.php.net/get/$pkgfile";
- } else {
- $pkgfile = "http://" . $config->get('master_server') .
- "/get/$pkgfile";
- }
- $need_download = true;
- }
- return $this->raiseError("could not open the package file: $pkgfile");
- }
-
- // Download package -----------------------------------------------
- if ($need_download) {
- $file = basename($pkgfile);
- if (PEAR::isError($downloaddir = $this->mkTempDir())) {
- return $downloaddir;
- }
- $this->log(2, '+ tmp dir created at ' . $downloaddir);
- $downloadfile = $downloaddir . DIRECTORY_SEPARATOR . $file;
- $this->log(1, "downloading $pkgfile ...");
- if (!$fp = @fopen($pkgfile, 'r')) {
- return $this->raiseError("$pkgfile: failed to download ($php_errormsg)");
- }
- if (!$wp = @fopen($downloadfile, 'w')) {
- return $this->raiseError("$downloadfile: write failed ($php_errormsg)");
- }
- $bytes = 0;
- while ($data = @fread($fp, 16384)) {
- $bytes += strlen($data);
- if (!@fwrite($wp, $data)) {
- return $this->raiseError("$downloadfile: write failed ($php_errormsg)");
- }
- }
- $pkgfile = $downloadfile;
- fclose($fp);
- fclose($wp);
- $this->log(1, '...done: ' . number_format($bytes, 0, '', ',') . ' bytes');
- }
-
- // Decompress pack in tmp dir -------------------------------------
-
- // To allow relative package file calls
- if (!chdir(dirname($pkgfile))) {
- return $this->raiseError('unable to chdir to package directory');
- }
- $pkgfile = getcwd() . DIRECTORY_SEPARATOR . basename($pkgfile);
-
- if (PEAR::isError($tmpdir = $this->mkTempDir())) {
- chdir($oldcwd);
- return $tmpdir;
- }
- $this->log(2, '+ tmp dir created at ' . $tmpdir);
-
- $tar = new Archive_Tar($pkgfile, true);
- if (!@$tar->extract($tmpdir)) {
- chdir($oldcwd);
- return $this->raiseError("unable to unpack $pkgfile");
- }
- $file = basename($pkgfile);
- // Assume the decompressed dir name
- if (($pos = strrpos($file, '.')) === false) {
- chdir($oldcwd);
- return $this->raiseError("invalid package name");
- }
- $pkgdir = substr($file, 0, $pos);
- $descfile = $tmpdir . DIRECTORY_SEPARATOR . $pkgdir . DIRECTORY_SEPARATOR . 'package.xml';
-
- if (!is_file($descfile)) {
- chdir($oldcwd);
- return $this->raiseError("no package.xml file after extracting the archive");
- }
-
- // Parse xml file -----------------------------------------------
- $pkginfo = $this->infoFromDescriptionFile($descfile);
- if (PEAR::isError($pkginfo)) {
- chdir($oldcwd);
- return $pkginfo;
- }
-
- $pkgname = $pkginfo['package'];
-
- // Check dependencies -------------------------------------------
- if (isset($pkginfo['release_deps']) && !isset($options['nodeps'])) {
- $error = $this->checkDeps($pkginfo);
- if ($error) {
- $this->log(0, $error);
- return $this->raiseError('Dependencies failed');
- }
- }
-
- if (empty($options['upgrade'])) {
- // checks to do only when installing new packages
- if (empty($options['force']) && $this->registry->packageExists($pkgname)) {
- return $this->raiseError("$pkgname already installed");
- }
- } else {
- // check to do only when upgrading packages
- if (!$this->registry->packageExists($pkgname)) {
- return $this->raiseError("$pkgname not installed");
- }
- $v1 = $this->registry->packageInfo($pkgname, 'version');
- $v2 = $pkginfo['version'];
- $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)");
- }
- if (empty($options['register_only'])) {
- // when upgrading, remove old release's files first:
- $this->_deletePackageFiles($package);
- }
- }
-
- // Copy files to dest dir ---------------------------------------
-
- // info from the package it self we want to access from _installFile
- $this->pkginfo = $pkginfo;
- if (empty($options['register_only'])) {
- if (!is_dir($this->phpdir)) {
- chdir($oldcwd);
- return $this->raiseError("no script destination directory\n",
- null, PEAR_ERROR_DIE);
- }
- $tmp_path = dirname($descfile);
- foreach ($pkginfo['filelist'] as $file => $atts) {
- $this->_installFile($file, $atts, $tmp_path);
- }
- }
-
- // Register that the package is installed -----------------------
- if (empty($options['upgrade'])) {
- $ret = $this->registry->addPackage($pkgname, $this->pkginfo);
- } else {
- $ret = $this->registry->updatePackage($pkgname, $this->pkginfo, false);
- }
- chdir($oldcwd);
- return $ret;
- }
-
- // }}}
- // {{{ uninstall()
-
- function uninstall($package)
- {
- if (empty($this->registry)) {
- $this->registry = new PEAR_Registry($this->phpdir);
- }
-
- // Delete the files
- $this->_deletePackageFiles($package);
-
- // Register that the package is no longer installed
- return $this->registry->deletePackage($package);
- }
-
- // }}}
- // {{{ checkDeps()
-
- function checkDeps(&$pkginfo)
- {
- $deps = new PEAR_Dependency;
- $errors = null;
- if (is_array($pkginfo['release_deps'])) {
- foreach($pkginfo['release_deps'] as $dep) {
- if ($error = $deps->callCheckMethod($dep)) {
- $errors .= "\n$error";
- }
- }
- if ($errors) {
- return $errors;
- }
- }
- return false;
- }
-
- // }}}
-}
-
-?> \ No newline at end of file
diff --git a/pear/PEAR/Packager.php b/pear/PEAR/Packager.php
deleted file mode 100644
index f892b79676..0000000000
--- a/pear/PEAR/Packager.php
+++ /dev/null
@@ -1,162 +0,0 @@
-<?php
-//
-// +----------------------------------------------------------------------+
-// | PHP Version 4 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2002 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.02 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Authors: Stig Bakken <ssb@fast.no> |
-// | Tomas V.V.Cox <cox@idecnet.com> |
-// | |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-
-require_once 'PEAR/Common.php';
-
-/**
- * Administration class used to make a PEAR release tarball.
- *
- * TODO:
- * - add an extra param the dir where to place the created package
- * - finish and test Windows support
- *
- * @since PHP 4.0.2
- * @author Stig Bakken <ssb@fast.no>
- */
-class PEAR_Packager extends PEAR_Common
-{
- // {{{ properties
-
- /** assoc with information about the package */
- var $pkginfo = array();
-
- /** name of the package directory, for example Foo-1.0 */
- var $pkgdir;
-
- /** directory where PHP code files go */
- var $phpdir;
-
- /** directory where PHP extension files go */
- var $extdir;
-
- /** directory where documentation goes */
- var $docdir;
-
- /** directory where system state information goes */
- var $statedir;
-
- /** debug mode (integer) */
- var $debug = 0;
-
- /** temporary directory */
- var $tmpdir;
-
- /** whether file list is currently being copied */
- var $recordfilelist;
-
- /** temporary space for copying file list */
- var $filelist;
-
- /** package name and version, for example "HTTP-1.0" */
- var $pkgver;
-
- // }}}
-
- // {{{ constructor
-
- function PEAR_Packager($phpdir = PEAR_INSTALL_DIR,
- $extdir = PEAR_EXTENSION_DIR,
- $docdir = '')
- {
- $this->PEAR();
- $this->phpdir = $phpdir;
- $this->extdir = $extdir;
- $this->docdir = $docdir;
- }
-
- // }}}
- // {{{ destructor
-
- function _PEAR_Packager()
- {
- chdir($this->orig_pwd);
- $this->_PEAR_Common();
- }
-
- // }}}
-
- // {{{ package()
-
- function package($pkgfile = null)
- {
- $this->orig_pwd = getcwd();
- if (empty($pkgfile)) {
- $pkgfile = 'package.xml';
- }
- $pkginfo = $this->infoFromDescriptionFile($pkgfile);
- if (PEAR::isError($pkginfo)) {
- return $pkginfo;
- }
- // XXX This needs to be checked in infoFromDescriptionFile
- // or at least a helper method to do the proper checks
- if (empty($pkginfo['version'])) {
- return $this->raiseError("No version information found in $pkgfile",
- null, PEAR_ERROR_TRIGGER, E_USER_ERROR);
- }
- // TMP DIR -------------------------------------------------
- // We allow calls like "pear package /home/user/mypack/package.xml"
- if (!@chdir(dirname($pkgfile))) {
- return $this->raiseError('Couldn\'t chdir to package.xml dir',
- null, PEAR_ERROR_TRIGGER, E_USER_ERROR);
- }
- $pwd = getcwd();
- $pkgfile = basename($pkgfile);
- if (isset($pkginfo['release_state']) && $pkginfo['release_state'] == 'snapshot') {
- $pkginfo['version'] = date('Ymd');
- }
- // don't want strange characters
- $pkgname = ereg_replace ('[^a-zA-Z0-9._]', '_', $pkginfo['package']);
- $pkgversion = ereg_replace ('[^a-zA-Z0-9._\-]', '_', $pkginfo['version']);
- $pkgver = $pkgname . '-' . $pkgversion;
-
- // ----- Create the package file list
- $filelist = array();
- $i = 0;
-
- // ----- Add the package XML file
- $filelist[$i++] = $pkgfile;
-
- // Copy files -----------------------------------------------
- foreach ($pkginfo['filelist'] as $fname => $atts) {
- if (!file_exists($fname)) {
- return $this->raiseError("File $fname does not exists");
- } else {
- $filelist[$i++] = $fname;
- }
- }
- // XXX TODO: Rebuild the package file as the old method did?
-
- // TAR the Package -------------------------------------------
- $dest_package = $this->orig_pwd . DIRECTORY_SEPARATOR . "{$pkgver}.tgz";
- $tar = new Archive_Tar($dest_package, true);
- $tar->setErrorHandling(PEAR_ERROR_PRINT);
- if (!$tar->createModify($filelist, $pkgver)) {
- return $this->raiseError('an error ocurred during package creation');
- }
- $this->log(1, "Package $dest_package done");
- return $dest_package;
- }
-
- // }}}
-}
-
-?> \ No newline at end of file
diff --git a/pear/PEAR/Registry.php b/pear/PEAR/Registry.php
deleted file mode 100644
index 51b128d178..0000000000
--- a/pear/PEAR/Registry.php
+++ /dev/null
@@ -1,187 +0,0 @@
-<?php
-//
-// +----------------------------------------------------------------------+
-// | PHP Version 4 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2002 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.02 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Authors: Stig Bakken <ssb@fast.no> |
-// | |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-
-require_once "System.php";
-
-/**
- * Administration class used to maintain the installed package database.
- */
-class PEAR_Registry
-{
- // {{{ properties
-
- var $statedir;
-
- // }}}
-
- // {{{ PEAR_Registry
-
- function PEAR_Registry($pear_install_dir = PEAR_INSTALL_DIR)
- {
- $this->statedir = $pear_install_dir . "/.registry";
- }
-
- // }}}
-
- // {{{ _assertStateDir()
-
- function _assertStateDir()
- {
- if (!@is_dir($this->statedir)) {
- System::mkdir("-p {$this->statedir}");
- }
- }
-
- // }}}
- // {{{ _packageFileName()
-
- function _packageFileName($package)
- {
- return "{$this->statedir}/{$package}.reg";
- }
-
- // }}}
- // {{{ _openPackageFile()
-
- function _openPackageFile($package, $mode)
- {
- $this->_assertStateDir();
- $file = $this->_packageFileName($package);
- $fp = @fopen($file, $mode);
- if (!$fp) {
- return null;
- }
- return $fp;
- }
-
- // }}}
- // {{{ _closePackageFile()
-
- function _closePackageFile($fp)
- {
- fclose($fp);
- }
-
- // }}}
-
- // {{{ packageExists()
-
- function packageExists($package)
- {
- return file_exists($this->_packageFileName($package));
- }
-
- // }}}
- // {{{ addPackage()
-
- function addPackage($package, $info)
- {
- if ($this->packageExists($package)) {
- return false;
- }
- $fp = $this->_openPackageFile($package, "w");
- if ($fp === null) {
- return false;
- }
- fwrite($fp, serialize($info));
- $this->_closePackageFile($fp);
- return true;
- }
-
- // }}}
- // {{{ packageInfo()
-
- function packageInfo($package = null, $key = null)
- {
- if ($package === null) {
- return array_map(array($this, "packageInfo"),
- $this->listPackages());
- }
- $fp = $this->_openPackageFile($package, "r");
- if ($fp === null) {
- return null;
- }
- $data = fread($fp, filesize($this->_packageFileName($package)));
- $this->_closePackageFile($fp);
- $data = unserialize($data);
- if ($key === null) {
- return $data;
- }
- if (isset($data[$key])) {
- return $data[$key];
- }
- return null;
- }
-
- // }}}
- // {{{ deletePackage()
-
- function deletePackage($package)
- {
- $file = $this->_packageFileName($package);
- return @unlink($file);
- }
-
- // }}}
- // {{{ updatePackage()
-
- 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 ($merge) {
- fwrite($fp, serialize(array_merge($oldinfo, $info)));
- } else {
- fwrite($fp, serialize($info));
- }
- $this->_closePackageFile($fp);
- return true;
- }
-
- // }}}
- // {{{ listPackages()
-
- function listPackages()
- {
- $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);
- }
- return $pkglist;
- }
-
- // }}}
-}
-
-?> \ No newline at end of file
diff --git a/pear/PEAR/Remote.php b/pear/PEAR/Remote.php
deleted file mode 100644
index f2a44f9648..0000000000
--- a/pear/PEAR/Remote.php
+++ /dev/null
@@ -1,124 +0,0 @@
-<?php
-//
-// +----------------------------------------------------------------------+
-// | PHP Version 4 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2002 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.02 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Authors: Stig Bakken <ssb@fast.no> |
-// | |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-
-require_once 'PEAR.php';
-
-/**
- * This is a class for doing remote operations against the central
- * PEAR database.
- */
-class PEAR_Remote extends PEAR
-{
- // {{{ properties
-
- var $config_object = null;
-
- // }}}
-
- // {{{ PEAR_Remote(config_object)
-
- function PEAR_Remote($config_object)
- {
- $this->PEAR();
- $this->config_object = $config_object;
- }
-
- // }}}
-
- // {{{ call(method, [args...])
-
- function call($method)
- {
- $args = func_get_args();
- array_shift($args);
- $this->__call($method, $args, $retval);
- return $retval;
- }
-
- // }}}
-
- // {{{ __call(method, args)
-
- function __call($method, $params, &$retval)
- {
- if (!extension_loaded("xmlrpc")) {
- $retval = $this->raiseError("xmlrpc support not loaded");
- return false;
- }
- $method = str_replace("_", ".", $method);
- $request = xmlrpc_encode_request($method, $params);
- $server_host = $this->config_object->get("master_server");
- if (empty($server_host)) {
- $retval = $this->raiseError("PEAR_Remote::call: no master_server configured");
- return false;
- }
- $server_port = 80;
- $fp = @fsockopen($server_host, $server_port);
- if (!$fp) {
- $retval = $this->raiseError("PEAR_Remote::call: fsockopen(`$server_host', $server_port) failed");
- return false;
- }
- $len = strlen($request);
- fwrite($fp, ("POST /xmlrpc.php HTTP/1.0\r\n".
- "Host: $server_host:$server_port\r\n".
- "Content-type: text/xml\r\n".
- "Content-length: $len\r\n".
- "\r\n$request"));
- $response = '';
- while (trim(fgets($fp, 2048)) != ''); // skip headers
- while ($chunk = fread($fp, 10240)) {
- $response .= $chunk;
- }
- fclose($fp);
- $ret = xmlrpc_decode($response);
- if (is_array($ret) && isset($ret['__PEAR_TYPE__'])) {
- if ($ret['__PEAR_TYPE__'] == 'error') {
- if (isset($ret['__PEAR_CLASS__'])) {
- $class = $ret['__PEAR_CLASS__'];
- } else {
- $class = "PEAR_Error";
- }
- if ($ret['code'] === '') $ret['code'] = null;
- if ($ret['message'] === '') $ret['message'] = null;
- if ($ret['userinfo'] === '') $ret['userinfo'] = null;
- if (strtolower($class) == 'db_error') {
- $retval = $this->raiseError(DB::errorMessage($ret['code']),
- $ret['code'], null, null,
- $ret['userinfo']);
- } else {
- $retval = $this->raiseError($ret['message'], $ret['code'],
- null, null, $ret['userinfo']);
- }
- return true;
- }
- }
- $retval = $ret;
- return true;
- }
-
- // }}}
-}
-
-if (function_exists("overload")) {
- overload("PEAR_Remote");
-}
-
-?> \ No newline at end of file
diff --git a/pear/PEAR/Uploader.php b/pear/PEAR/Uploader.php
deleted file mode 100644
index 210de68a02..0000000000
--- a/pear/PEAR/Uploader.php
+++ /dev/null
@@ -1,61 +0,0 @@
-<?php
-//
-// +----------------------------------------------------------------------+
-// | PHP Version 4 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2002 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.02 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Authors: Stig Bakken <ssb@fast.no> |
-// | |
-// +----------------------------------------------------------------------+
-//
-
-require_once "PEAR/Common.php";
-
-/**
- * Administration class used to install PEAR packages and maintain the
- * installed package database.
- *
- * @since PHP 4.0.2
- * @author Stig Bakken <ssb@fast.no>
- */
-class PEAR_Uploader extends PEAR_Common
-{
- // {{{ properties
-
- var $_tempfiles = array();
-
- // }}}
-
- // {{{ constructor
-
- function PEAR_Uploader()
- {
- $this->PEAR_Common();
- }
-
- // }}}
-
- function upload($pkgfile, $infofile = null)
- {
- if ($infofile === null) {
- $info = $this->infoFromTarBall($pkgfile);
- } else {
- $info = $this->infoFromDescriptionFile($infofile);
- }
- if (PEAR::isError($info)) {
- return $info;
- }
-
- }
-}
-
-?>
diff --git a/pear/PEAR/WebInstaller.php b/pear/PEAR/WebInstaller.php
deleted file mode 100644
index c96a759f14..0000000000
--- a/pear/PEAR/WebInstaller.php
+++ /dev/null
@@ -1,631 +0,0 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4; */
-// +---------------------------------------------------------------------+
-// | PHP version 4.0 |
-// +---------------------------------------------------------------------+
-// | Copyright (c) 1997-2002 The PHP Group |
-// +---------------------------------------------------------------------+
-// | This source file is subject to version 2.0 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +---------------------------------------------------------------------+
-// | Authors: Christian Stocker <chregu@phant.ch> |
-// +---------------------------------------------------------------------+
-
-
-/* This class should simplify the task of installing PEAR-packages, if you
- * don't have a cgi-php binary on your system or you don't have access to
- * the system-wide pear directory.
- *
- * To use it, make the following php-script:
- *
- * <?php
- * require("PEAR/WebInstaller.php");
- * $installer = new PEAR_WebInstaller("/path/to/your/install/dir","http://php.chregu.tv/pear/");
- * $installer->start();
- * ?>
- *
- * and put PEAR/WebInstaller.php (this script) anywhere in your include_path.
- *
- * (http://php.chregu.tv/pear/ is just for testing purposes until this
- * system runs on pear.php.net, but feel free to use it till then)
- *
- * Both parameters are optional. If the install dir is ommitted, the
- * installer takes either the system wide pear-directory (mostly
- * /usr/local/lib/php on unix), if it's writeable, or else the directory
- * the script is started. Be advised, that the directory, where the
- * PEAR::Packages will be installed, has to be writeable for the web-server.
- *
- * The second parameter points to the server/directory where all the
- * packages and especially Packages.xml is located. If not given, the
- * standard PEAR-Repository is taken (http://pear.php.net/whatever..)
- *
- * After installation, just add the install-dir to your include_path and
- * the packages should work.
- *
- * If you are System Adminisitrator and want the installed packages to be
- * made available for everyone, just copy the files to the systemwide
- * pear-dir after installation on the commandline. Or also add the
- * install-dir to the systemwide include_path (and maybe don't forget to
- * take the writeable off the directory..)
- *
- * TODO:
- * - More Error Detection
- * - Grouping of Packages
- * - Show installed Packages (from /var/lib/php/packages.lst?)
- * - Add possibility to install a package (.tgz) from the local file
- * system without a global Packages.xml (useful if no cgi-php
- * around and you need this package you downloaded installed :) )
- * - Search Function (maybe needed if we have hundreds of packages)
- * - Only download Packages.xml, if it actually changed.
- *
- * This Code is highly experimental.
- */
-
-require_once "PEAR.php";
-
-class PEAR_WebInstaller extends PEAR
-{
- // {{{ properties
-
- /** stack of elements, gives some sort of XML context */
- var $element_stack;
-
- /** 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();
-
- /** assoc with information about all packages */
- var $AllPackages;
-
- /** URL to the server containing all packages in tgz-Format and the Package.xml */
- var $remotedir = "http://php.chregu.tv/pear/";
-
- /* Directory where the to be installed files should be put
- per default PEAR_INSTALL_DIR (/usr/local/lib/php) if it's writeable for the webserver,
- else current directory, or user defined directory (provided as first parameter in constructor)
- The Directory hast to be writeable for the php-module (webserver)
- */
- var $installdir;
-
- /** how many seconds we should cache Packages.xml */
- var $cachetime = 3600;
-
- var $printlogger = True;
- // }}}
-
- // {{{ constructor
-
- function PEAR_Webinstaller($installdir = Null,$remotedir = Null)
- {
- $this->PEAR();
- if ($installdir)
- {
- $this->installdir = $installdir;
- }
- else
- {
- if (is_writeable(PEAR_INSTALL_DIR))
- {
- $this->installdir = PEAR_INSTALL_DIR;
- }
- else
- {
- $this->installdir = getcwd();
- }
- }
-
- if ($remotedir)
- {
- $this->remotedir = $remotedir;
- }
- }
-
- // }}}
- // {{{ start()
-
- function start() {
- global $HTTP_POST_VARS,$HTTP_GET_VARS;
-
- //print header
- $this->header();
-
- $this->loggerStart();
-
- //if some checkboxes for installation were selected, install.
- if ($HTTP_GET_VARS["help"]) {
-
- $this->help($HTTP_GET_VARS["help"]);
- }
-
- elseif ($HTTP_POST_VARS["InstPack"]) {
- $this->installPackages(array_keys($HTTP_POST_VARS["InstPack"]));
- }
-
- //else print all modules
- else {
- $this->printTable();
- }
- $this->footer();
- }
- // }}}
- // {{{ installPackages()
-
- /* installs the Packages and prints if successfull or not */
-
- function installPackages($packages)
- {
- require_once "PEAR/Installer.php";
- $installer =& new PEAR_Installer();
- $installer->phpdir = $this->installdir;
- $this->loggerEnd();
- print "<TABLE CELLSPACING=0 BORDER=0 CELLPADDING=1>";
- print "<TR><TD BGCOLOR=\"#000000\">\n";
- print "<TABLE CELLSPACING=1 BORDER=0 CELLPADDING=3 width=100%>\n";
- print " <TR BGCOLOR=\"#e0e0e0\">\n";
- print " <TH>Package</TH>\n";
- print " <TH>Status</TH>\n";
-
- foreach ($packages as $package)
- {
-
-
- if (++$i % 2) {
- $bg1 = "#ffffff";
- $bg2 = "#f0f0f0";
- }
- else {
- $bg1 = "#f0f0f0";
- $bg2 = "#e0e0e0";
- }
- print " <TR>\n";
-
- print "<TD BGCOLOR=\"$bg1\">";
- print $package;
- print "</TD>\n";
-
-
- /*
- print "<TD BGCOLOR=\"$bg2\">";
- print "Installing ...";
- print "</td>";
- print " <TR>\n";
- print "<TD BGCOLOR=\"$bg1\">";
- print "&nbsp;";
- print "</TD>\n";
- */
- print "<TD BGCOLOR=\"$bg2\">";
- if (PEAR::isError($installer->Install($this->remotedir."/".$package.".tgz"))) {
- print "\ninstall failed\n";
- }
- else {
-
- print "install ok\n";
- }
- print "</td></tr>\n";
- }
- print "</td></tr>";
- print "</table>";
- print "<TABLE CELLSPACING=1 BORDER=0 CELLPADDING=3 width=\"100%\">\n";
- print " <TR BGCOLOR=\"$bg1\">\n";
- print "<th colspan=\"2\">";
- print "<a href=\"$GLOBALS[PHP_SELF]\">Back to the Packages</a>\n";
- print "</th></tr></table>";
- print"</td></tr></table>";
- }
-
- // }}}
- // {{{ printTable()
- /* Prints a table with all modules available on the server-directory */
-
- function printTable()
- {
- global $PHP_SELF;
- $Packages = $this->getPackages();
- if (PEAR::IsError($Packages))
- {
- if ($this->printlogger) {
- $this->logger($Packages->message);
- }
- else
- {
- print $Packages->message;
- }
- return $Packages;
- }
- $this->loggerEnd();
- print "<FORM action=\"$GLOBALS[PHP_SELF]\" method=\"post\">\n";
- print "<TABLE CELLSPACING=0 BORDER=0 CELLPADDING=1>";
- print "<TR><TD BGCOLOR=\"#000000\">\n";
- print "<TABLE CELLSPACING=1 BORDER=0 CELLPADDING=3 width=\"100%\">\n";
- print "<tr bgcolor=\"f0f0f0\">";
- print "<td COLSPAN=\"6\" ><input type=\"submit\" value=\"Install\"></td>";
- print "</tr>";
-
- print " <TR BGCOLOR=\"#e0e0e0\" >\n";
- print " <TH>Inst.</TH>\n";
- print " <TH>Package</TH>\n";
- print " <TH>Summary</TH>\n";
- print " <TH>Version</TH>\n";
- print " <TH>Release date</TH>\n";
- print " <TH>Release notes</TH>\n";
- print " </TR>\n";
- $i = 0;
-
- ksort($Packages);
- foreach ( $Packages as $package) {
-
- if (++$i % 2) {
- $bg1 = "#ffffff";
- $bg2 = "#f0f0f0";
- }
- else {
- $bg1 = "#f0f0f0";
- $bg2 = "#e0e0e0";
- }
-
-
- print "<TR>\n";
-
- print "<TD align=\"middle\" BGCOLOR=\"$bg2\">";
- print "<input type=\"checkbox\" name=\"InstPack[".$package["name"]."-".$package["version"]."]\">\n";
- print "</TD>\n";
-
- print " <TD BGCOLOR=\"$bg1\">";
- print $this->printCell ($package["name"],"http://pear.php.net/pkginfo.php?package=$package[name]");
- print "</TD>\n";
-
- print "<TD BGCOLOR=\"$bg2\">";
- $this->printCell ($package["summary"]);
- print "</TD>\n";
-
- print "<TD BGCOLOR=\"$bg2\">";
- $this->printCell ($package["version"],$this->remotedir."/".$package["name"]."-".$package["version"].".tgz");
- print "</TD>\n";
-
- print "<TD BGCOLOR=\"$bg2\">";
- $this->printCell ($package["release_date"]);
- print "</TD>\n";
-
- print "<TD BGCOLOR=\"$bg2\">";
- $this->printCell (nl2br($package["release_notes"]));
- print "</TD>\n";
- print " </TR>\n";
-
- }
- print "<tr bgcolor=\"$bg1\">";
- print "<td COLSPAN=\"6\" ><input type=\"submit\" value=\"Install\"></td>";
- print "</tr>";
- print "</TABLE> \n";
-
-
- print "<TABLE CELLSPACING=1 BORDER=0 CELLPADDING=3 width=\"100%\">\n";
- print " <TR BGCOLOR=\"#e0e0e0\">\n";
-
- print "<th align=left width=\"10%\" nowrap>\n";
- print "Install Directory: </th><td>$this->installdir";
- if (!is_writable($this->installdir))
- {
- print " <font color=\"red\">(Directory is NOT writeable!)</font>";
- }
-
- print "</td></tr>\n";
-
- print " <TR BGCOLOR=\"#f0f0f0\">\n";
- print "<th align=left width=\"10%\" nowrap>\n";
- print "PEAR Repository: </th><td>$this->remotedir</td></tr>\n";
-
- print " <TR BGCOLOR=\"#e0e0e0\">\n";
- print "<th align=left width=\"10%\" nowrap>\n";
- print "Caching Time: </th><td>$this->cachetime seconds</td></tr>\n";
-
- print "</table>\n";
- print "</tr></td></table></FORM>\n";
- print "<a href=\"$PHP_SELF?help=1\">Help</A>\n";
- }
-
- // }}}
- // {{{ getPackages()
-
- /** gets the Packages.xml from the server and saves it on the local disc for caching (if possible)
- * If the zlib-extension is compiled in, Packages.xml.gz is used instead.
- */
-
- function getPackages ($TryGz = True)
- {
-
- // if we can write to the installdir, cache the Packages.xml there
-
- $PackageFile = "Packages.xml";
-
- // check if we have the zlib-extension compiled in
- if ($TryGz && function_exists("gzfile")) { $useGz = True; $PackageFile .= ".gz";}
-
- // check if we can write the Package.xml file for caching
-
- if ( (file_exists($this->installdir."/$PackageFile") && is_writeable($this->installdir."/$PackageFile")) || !file_exists($this->installdir."/$PackageFile") && is_writeable($this->installdir) )
- {
- $time = filemtime($this->installdir."/$PackageFile");
-
- if ($time < (time () - $this->cachetime )) {
- $this->logger("$PackageFile too old. Get new one.");
- $fp = @fopen($this->remotedir."/$PackageFile","r");
- if (!$fp) {
- if ($useGz)
- {
- $this->logger("$PackageFile could not be read. Try uncompressed one");
- return $this->getPackages(False);
- }
- else {
- $this->logger("$PackageFile could not be read.");
- return $this->raiseError("$PackageFile could not be read.");
- }
- }
- $fout = fopen($this->installdir."/$PackageFile","w");
- while ($data = fread($fp,8192)) {
- fwrite ($fout, $data);
- }
- fclose($fout);
- fclose($fp);
- $this->logger("Got $PackageFile");
- }
- else {
- $this->logger("Cached $PackageFile seems new enough");
- }
- $Packages = $this->infoFromDescriptionFile($this->installdir."/$PackageFile");
- }
- else
- {
- $this->logger("$PackageFile can not be cached, because Install-Dir or $PackageFile is not writeable. Get it each time from the server");
- $Packages = $this->infoFromDescriptionFile($this->remotedir."/Packages.xml");
- }
- $this->logger("Got Packages");
- return $Packages;
- }
-
- // }}}
- // {{{ printCell()
-
- function printCell($text,$link = Null)
- {
- if ($text)
- {
- if ($link) {
- print "<a href=\"$link\" style=\"color: #000000;\">";
- }
-
- print "$text";
-
- if ($link) {
- print "</a>";
- }
-
- }
- else
- {
- print "&nbsp;";
- }
- }
-
- // }}}
- /* The following 4 functions are taken from PEAR/Common.php written by Stig Bakken
- I had to adjust to use the Packages.xml format.
- */
- // {{{ _element_start()
-
-
- function _element_start($xp, $name, $attribs)
- {
- array_push($this->element_stack, $name);
- $this->current_element = $name;
- $this->current_attributes = $attribs;
- }
-
- // }}}
- // {{{ _element_end()
-
- function _element_end($xp, $name)
- {
- array_pop($this->element_stack);
- if ($name == "PACKAGE")
- {
- $this->AllPackages[$this->pkginfo["name"]] = $this->pkginfo;
- $this->pkginfo = array();
-
- }
-
- $this->current_element = $this->element_stack[sizeof($this->element_stack)-1];
- }
-
- // }}}
- // {{{ _pkginfo_cdata()
-
- function _pkginfo_cdata($xp, $data)
- {
- $next = $this->element_stack[sizeof($this->element_stack)-1];
- switch ($this->current_element) {
- case "NAME":
- $this->pkginfo["name"] .= $data;
- break;
- case "SUMMARY":
- $this->pkginfo["summary"] .= $data;
- break;
- case "USER":
- $this->pkginfo["maintainer_handle"] .= $data;
- break;
- case "EMAIL":
- $this->pkginfo["maintainer_email"] .= $data;
- break;
- case "VERSION":
- $this->pkginfo["version"] .= $data;
- break;
- case "DATE":
- $this->pkginfo["release_date"] .= $data;
- break;
- case "NOTES":
- $this->pkginfo["release_notes"] .= $data;
- break;
- case "DIR":
- if (!$this->installdir) {
- break;
- }
- $dir = trim($data);
- // XXX add to file list
- break;
- case "FILE":
- $role = strtolower($this->current_attributes["ROLE"]);
- $file = trim($data);
- // XXX add to file list
- break;
- }
- }
-
- // }}}
- // {{{ infoFromDescriptionFile()
-
- function infoFromDescriptionFile($descfile)
- {
- $fp = @fopen($descfile,"r");
- if (!$fp) {
- return $this->raiseError("Unable to open $descfile in ".__FILE__.":".__LINE__);
- }
- $xp = @xml_parser_create();
-
- if (!$xp) {
- return $this->raiseError("Unable to create XML parser.");
- }
-
- xml_set_object($xp, $this);
-
- xml_set_element_handler($xp, "_element_start", "_element_end");
- xml_set_character_data_handler($xp, "_pkginfo_cdata");
- xml_parser_set_option($xp, XML_OPTION_CASE_FOLDING, true);
-
- $this->element_stack = array();
- $this->pkginfo = array();
- $this->current_element = false;
- $this->destdir = '';
-
- // read the whole thing so we only get one cdata callback
- // for each block of cdata
-
- if (preg_match("/\.gz$/",$descfile))
- {
- $data = implode("",gzfile($descfile));
- }
- else
- {
- $data = implode("",file($descfile));
- }
-
- if (!@xml_parse($xp, $data, 1)) {
- $msg = sprintf("XML error: %s at line %d",
- xml_error_string(xml_get_error_code($xp)),
- xml_get_current_line_number($xp));
- xml_parser_free($xp);
- return $this->raiseError($msg);
- }
-
- xml_parser_free($xp);
-
- foreach ($this->pkginfo as $k => $v) {
- $this->pkginfo[$k] = trim($v);
- }
-
- return $this->AllPackages;
- }
-
- // }}}
- // {{{ header()
-
- function header ()
- {
- print "<html>
- <head>
- <title>PEAR::WebInstaller</title>\n";
- if (file_exists("./style.css"))
- {
- print '<link rel="stylesheet" href="/style.css">';
- }
- print "</head>
- <body bgcolor=\"#FFFFFF\">
- <h3>PEAR::WebInstaller</h3>";
-
- }
-
- // }}}
- // {{{ footer()
-
- function footer () {
- print "</body></html>";
- }
-
- // }}}
-
- function logger ($text) {
-
- if ($this->printlogger) {
- if (++$this->logcol % 2) {
- $bg1 = "#ffffff";
- $bg2 = "#f0f0f0";
- }
- else {
- $bg1 = "#f0f0f0";
- $bg2 = "#e0e0e0";
- }
- print "<TR>\n";
- print "<TD BGCOLOR=\"$bg1\">".date("h:m:i",time())."</td>";
- print "<TD BGCOLOR=\"$bg2\">";
- print "$text\n";
- print "</TD>\n";
- print "</tr>";
- }
- }
- function loggerStart () {
- if ($this->printlogger) {
- print "<TABLE CELLSPACING=0 BORDER=0 CELLPADDING=1>";
- print "<TR><TD BGCOLOR=\"#000000\">\n";
- print "<TABLE CELLSPACING=1 BORDER=0 CELLPADDING=3 width=\"100%\">\n";
- }
- }
-
- function loggerEnd () {
- if ($this->printlogger) {
- print "</table></td></tr></table>";
- }
- }
- function help ($Full = False) {
- global $PHP_SELF;
- $this->loggerEnd();
- print "From the WebInstaller.php introduction: <p>";
-
- $file = file(__FILE__);
- foreach($file as $line)
- {
- if ($Full != 2 && strstr($line,"require_once")){
- break;
- }
- $help .= $line;
- }
-
- highlight_string($help);
- print "<p>";
- if ($Full != 2) {
- print "<a href=\"$PHP_SELF?help=2\">See the full source</a><p>\n";
- }
-
- print "<a href=\"$PHP_SELF\">Back to the packages overview</A>\n";
- }
-
-}
-
-?>
diff --git a/pear/README b/pear/README
deleted file mode 100644
index 0101fb268f..0000000000
--- a/pear/README
+++ /dev/null
@@ -1,37 +0,0 @@
- PEAR - PHP Extension and Application Repository
- ===============================================
- Dedicated to Malin Bakken, born 1999-11-21
-
-WHAT IS PEAR?
-
-PEAR is a code repository for PHP extensions and PHP library code
-similar to TeX's CTAN and Perl's CPAN.
-
-The intention behind PEAR is to provide a means for library code
-authors to organize their code in a defined way shared by other
-developers, and to give the PHP community a single source for such
-code.
-
-
-ADMINISTRATION
-
-This section will describe the rules for how files are structured and
-how functions and classes should be named.
-
-
-TOOLS
-
-This section will describe the tools provided to PEAR users.
-
-
-CODING RULES AND GUIDELINES
-
-* Before adding a new top-level directory ("DB" is one), discuss your
- intentions on pear-dev@lists.php.net.
-
-* Please see http://pear.php.net/manual/standards.php for full rules and guidelines.
-
-
-DOCUMENTATION
-
-Documentation for PEAR can be found at http://pear.php.net/manual/.
diff --git a/pear/System.php b/pear/System.php
deleted file mode 100644
index fd90901295..0000000000
--- a/pear/System.php
+++ /dev/null
@@ -1,354 +0,0 @@
-<?php
-//
-// +----------------------------------------------------------------------+
-// | PHP Version 4 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2002 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.0 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Authors: Tomas V.V.Cox <cox@idecnet.com> |
-// | |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-//
-
-// TODO:
-// - Build strong tests
-// - Error reporting (now shows standar php errors)
-// - Write doc
-
-require_once 'PEAR.php';
-require_once 'Console/Getopt.php';
-
-/**
-* 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 repectively
-* GNU commands.
-*
-* Example usage: System::rm('-r file1 dir1');
-*
-* ------------------- EXPERIMENTAL STATUS -------------------
-*
-* @package System
-* @author Tomas V.V.Cox <cox@idecnet.com>
-* @version $Revision$
-* @access public
-*/
-class System extends PEAR
-{
- /**
- * 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
- * @access private
- */
- function _parseArgs($argv, $short_options, $long_options = null)
- {
- if (!is_array($argv) && $argv !== null) {
- $argv = preg_split('/\s+/', $argv);
- }
- return Console_Getopt::getopt($argv, $short_options);
- }
-
- /**
- * 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
- * @return array the structure of the dir
- * @access private
- */
-
- function _dirToStruct($sPath, $maxinst, $aktinst = 0)
- {
- $struct = array('dirs' => array(), 'files' => array());
- if (($dir = @opendir($sPath)) === false) {
- return $struct; // XXX could not open error
- }
- $struct['dirs'][] = $sPath; // XXX don't add if '.' or '..' ?
- $list = array();
- while ($file = readdir($dir)) {
- if ($file != '.' && $file != '..') {
- $list[] = $file;
- }
- }
- closedir($dir);
- sort($list);
- foreach($list as $val) {
- $path = $sPath . DIRECTORY_SEPARATOR . $val;
- if (is_dir($path)) {
- if ($aktinst < $maxinst || $maxinst == 0) {
- $tmp = System::_dirToStruct($path, $maxinst, $aktinst+1);
- $struct = array_merge_recursive($tmp, $struct);
- }
- } 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
- * @see System::_dirToStruct()
- */
- function _multipleToStruct($files)
- {
- $struct = array('dirs' => array(), 'files' => array());
- foreach($files as $file) {
- if (is_dir($file)) {
- $tmp = System::_dirToStruct($file, 0);
- $struct = array_merge_recursive($tmp, $struct);
- } else {
- $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
- * @access public
- */
- function rm($args)
- {
- $opts = System::_parseArgs($args, 'rf'); // "f" do nothing but like it :-)
- if (PEAR::isError($opts)) {
- return $opts;
- }
- foreach($opts[0] as $opt) {
- if ($opt[0] == 'r') {
- $do_recursive = true;
- }
- }
- if (isset($do_recursive)) {
- $struct = System::_multipleToStruct($opts[1]);
- if (PEAR::isError($struct)) {
- return $struct;
- }
- foreach($struct['files'] as $file) {
- unlink($file); // XXXX Works under Windows?
- }
- foreach($struct['dirs'] as $dir) {
- rmdir($dir);
- }
- } else {
- foreach ($opts[1] as $file) {
- $delete = (is_dir($file)) ? 'rmdir' : 'unlink'; // XXXX Windows?
- $delete($file);
- }
- }
- return true;
- }
-
- /**
- * Make directories
- *
- * @param string $args the name of the director(y|ies) to create
- * @return mixed PEAR_Error or true for success
- * @access public
- */
- function mkDir($args)
- {
- $opts = System::_parseArgs($args, 'pm:');
- if (PEAR::isError($opts)) {
- return $opts;
- }
- $mode = 0777; // default mode
- foreach($opts[0] as $opt) {
- if ($opt[0] == 'p') {
- $create_parents = true;
- } elseif($opt[0] == 'm') {
- $mode = $opt[1];
- }
- }
- $ret = true;
- if (isset($create_parents)) {
- foreach($opts[1] as $dir) {
- $dirstack = array();
- while (!@is_dir($dir) && $dir != DIRECTORY_SEPARATOR) {
- array_unshift($dirstack, $dir);
- $dir = dirname($dir);
- }
- while ($newdir = array_shift($dirstack)) {
- if (!mkdir($newdir, $mode)) {
- $ret = false;
- }
- }
- }
- } else {
- foreach($opts[1] as $dir) {
- if (!@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
- * @access public
- */
- function &cat($args)
- {
- $ret = null;
- $files = array();
- if (!is_array($args)) {
- $args = preg_split('/\s+/', $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];
- }
- }
- if (isset($mode)) {
- if (!$outputfd = fopen($outputfile, $mode)) {
- return $this->raiseError("Could not open $outputfile");
- }
- $ret = true;
- }
- foreach($files as $file) {
- if (!$fd = fopen($file, 'r')) {
- return $this->raiseError("Could not open $file");
- }
- while(!feof($fd)) {
- $cont = fread($fd, 2048);
- if (isset($outputfd)) {
- fwrite($outputfd, $cont);
- } else {
- $ret .= $cont;
- }
- }
- fclose($fd);
- }
- if (@is_resource($outputfd)) {
- fclose($outputfd);
- }
- return $ret;
- }
-
- /**
- * Creates temporal files or directories
- *
- * 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 temporal dir will be created instead of a file.
- * -t -> The target dir where the temporal (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 a PEAR_Error
- * @access public
- */
- function mktemp($args = null)
- {
- $opts = System::_parseArgs($args, 't:d');
- if (PEAR::isError($opts)) {
- return $opts;
- }
- foreach($opts[0] as $opt) {
- if($opt[0] == 'd') {
- $tmp_is_dir = true;
- } elseif($opt[0] == 't') {
- $tmpdir = $opt[1];
- }
- }
- //print_r($opts);
- $prefix = (isset($opts[1][0])) ? $opts[1][0] : 'tmp';
- if (!isset($tmpdir)) {
- $tmpdir = System::tmpdir();
- }
- System::mkDir("-p $tmpdir");
- $tmp = tempnam($tmpdir, $prefix);
- if(isset($tmp_is_dir)) {
- unlink($tmp); // be careful possible race condition here
- if (!mkdir($tmp, 0700)) {
- return $this->raiseError("Unable to create temporary directory $tmpdir");
- }
- }
- return $tmp;
- }
-
- function tmpdir()
- {
- if (OS_WINDOWS){
- if (isset($_ENV['TEMP'])) {
- return $_ENV['TEMP'];
- }
- if (isset($_ENV['TMP'])) {
- return $_ENV['TMP'];
- }
- if (isset($_ENV['windir'])) {
- return $_ENV['windir'] . '\temp';
- }
- return $_ENV['SystemRoot'] . '\temp';
- }
- if (isset($_ENV['TMPDIR'])) {
- return $_ENV['TMPDIR'];
- }
- return '/tmp';
- }
-}
-?> \ No newline at end of file
diff --git a/pear/TODO b/pear/TODO
deleted file mode 100644
index 64dde1b275..0000000000
--- a/pear/TODO
+++ /dev/null
@@ -1,20 +0,0 @@
-TODO file for PEAR. Last modified $Date$ by $Author$
-
-Legend:
-
--: noone actively working on this right now
-W: work in progress by NN
-
-Infrastructure stuff:
-
-- finish database design
-W ssb make XML DTD for package description files
-- build web site for uploading/downloading packages and XML
- description files
-W ssb build tools for installing packages from the net
-
-Bundled PEAR packages:
-
-W ssb make regression tests for DB
-- make DB_Error store queries
-W uw implement Javadoc -> phpdoc/DocBook conversion
diff --git a/pear/catalog b/pear/catalog
deleted file mode 100644
index 6e0c69d40b..0000000000
--- a/pear/catalog
+++ /dev/null
@@ -1 +0,0 @@
-PUBLIC "-//PHP Group//DTD PEAR Package 1.0//EN//XML" "package.dtd"
diff --git a/pear/install-pear.txt b/pear/install-pear.txt
deleted file mode 100644
index 3cb9338a40..0000000000
--- a/pear/install-pear.txt
+++ /dev/null
@@ -1,11 +0,0 @@
-+----------------------------------------------------------------------+
-| The installation process is incomplete. The following resources were |
-| not installed: |
-| |
-| Self-contained Extension Support |
-| PEAR: PHP Extension and Add-on Repository |
-| |
-| To install these components, become the superuser and execute: |
-| |
-| # make install-su |
-+----------------------------------------------------------------------+
diff --git a/pear/package.dtd b/pear/package.dtd
deleted file mode 100644
index 7afff8fb85..0000000000
--- a/pear/package.dtd
+++ /dev/null
@@ -1,81 +0,0 @@
-<!--
- $Id: package.dtd,v 1.14 2002-02-02 00:06:44 ssb Exp $
-
- This is the PEAR package description, version 1.1b2.
- It should be used with the informal public identifier:
-
- "-//PHP Group//DTD PEAR Package 1.1b2//EN//XML"
-
- Copyright (c) 1997-2002 The PHP Group
-
- This source file is subject to version 2.02 of the PHP license,
- that is bundled with this package in the file LICENSE, and is
- available at through the world-wide-web at
- http://www.php.net/license/2_02.txt.
- If you did not receive a copy of the PHP license and are unable to
- obtain it through the world-wide-web, please send a note to
- license@php.net so we can mail you a copy immediately.
-
- Authors:
- Stig S. Bakken <ssb@fast.no>
-
- -->
-
-<!ELEMENT package (name|summary|description|maintainers|release)*>
-<!ATTLIST package type (source|binary|empty) "empty"
- version CDATA #REQUIRED>
-
-<!ELEMENT name (#PCDATA)>
-
-<!ELEMENT summary (#PCDATA)>
-
-<!ELEMENT description (#PCDATA)>
-
-<!ELEMENT maintainers (maintainer)*>
-
-<!ELEMENT maintainer (user|role|name|email)*>
-
-<!ELEMENT user (#PCDATA)>
-
-<!ELEMENT role (#PCDATA)>
-
-<!ELEMENT email (#PCDATA)>
-
-<!ELEMENT release (version|state|date|notes|filelist|deps)*>
-
-<!ELEMENT version (#PCDATA)>
-
-<!ELEMENT state (#PCDATA)>
-
-<!ELEMENT date (#PCDATA)>
-
-<!ELEMENT notes (#PCDATA)>
-
-<!ELEMENT filelist (dir|file|libfile)*>
-
-<!ELEMENT dir (file|libfile)*>
-<!ATTLIST dir name CDATA #REQUIRED
- baseinstalldir CDATA #IMPLIED>
-
-<!ELEMENT file (#PCDATA)>
-<!ATTLIST file role (php|ext|test|doc) 'php'
- debug (na|on|off) 'na'
- threaded (na|on|off) 'na'
- format CDATA #IMPLIED
- baseinstalldir CDATA #IMPLIED>
-
-<!ELEMENT libfile (libname|sources|includes|libadd)*>
-
-<!ELEMENT libname (#PCDATA)>
-
-<!ELEMENT sources (#PCDATA)>
-
-<!ELEMENT libadd (#PCDATA)>
-
-<!ELEMENT deps (dep)*>
-
-<!ELEMENT dep (#PCDATA)>
-<!ATTLIST dep
- type (pkg|ext|php|prog|ldlib|ltlib|os|websrv|sapi) #REQUIRED
- rel (has|eq|lt|le|gt|ge) #IMPLIED
- version CDATA #IMPLIED>
diff --git a/pear/pear.m4 b/pear/pear.m4
deleted file mode 100644
index 9f12801611..0000000000
--- a/pear/pear.m4
+++ /dev/null
@@ -1,89 +0,0 @@
-
-AC_INIT(Makefile.in)
-
-AC_DEFUN(PHP_WITH_PHP_CONFIG,[
- AC_ARG_WITH(php-config,
-[ --with-php-config=PATH],[
- PHP_CONFIG=$withval
-],[
- PHP_CONFIG=php-config
-])
-
- prefix=`$PHP_CONFIG --prefix 2>/dev/null`
- INCLUDES=`$PHP_CONFIG --includes 2>/dev/null`
- EXTENSION_DIR=`$PHP_CONFIG --extension-dir`
-
- if test -z "$prefix"; then
- AC_MSG_ERROR(Cannot find php-config. Please use --with-php-config=PATH)
- fi
- AC_MSG_CHECKING(for PHP prefix)
- AC_MSG_RESULT($prefix)
- AC_MSG_CHECKING(for PHP includes)
- AC_MSG_RESULT($INCLUDES)
- AC_MSG_CHECKING(for PHP extension directory)
- AC_MSG_RESULT($EXTENSION_DIR)
-])
-
-abs_srcdir=`(cd $srcdir && pwd)`
-
-php_always_shared=yes
-
-PHP_CONFIG_NICE(config.nice)
-
-AC_PROG_CC
-AC_PROG_CC_C_O
-
-PHP_WITH_PHP_CONFIG
-
-AC_PREFIX_DEFAULT()
-
-sinclude(config.m4)
-
-enable_static=no
-enable_shared=yes
-
-AC_PROG_LIBTOOL
-
-SHARED_LIBTOOL='$(LIBTOOL)'
-PHP_COMPILE='$(LIBTOOL) --mode=compile $(COMPILE) -c $<'
-phplibdir="`pwd`/modules"
-CPPFLAGS="$CPPFLAGS -DHAVE_CONFIG_H"
-
-test "$prefix" = "NONE" && prefix="/usr/local"
-test "$exec_prefix" = "NONE" && exec_prefix='$(prefix)'
-
-PHP_SUBST(prefix)
-PHP_SUBST(exec_prefix)
-PHP_SUBST(libdir)
-PHP_SUBST(prefix)
-PHP_SUBST(phplibdir)
-
-PHP_SUBST(PHP_COMPILE)
-PHP_SUBST(CC)
-PHP_SUBST(CFLAGS)
-PHP_SUBST(CPP)
-PHP_SUBST(CPPFLAGS)
-PHP_SUBST(CXX)
-PHP_SUBST(DEFS)
-PHP_SUBST(EXTENSION_DIR)
-PHP_SUBST(EXTRA_LDFLAGS)
-PHP_SUBST(EXTRA_LIBS)
-PHP_SUBST(INCLUDES)
-PHP_SUBST(LEX)
-PHP_SUBST(LEX_OUTPUT_ROOT)
-PHP_SUBST(LFLAGS)
-PHP_SUBST(SHARED_LIBTOOL)
-PHP_SUBST(LIBTOOL)
-PHP_SUBST(SHELL)
-
-PHP_FAST_OUTPUT(Makefile)
-
-PHP_GEN_CONFIG_VARS
-PHP_GEN_MAKEFILES($PHP_FAST_OUTPUT_FILES)
-
-test -d modules || mkdir modules
-touch .deps
-
-AC_CONFIG_HEADER(config.h)
-
-AC_OUTPUT()
diff --git a/pear/scripts/pear-get.in b/pear/scripts/pear-get.in
deleted file mode 100644
index 5ff308de03..0000000000
--- a/pear/scripts/pear-get.in
+++ /dev/null
@@ -1,58 +0,0 @@
-#!@prefix@/bin/php -Cq
-<?php // -*- PHP -*-
-//
-// +----------------------------------------------------------------------+
-// | PHP Version 4 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2002 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.02 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Authors: Stig Bakken <ssb@fast.no> |
-// | Tomas V.V.Cox <cox@idecnet.com> |
-// +----------------------------------------------------------------------+
-//
-
-require_once 'PEAR.php';
-require_once 'PEAR/Remote.php';
-
-error_reporting(E_ALL & ~E_NOTICE);
-
-$subcommands = array(
- 'help' => 'help [command]',
- 'install' => 'install [-r] <package file/name>',
- 'upgrade' => 'upgrade [-r] <package file/name>',
- 'list' => 'list',
- 'info' => 'info <package name>',
-);
-
-$shortcuts = array(
- 'list' => 'remote-list',
- 'upgrade' => 'install',
-);
-
-$command_options = array(
- 'install' => 'fr',
-);
-
-include "pearcmd-common.php";
-
-if (isset($shortcuts[$command])) {
- $realcommand = $shortcuts[$command];
-} else {
- $realcommand = $command;
-}
-
-if (isset($subcommands[$command])) {
- include "pearcmd-$realcommand.php";
-} elseif (!$store_default_config && !$store_user_config) {
- usage();
-}
-
-?>
diff --git a/pear/scripts/pear.bat b/pear/scripts/pear.bat
deleted file mode 100755
index 4a818ef4be..0000000000
--- a/pear/scripts/pear.bat
+++ /dev/null
@@ -1,31 +0,0 @@
-@ECHO OFF
-
-REM ----------------------------------------------------------------------
-REM PHP version 4.0
-REM ----------------------------------------------------------------------
-REM Copyright (c) 1997-2002 The PHP Group
-REM ----------------------------------------------------------------------
-REM This source file is subject to version 2.02 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/2_02.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: pear.bat,v 1.4 2001/10/13 06:22:09 mj Exp $
-
-REM change this four lines to match the paths of your system
-REM -------------------
-set PHP_PATH=c:\php
-set PEAR_INSTALL_DIR=c:\php\pear
-set PEAR_EXTENSION_DIR=c:\php\extensions
-set PEAR_DOC_DIR=c:\php\pear
-REM -------------------
-set DIRECTORY_SEPARATOR=\
-
-%PHP_PATH%\php.exe -q %PEAR_INSTALL_DIR%\scripts\pearwin.php %1 %2 %3 %4 %5 %6
-@ECHO ON \ No newline at end of file
diff --git a/pear/scripts/pear.in b/pear/scripts/pear.in
deleted file mode 100644
index d7bb854b53..0000000000
--- a/pear/scripts/pear.in
+++ /dev/null
@@ -1,58 +0,0 @@
-#!@prefix@/bin/php -Cq
-<?php // -*- PHP -*-
-//
-// +----------------------------------------------------------------------+
-// | PHP Version 4 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2002 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.02 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Authors: Stig Bakken <ssb@fast.no> |
-// | Tomas V.V.Cox <cox@idecnet.com> |
-// +----------------------------------------------------------------------+
-//
-
-require_once 'PEAR.php';
-require_once 'PEAR/Common.php';
-require_once 'PEAR/Registry.php';
-
-error_reporting(E_ALL & ~E_NOTICE);
-
-$subcommands = array(
- 'help' => 'help [command]',
- 'uninstall' => 'uninstall [-r] <package name>',
- 'package' => 'package [package info file]',
- 'info' => 'info',
- 'list' => 'list',
- 'show-config' => 'show-config',
-);
-
-$command_options = array(
- "list" => "v",
- "uninstall" => "fr",
-);
-
-include "pearcmd-common.php";
-
-if (isset($subcommands[$command])) {
- include "pearcmd-$command.php";
-} elseif (!$store_default_config && !$store_user_config) {
- usage();
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- */
-
-?>
diff --git a/pear/scripts/pearcmd-common.php b/pear/scripts/pearcmd-common.php
deleted file mode 100644
index 6293532451..0000000000
--- a/pear/scripts/pearcmd-common.php
+++ /dev/null
@@ -1,197 +0,0 @@
-<?php
-
-require_once "PEAR/Config.php";
-require_once "Console/Getopt.php";
-
-$progname = basename($argv[0]);
-
-PEAR::setErrorHandling(PEAR_ERROR_PRINT, "$progname: %s\n");
-
-$argv = Console_Getopt::readPHPArgv();
-if (PEAR::isError($argv)) {
- die($argv->getMessage());
-}
-$options = Console_Getopt::getopt($argv, "c:C:d:D:h?sSqu:v");
-if (PEAR::isError($options)) {
- usage($options);
-}
-
-if (OS_WINDOWS) {
- $pear_default_config = PHP_SYSCONFDIR.DIRECTORY_SEPARATOR.'pearsys.ini';
- $pear_user_config = PHP_SYSCONFDIR.DIRECTORY_SEPARATOR.'pear.ini';
-} else {
- $pear_default_config = PHP_SYSCONFDIR.DIRECTORY_SEPARATOR.'pear.conf';
- $pear_user_config = getenv('HOME').DIRECTORY_SEPARATOR.'.pearrc';
-}
-
-$opts = $options[0];
-
-foreach ($opts as $opt) {
- switch ($opt[0]) {
- case 'c':
- $pear_user_config = $opt[1];
- break;
- case 'C':
- $pear_default_config = $opt[1];
- break;
- }
-}
-
-$config = new PEAR_Config($pear_user_config, $pear_default_config);
-$store_user_config = false;
-$store_default_config = false;
-$verbose = 1;
-
-foreach ($opts as $opt) {
- $param = $opt[1];
- switch ($opt[0]) {
- case 'd':
- list($key, $value) = explode('=', $param);
- $config->set($key, $value);
- break;
- case 'D':
- list($key, $value) = explode('=', $param);
- $config->set($key, $value, true);
- break;
- case 's':
- $store_user_config = true;
- break;
- case 'S':
- $store_default_config = true;
- break;
- case 'u':
- $config->toDefault($param);
- break;
- case 'v':
- $verbose++;
- break;
- case 'q':
- $verbose--;
- break;
- }
-}
-
-if ($store_default_config) {
- if (@is_writeable($pear_default_config)) {
- $config->writeConfigFile($pear_default_config, 'default');
- } else {
- die("You don't have write access to $pear_default_config, exiting!\n");
- }
-}
-
-if ($store_user_config) {
- $config->writeConfigFile($pear_user_config, 'userdefined');
-}
-
-$fallback_config = array(
- 'master_server' => 'pear.php.net',
- 'php_dir' => PEAR_INSTALL_DIR,
- 'ext_dir' => PEAR_EXTENSION_DIR,
- 'doc_dir' => PHP_DATADIR . DIRECTORY_SEPARATOR . 'pear' .
- DIRECTORY_SEPARATOR . 'doc',
- 'verbose' => true,
-);
-$fallback_done = array();
-
-foreach ($fallback_config as $key => $value) {
- if (!$config->isDefined($key)) {
- $config->set($key, $value);
- $fallback_done[$key] = true;
- }
-}
-
-//$verbose = $config->get("verbose");
-$script_dir = $config->get("php_dir");
-$ext_dir = $config->get("ext_dir");
-$doc_dir = $config->get("doc_dir");
-
-$command = (isset($options[1][1])) ? $options[1][1] : null;
-$rest = array_slice($options[1], 2);
-
-if (isset($command_options[$command])) {
- $tmp = Console_Getopt::getopt($rest, $command_options[$command]);
- if (PEAR::isError($tmp)) {
- usage($tmp);
- }
- $cmdopts = $tmp[0];
- $cmdargs = $tmp[1];
-} else {
- $cmdopts = array();
- $cmdargs = $rest;
-}
-
-// {{{ usage()
-
-function usage($error = null, $helpsubject = null)
-{
- global $progname, $subcommands;
- $stderr = fopen('php://stderr', 'w');
- if (PEAR::isError($error)) {
- fputs($stderr, $error->getMessage());
- } elseif ($error !== null) {
- fputs($stderr, $error);
- }
- fputs($stderr,
- "Usage: $progname [options] command [command-options] <parameters>\n");
- if ($helpsubject == "options") {
- fputs($stderr,
- "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".
- " -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");
- } else {
- fputs($stderr, "Type \"$progname help options\" to list all options.\n");
- }
- fputs($stderr, "Commands:".implode("\n ", $subcommands) . "\n");
- fclose($stderr);
- exit;
-}
-
-// }}}
-// {{{ present_array()
-
-function present_array(&$arr, $keys = null)
-{
- if ($keys === null) {
- $keys = array_keys($arr);
- }
- $longest_key = max(array_map("strlen", array_keys($arr))) + 2;
- $format_string = "%{$longest_key}s : %s\n";
- foreach ($keys as $k) {
- if (is_array($arr[$k])) {
- foreach ($arr[$k] as $i => $value) {
- $x = "$k #$i";
- $cont = array();
- foreach(array_keys($value) as $val) {
- $cont[] = "$val=" . $value[$val];
- }
- $v = implode(", ", $cont);
- printf($format_string, $x, $v);
- }
- continue;
- } else {
- $v = $arr[$k];
- printf($format_string, $k, $v);
- }
- }
-}
-
-// }}}
-// {{{ heading()
-
-function heading($text)
-{
- $l = strlen(trim($text));
- print rtrim($text) . "\n" . str_repeat("=", $l) . "\n";
-}
-
-// }}}
-
-?> \ No newline at end of file
diff --git a/pear/scripts/pearcmd-help.php b/pear/scripts/pearcmd-help.php
deleted file mode 100644
index 5bb8b7db9f..0000000000
--- a/pear/scripts/pearcmd-help.php
+++ /dev/null
@@ -1,9 +0,0 @@
-<?php
-
-if (isset($cmdargs[0])) {
- usage(null, $cmdargs[0]);
-} else {
- usage();
-}
-
-?> \ No newline at end of file
diff --git a/pear/scripts/pearcmd-info.php b/pear/scripts/pearcmd-info.php
deleted file mode 100644
index baa6b883be..0000000000
--- a/pear/scripts/pearcmd-info.php
+++ /dev/null
@@ -1,9 +0,0 @@
-<?php
-
-$parser = new PEAR_Common;
-$parser->setErrorHandling(PEAR_ERROR_DIE, "pear info: %s\n");
-$info = $parser->infoFromTgzFile($cmdargs[0]);
-unset($info['filelist']);
-present_array($info);
-
-?> \ No newline at end of file
diff --git a/pear/scripts/pearcmd-install.php b/pear/scripts/pearcmd-install.php
deleted file mode 100644
index 4a4a349aef..0000000000
--- a/pear/scripts/pearcmd-install.php
+++ /dev/null
@@ -1,33 +0,0 @@
-<?php
-
-include_once 'PEAR/Installer.php';
-$pkgfile = $cmdargs[0];
-$installer =& new PEAR_Installer($script_dir, $ext_dir, $doc_dir);
-$installer->setErrorHandling(PEAR_ERROR_DIE,
- basename($pkgfile) . ": %s\n");
-$installer->debug = $verbose;
-$install_options = array();
-if ($command == 'upgrade') {
- $install_options['upgrade'] = true;
-}
-foreach ($cmdopts as $opt) {
- switch ($opt[0]) {
- case 'r':
- // This option is for use by rpm and other package
- // tools that can install files etc. by itself, but
- // still needs to register the package as installed in
- // PEAR's local registry.
- $install_options['register_only'] = true;
- break;
- case 'f':
- $install_options['force'] = true;
- break;
- }
-}
-if ($installer->install($pkgfile, $install_options, $config)) {
- print "install ok\n";
-} else {
- print "install failed\n";
-}
-
-?> \ No newline at end of file
diff --git a/pear/scripts/pearcmd-list.php b/pear/scripts/pearcmd-list.php
deleted file mode 100644
index 030c0b2c98..0000000000
--- a/pear/scripts/pearcmd-list.php
+++ /dev/null
@@ -1,20 +0,0 @@
-<?php
-
-$reg = new PEAR_Registry;
-$installed = $reg->packageInfo();
-$i = $j = 0;
-heading("Installed packages:");
-foreach ($installed as $package) {
- if ($i++ % 20 == 0) {
- if ($j++ > 0) {
- print "\n";
- }
- printf("%-20s %-10s %s\n",
- "Package", "Version", "State");
- print str_repeat("-", 75)."\n";
- }
- printf("%-20s %-10s %s\n", $package['package'],
- $package['version'], $package['release_state']);
-}
-
-?>
diff --git a/pear/scripts/pearcmd-package.php b/pear/scripts/pearcmd-package.php
deleted file mode 100644
index 5cc485a937..0000000000
--- a/pear/scripts/pearcmd-package.php
+++ /dev/null
@@ -1,15 +0,0 @@
-<?php
-
-include_once 'PEAR/Packager.php';
-$pkginfofile = isset($cmdargs[0]) ? $cmdargs[0] : null;
-$packager =& new PEAR_Packager($script_dir, $ext_dir, $doc_dir);
-$packager->setErrorHandling(PEAR_ERROR_DIE, "pear page: %s\n");
-$packager->debug = $verbose;
-if (PEAR::isError($packager->Package($pkginfofile))) {
- print "\npackage failed\n";
-} else {
- print "package ok\n";
-}
-
-
-?> \ No newline at end of file
diff --git a/pear/scripts/pearcmd-remote-list.php b/pear/scripts/pearcmd-remote-list.php
deleted file mode 100644
index d30a4679fe..0000000000
--- a/pear/scripts/pearcmd-remote-list.php
+++ /dev/null
@@ -1,24 +0,0 @@
-<?php
-
-$remote = new PEAR_Remote($config);
-$result = $remote->call('package.listAll', 1);
-$i = $j = 0;
-heading("Available packages");
-foreach ($result as $package => $info) {
- if ($i++ % 20 == 0) {
- if ($j++ > 0) {
- print "\n";
- }
- printf("%-20s %-10s %-15s %s\n",
- "Package", "Stable", "Lead", "Category");
- print str_repeat("-", 75)."\n";
- }
- if (empty($info['stable'])) {
- $info['stable'] = '(none)';
- }
- $stable = (string)$info['stable'];
- printf("%-20s %-10s %-15s %s\n", $info['name'],
- $info['stable'], $info['lead'], $info['category']);
-}
-
-?> \ No newline at end of file
diff --git a/pear/scripts/pearcmd-show-config.php b/pear/scripts/pearcmd-show-config.php
deleted file mode 100644
index 0ebc70a38a..0000000000
--- a/pear/scripts/pearcmd-show-config.php
+++ /dev/null
@@ -1,16 +0,0 @@
-<?php
-
-$keys = $config->getKeys();
-foreach ($keys as $key) {
- $value = $config->get($key);
- $xi = "";
- if ($config->isDefaulted($key)) {
- $xi .= " (default)";
- }
- if (isset($fallback_done[$key])) {
- $xi .= " (built-in)";
- }
- printf("%s = %s%s\n", $key, $value, $xi);
-}
-
-?> \ No newline at end of file
diff --git a/pear/scripts/pearcmd-uninstall.php b/pear/scripts/pearcmd-uninstall.php
deleted file mode 100644
index 18f4e41931..0000000000
--- a/pear/scripts/pearcmd-uninstall.php
+++ /dev/null
@@ -1,26 +0,0 @@
-<?php
-
-include_once 'PEAR/Installer.php';
-$pkgfile = $cmdargs[0];
-$installer =& new PEAR_Installer($script_dir, $ext_dir, $doc_dir);
-$installer->setErrorHandling(PEAR_ERROR_DIE,
- basename($pkgfile) . ": %s\n");
-$installer->debug = $verbose;
-$uninstall_options = array();
-foreach ($cmdopts as $opt) {
- switch ($opt[0]) {
- case 'r':
- $uninstall_options['register_only'] = true;
- break;
- case 'f':
- $uninstall_options['force'] = true;
- break;
- }
-}
-if ($installer->uninstall($pkgfile, $uninstall_options)) {
- print "uninstall ok\n";
-} else {
- print "uninstall failed\n";
-}
-
-?>
diff --git a/pear/scripts/pearize.in b/pear/scripts/pearize.in
deleted file mode 100644
index 1a17d3f2d0..0000000000
--- a/pear/scripts/pearize.in
+++ /dev/null
@@ -1,225 +0,0 @@
-#!@prefix@/bin/php -Cq
-<?php // -*- PHP -*-
-
-main($argc, $argv, $_ENV);
-
-// {{{ main()
-
-function main(&$argc, &$argv, &$env)
-{
- global $debug;
- $debug = false;
- $file = check_options($argc, $argv, $env);
- parse_package_file($file);
- make_makefile_in($env);
-}
-
-// }}}
-// {{{ check_options()
-
-function check_options($argc, $argv, $env)
-{
- global $debug;
- array_shift($argv);
- while ($argv[0]{0} == '-' && $argv[0] != '-') {
- $opt = array_shift($argv);
- switch ($opt) {
- case '--': {
- break 2;
- }
- case '-d': {
- $debug = true;
- break;
- }
- default: {
- die("pearize: unrecognized option `$opt'\n");
- }
- }
- }
- $file = array_shift($argv);
- if (empty($file)) {
- $file = "package.xml";
- } elseif ($file == '-') {
- $file = "php://stdin";
- }
- return $file;
-}
-
-// }}}
-// {{{ make_makefile_in()
-
-function make_makefile_in(&$env)
-{
- global $libdata, $debug;
- if (sizeof($libdata) > 1) {
- die("No support yet for multiple libraries in one package.\n");
- }
-
- if ($debug) {
- $wp = fopen("php://stdout", "w");
- } else {
- $wp = @fopen("Makefile.in", "w");
- }
- if (is_resource($wp)) {
- print "Creating Makefile.in...";
- flush();
- } else {
- die("Could not create Makefile.in in current directory.\n");
- }
-
- $who = $env["USER"];
- $when = gmdate('Y-m-d h:i');
- fwrite($wp, "# This file was generated by `pearize' by $who at $when GMT\n\n");
-
- foreach ($libdata as $lib => $info) {
- extract($info);
- fwrite($wp, "\
-INCLUDES = $includes
-LTLIBRARY_NAME = lib{$lib}.la
-LTLIBRARY_SOURCES = $sources
-LTLIBRARY_SHARED_NAME = {$lib}.la
-LTLIBRARY_SHARED_LIBADD = $libadd
-");
- }
-
- if (sizeof($libdata) > 0) {
- fwrite($wp, "include \$(top_srcdir)/build/dynlib.mk\n");
- }
- fclose($wp);
- print "done.\n";
-}
-
-// }}}
-// {{{ parse_package_file()
-
-function parse_package_file($file)
-{
- global $in_file, $curlib, $curelem, $libdata, $cdata;
- global $currinstalldir, $baseinstalldir;
-
- $in_file = false;
- $curlib = '';
- $curelem = '';
- $libdata = array();
- $cdata = array();
- $baseinstalldir = array();
- $currinstalldir = array();
-
- $xp = xml_parser_create();
- xml_set_element_handler($xp, "start_handler", "end_handler");
- xml_set_character_data_handler($xp, "cdata_handler");
- xml_parser_set_option($xp, XML_OPTION_CASE_FOLDING, false);
-
- $fp = @fopen($file, "r");
- if (!is_resource($fp)) {
- die("Could not open file `$file'.\n");
- }
- while (!feof($fp)) {
- xml_parse($xp, fread($fp, 2048), feof($fp));
- }
- xml_parser_free($xp);
-}
-
-// }}}
-// {{{ start_handler()
-
-function start_handler($xp, $elem, $attrs)
-{
- global $cdata, $in_file, $curelem, $curfile, $filerole;
- global $baseinstalldir, $currinstalldir;
- switch ($elem) {
- case "file": {
- $curfile = '';
- $filerole = $attrs['role'];
- switch ($filerole) {
- case "ext": {
- $in_file = true;
- $cdata = array();
- break;
- }
- case "php": default: {
- break;
- }
- }
- break;
- }
- case "dir": {
- $cdir = $currinstalldir[sizeof($currinstalldir)-1];
- $bdir = $baseinstalldir[sizeof($baseinstalldir)-1];
- array_push($currinstalldir, "$cdir/{$attrs[name]}");
- if (isset($attrs["baseinstalldir"])) {
- array_push($baseinstalldir, "$bdir/{$attrs[baseinstalldir]}");
- } else {
- array_push($baseinstalldir, $bdir);
- }
- break;
- }
- case "includes":
- case "libname":
- case "libadd":
- case "sources": {
- $curelem = $elem;
- break;
- }
- }
-}
-
-// }}}
-// {{{ end_handler()
-
-function end_handler($xp, $elem)
-{
- global $in_file, $curlib, $curelem, $libdata, $cdata;
- global $baseinstalldir, $currinstalldir;
- switch ($elem) {
- case "file": {
- if ($in_file === true) {
- $libname = trim($cdata['libname']);
- $libdata[$libname] = array(
- "sources" => trim($cdata['sources']),
- "includes" => trim($cdata['includes']),
- "libadd" => trim($cdata['libadd']),
- );
- $in_file = false;
- }
- break;
- }
- case "dir": {
- array_pop($currinstalldir);
- array_pop($baseinstalldir);
- break;
- }
- }
-}
-
-// }}}
-// {{{ cdata_handler()
-
-function cdata_handler($xp, $data)
-{
- global $curelem, $cdata, $curfile;
- switch ($curelem) {
- case "file": {
- $curfile .= $data;
- break;
- }
- case "includes":
- case "libadd":
- case "libname":
- case "sources": {
- $cdata[$curelem] .= $data;
- break;
- }
- }
-}
-
-// }}}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
-?>
diff --git a/pear/scripts/pearwin.php b/pear/scripts/pearwin.php
deleted file mode 100644
index b58a8cbb6e..0000000000
--- a/pear/scripts/pearwin.php
+++ /dev/null
@@ -1,150 +0,0 @@
-<?php
-//
-// +----------------------------------------------------------------------+
-// | PHP Version 4 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2002 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.02 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Authors: Stig Bakken <ssb@fast.no> |
-// | Tomas V.V.Cox <cox@idecnet.com> |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-
-require_once 'PEAR.php';
-require_once 'Console/Getopt.php';
-
-error_reporting(E_ALL ^ E_NOTICE);
-
-$options = Console_Getopt::getopt($argv, "h?v:e:p:d:");
-if (PEAR::isError($options)) {
- usage($options);
-}
-
-$opts = $options[0];
-foreach ($opts as $opt) {
- $param = $opt[1];
- switch ($opt[0]) {
- case 'v':
- $verbose = $param;
- break;
- case 'e':
- if ($param{0} != getenv('DIRECTORY_SEPARATOR')) {
- usage (new PEAR_Error("no absolute path (eg. /usr/lib/php)\n"));
- }
- $ext_dir = $param;
- break;
- case 'p':
- if ($param{0} != getenv('DIRECTORY_SEPARATOR')) {
- usage (new PEAR_Error("no absolute path (eg. /usr/lib/php)\n"));
- }
- $script_dir = $param;
- break;
- case 'd':
- if ($param{0} != getenv('DIRECTORY_SEPARATOR')) {
- usage (new PEAR_Error("no absolute path (eg. /usr/lib/php)\n"));
- }
- $doc_dir = $param;
- break;
- }
-}
-
-$verbose = (isset($verbose)) ? $verbose : 1;
-$script_dir = (isset($script_dir)) ? $script_dir : getenv('PEAR_INSTALL_DIR');
-$ext_dir = (isset($ext_dir)) ? $ext_dir : getenv('PEAR_EXTENSION_DIR');
-$doc_dir = (isset($doc_dir)) ? $doc_dir : '';
-
-PEAR::setErrorHandling(PEAR_ERROR_PRINT);
-$command = $options[1][1];
-
-switch ($command) {
- case 'install':
- include_once 'PEAR/Installer.php';
- $package = $options[1][2];
- $installer =& new PEAR_Installer($script_dir, $ext_dir, $doc_dir);
- $installer->debug = $verbose;
- if (PEAR::isError($installer->Install($package))) {
- print "\ninstall failed\n";
- } else {
- print "install ok\n";
- }
- break;
- case 'uninstall':
- include_once 'PEAR/Installer.php';
- $package = $options[1][2];
- $installer =& new PEAR_Installer($script_dir, $ext_dir, $doc_dir);
- $installer->debug = $verbose;
- if (PEAR::isError($installer->uninstall($package))) {
- print "\nuninstall failed\n";
- } else {
- print "uninstall ok\n";
- }
- break;
- case 'list-installed':
- include_once 'PEAR/Registry.php';
- $reg = new PEAR_Registry($script_dir);
- $installed = $reg->packageInfo();
- $i = $j = 0;
- print("Installed packages:\n");
- foreach ($installed as $package) {
- if ($i++ % 20 == 0) {
- if ($j++ > 0) {
- print "\n";
- }
- printf("%-20s %-10s %s\n",
- "Package", "Version", "State");
- print str_repeat("-", 75)."\n";
- }
- printf("%-20s %-10s %s\n", $package['package'],
- $package['version'], $package['release_state']);
- }
- break;
- case 'package':
- include_once 'PEAR/Packager.php';
- $pkginfofile = $options[1][2];
- $packager =& new PEAR_Packager($script_dir, $ext_dir, $doc_dir);
- $packager->debug = $verbose;
- if (PEAR::isError($packager->Package($pkginfofile))) {
- print "\npackage failed\n";
- } else {
- print "package ok\n";
- }
- break;
- default:
- usage();
- break;
-}
-
-function usage($obj = null)
-{
- $stderr = fopen('php://stderr', 'w');
- if ($obj !== null) {
- fputs($stderr, $obj->getMessage());
- }
- fputs($stderr,
- "Usage: pear [-v n] [-h] [-p <dir>] [-e <dir>] [-d <dir>] command <parameters>\n".
- "Options:\n".
- " -v set verbosity level to <n> (0-2, default 1)\n".
- " -p <dir> set script install dir (absolute path)\n".
- " -e <dir> set extension install dir (absolute path)\n".
- " -d <dir> set documentation dest dir (absolute path)\n".
- " -h, -? display help/usage (this message)\n".
- "Commands:\n".
- " list-installed \n".
- " install <package file>\n".
- " uninstall <package file>\n".
- " package [package info file]\n".
- "\n");
- fclose($stderr);
- exit;
-}
-
-?> \ No newline at end of file
diff --git a/pear/scripts/php-config.in b/pear/scripts/php-config.in
deleted file mode 100644
index c2f850a000..0000000000
--- a/pear/scripts/php-config.in
+++ /dev/null
@@ -1,26 +0,0 @@
-#! /bin/sh
-
-prefix="@prefix@"
-version="@VERSION@"
-includedir="@includedir@/php"
-includes="-I$includedir -I$includedir/main -I$includedir/Zend"
-if test '@TSRM_DIR@' != ''; then
- includes="$includes -I$includedir/TSRM"
-fi
-extension_dir='@EXTENSION_DIR@'
-
-case "$1" in
---prefix)
- echo $prefix;;
---includes)
- echo $includes;;
---extension-dir)
- echo $extension_dir;;
---version)
- echo $version;;
-*)
- echo "Usage: $0 [--prefix|--includes|--extension-dir|--version]"
- exit 1;;
-esac
-
-exit 0
diff --git a/pear/scripts/phpextdist b/pear/scripts/phpextdist
deleted file mode 100755
index 97df70020d..0000000000
--- a/pear/scripts/phpextdist
+++ /dev/null
@@ -1,27 +0,0 @@
-#! /bin/sh
-if test $# -lt 2; then
- echo "usage: phpextdist <extension> <version>";
- exit 1
-fi
-
-phpize=`php-config --prefix`/bin/phpize
-distname="$1-$2"
-
-if test ! -f Makefile.in || test ! -f config.m4; then
- echo "Did not find required files in current directory"
- exit 1
-fi
-
-rm -rf modules *.lo *.o *.la config.status config.cache \
-config.log libtool php_config.h config_vars.mk Makefile
-
-myname=`basename \`pwd\``
-cd ..
-cp -rp $myname $distname
-cd $distname
-$phpize
-cd ..
-tar cf $distname.tar $distname
-rm -rf $distname $distname.tar.*
-gzip --best $distname.tar
-mv $distname.tar.gz $myname
diff --git a/pear/scripts/phpize.in b/pear/scripts/phpize.in
deleted file mode 100644
index 33b5ad2cfb..0000000000
--- a/pear/scripts/phpize.in
+++ /dev/null
@@ -1,31 +0,0 @@
-#! /bin/sh
-
-prefix='@prefix@'
-phpdir="$prefix/lib/php/build"
-builddir="`pwd`"
-FILES_BUILD="dynlib.mk fastgen.sh library.mk ltlib.mk mkdep.awk program.mk rules.mk rules_common.mk rules_pear.mk shtool"
-FILES="acinclude.m4 dynlib.m4"
-
-if test ! -r config.m4; then
- echo "Cannot find config.m4. "
- echo "Make sure that you run $0 in the top level source directory of the module"
- exit 1
-fi
-
-test -d build || mkdir build
-
-(cd $phpdir && cp $FILES_BUILD $builddir/build)
-(cd $phpdir && cp $FILES $builddir)
-
-mv build/rules_pear.mk build/rules.mk
-
-sed \
--e "s#@prefix@#$prefix#" \
-< $phpdir/pear.m4 > configure.in
-
-touch install-sh mkinstalldirs missing
-
-aclocal
-autoconf
-autoheader
-libtoolize -f -c
diff --git a/pear/scripts/phptar.in b/pear/scripts/phptar.in
deleted file mode 100755
index 08361c1d0a..0000000000
--- a/pear/scripts/phptar.in
+++ /dev/null
@@ -1,236 +0,0 @@
-#!@prefix@/bin/php -Cq
-<?php // -*- PHP -*-
-
-// {{{ setup
-
-define('S_IFDIR', 0040000); // Directory
-define('S_IFCHR', 0020000); // Character device
-define('S_IFBLK', 0060000); // Block device
-define('S_IFREG', 0100000); // Regular file
-define('S_IFIFO', 0010000); // FIFO
-define('S_IFLNK', 0120000); // Symbolic link
-define('S_IFSOCK', 0140000); // Socket
-
-require_once "PEAR.php";
-require_once "Archive/Tar.php";
-require_once "Console/Getopt.php";
-
-// }}}
-// {{{ options
-
-$verbose = false;
-$op_create = false;
-$op_list = false;
-$op_extract = false;
-$use_gzip = false;
-$file = '';
-
-$progname = basename(array_shift($argv));
-
-$options = Console_Getopt::getopt($argv, "h?ctxvzf:");
-if (PEAR::isError($options)) {
- usage($options);
-}
-
-$opts = $options[0];
-foreach ($opts as $opt) {
- switch ($opt[0]) {
- case 'v': {
- $verbose = true;
- break;
- }
- case 'c': {
- $op_create = true;
- break;
- }
- case 't': {
- $op_list = true;
- break;
- }
- case 'x': {
- $op_extract = true;
- break;
- }
- case 'z': {
- $use_gzip = true;
- break;
- }
- case 'f': {
- $file = $opt[1];
- break;
- }
- case 'h':
- case '?': {
- usage();
- break;
- }
- }
-}
-
-if ($op_create + $op_list + $op_extract > 1) {
- usage("Only one of -c, -t and -x can be specified at once!");
-}
-
-if ($op_create + $op_list + $op_extract == 0) {
- usage("Please specify either -c, -t or -x!");
-}
-
-if (empty($file)) {
- if ($op_create) {
- $file = "php://stdout";
- } else {
- $file = "php://stdin";
- }
-}
-
-// }}}
-
-$tar = new Archive_Tar($file, $use_gzip);
-$tar->setErrorHandling(PEAR_ERROR_DIE, "$progname error: %s\n");
-
-if ($op_create) {
- do_create($tar, $options[1]);
- $tar->create($options[1]);
-} elseif ($op_list) {
- do_list($tar, $verbose);
-} elseif ($op_extract) {
- do_extract($tar);
-}
-
-// {{{ getrwx()
-
-function getrwx($bits) {
- $str = '';
- $str .= ($bits & 4) ? 'r' : '-';
- $str .= ($bits & 2) ? 'w' : '-';
- $str .= ($bits & 1) ? 'x' : '-';
- return $str;
-}
-
-// }}}
-// {{{ getfiletype()
-
-function getfiletype($bits) {
- static $map = array(
- '-' => S_IFREG,
- 'd' => S_IFDIR,
- 'l' => S_IFLNK,
- 'c' => S_IFCHR,
- 'b' => S_IFBLK,
- 'p' => S_IFIFO,
- 's' => S_IFSOCK,
- );
- foreach ($map as $char => $mask) {
- if ($bits & $mask) {
- return $char;
- }
- }
-}
-
-// }}}
-// {{{ getuser()
-
-function getuser($uid) {
- static $cache = array();
- if (isset($cache[$uid])) {
- return $cache[$uid];
- }
- if (function_exists("posix_getpwuid")) {
- if (is_array($user = @posix_getpwuid($uid))) {
- $cache[$uid] = $user['name'];
- return $user['name'];
- }
- }
- $cache[$uid] = $uid;
- return $uid;
-}
-
-// }}}
-// {{{ getgroup()
-
-function getgroup($gid) {
- static $cache = array();
- if (isset($cache[$gid])) {
- return $cache[$gid];
- }
- if (function_exists("posix_getgrgid")) {
- if (is_array($group = @posix_getgrgid($gid))) {
- $cache[$gid] = $group['name'];
- return $group['name'];
- }
- }
- $cache[$gid] = $gid;
- return $gid;
-}
-
-// }}}
-// {{{ do_create()
-
-function do_create(&$tar, &$files)
-{
- $tar->create($files);
-}
-
-// }}}
-// {{{ do_list()
-
-function do_list(&$tar, $verbose)
-{
- static $rwx = array(4 => 'r', 2 => 'w', 1 => 'x');
- $files = $tar->listContent();
- if (is_array($files) && sizeof($files) > 0) {
- foreach ($files as $file) {
- if ($verbose) {
- $fm = (int)$file['mode'];
- $mode = sprintf('%s%s%s%s', getfiletype($fm),
- getrwx(($fm >> 6) & 7), getrwx(($fm >> 3) & 7),
- getrwx($fm & 7));
- $owner = getuser($file['uid']) . '/' . getgroup($file['gid']);
- printf("%10s %-11s %7d %s %s\n", $mode, $owner, $file['size'],
- date('Y-m-d H:i:s', $file['mtime']), $file['filename']);
- } else {
- printf("%s\n", $file['filename']);
- }
- }
- }
-}
-
-// }}}
-// {{{ do_extract()
-
-function do_extract(&$tar, $destdir = ".")
-{
- $tar->extract($destdir);
-}
-
-// }}}
-// {{{ usage()
-
-function usage($errormsg = '')
-{
- global $progname;
- $fp = fopen("php://stderr", "w");
- if ($errormsg) {
- if (PEAR::isError($errormsg)) {
- fwrite($fp, $errormsg->getMessage() . "\n");
- } else {
- fwrite($fp, "$errormsg\n");
- }
- }
- fwrite($fp, "$progname [-h|-?] {-c|-t|-x} [-z] [-v] [-f file] [file(s)...]
-Options:
- -h, -? Show this screen
- -c Create archive
- -t List archive
- -x Extract archive
- -z Run input/output through gzip
- -f file Use <file> as input or output (default is stdin/stdout)
-
-");
- fclose($fp);
- exit;
-}
-
-// }}}
-
-?>
diff --git a/pear/tests/pear1.phpt b/pear/tests/pear1.phpt
deleted file mode 100644
index 067c7165fe..0000000000
--- a/pear/tests/pear1.phpt
+++ /dev/null
@@ -1,87 +0,0 @@
---TEST--
-PEAR constructor/destructor test
---SKIPIF--
---FILE--
-<?php
-
-require_once "PEAR.php";
-
-class TestPEAR extends PEAR {
- function TestPEAR($name) {
- $this->_debug = true;
- $this->name = $name;
- $this->PEAR();
- }
- 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() {
- $this->PEAR();
- }
-
- 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";
-
-?>
---GET--
---POST--
---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'
diff --git a/pear/tests/pear_autoloader.phpt b/pear/tests/pear_autoloader.phpt
deleted file mode 100644
index d6c780d1ac..0000000000
--- a/pear/tests/pear_autoloader.phpt
+++ /dev/null
@@ -1,80 +0,0 @@
---TEST--
-PEAR_Autoloader
---SKIPIF--
-<?php if (!extension_loaded("overload")) die("skip\n"); ?>
---FILE--
-<?php
-
-require "../PEAR/Autoloader.php";
-
-class test1 extends PEAR_Autoloader {
- function test1() {
- $this->addAutoload(array(
- 'testfunc1' => 'testclass1',
- 'testfunca' => 'testclass1',
- 'testfunc2' => 'testclass2',
- 'testfuncb' => 'testclass2',
- ));
- }
-}
-
-class testclass1 {
- function testfunc1($a) {
- print "testfunc1 arg=";var_dump($a);
- return 1;
- }
- function testfunca($a) {
- print "testfunca arg=";var_dump($a);
- return 2;
- }
-}
-
-class testclass2 {
- function testfunc2($b) {
- print "testfunc2 arg=";var_dump($b);
- return 3;
- }
- function testfuncb($b) {
- print "testfuncb arg=";var_dump($b);
- return 4;
- }
-}
-
-function dump($obj) {
- print "mapped methods:";
- foreach ($obj->_method_map as $method => $object) {
- print " $method";
- }
- print "\n";
-}
-
-function call($msg, $retval) {
- print "calling $msg returned $retval\n";
-}
-
-$obj = new test1;
-dump($obj);
-call("testfunc1", $obj->testfunc1(2));
-dump($obj);
-call("testfunca", $obj->testfunca(2));
-dump($obj);
-call("testfunc2", $obj->testfunc2(2));
-dump($obj);
-call("testfuncb", $obj->testfuncb(2));
-dump($obj);
-
-?>
---EXPECT--
-mapped methods:
-testfunc1 arg=int(2)
-calling testfunc1 returned 1
-mapped methods: testfunc1 testfunca
-testfunca arg=int(2)
-calling testfunca returned 2
-mapped methods: testfunc1 testfunca
-testfunc2 arg=int(2)
-calling testfunc2 returned 3
-mapped methods: testfunc1 testfunca testfunc2 testfuncb
-testfuncb arg=int(2)
-calling testfuncb returned 4
-mapped methods: testfunc1 testfunca testfunc2 testfuncb
diff --git a/pear/tests/pear_config.phpt b/pear/tests/pear_config.phpt
deleted file mode 100644
index 186c3a0cc3..0000000000
--- a/pear/tests/pear_config.phpt
+++ /dev/null
@@ -1,72 +0,0 @@
---TEST--
-PEAR_Config
---FILE--
-<?php
-
-error_reporting(E_ALL);
-include "../PEAR/Config.php";
-copy("system.input", "system.conf");
-copy("user.input", "user.conf");
-PEAR::setErrorHandling(PEAR_ERROR_DIE, "%s\n");
-dumpall();
-
-print "creating config object\n";
-$config = new PEAR_Config("user.conf", "system.conf");
-
-// overriding system values
-$config->set("master_server", "pear.localdomain");
-$config->writeConfigFile();
-dumpall();
-var_dump($config->get("master_server"));
-
-// going back to defaults
-$config->toDefault("master_server");
-$config->writeConfigFile();
-dumpall();
-
-//
-
-print "done\n";
-
-unlink("user.conf");
-unlink("system.conf");
-
-// ------------------------------------------------------------------------- //
-
-function dumpit($file)
-{
- $fp = fopen($file, "r");
- print "$file:";
- $data = unserialize(fread($fp, filesize($file)));
- fclose($fp);
- if (!is_array($data)) {
- print " <empty>\n";
- return;
- }
- foreach ($data as $k => $v) {
- print " $k=\"$v\"";
- }
- print "\n";
-}
-
-function dumpall()
-{
- print "dumping...\n";
- dumpit("system.conf");
- dumpit("user.conf");
-}
-
-?>
---EXPECT--
-dumping...
-system.conf: master_server="pear.php.net"
-user.conf: <empty>
-creating config object
-dumping...
-system.conf: master_server="pear.php.net"
-user.conf: master_server="pear.localdomain"
-string(16) "pear.localdomain"
-dumping...
-system.conf: master_server="pear.php.net"
-user.conf:
-done
diff --git a/pear/tests/pear_error.phpt b/pear/tests/pear_error.phpt
deleted file mode 100644
index f4e5b12699..0000000000
--- a/pear/tests/pear_error.phpt
+++ /dev/null
@@ -1,153 +0,0 @@
---TEST--
-PEAR_Error: basic test
---SKIPIF--
---FILE--
-<?php // -*- PHP -*-
-
-// Test for: PEAR.php
-// Parts tested: - PEAR_Error class
-// - PEAR::isError static method
-
-require "../PEAR.php";
-
-function test_error_handler($errno, $errmsg, $file, $line, $vars) {
- $errortype = array (
- 1 => "Error",
- 2 => "Warning",
- 4 => "Parsing Error",
- 8 => "Notice",
- 16 => "Core Error",
- 32 => "Core Warning",
- 64 => "Compile Error",
- 128 => "Compile Warning",
- 256 => "User Error",
- 512 => "User Warning",
- 1024=> "User Notice"
- );
- if (preg_match('/^The call_user_method.. function is deprecated/',
- $errmsg)) {
- return;
- }
- $prefix = $errortype[$errno];
- $file = basename($file);
- print "\n$prefix: $errmsg in $file on line $line\n";
-}
-
-error_reporting(E_ALL);
-set_error_handler("test_error_handler");
-
-class Foo_Error extends PEAR_Error
-{
- function Foo_Error($message = "unknown error", $code = null,
- $mode = null, $options = null, $userinfo = null)
- {
- $this->PEAR_Error($message, $code, $mode, $options, $userinfo);
- $this->error_message_prefix = 'Foo_Error prefix';
- }
-}
-
-class Test1 extends PEAR {
- function Test1() {
- $this->PEAR("Foo_Error");
- }
- function runtest() {
- return $this->raiseError("test error");
- }
-}
-
-function errorhandler(&$obj) {
- print "errorhandler function called, obj=".$obj->toString()."\n";
-}
-
-class errorclass {
- function errorhandler(&$obj) {
- print "errorhandler method called, obj=".$obj->toString()."\n";
- }
-}
-
-print "specify error class: ";
-$obj = new Test1;
-$err = $obj->runtest();
-print $err->toString() . "\n";
-
-$eo = new errorclass;
-
-print "default PEAR_Error: ";
-$err = new PEAR_Error;
-print $err->toString() . "\n";
-print "Testing it: ";
-var_dump(PEAR::isError($err));
-print "This is not an error: ";
-$str = "not an error";
-var_dump(PEAR::isError($str));
-
-print "Now trying a bunch of variations...\n";
-
-print "different message: ";
-$err = new PEAR_Error("test error");
-print $err->toString() . "\n";
-
-print "different message,code: ";
-$err = new PEAR_Error("test error", -42);
-print $err->toString() . "\n";
-
-print "mode=print: ";
-$err = new PEAR_Error("test error", -42, PEAR_ERROR_PRINT);
-print $err->toString() . "\n";
-
-print "mode=callback(function): ";
-$err = new PEAR_Error("test error", -42, PEAR_ERROR_CALLBACK, "errorhandler");
-
-print "mode=callback(method): ";
-$err = new PEAR_Error("test error", -42, PEAR_ERROR_CALLBACK,
- array(&$eo, "errorhandler"));
-
-print "mode=print&trigger: ";
-$err = new PEAR_Error("test error", -42, PEAR_ERROR_PRINT|PEAR_ERROR_TRIGGER);
-print $err->toString() . "\n";
-
-print "mode=trigger:";
-$err = new PEAR_Error("test error", -42, PEAR_ERROR_TRIGGER);
-print $err->toString() . "\n";
-
-print "mode=trigger,level=notice:";
-$err = new PEAR_Error("test error", -42, PEAR_ERROR_TRIGGER, E_USER_NOTICE);
-print $err->toString() . "\n";
-
-print "mode=trigger,level=warning:";
-$err = new PEAR_Error("test error", -42, PEAR_ERROR_TRIGGER, E_USER_WARNING);
-print $err->toString() . "\n";
-
-print "mode=trigger,level=error:";
-$err = new PEAR_Error("test error", -42, PEAR_ERROR_TRIGGER, E_USER_ERROR);
-print $err->toString() . "\n";
-
-?>
---GET--
---POST--
---EXPECT--
-specify error class: [foo_error: message="test error" code=0 mode=return level=notice prefix="Foo_Error prefix" info=""]
-default PEAR_Error: [pear_error: message="unknown error" code=0 mode=return level=notice prefix="" info=""]
-Testing it: bool(true)
-This is not an error: bool(false)
-Now trying a bunch of variations...
-different message: [pear_error: message="test error" code=0 mode=return level=notice prefix="" info=""]
-different message,code: [pear_error: message="test error" code=-42 mode=return level=notice prefix="" info=""]
-mode=print: test error[pear_error: message="test error" code=-42 mode=print level=notice prefix="" info=""]
-mode=callback(function): errorhandler function called, obj=[pear_error: message="test error" code=-42 mode=callback callback=errorhandler prefix="" info=""]
-mode=callback(method): errorhandler method called, obj=[pear_error: message="test error" code=-42 mode=callback callback=errorclass::errorhandler prefix="" info=""]
-mode=print&trigger: test error
-User Notice: test error in PEAR.php on line 594
-[pear_error: message="test error" code=-42 mode=print|trigger level=notice prefix="" info=""]
-mode=trigger:
-User Notice: test error in PEAR.php on line 594
-[pear_error: message="test error" code=-42 mode=trigger level=notice prefix="" info=""]
-mode=trigger,level=notice:
-User Notice: test error in PEAR.php on line 594
-[pear_error: message="test error" code=-42 mode=trigger level=notice prefix="" info=""]
-mode=trigger,level=warning:
-User Warning: test error in PEAR.php on line 594
-[pear_error: message="test error" code=-42 mode=trigger level=warning prefix="" info=""]
-mode=trigger,level=error:
-User Error: test error in PEAR.php on line 594
-[pear_error: message="test error" code=-42 mode=trigger level=error prefix="" info=""]
diff --git a/pear/tests/pear_error2.phpt b/pear/tests/pear_error2.phpt
deleted file mode 100644
index eef585289f..0000000000
--- a/pear/tests/pear_error2.phpt
+++ /dev/null
@@ -1,24 +0,0 @@
---TEST--
-PEAR_Error: die mode
---SKIPIF--
---FILE--
-<?php // -*- C++ -*-
-
-// Test for: PEAR.php
-// Parts tested: - PEAR_Error class
-// - PEAR::isError static method
-// testing PEAR_Error
-
-require "../PEAR.php";
-
-error_reporting(E_ALL);
-
-print "mode=die: ";
-$err = new PEAR_Error("test error!!\n", -42, PEAR_ERROR_DIE);
-print $err->toString() . "\n";
-
-?>
---GET--
---POST--
---EXPECT--
-mode=die: test error!!
diff --git a/pear/tests/pear_error3.phpt b/pear/tests/pear_error3.phpt
deleted file mode 100644
index 86d82c464d..0000000000
--- a/pear/tests/pear_error3.phpt
+++ /dev/null
@@ -1,40 +0,0 @@
---TEST--
-PEAR_Error: default error handling
---FILE--
-<?php // -*- PHP -*-
-
-// Test for: PEAR.php
-// Parts tested: - PEAR_Error class
-// - PEAR::setErrorHandling
-// - PEAR::raiseError method
-
-require "../PEAR.php";
-
-error_reporting(E_ALL);
-
-function errorhandler($eobj)
-{
- if (PEAR::isError($eobj)) {
- print "errorhandler called with an error object.\n";
- print "error message: ".$eobj->getMessage()."\n";
- } else {
- print "errorhandler called, but without an error object.\n";
- }
-}
-
-$obj = new PEAR;
-$obj->setErrorHandling(PEAR_ERROR_PRINT);
-$obj->raiseError("error 1\n");
-$obj->setErrorHandling(null);
-$obj->raiseError("error 2\n");
-PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, "errorhandler");
-$obj->raiseError("error 3\n");
-$obj->setErrorHandling(PEAR_ERROR_PRINT);
-$obj->raiseError("error 4\n");
-
-?>
---EXPECT--
-error 1
-errorhandler called with an error object.
-error message: error 3
-error 4
diff --git a/pear/tests/pear_error4.phpt b/pear/tests/pear_error4.phpt
deleted file mode 100644
index 1b50637698..0000000000
--- a/pear/tests/pear_error4.phpt
+++ /dev/null
@@ -1,89 +0,0 @@
---TEST--
-PEAR_Error: expected errors
---FILE--
-<?php // -*- PHP -*-
-
-// Test for: PEAR.php
-// Parts tested: - PEAR_Error class
-// - PEAR::expectError
-// - PEAR::popExpect
-
-require "../PEAR.php";
-
-error_reporting(E_ALL);
-
-function errorhandler($eobj)
-{
- if (PEAR::isError($eobj)) {
- print "error: ".$eobj->getMessage()."\n";
- } else {
- print "errorhandler called without error object\n";
- }
-}
-
-$obj = new PEAR;
-$obj->setErrorHandling(PEAR_ERROR_CALLBACK, "errorhandler");
-
-print "subtest 1\n";
-$obj->expectError(1);
-$obj->raiseError("1", 1);
-$obj->popExpect();
-$obj->raiseError("2", 2);
-
-print "subtest 2\n";
-$obj->expectError(3);
-$obj->expectError(2);
-$obj->raiseError("3", 3);
-
-print "subtest 3\n";
-$obj->popExpect();
-$obj->raiseError("3", 3);
-$obj->popExpect();
-
-print "subtest 4\n";
-$obj->expectError(array(1,2,3,4,5));
-$obj->raiseError("0", 0);
-$obj->raiseError("1", 1);
-$obj->raiseError("2", 2);
-$obj->raiseError("3", 3);
-$obj->raiseError("4", 4);
-$obj->raiseError("5", 5);
-$obj->raiseError("6", 6);
-$obj->raiseError("error");
-$obj->popExpect();
-
-print "subtest 5\n";
-$obj->expectError("*");
-$obj->raiseError("42", 42);
-$obj->raiseError("75", 75);
-$obj->raiseError("13", 13);
-$obj->popExpect();
-
-print "subtest 6\n";
-$obj->expectError();
-$obj->raiseError("123", 123);
-$obj->raiseError("456", 456);
-$obj->raiseError("789", 789);
-$obj->popExpect();
-
-print "subtest 7\n";
-$obj->expectError("syntax error");
-$obj->raiseError("type mismatch");
-$obj->raiseError("syntax error");
-$obj->popExpect();
-
-?>
---EXPECT--
-subtest 1
-error: 2
-subtest 2
-error: 3
-subtest 3
-subtest 4
-error: 0
-error: 6
-error: error
-subtest 5
-subtest 6
-subtest 7
-error: type mismatch
diff --git a/pear/tests/pear_registry.phpt b/pear/tests/pear_registry.phpt
deleted file mode 100644
index 55af6d3aba..0000000000
--- a/pear/tests/pear_registry.phpt
+++ /dev/null
@@ -1,92 +0,0 @@
---TEST--
-PEAR_Registry
---FILE--
-<?php
-
-error_reporting(E_ALL);
-include "../PEAR/Registry.php";
-PEAR::setErrorHandling(PEAR_ERROR_DIE, "%s\n");
-cleanall();
-
-print "creating registry object\n";
-$reg = new PEAR_Registry;
-$reg->statedir = getcwd();
-dumpall($reg);
-$reg->addPackage("pkg1", array("name" => "pkg1", "version" => "1.0"));
-dumpall($reg);
-$reg->addPackage("pkg2", array("name" => "pkg2", "version" => "2.0"));
-$reg->addPackage("pkg3", array("name" => "pkg3", "version" => "3.0"));
-dumpall($reg);
-$reg->updatePackage("pkg2", array("version" => "2.1"));
-dumpall($reg);
-var_dump($reg->deletePackage("pkg2"));
-dumpall($reg);
-var_dump($reg->deletePackage("pkg2"));
-dumpall($reg);
-$reg->updatePackage("pkg3", array("version" => "3.1b1", "status" => "beta"));
-dumpall($reg);
-
-print "tests done\n";
-
-cleanall();
-
-// ------------------------------------------------------------------------- //
-
-function cleanall()
-{
- $dp = opendir(".");
- while ($ent = readdir($dp)) {
- if (substr($ent, -4) == ".reg") {
- unlink($ent);
- }
- }
-}
-
-function dumpall(&$reg)
-{
- print "dumping registry...\n";
- $info = $reg->packageInfo();
- foreach ($info as $pkg) {
- print $pkg["name"] . ":";
- unset($pkg["name"]);
- foreach ($pkg as $k => $v) {
- print " $k=\"$v\"";
- }
- print "\n";
- }
- print "dump done\n";
-}
-
-?>
---EXPECT--
-creating registry object
-dumping registry...
-dump done
-dumping registry...
-pkg1: version="1.0"
-dump done
-dumping registry...
-pkg1: version="1.0"
-pkg2: version="2.0"
-pkg3: version="3.0"
-dump done
-dumping registry...
-pkg1: version="1.0"
-pkg2: version="2.1"
-pkg3: version="3.0"
-dump done
-bool(true)
-dumping registry...
-pkg1: version="1.0"
-pkg3: version="3.0"
-dump done
-bool(false)
-dumping registry...
-pkg1: version="1.0"
-pkg3: version="3.0"
-dump done
-dumping registry...
-pkg1: version="1.0"
-pkg3: version="3.1b1" status="beta"
-dump done
-tests done
diff --git a/pear/tests/php.ini b/pear/tests/php.ini
deleted file mode 100644
index c75c9b4f11..0000000000
--- a/pear/tests/php.ini
+++ /dev/null
@@ -1,2 +0,0 @@
-; php.ini for PEAR tests
-include_path=..
diff --git a/pear/tests/system.input b/pear/tests/system.input
deleted file mode 100644
index 9c6bece157..0000000000
--- a/pear/tests/system.input
+++ /dev/null
@@ -1 +0,0 @@
-a:1:{s:13:"master_server";s:12:"pear.php.net";} \ No newline at end of file
diff --git a/pear/tests/user.input b/pear/tests/user.input
deleted file mode 100644
index e69de29bb2..0000000000
--- a/pear/tests/user.input
+++ /dev/null