summaryrefslogtreecommitdiff
path: root/pear
diff options
context:
space:
mode:
Diffstat (limited to 'pear')
-rw-r--r--pear/Archive/Tar.php1192
-rw-r--r--pear/Archive/docs/Tar.txt424
-rwxr-xr-xpear/CMD.php285
-rw-r--r--pear/CODING_STANDARDS8
-rw-r--r--pear/Console/tests/001-getopt.phpt66
-rw-r--r--pear/HTTP.php172
-rw-r--r--pear/ITX.xml21
-rw-r--r--pear/Mail.php186
-rw-r--r--pear/Makefile.frag183
-rw-r--r--pear/README18
-rw-r--r--pear/catalog1
-rw-r--r--pear/docs/Archive_Tar.txt424
-rw-r--r--pear/install-pear.php93
-rw-r--r--pear/install-pear.txt11
-rw-r--r--pear/package-Archive_Tar.xml60
-rw-r--r--pear/packages/DB-1.2.tarbin381952 -> 0 bytes
-rw-r--r--pear/packages/XML_Parser-1.0.tarbin25600 -> 0 bytes
-rw-r--r--pear/packages/XML_RPC-1.0.3.tarbin49152 -> 0 bytes
-rw-r--r--pear/pear.m4118
-rw-r--r--pear/scripts/pearize.in225
-rw-r--r--pear/scripts/pearwin.php233
-rw-r--r--pear/scripts/php-config.in26
-rwxr-xr-xpear/scripts/phpextdist27
-rw-r--r--pear/scripts/phpize.in40
-rwxr-xr-xpear/scripts/phptar.in236
-rw-r--r--pear/tests/merge.input1
-rw-r--r--pear/tests/pear1.phpt87
-rw-r--r--pear/tests/pear_autoloader.phpt80
-rw-r--r--pear/tests/pear_config.phpt215
-rw-r--r--pear/tests/pear_error.phpt153
-rw-r--r--pear/tests/pear_error2.phpt24
-rw-r--r--pear/tests/pear_error3.phpt52
-rw-r--r--pear/tests/pear_error4.phpt89
-rw-r--r--pear/tests/pear_registry.phpt93
-rw-r--r--pear/tests/pear_system.phpt95
-rw-r--r--pear/tests/php.ini2
-rw-r--r--pear/tests/system.input1
-rw-r--r--pear/tests/toonew.conf2
-rw-r--r--pear/tests/user.input0
-rw-r--r--pear/tests/user2.input1
40 files changed, 0 insertions, 4944 deletions
diff --git a/pear/Archive/Tar.php b/pear/Archive/Tar.php
deleted file mode 100644
index 3796ae2451..0000000000
--- a/pear/Archive/Tar.php
+++ /dev/null
@@ -1,1192 +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. |
-// +----------------------------------------------------------------------+
-// | Author: 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 = null)
- {
- $this->PEAR();
- if ($p_compress === null) {
- if (@file_exists($p_tarname)) {
- if ($fp = @fopen($p_tarname, "r")) {
- // look for gzip magic cookie
- $data = fread($fp, 2);
- if ($data == "\37\213") {
- $p_compress = true;
- }
- }
- } else {
- // probably a remote file or some file accessible
- // through a stream interface
- if (substr($p_tarname, -2) == 'gz') {
- $p_compress = true;
- }
- }
- }
- $this->_tarname = $p_tarname;
- if ($p_compress) { // assert zlib extension support
- $extname = 'zlib';
- if (!extension_loaded($extname)) {
- if (OS_WINDOWS) {
- @dl("php_$extname.dll");
- } else {
- @dl("$extname.so");
- }
- }
- if (!extension_loaded($extname)) {
- die("The extension '$extname' couldn't be found.\n".
- "Please make sure your version of PHP was built".
- "with '$extname' support.\n");
- return false;
- }
- }
- $this->_compress = (bool)$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 a file with the same name exist and is writable, it is replaced
- * by the new tar.
- * The method return false and a PEAR error text.
- * The $p_filelist parameter can be an array of string, each string
- * representing a filename or a directory name with their path if
- * needed. It can also be a single string with names separated by a
- * single blank.
- * For each directory added in the archive, the files and
- * sub-directories are also added.
- * See also createModify() method for more details.
- *
- * @param array $p_filelist An array of filenames and directory names, or a single
- * string with names separated by a single blank space.
- * @return true on success, false on error.
- * @see createModify()
- * @access public
- */
- function create($p_filelist)
- {
- return $this->createModify($p_filelist, '', '');
- }
- // }}}
-
- // {{{ add()
- /**
- * This method add the files / directories that are listed in $p_filelist in
- * the archive. If the archive does not exist it is created.
- * The method return false and a PEAR error text.
- * The files and directories listed are only added at the end of the archive,
- * even if a file with the same name is already archived.
- * See also createModify() method for more details.
- *
- * @param array $p_filelist An array of filenames and directory names, or a single
- * string with names separated by a single blank space.
- * @return true on success, false on error.
- * @see createModify()
- * @access public
- */
- function add($p_filelist)
- {
- return $this->addModify($p_filelist, '', '');
- }
- // }}}
-
- // {{{ extract()
- function extract($p_path='')
- {
- return $this->extractModify($p_path, '');
- }
- // }}}
-
- // {{{ listContent()
- function listContent()
- {
- $v_list_detail = array();
-
- if ($this->_openRead()) {
- if (!$this->_extractList('', $v_list_detail, "list", '', '')) {
- unset($v_list_detail);
- 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();
-
- // ----- Remove potential windows directory separator
- $p_add_dir = $this->_translateWinPath($p_add_dir);
- $p_remove_dir = $this->_translateWinPath($p_remove_dir, false);
-
- if (!$this->_file) {
- $this->_error('Invalid file descriptor');
- return false;
- }
-
- if (sizeof($p_list) == 0)
- return true;
-
- for ($j=0; ($j<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
- $p_filename = $this->_translateWinPath($p_filename, false);;
- $v_stored_filename = $p_filename;
- if (strcmp($p_filename, $p_remove_dir) == 0) {
- return true;
- }
- if ($p_remove_dir != '') {
- if (substr($p_remove_dir, -1) != '/')
- $p_remove_dir .= '/';
-
- if (substr($p_filename, 0, strlen($p_remove_dir)) == $p_remove_dir)
- $v_stored_filename = substr($p_filename, strlen($p_remove_dir));
- }
- $v_stored_filename = $this->_translateWinPath($v_stored_filename);
- if ($p_add_dir != '') {
- if (substr($p_add_dir, -1) == '/')
- $v_stored_filename = $p_add_dir.$v_stored_filename;
- else
- $v_stored_filename = $p_add_dir.'/'.$v_stored_filename;
- }
-
- $v_stored_filename = $this->_pathReduction($v_stored_filename);
-
- if (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;
-
- $p_path = $this->_translateWinPath($p_path, false);
- if ($p_path == '' || (substr($p_path, 0, 1) != '/' && substr($p_path, 0, 3) != "../" && !strpos($p_path, ':'))) {
- $p_path = "./".$p_path;
- }
- $p_remove_path = $this->_translateWinPath($p_remove_path);
-
- // ----- Look for path to remove format (should end by /)
- if (($p_remove_path != '') && (substr($p_remove_path, -1) != '/'))
- $p_remove_path .= '/';
- $p_remove_path_size = strlen($p_remove_path);
-
- switch ($p_mode) {
- case "complete" :
- $v_extract_all = TRUE;
- $v_listing = FALSE;
- break;
- case "partial" :
- $v_extract_all = FALSE;
- $v_listing = FALSE;
- break;
- case "list" :
- $v_extract_all = FALSE;
- $v_listing = TRUE;
- break;
- default :
- $this->_error('Invalid extract mode ('.$p_mode.')');
- return false;
- }
-
- clearstatcache();
-
- While (!($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()
-
- /**
- * Check if a directory exists and create it (including parent
- * dirs) if not.
- *
- * @param string $p_dir directory to check
- *
- * @return bool TRUE if the directory exists or was created
- */
- function _dirCheck($p_dir)
- {
- if ((@is_dir($p_dir)) || ($p_dir == ''))
- return true;
-
- $p_parent_dir = dirname($p_dir);
-
- if (($p_parent_dir != $p_dir) &&
- ($p_parent_dir != '') &&
- (!$this->_dirCheck($p_parent_dir)))
- return false;
-
- if (!@mkdir($p_dir, 0777)) {
- $this->_error("Unable to create directory '$p_dir'");
- return false;
- }
-
- return true;
- }
-
- // }}}
-
- // {{{ _pathReduction()
-
- /**
- * Compress path by changing for example "/dir/foo/../bar" to "/dir/bar", and
- * remove double slashes.
- *
- * @param string $p_dir path to reduce
- *
- * @return string reduced path
- *
- * @access private
- *
- */
- function _pathReduction($p_dir)
- {
- $v_result = '';
-
- // ----- Look for not empty path
- if ($p_dir != '') {
- // ----- Explode path by directory names
- $v_list = explode('/', $p_dir);
-
- // ----- Study directories from last to first
- for ($i=sizeof($v_list)-1; $i>=0; $i--) {
- // ----- Look for current path
- if ($v_list[$i] == ".") {
- // ----- Ignore this directory
- // Should be the first $i=0, but no check is done
- }
- else if ($v_list[$i] == "..") {
- // ----- Ignore it and ignore the $i-1
- $i--;
- }
- else if (($v_list[$i] == '') && ($i!=(sizeof($v_list)-1)) && ($i!=0)) {
- // ----- Ignore only the double '//' in path,
- // but not the first and last /
- } else {
- $v_result = $v_list[$i].($i!=(sizeof($v_list)-1)?'/'.$v_result:'');
- }
- }
- }
- $v_result = strtr($v_result, '\\', '/');
- return $v_result;
- }
-
- // }}}
-
- // {{{ _translateWinPath()
- function _translateWinPath($p_path, $p_remove_disk_letter=true)
- {
- if (OS_WINDOWS) {
- // ----- Look for potential disk letter
- if (($p_remove_disk_letter) && (($v_position = strpos($p_path, ':')) != false)) {
- $p_path = substr($p_path, $v_position+1);
- }
- // ----- Change potential windows directory separator
- if ((strpos($p_path, '\\') > 0) || (substr($p_path, 0,1) == '\\')) {
- $p_path = strtr($p_path, '\\', '/');
- }
- }
- return $p_path;
- }
- // }}}
-
-}
-?> \ No newline at end of file
diff --git a/pear/Archive/docs/Tar.txt b/pear/Archive/docs/Tar.txt
deleted file mode 100644
index 73bee0d786..0000000000
--- a/pear/Archive/docs/Tar.txt
+++ /dev/null
@@ -1,424 +0,0 @@
-Documentation for class Archive_Tar
-===================================
-Last update : 2001-08-15
-
-
-
-Overview :
-----------
-
- The Archive_Tar class helps in creating and managing GNU TAR format
- files compressed by GNU ZIP or not.
- The class offers basic functions like creating an archive, adding
- files in the archive, extracting files from the archive and listing
- the archive content.
- It also provide advanced functions that allow the adding and
- extraction of files with path manipulation.
-
-
-Sample :
---------
-
- // ----- Creating the object (uncompressed archive)
- $tar_object = new Archive_Tar("tarname.tar");
- $tar_object->setErrorHandling(PEAR_ERROR_PRINT);
-
- // ----- Creating the archive
- $v_list[0]="file.txt";
- $v_list[1]="data/";
- $v_list[2]="file.log";
- $tar_object->create($v_list);
-
- // ----- Adding files
- $v_list[0]="dev/file.txt";
- $v_list[1]="dev/data/";
- $v_list[2]="log/file.log";
- $tar_object->add($v_list);
-
- // ----- Adding more files
- $tar_object->add("release/newfile.log release/readme.txt");
-
- // ----- Listing the content
- if (($v_list = $tar_object->listContent()) != 0)
- for ($i=0; $i<sizeof($v_list); $i++)
- {
- echo "Filename :'".$v_list[$i][filename]."'<br>";
- echo " .size :'".$v_list[$i][size]."'<br>";
- echo " .mtime :'".$v_list[$i][mtime]."' (".date("l dS of F Y h:i:s A", $v_list[$i][mtime]).")<br>";
- echo " .mode :'".$v_list[$i][mode]."'<br>";
- echo " .uid :'".$v_list[$i][uid]."'<br>";
- echo " .gid :'".$v_list[$i][gid]."'<br>";
- echo " .typeflag :'".$v_list[$i][typeflag]."'<br>";
- }
-
- // ----- Extracting the archive in directory "install"
- $tar_object->extract("install");
-
-
-Public arguments :
-------------------
-
-None
-
-
-Public Methods :
-----------------
-
-Method : Archive_Tar($p_tarname, $compress = false)
-Description :
- Archive_Tar Class constructor. This flavour of the constructor only
- declare a new Archive_Tar object, identifying it by the name of the
- tar file.
- If the compress argument is set the tar will be read or created as a
- gzip compressed TAR file.
-Arguments :
- $p_tarname : A valid filename for the tar archive file.
- $p_compress : true/false. Indicate if the archive need to be
- compressed or not.
-Return value :
- The Archive_Tar object.
-Sample :
- $tar_object = new Archive_Tar("tarname.tar");
- $tar_object_compressed = new Archive_Tar("tarname.tgz", true);
-How it works :
- Initialize the object.
-
-Method : create($p_filelist)
-Description :
- This method creates the archive file and add the files / directories
- that are listed in $p_filelist.
- If the file already exists and is writable, it is replaced by the
- new tar. It is a create and not an add. If the file exists and is
- read-only or is a directory it is not replaced. The method return
- false and a PEAR error text.
- The $p_filelist parameter can be an array of string, each string
- representing a filename or a directory name with their path if
- needed. It can also be a single string with names separated by a
- single blank.
- See also createModify() method for more details.
-Arguments :
- $p_filelist : An array of filenames and directory names, or a single
- string with names separated by a single blank space.
-Return value :
- true on success, false on error.
-Sample 1 :
- $tar_object = new Archive_Tar("tarname.tar");
- $tar_object->setErrorHandling(PEAR_ERROR_PRINT); // Optional error handling
- $v_list[0]="file.txt";
- $v_list[1]="data/"; (Optional '/' at the end)
- $v_list[2]="file.log";
- $tar_object->create($v_list);
-Sample 2 :
- $tar_object = new Archive_Tar("tarname.tar");
- $tar_object->setErrorHandling(PEAR_ERROR_PRINT); // Optional error handling
- $tar_object->create("file.txt data/ file.log");
-How it works :
- Just calling the createModify() method with the right parameters.
-
-Method : createModify($p_filelist, $p_add_dir, $p_remove_dir = "")
-Description :
- This method creates the archive file and add the files / directories
- that are listed in $p_filelist.
- If the file already exists and is writable, it is replaced by the
- new tar. It is a create and not an add. If the file exists and is
- read-only or is a directory it is not replaced. The method return
- false and a PEAR error text.
- The $p_filelist parameter can be an array of string, each string
- representing a filename or a directory name with their path if
- needed. It can also be a single string with names separated by a
- single blank.
- The path indicated in $p_remove_dir will be removed from the
- memorized path of each file / directory listed when this path
- exists. By default nothing is removed (empty path "")
- The path indicated in $p_add_dir will be added at the beginning of
- the memorized path of each file / directory listed. However it can
- be set to empty "". The adding of a path is done after the removing
- of path.
- The path add/remove ability enables the user to prepare an archive
- for extraction in a different path than the origin files are.
- See also addModify() method for file adding properties.
-Arguments :
- $p_filelist : An array of filenames and directory names, or a single
- string with names separated by a single blank space.
- $p_add_dir : A string which contains a path to be added to the
- memorized path of each element in the list.
- $p_remove_dir : A string which contains a path to be removed from
- the memorized path of each element in the list, when
- relevant.
-Return value :
- true on success, false on error.
-Sample 1 :
- $tar_object = new Archive_Tar("tarname.tar");
- $tar_object->setErrorHandling(PEAR_ERROR_PRINT); // Optional error handling
- $v_list[0]="file.txt";
- $v_list[1]="data/"; (Optional '/' at the end)
- $v_list[2]="file.log";
- $tar_object->createModify($v_list, "install");
- // files are stored in the archive as :
- // install/file.txt
- // install/data
- // install/data/file1.txt
- // install/data/... all the files and sub-dirs of data/
- // install/file.log
-Sample 2 :
- $tar_object = new Archive_Tar("tarname.tar");
- $tar_object->setErrorHandling(PEAR_ERROR_PRINT); // Optional error handling
- $v_list[0]="dev/file.txt";
- $v_list[1]="dev/data/"; (Optional '/' at the end)
- $v_list[2]="log/file.log";
- $tar_object->createModify($v_list, "install", "dev");
- // files are stored in the archive as :
- // install/file.txt
- // install/data
- // install/data/file1.txt
- // install/data/... all the files and sub-dirs of data/
- // install/log/file.log
-How it works :
- Open the file in write mode (erasing the existing one if one),
- call the _addList() method for adding the files in an empty archive,
- add the tar footer (512 bytes block), close the tar file.
-
-
-Method : addModify($p_filelist, $p_add_dir, $p_remove_dir="")
-Description :
- This method add the files / directories listed in $p_filelist at the
- end of the existing archive. If the archive does not yet exists it
- is created.
- The $p_filelist parameter can be an array of string, each string
- representing a filename or a directory name with their path if
- needed. It can also be a single string with names separated by a
- single blank.
- The path indicated in $p_remove_dir will be removed from the
- memorized path of each file / directory listed when this path
- exists. By default nothing is removed (empty path "")
- The path indicated in $p_add_dir will be added at the beginning of
- the memorized path of each file / directory listed. However it can
- be set to empty "". The adding of a path is done after the removing
- of path.
- The path add/remove ability enables the user to prepare an archive
- for extraction in a different path than the origin files are.
- If a file/dir is already in the archive it will only be added at the
- end of the archive. There is no update of the existing archived
- file/dir. However while extracting the archive, the last file will
- replace the first one. This results in a none optimization of the
- archive size.
- If a file/dir does not exist the file/dir is ignored. However an
- error text is send to PEAR error.
- If a file/dir is not readable the file/dir is ignored. However an
- error text is send to PEAR error.
- If the resulting filename/dirname (after the add/remove option or
- not) string is greater than 99 char, the file/dir is
- ignored. However an error text is send to PEAR error.
-Arguments :
- $p_filelist : An array of filenames and directory names, or a single
- string with names separated by a single blank space.
- $p_add_dir : A string which contains a path to be added to the
- memorized path of each element in the list.
- $p_remove_dir : A string which contains a path to be removed from
- the memorized path of each element in the list, when
- relevant.
-Return value :
- true on success, false on error.
-Sample 1 :
- $tar_object = new Archive_Tar("tarname.tar");
- [...]
- $v_list[0]="dev/file.txt";
- $v_list[1]="dev/data/"; (Optional '/' at the end)
- $v_list[2]="log/file.log";
- $tar_object->addModify($v_list, "install");
- // files are stored in the archive as :
- // install/file.txt
- // install/data
- // install/data/file1.txt
- // install/data/... all the files and sub-dirs of data/
- // install/file.log
-Sample 2 :
- $tar_object = new Archive_Tar("tarname.tar");
- [...]
- $v_list[0]="dev/file.txt";
- $v_list[1]="dev/data/"; (Optional '/' at the end)
- $v_list[2]="log/file.log";
- $tar_object->addModify($v_list, "install", "dev");
- // files are stored in the archive as :
- // install/file.txt
- // install/data
- // install/data/file1.txt
- // install/data/... all the files and sub-dirs of data/
- // install/log/file.log
-How it works :
- If the archive does not exists it create it and add the files.
- If the archive does exists and is not compressed, it open it, jump
- before the last empty 512 bytes block (tar footer) and add the files
- at this point.
- If the archive does exists and is compressed, a temporary copy file
- is created. This temporary file is then 'gzip' read block by block
- until the last empty block. The new files are then added in the
- compressed file.
- The adding of files is done by going through the file/dir list,
- adding files per files, in a recursive way through the
- directory. Each time a path need to be added/removed it is done
- before writing the file header in the archive.
-
-Method : add($p_filelist)
-Description :
- This method add the files / directories listed in $p_filelist at the
- end of the existing archive. If the archive does not yet exists it
- is created.
- The $p_filelist parameter can be an array of string, each string
- representing a filename or a directory name with their path if
- needed. It can also be a single string with names separated by a
- single blank.
- See addModify() method for details and limitations.
-Arguments :
- $p_filelist : An array of filenames and directory names, or a single
- string with names separated by a single blank space.
-Return value :
- true on success, false on error.
-Sample 1 :
- $tar_object = new Archive_Tar("tarname.tar");
- [...]
- $v_list[0]="dev/file.txt";
- $v_list[1]="dev/data/"; (Optional '/' at the end)
- $v_list[2]="log/file.log";
- $tar_object->add($v_list);
-Sample 2 :
- $tar_object = new Archive_Tar("tarname.tgz", true);
- [...]
- $v_list[0]="dev/file.txt";
- $v_list[1]="dev/data/"; (Optional '/' at the end)
- $v_list[2]="log/file.log";
- $tar_object->add($v_list);
-How it works :
- Simply call the addModify() method with the right parameters.
-
-Method : extract($p_path = "")
-Description :
- This method extract all the content of the archive in the directory
- indicated by $p_path.If $p_path is optional, if not set the archive
- is extracted in the current directory.
- While extracting a file, if the directory path does not exists it is
- created.
- See extractModify() for details and limitations.
-Arguments :
- $p_path : Optional path where the files/dir need to by extracted.
-Return value :
- true on success, false on error.
-Sample :
- $tar_object = new Archive_Tar("tarname.tar");
- $tar_object->extract();
-How it works :
- Simply call the extractModify() method with appropriate parameters.
-
-Method : extractModify($p_path, $p_remove_path)
-Description :
- This method extract all the content of the archive in the directory
- indicated by $p_path. When relevant the memorized path of the
- files/dir can be modified by removing the $p_remove_path path at the
- beginning of the file/dir path.
- While extracting a file, if the directory path does not exists it is
- created.
- While extracting a file, if the file already exists it is replaced
- without looking for last modification date.
- While extracting a file, if the file already exists and is write
- protected, the extraction is aborted.
- While extracting a file, if a directory with the same name already
- exists, the extraction is aborted.
- While extracting a directory, if a file with the same name already
- exists, the extraction is aborted.
- While extracting a file/directory if the destination directory exist
- and is write protected, or does not exist but can not be created,
- the extraction is aborted.
- If after extraction an extracted file does not show the correct
- stored file size, the extraction is aborted.
- When the extraction is aborted, a PEAR error text is set and false
- is returned. However the result can be a partial extraction that may
- need to be manually cleaned.
-Arguments :
- $p_path : The path of the directory where the files/dir need to by
- extracted.
- $p_remove_path : Part of the memorized path that can be removed if
- present at the beginning of the file/dir path.
-Return value :
- true on success, false on error.
-Sample :
- // Imagine tarname.tar with files :
- // dev/data/file.txt
- // dev/data/log.txt
- // readme.txt
- $tar_object = new Archive_Tar("tarname.tar");
- $tar_object->extractModify("install", "dev");
- // Files will be extracted there :
- // install/data/file.txt
- // install/data/log.txt
- // install/readme.txt
-How it works :
- Open the archive and call a more generic function that can extract
- only a part of the archive or all the archive.
- See extractList() method for more details.
-
-Method : listContent()
-Description :
- This method returns an array of arrays that describe each
- file/directory present in the archive.
- The array is not sorted, so it show the position of the file in the
- archive.
- The file informations are :
- $file[filename] : Name and path of the file/dir.
- $file[mode] : File permissions (result of fileperms())
- $file[uid] : user id
- $file[gid] : group id
- $file[size] : filesize
- $file[mtime] : Last modification time (result of filemtime())
- $file[typeflag] : "" for file, "5" for directory
-Arguments :
-Return value :
- An array of arrays or 0 on error.
-Sample :
- $tar_object = new Archive_Tar("tarname.tar");
- if (($v_list = $tar_object->listContent()) != 0)
- for ($i=0; $i<sizeof($v_list); $i++)
- {
- echo "Filename :'".$v_list[$i][filename]."'<br>";
- echo " .size :'".$v_list[$i][size]."'<br>";
- echo " .mtime :'".$v_list[$i][mtime]."' (".
- date("l dS of F Y h:i:s A", $v_list[$i][mtime]).")<br>";
- echo " .mode :'".$v_list[$i][mode]."'<br>";
- echo " .uid :'".$v_list[$i][uid]."'<br>";
- echo " .gid :'".$v_list[$i][gid]."'<br>";
- echo " .typeflag :'".$v_list[$i][typeflag]."'<br>";
- }
-How it works :
- Call the same function as an extract however with a flag to only go
- through the archive without extracting the files.
-
-Method : extractList($p_filelist, $p_path = "", $p_remove_path = "")
-Description :
- This method extract from the archive only the files indicated in the
- $p_filelist. These files are extracted in the current directory or
- in the directory indicated by the optional $p_path parameter.
- If indicated the $p_remove_path can be used in the same way as it is
- used in extractModify() method.
-Arguments :
- $p_filelist : An array of filenames and directory names, or a single
- string with names separated by a single blank space.
- $p_path : The path of the directory where the files/dir need to by
- extracted.
- $p_remove_path : Part of the memorized path that can be removed if
- present at the beginning of the file/dir path.
-Return value :
- true on success, false on error.
-Sample :
- // Imagine tarname.tar with files :
- // dev/data/file.txt
- // dev/data/log.txt
- // readme.txt
- $tar_object = new Archive_Tar("tarname.tar");
- $tar_object->extractList("dev/data/file.txt readme.txt", "install",
- "dev");
- // Files will be extracted there :
- // install/data/file.txt
- // install/readme.txt
-How it works :
- Go through the archive and extract only the files present in the
- list.
-
diff --git a/pear/CMD.php b/pear/CMD.php
deleted file mode 100755
index e33544463e..0000000000
--- a/pear/CMD.php
+++ /dev/null
@@ -1,285 +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. |
-// +----------------------------------------------------------------------+
-// | Author: 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/tests/001-getopt.phpt b/pear/Console/tests/001-getopt.phpt
deleted file mode 100644
index 440a8834c9..0000000000
--- a/pear/Console/tests/001-getopt.phpt
+++ /dev/null
@@ -1,66 +0,0 @@
---TEST--
-Console_Getopt
---FILE--
-<?php
-
-error_reporting(E_ALL);
-chdir(dirname(__FILE__));
-include "../Getopt.php";
-PEAR::setErrorHandling(PEAR_ERROR_PRINT, "%s\n\n");
-
-function test($argstr, $optstr) {
- $argv = split('[[:space:]]+', $argstr);
- if (PEAR::isError($options = Console_Getopt::getopt($argv, $optstr))) {
- return;
- }
- $opts = $options[0];
- $non_opts = $options[1];
- $i = 0;
- print "options: ";
- foreach ($opts as $o => $d) {
- if ($i++ > 0) {
- print ", ";
- }
- print $d[0] . '=' . $d[1];
- }
- print "\n";
- print "params: " . implode(", ", $non_opts) . "\n";
- print "\n";
-}
-
-test("-abc", "abc");
-test("-abc foo", "abc");
-test("-abc foo", "abc:");
-test("-abc foo bar gazonk", "abc");
-test("-abc foo bar gazonk", "abc:");
-test("-a -b -c", "abc");
-test("-a -b -c", "abc:");
-test("-abc", "ab:c");
-test("-abc foo -bar gazonk", "abc");
-?>
---EXPECT--
-options: a=, b=, c=
-params:
-
-options: a=, b=, c=
-params: foo
-
-options: a=, b=, c=foo
-params:
-
-options: a=, b=, c=
-params: foo, bar, gazonk
-
-options: a=, b=, c=foo
-params: bar, gazonk
-
-options: a=, b=, c=
-params:
-
-Console_Getopt: option requires an argument -- c
-
-options: a=, b=c
-params:
-
-options: a=, b=, c=
-params: foo, -bar, gazonk
diff --git a/pear/HTTP.php b/pear/HTTP.php
deleted file mode 100644
index 9f28094848..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. |
-// +----------------------------------------------------------------------+
-// | Author: 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 (isset($HTTP_SERVER_VARS['REMOTE_HOST']) &&
- 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 75259454c5..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. |
-// +----------------------------------------------------------------------+
-// | Author: 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.frag b/pear/Makefile.frag
deleted file mode 100644
index ca171320c5..0000000000
--- a/pear/Makefile.frag
+++ /dev/null
@@ -1,183 +0,0 @@
-# -*- makefile -*-
-
-pear_install_targets = \
- install-pear \
- install-headers \
- install-build \
- install-programs
-
-peardir=$(PEAR_INSTALLDIR)
-
-#PEAR_SUBDIRS = \
-# Archive \
-# Console \
-# PEAR \
-# PEAR/Command \
-# PEAR/Frontend \
-# XML
-
-# These are moving to /pear (in cvs):
-# Crypt \
-# File \
-# Date \
-# DB \
-# HTML \
-# HTTP \
-# Image \
-# Mail \
-# Net \
-# Schedule \
-
-#PEAR_FILES = \
-# Archive/Tar.php \
-# Console/Getopt.php \
-# PEAR.php \
-# PEAR/Autoloader.php \
-# PEAR/Command.php \
-# PEAR/Command/Auth.php \
-# PEAR/Command/Common.php \
-# PEAR/Command/Config.php \
-# PEAR/Command/Install.php \
-# PEAR/Command/Package.php \
-# PEAR/Command/Registry.php \
-# PEAR/Command/Remote.php \
-# PEAR/Frontend/CLI.php \
-# PEAR/Frontend/Gtk.php \
-# PEAR/Common.php \
-# PEAR/Config.php \
-# PEAR/Dependency.php \
-# PEAR/Installer.php \
-# PEAR/Packager.php \
-# PEAR/Registry.php \
-# PEAR/Remote.php \
-# System.php \
-# XML/Parser.php
-
-# These are moving to /pear (in cvs):
-# Crypt/CBC.php \
-# Crypt/HCEMD5.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 \
-# Date/Calc.php \
-# Date/Human.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 \
-# Mail.php \
-# Mail/RFC822.php \
-# Mail/sendmail.php \
-# Mail/smtp.php \
-# Net/Curl.php \
-# Net/Dig.php \
-# Net/SMTP.php \
-# Net/Socket.php \
-# Schedule/At.php \
-
-PEARCMD=$(top_builddir)/sapi/cli/php -d include_path=$(top_srcdir)/pear pear/scripts/pear.in
-
-install-pear-installer: $(top_builddir)/sapi/cli/php
- $(top_builddir)/sapi/cli/php $(srcdir)/install-pear.php $(srcdir)/package-*.xml
-
-install-pear-packages: $(top_builddir)/sapi/cli/php
- $(top_builddir)/sapi/cli/php $(srcdir)/install-pear.php $(srcdir)/packages/*.tar
-
-install-pear:
- @if $(mkinstalldirs) $(INSTALL_ROOT)$(peardir); then \
- $(MAKE) install-pear-installer; \
- $(MAKE) install-pear-packages; \
- else \
- cat $(srcdir)/install-pear.txt; \
- exit 5; \
- fi
-
-phpincludedir = $(includedir)/php
-phpbuilddir = $(prefix)/lib/php/build
-
-BUILD_FILES = \
- pear/pear.m4 \
- build/mkdep.awk \
- build/shtool \
- Makefile.global \
- scan_makefile_in.awk \
- acinclude.m4
-
-bin_SCRIPTS = phpize php-config pear 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 $(builddir)/scripts/$$prog $(INSTALL_ROOT)$(bindir)/$$prog; \
- done; \
- for file in $(INSTALL_ROOT)$(bindir)/pearcmd-*.php; do \
- rm -f $$file; \
- done; \
- for prog in phpextdist; do \
- echo "Installing program: $$prog"; \
- $(INSTALL) -m 755 $(srcdir)/scripts/$$prog $(INSTALL_ROOT)$(bindir)/$$prog; \
- done
-
-HEADER_DIRS = \
- / \
- Zend \
- TSRM \
- ext/standard \
- ext/session \
- ext/xml \
- ext/xml/expat \
- main \
- ext/mbstring \
- ext/pgsql \
- 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
-
-$(builddir)/scripts/pear: $(srcdir)/scripts/pear.in $(top_builddir)/config.status
- (CONFIG_FILES=$@ CONFIG_HEADERS= $(top_builddir)/config.status)
-
-$(builddir)/scripts/phpize: $(srcdir)/scripts/phpize.in $(top_builddir)/config.status
- (CONFIG_FILES=$@ CONFIG_HEADERS= $(top_builddir)/config.status)
-
-$(builddir)/scripts/phptar: $(srcdir)/scripts/phptar.in $(top_builddir)/config.status
- (CONFIG_FILES=$@ CONFIG_HEADERS= $(top_builddir)/config.status)
-
-$(builddir)/scripts/pearize: $(srcdir)/scripts/pearize.in $(top_builddir)/config.status
- (CONFIG_FILES=$@ CONFIG_HEADERS= $(top_builddir)/config.status)
-
-$(builddir)/scripts/php-config: $(srcdir)/scripts/php-config.in $(top_builddir)/config.status
- (CONFIG_FILES=$@ CONFIG_HEADERS= $(top_builddir)/config.status)
diff --git a/pear/README b/pear/README
deleted file mode 100644
index c953c26b13..0000000000
--- a/pear/README
+++ /dev/null
@@ -1,18 +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.
-
-
-DOCUMENTATION
-
-Documentation for PEAR can be found at http://pear.php.net/manual/.
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/docs/Archive_Tar.txt b/pear/docs/Archive_Tar.txt
deleted file mode 100644
index 73bee0d786..0000000000
--- a/pear/docs/Archive_Tar.txt
+++ /dev/null
@@ -1,424 +0,0 @@
-Documentation for class Archive_Tar
-===================================
-Last update : 2001-08-15
-
-
-
-Overview :
-----------
-
- The Archive_Tar class helps in creating and managing GNU TAR format
- files compressed by GNU ZIP or not.
- The class offers basic functions like creating an archive, adding
- files in the archive, extracting files from the archive and listing
- the archive content.
- It also provide advanced functions that allow the adding and
- extraction of files with path manipulation.
-
-
-Sample :
---------
-
- // ----- Creating the object (uncompressed archive)
- $tar_object = new Archive_Tar("tarname.tar");
- $tar_object->setErrorHandling(PEAR_ERROR_PRINT);
-
- // ----- Creating the archive
- $v_list[0]="file.txt";
- $v_list[1]="data/";
- $v_list[2]="file.log";
- $tar_object->create($v_list);
-
- // ----- Adding files
- $v_list[0]="dev/file.txt";
- $v_list[1]="dev/data/";
- $v_list[2]="log/file.log";
- $tar_object->add($v_list);
-
- // ----- Adding more files
- $tar_object->add("release/newfile.log release/readme.txt");
-
- // ----- Listing the content
- if (($v_list = $tar_object->listContent()) != 0)
- for ($i=0; $i<sizeof($v_list); $i++)
- {
- echo "Filename :'".$v_list[$i][filename]."'<br>";
- echo " .size :'".$v_list[$i][size]."'<br>";
- echo " .mtime :'".$v_list[$i][mtime]."' (".date("l dS of F Y h:i:s A", $v_list[$i][mtime]).")<br>";
- echo " .mode :'".$v_list[$i][mode]."'<br>";
- echo " .uid :'".$v_list[$i][uid]."'<br>";
- echo " .gid :'".$v_list[$i][gid]."'<br>";
- echo " .typeflag :'".$v_list[$i][typeflag]."'<br>";
- }
-
- // ----- Extracting the archive in directory "install"
- $tar_object->extract("install");
-
-
-Public arguments :
-------------------
-
-None
-
-
-Public Methods :
-----------------
-
-Method : Archive_Tar($p_tarname, $compress = false)
-Description :
- Archive_Tar Class constructor. This flavour of the constructor only
- declare a new Archive_Tar object, identifying it by the name of the
- tar file.
- If the compress argument is set the tar will be read or created as a
- gzip compressed TAR file.
-Arguments :
- $p_tarname : A valid filename for the tar archive file.
- $p_compress : true/false. Indicate if the archive need to be
- compressed or not.
-Return value :
- The Archive_Tar object.
-Sample :
- $tar_object = new Archive_Tar("tarname.tar");
- $tar_object_compressed = new Archive_Tar("tarname.tgz", true);
-How it works :
- Initialize the object.
-
-Method : create($p_filelist)
-Description :
- This method creates the archive file and add the files / directories
- that are listed in $p_filelist.
- If the file already exists and is writable, it is replaced by the
- new tar. It is a create and not an add. If the file exists and is
- read-only or is a directory it is not replaced. The method return
- false and a PEAR error text.
- The $p_filelist parameter can be an array of string, each string
- representing a filename or a directory name with their path if
- needed. It can also be a single string with names separated by a
- single blank.
- See also createModify() method for more details.
-Arguments :
- $p_filelist : An array of filenames and directory names, or a single
- string with names separated by a single blank space.
-Return value :
- true on success, false on error.
-Sample 1 :
- $tar_object = new Archive_Tar("tarname.tar");
- $tar_object->setErrorHandling(PEAR_ERROR_PRINT); // Optional error handling
- $v_list[0]="file.txt";
- $v_list[1]="data/"; (Optional '/' at the end)
- $v_list[2]="file.log";
- $tar_object->create($v_list);
-Sample 2 :
- $tar_object = new Archive_Tar("tarname.tar");
- $tar_object->setErrorHandling(PEAR_ERROR_PRINT); // Optional error handling
- $tar_object->create("file.txt data/ file.log");
-How it works :
- Just calling the createModify() method with the right parameters.
-
-Method : createModify($p_filelist, $p_add_dir, $p_remove_dir = "")
-Description :
- This method creates the archive file and add the files / directories
- that are listed in $p_filelist.
- If the file already exists and is writable, it is replaced by the
- new tar. It is a create and not an add. If the file exists and is
- read-only or is a directory it is not replaced. The method return
- false and a PEAR error text.
- The $p_filelist parameter can be an array of string, each string
- representing a filename or a directory name with their path if
- needed. It can also be a single string with names separated by a
- single blank.
- The path indicated in $p_remove_dir will be removed from the
- memorized path of each file / directory listed when this path
- exists. By default nothing is removed (empty path "")
- The path indicated in $p_add_dir will be added at the beginning of
- the memorized path of each file / directory listed. However it can
- be set to empty "". The adding of a path is done after the removing
- of path.
- The path add/remove ability enables the user to prepare an archive
- for extraction in a different path than the origin files are.
- See also addModify() method for file adding properties.
-Arguments :
- $p_filelist : An array of filenames and directory names, or a single
- string with names separated by a single blank space.
- $p_add_dir : A string which contains a path to be added to the
- memorized path of each element in the list.
- $p_remove_dir : A string which contains a path to be removed from
- the memorized path of each element in the list, when
- relevant.
-Return value :
- true on success, false on error.
-Sample 1 :
- $tar_object = new Archive_Tar("tarname.tar");
- $tar_object->setErrorHandling(PEAR_ERROR_PRINT); // Optional error handling
- $v_list[0]="file.txt";
- $v_list[1]="data/"; (Optional '/' at the end)
- $v_list[2]="file.log";
- $tar_object->createModify($v_list, "install");
- // files are stored in the archive as :
- // install/file.txt
- // install/data
- // install/data/file1.txt
- // install/data/... all the files and sub-dirs of data/
- // install/file.log
-Sample 2 :
- $tar_object = new Archive_Tar("tarname.tar");
- $tar_object->setErrorHandling(PEAR_ERROR_PRINT); // Optional error handling
- $v_list[0]="dev/file.txt";
- $v_list[1]="dev/data/"; (Optional '/' at the end)
- $v_list[2]="log/file.log";
- $tar_object->createModify($v_list, "install", "dev");
- // files are stored in the archive as :
- // install/file.txt
- // install/data
- // install/data/file1.txt
- // install/data/... all the files and sub-dirs of data/
- // install/log/file.log
-How it works :
- Open the file in write mode (erasing the existing one if one),
- call the _addList() method for adding the files in an empty archive,
- add the tar footer (512 bytes block), close the tar file.
-
-
-Method : addModify($p_filelist, $p_add_dir, $p_remove_dir="")
-Description :
- This method add the files / directories listed in $p_filelist at the
- end of the existing archive. If the archive does not yet exists it
- is created.
- The $p_filelist parameter can be an array of string, each string
- representing a filename or a directory name with their path if
- needed. It can also be a single string with names separated by a
- single blank.
- The path indicated in $p_remove_dir will be removed from the
- memorized path of each file / directory listed when this path
- exists. By default nothing is removed (empty path "")
- The path indicated in $p_add_dir will be added at the beginning of
- the memorized path of each file / directory listed. However it can
- be set to empty "". The adding of a path is done after the removing
- of path.
- The path add/remove ability enables the user to prepare an archive
- for extraction in a different path than the origin files are.
- If a file/dir is already in the archive it will only be added at the
- end of the archive. There is no update of the existing archived
- file/dir. However while extracting the archive, the last file will
- replace the first one. This results in a none optimization of the
- archive size.
- If a file/dir does not exist the file/dir is ignored. However an
- error text is send to PEAR error.
- If a file/dir is not readable the file/dir is ignored. However an
- error text is send to PEAR error.
- If the resulting filename/dirname (after the add/remove option or
- not) string is greater than 99 char, the file/dir is
- ignored. However an error text is send to PEAR error.
-Arguments :
- $p_filelist : An array of filenames and directory names, or a single
- string with names separated by a single blank space.
- $p_add_dir : A string which contains a path to be added to the
- memorized path of each element in the list.
- $p_remove_dir : A string which contains a path to be removed from
- the memorized path of each element in the list, when
- relevant.
-Return value :
- true on success, false on error.
-Sample 1 :
- $tar_object = new Archive_Tar("tarname.tar");
- [...]
- $v_list[0]="dev/file.txt";
- $v_list[1]="dev/data/"; (Optional '/' at the end)
- $v_list[2]="log/file.log";
- $tar_object->addModify($v_list, "install");
- // files are stored in the archive as :
- // install/file.txt
- // install/data
- // install/data/file1.txt
- // install/data/... all the files and sub-dirs of data/
- // install/file.log
-Sample 2 :
- $tar_object = new Archive_Tar("tarname.tar");
- [...]
- $v_list[0]="dev/file.txt";
- $v_list[1]="dev/data/"; (Optional '/' at the end)
- $v_list[2]="log/file.log";
- $tar_object->addModify($v_list, "install", "dev");
- // files are stored in the archive as :
- // install/file.txt
- // install/data
- // install/data/file1.txt
- // install/data/... all the files and sub-dirs of data/
- // install/log/file.log
-How it works :
- If the archive does not exists it create it and add the files.
- If the archive does exists and is not compressed, it open it, jump
- before the last empty 512 bytes block (tar footer) and add the files
- at this point.
- If the archive does exists and is compressed, a temporary copy file
- is created. This temporary file is then 'gzip' read block by block
- until the last empty block. The new files are then added in the
- compressed file.
- The adding of files is done by going through the file/dir list,
- adding files per files, in a recursive way through the
- directory. Each time a path need to be added/removed it is done
- before writing the file header in the archive.
-
-Method : add($p_filelist)
-Description :
- This method add the files / directories listed in $p_filelist at the
- end of the existing archive. If the archive does not yet exists it
- is created.
- The $p_filelist parameter can be an array of string, each string
- representing a filename or a directory name with their path if
- needed. It can also be a single string with names separated by a
- single blank.
- See addModify() method for details and limitations.
-Arguments :
- $p_filelist : An array of filenames and directory names, or a single
- string with names separated by a single blank space.
-Return value :
- true on success, false on error.
-Sample 1 :
- $tar_object = new Archive_Tar("tarname.tar");
- [...]
- $v_list[0]="dev/file.txt";
- $v_list[1]="dev/data/"; (Optional '/' at the end)
- $v_list[2]="log/file.log";
- $tar_object->add($v_list);
-Sample 2 :
- $tar_object = new Archive_Tar("tarname.tgz", true);
- [...]
- $v_list[0]="dev/file.txt";
- $v_list[1]="dev/data/"; (Optional '/' at the end)
- $v_list[2]="log/file.log";
- $tar_object->add($v_list);
-How it works :
- Simply call the addModify() method with the right parameters.
-
-Method : extract($p_path = "")
-Description :
- This method extract all the content of the archive in the directory
- indicated by $p_path.If $p_path is optional, if not set the archive
- is extracted in the current directory.
- While extracting a file, if the directory path does not exists it is
- created.
- See extractModify() for details and limitations.
-Arguments :
- $p_path : Optional path where the files/dir need to by extracted.
-Return value :
- true on success, false on error.
-Sample :
- $tar_object = new Archive_Tar("tarname.tar");
- $tar_object->extract();
-How it works :
- Simply call the extractModify() method with appropriate parameters.
-
-Method : extractModify($p_path, $p_remove_path)
-Description :
- This method extract all the content of the archive in the directory
- indicated by $p_path. When relevant the memorized path of the
- files/dir can be modified by removing the $p_remove_path path at the
- beginning of the file/dir path.
- While extracting a file, if the directory path does not exists it is
- created.
- While extracting a file, if the file already exists it is replaced
- without looking for last modification date.
- While extracting a file, if the file already exists and is write
- protected, the extraction is aborted.
- While extracting a file, if a directory with the same name already
- exists, the extraction is aborted.
- While extracting a directory, if a file with the same name already
- exists, the extraction is aborted.
- While extracting a file/directory if the destination directory exist
- and is write protected, or does not exist but can not be created,
- the extraction is aborted.
- If after extraction an extracted file does not show the correct
- stored file size, the extraction is aborted.
- When the extraction is aborted, a PEAR error text is set and false
- is returned. However the result can be a partial extraction that may
- need to be manually cleaned.
-Arguments :
- $p_path : The path of the directory where the files/dir need to by
- extracted.
- $p_remove_path : Part of the memorized path that can be removed if
- present at the beginning of the file/dir path.
-Return value :
- true on success, false on error.
-Sample :
- // Imagine tarname.tar with files :
- // dev/data/file.txt
- // dev/data/log.txt
- // readme.txt
- $tar_object = new Archive_Tar("tarname.tar");
- $tar_object->extractModify("install", "dev");
- // Files will be extracted there :
- // install/data/file.txt
- // install/data/log.txt
- // install/readme.txt
-How it works :
- Open the archive and call a more generic function that can extract
- only a part of the archive or all the archive.
- See extractList() method for more details.
-
-Method : listContent()
-Description :
- This method returns an array of arrays that describe each
- file/directory present in the archive.
- The array is not sorted, so it show the position of the file in the
- archive.
- The file informations are :
- $file[filename] : Name and path of the file/dir.
- $file[mode] : File permissions (result of fileperms())
- $file[uid] : user id
- $file[gid] : group id
- $file[size] : filesize
- $file[mtime] : Last modification time (result of filemtime())
- $file[typeflag] : "" for file, "5" for directory
-Arguments :
-Return value :
- An array of arrays or 0 on error.
-Sample :
- $tar_object = new Archive_Tar("tarname.tar");
- if (($v_list = $tar_object->listContent()) != 0)
- for ($i=0; $i<sizeof($v_list); $i++)
- {
- echo "Filename :'".$v_list[$i][filename]."'<br>";
- echo " .size :'".$v_list[$i][size]."'<br>";
- echo " .mtime :'".$v_list[$i][mtime]."' (".
- date("l dS of F Y h:i:s A", $v_list[$i][mtime]).")<br>";
- echo " .mode :'".$v_list[$i][mode]."'<br>";
- echo " .uid :'".$v_list[$i][uid]."'<br>";
- echo " .gid :'".$v_list[$i][gid]."'<br>";
- echo " .typeflag :'".$v_list[$i][typeflag]."'<br>";
- }
-How it works :
- Call the same function as an extract however with a flag to only go
- through the archive without extracting the files.
-
-Method : extractList($p_filelist, $p_path = "", $p_remove_path = "")
-Description :
- This method extract from the archive only the files indicated in the
- $p_filelist. These files are extracted in the current directory or
- in the directory indicated by the optional $p_path parameter.
- If indicated the $p_remove_path can be used in the same way as it is
- used in extractModify() method.
-Arguments :
- $p_filelist : An array of filenames and directory names, or a single
- string with names separated by a single blank space.
- $p_path : The path of the directory where the files/dir need to by
- extracted.
- $p_remove_path : Part of the memorized path that can be removed if
- present at the beginning of the file/dir path.
-Return value :
- true on success, false on error.
-Sample :
- // Imagine tarname.tar with files :
- // dev/data/file.txt
- // dev/data/log.txt
- // readme.txt
- $tar_object = new Archive_Tar("tarname.tar");
- $tar_object->extractList("dev/data/file.txt readme.txt", "install",
- "dev");
- // Files will be extracted there :
- // install/data/file.txt
- // install/readme.txt
-How it works :
- Go through the archive and extract only the files present in the
- list.
-
diff --git a/pear/install-pear.php b/pear/install-pear.php
deleted file mode 100644
index 0af598add7..0000000000
--- a/pear/install-pear.php
+++ /dev/null
@@ -1,93 +0,0 @@
-<?php
-
-$pear_dir = dirname(__FILE__);
-ini_set('include_path', $pear_dir);
-##//include_once 'PEAR/Config.php';
-include_once 'PEAR.php';
-include_once 'PEAR/Installer.php';
-include_once 'PEAR/Registry.php';
-include_once 'PEAR/Frontend/CLI.php';
-
-##//$config = &PEAR_Config::singleton();
-
-array_shift($argv);
-if ($argv[0] == '--force') {
- array_shift($argv);
- $force = true;
-} else {
- $force = false;
-}
-// package => install_file
-$install_files = array();
-
-/*
-$dp = opendir($pear_dir);
-while ($ent = readdir($dp)) {
- if (ereg('^package-(.*)\.xml$', $ent, $matches)) {
- $install_files[$matches[1]] = $ent;
- }
-}
-closedir($dp);
-*/
-foreach ($argv as $arg) {
- $bn = basename($arg);
- if (ereg('^package-(.*)\.xml$', $bn, $matches) ||
- ereg('^([A-Za-z0-9_:]+)-.*\.(tar|tgz)$', $bn, $matches)) {
- $install_files[$matches[1]] = $arg;
- }
-}
-
-$config = &PEAR_Config::singleton();
-
-// make sure we use only default values
-$config_layers = $config->getLayers();
-foreach ($config_layers as $layer) {
- if ($layer == 'default') continue;
- $config->removeLayer($layer);
-}
-$config->set('verbose', 0, 'default');
-
-$reg = &new PEAR_Registry($config->get('php_dir'));
-$ui = &new PEAR_Frontend_CLI();
-$installer = &new PEAR_Installer($ui);
-
-foreach ($install_files as $package => $instfile) {
- if ($reg->packageExists($package)) {
- $info = $installer->infoFromAny($instfile);
- if (PEAR::isError($info)) {
- $ui->displayLine(sprintf("[PEAR] %s: %s", $package, $info->getMessage()));
- continue;
- }
- $new_ver = $info['version'];
- $old_ver = $reg->packageInfo($package, 'version');
- if (version_compare($new_ver, $old_ver, 'gt')) {
- $err = $installer->install($instfile, array('upgrade' => true));
- if (PEAR::isError($err)) {
- $ui->displayLine(sprintf("[PEAR] %s: %s", $package, $err->getMessage()));
- continue;
- }
- $ui->displayLine(sprintf("[PEAR] %-15s- upgraded: %s", $package, $new_ver));
- } else {
- if (@$argv[1] == '--force') {
- $err = $installer->install($instfile, array('force' => true));
- if (PEAR::isError($err)) {
- $ui->displayLine(sprintf("[PEAR] %s: %s", $package, $err->getMessage()));
- continue;
- }
- $ui->displayLine(sprintf("[PEAR] %-15s- installed: %s", $package, $new_ver));
- } else {
- $ui->displayLine(sprintf("[PEAR] %-15s- already installed: %s", $package, $old_ver));
- }
- }
- } else {
- $err = $installer->install($instfile);
- if (PEAR::isError($err)) {
- $ui->displayLine(sprintf("[PEAR] %s: %s", $package, $err->getMessage()));
- continue;
- }
- $new_ver = $reg->packageInfo($package, 'version');
- $ui->displayLine(sprintf("[PEAR] %-15s- installed: %s", $package, $new_ver));
- }
-}
-
-?> \ No newline at end of file
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-Archive_Tar.xml b/pear/package-Archive_Tar.xml
deleted file mode 100644
index 64ee07b5c8..0000000000
--- a/pear/package-Archive_Tar.xml
+++ /dev/null
@@ -1,60 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1" ?>
-<!DOCTYPE package SYSTEM "package.dtd">
-<package version="1.0">
- <name>Archive_Tar</name>
- <summary>Tar file management class</summary>
- <description>This class provides handling of tar files in PHP.
-It supports creating, listing, extracting and adding to tar files.
-Gzip support is available if PHP has the zlib extension built-in or
-loaded.
-</description>
- <license>PHP License</license>
- <maintainers>
- <maintainer>
- <user>vblavet</user>
- <role>lead</role>
- <name>Vincent Blavet</name>
- <email>vincent@blavet.net</email>
- </maintainer>
- <maintainer>
- <user>ssb</user>
- <role>helper</role>
- <name>Stig Sæther Bakken</name>
- <email>stig@php.net</email>
- </maintainer>
- </maintainers>
- <release>
- <version>0.9</version>
- <date>2002-05-27</date>
- <notes>
- * Auto-detect gzip'ed files
- </notes>
- <state>stable</state>
- <filelist>
- <dir name="Archive">
- <file role="php" name="Tar.php"/>
- </dir>
- <file role="doc" name="docs/Archive_Tar.txt" baseinstalldir="/"/>
- </filelist>
- </release>
- <changelog>
- <release>
- <version>0.4</version>
- <date>2002-05-20</date>
- <notes>Windows bugfix: use forward slashes inside archives</notes>
- <state>stable</state>
- </release>
- <release>
- <version>0.2</version>
- <date>2002-02-18</date>
- <notes>From initial commit to stable</notes>
- <state>stable</state>
- </release>
- <release>
- <version>0.3</version>
- <date>2002-04-13</date>
- <notes>Windows bugfix: used wrong directory separators</notes>
- <state>stable</state>
- </release>
- </changelog>
-</package>
diff --git a/pear/packages/DB-1.2.tar b/pear/packages/DB-1.2.tar
deleted file mode 100644
index 7a9d1c0ddd..0000000000
--- a/pear/packages/DB-1.2.tar
+++ /dev/null
Binary files differ
diff --git a/pear/packages/XML_Parser-1.0.tar b/pear/packages/XML_Parser-1.0.tar
deleted file mode 100644
index a9f416d56a..0000000000
--- a/pear/packages/XML_Parser-1.0.tar
+++ /dev/null
Binary files differ
diff --git a/pear/packages/XML_RPC-1.0.3.tar b/pear/packages/XML_RPC-1.0.3.tar
deleted file mode 100644
index 5e35e1cf1c..0000000000
--- a/pear/packages/XML_RPC-1.0.3.tar
+++ /dev/null
Binary files differ
diff --git a/pear/pear.m4 b/pear/pear.m4
deleted file mode 100644
index c6f8cf0a0a..0000000000
--- a/pear/pear.m4
+++ /dev/null
@@ -1,118 +0,0 @@
-dnl This file becomes configure.in for self-contained extensions.
-
-AC_INIT(config.m4)
-
-PHP_INIT_BUILD_SYSTEM
-
-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)
-])
-dnl
-AC_DEFUN(PHP_EXT_BUILDDIR,[.])dnl
-AC_DEFUN(PHP_EXT_DIR,[""])dnl
-AC_DEFUN(PHP_EXT_SRCDIR,[$abs_srcdir])dnl
-AC_DEFUN(PHP_ALWAYS_SHARED,[
- ext_output="yes, shared"
- ext_shared=yes
- test "[$]$1" = "no" && $1=yes
-])dnl
-dnl
-abs_srcdir=`(cd $srcdir && pwd)`
-abs_builddir=`pwd`
-
-PHP_CONFIG_NICE(config.nice)
-
-AC_PROG_CC
-AC_PROG_CC_C_O
-
-PHP_SHLIB_SUFFIX_NAME
-PHP_WITH_PHP_CONFIG
-
-PHP_BUILD_SHARED
-
-AC_PREFIX_DEFAULT()
-
-AC_ARG_WITH(openssl,
-[ --with-openssl[=DIR] Include OpenSSL support (requires OpenSSL >= 0.9.5) ],
-[
- if test "$withval" != "no"; then
- PHP_WITH_SHARED
- PHP_OPENSSL=$withval
- ext_openssl_shared=yes
- ext_shared=yes
- PHP_SETUP_OPENSSL
- fi
-])
-
-sinclude(config.m4)
-
-enable_static=no
-enable_shared=yes
-
-AC_PROG_LIBTOOL
-
-all_targets='$(PHP_MODULES)'
-install_targets=install-modules
-phplibdir="`pwd`/modules"
-CPPFLAGS="$CPPFLAGS -DHAVE_CONFIG_H"
-
-test "$prefix" = "NONE" && prefix="/usr/local"
-test "$exec_prefix" = "NONE" && exec_prefix='$(prefix)'
-
-PHP_SUBST(PHP_MODULES)
-PHP_SUBST(all_targets)
-PHP_SUBST(install_targets)
-
-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(LDFLAGS)
-PHP_SUBST(SHARED_LIBTOOL)
-PHP_SUBST(LIBTOOL)
-PHP_SUBST(SHELL)
-
-PHP_GEN_BUILD_DIRS
-PHP_GEN_GLOBAL_MAKEFILE
-
-test -d modules || mkdir modules
-touch .deps
-
-AC_CONFIG_HEADER(config.h)
-
-AC_OUTPUT()
diff --git a/pear/scripts/pearize.in b/pear/scripts/pearize.in
deleted file mode 100644
index 0a9beec459..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:
- */
-// vim600:syn=php
-?>
diff --git a/pear/scripts/pearwin.php b/pear/scripts/pearwin.php
deleted file mode 100644
index d3383918a4..0000000000
--- a/pear/scripts/pearwin.php
+++ /dev/null
@@ -1,233 +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 'PEAR/Common.php';
-require_once 'PEAR/Config.php';
-require_once 'PEAR/Remote.php';
-require_once 'PEAR/Registry.php';
-require_once 'Console/Getopt.php';
-
-error_reporting(E_ALL ^ E_NOTICE);
-
-$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);
-}
-
-
-$php_sysconfdir = getenv('PHP_SYSCONFDIR');
-if (!empty($php_sysconfdir)) {
- $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.'pearsys.ini';
- $pear_user_config = PHP_SYSCONFDIR.DIRECTORY_SEPARATOR.'pear.ini';
-}
-
-$opts = $options[0];
-
-//echo "ini_get : ".ini_get("pear_install_dir")."\n";
-//echo "get_cfg_var : ".get_cfg_var("pear_install_dir")."\n";
-
-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' => getenv('PEAR_INSTALL_DIR'),
- 'ext_dir' => getenv('PEAR_EXTENSION_DIR'),
- 'doc_dir' => getenv('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");
-
-PEAR::setErrorHandling(PEAR_ERROR_PRINT);
-
-$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;
-}
-
-
-/* Extracted from pearcmd-common.php */
-function heading($text)
-{
- $l = strlen(trim($text));
- print rtrim($text) . "\n" . str_repeat("=", $l) . "\n";
-}
-
-switch ($command) {
- case 'install':
- include 'pearcmd-install.php';
- break;
- case 'uninstall':
- include 'pearcmd-uninstall.php';
- break;
- case 'list':
- include 'pearcmd-list.php';
- break;
- case 'package':
- include 'pearcmd-package.php';
- break;
- case 'remote-list':
- include 'pearcmd-remote-list.php';
- break;
- case 'show-config':
- $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);
- }
- break;
- default: {
- if (!$store_default_config && !$store_user_config) {
- usage();
- }
- break;
- }
-}
-
-function usage($obj = null)
-{
- $stderr = fopen('php://stderr', 'w');
- if ($obj !== null) {
- fputs($stderr, $obj->getMessage());
- }
- fputs($stderr,
- "Usage: pear [options] command [command-options] <parameters>\n".
- "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".
- "Commands:\n".
- " help [command]\n".
- " install [-r] <package file>\n".
- " uninstall [-r] <package name>\n".
- " package [package info file]\n".
- " list\n".
- " remote-list\n".
- " show-config\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 bcb6ef35f8..0000000000
--- a/pear/scripts/php-config.in
+++ /dev/null
@@ -1,26 +0,0 @@
-#! /bin/sh
-
-prefix="@prefix@"
-version="@PHP_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 daf22c9cd5..0000000000
--- a/pear/scripts/phpize.in
+++ /dev/null
@@ -1,40 +0,0 @@
-#! /bin/sh
-
-prefix='@prefix@'
-phpdir="$prefix/lib/php/build"
-includedir="$prefix/include/php"
-builddir="`pwd`"
-FILES_BUILD="mkdep.awk shtool"
-FILES="acinclude.m4 Makefile.global scan_makefile_in.awk"
-
-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)
-
-sed \
--e "s#@prefix@#$prefix#" \
-< $phpdir/pear.m4 > configure.in
-
-touch install-sh mkinstalldirs missing
-
-aclocal
-autoconf
-autoheader
-libtoolize -f -c
-
-# dumping API NOs:
-PHP_API_VERSION=`egrep '#define PHP_API_VERSION' $includedir/main/php.h|sed 's/#define PHP_API_VERSION//'`
-ZEND_MODULE_API_NO=`egrep '#define ZEND_MODULE_API_NO' $includedir/Zend/zend_modules.h|sed 's/#define ZEND_MODULE_API_NO//'`
-ZEND_EXTENSION_API_NO=`egrep '#define ZEND_EXTENSION_API_NO' $includedir/Zend/zend_extensions.h|sed 's/#define ZEND_EXTENSION_API_NO//'`
-
-echo "Configuring for:"
-echo " PHP Api Version: "$PHP_API_VERSION
-echo " Zend Module Api No: "$ZEND_MODULE_API_NO
-echo " Zend Extension Api No: "$ZEND_EXTENSION_API_NO
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/merge.input b/pear/tests/merge.input
deleted file mode 100644
index 440106ea45..0000000000
--- a/pear/tests/merge.input
+++ /dev/null
@@ -1 +0,0 @@
-a:1:{s:7:"verbose";i:100;} \ No newline at end of file
diff --git a/pear/tests/pear1.phpt b/pear/tests/pear1.phpt
deleted file mode 100644
index c1d5c1d679..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 d75189c2b3..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
-
-include dirname(__FILE__)."/../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 5478319f73..0000000000
--- a/pear/tests/pear_config.phpt
+++ /dev/null
@@ -1,215 +0,0 @@
---TEST--
-PEAR_Config
---FILE--
-<?php
-
-error_reporting(E_ALL);
-chdir(dirname(__FILE__));
-include "../PEAR/Config.php";
-copy("system.input", "system.conf");
-copy("user.input", "user.conf");
-copy("user2.input", "user2.conf");
-copy("merge.input", "merge.conf");
-PEAR::setErrorHandling(PEAR_ERROR_PRINT, "%s\n");
-
-print "#0 starting up\n";
-dump_files();
-
-print "#1 testing: constructor\n";
-$config = new PEAR_Config("user.conf", "system.conf");
-dump_array("files", $config->files);
-
-print "#2 testing: singleton\n";
-$o1 = &PEAR_Config::singleton();
-$o1->blah = 'blah';
-$o2 = &PEAR_Config::singleton();
-var_dump($o1->blah);
-@var_dump($o2->blah);
-
-print "#3 testing: readConfigFile\n";
-$config->readConfigFile("user2.conf", "user");
-dump_config($config);
-$config->readConfigFile("user.conf");
-dump_config($config);
-
-print "#4 testing: mergeConfigFile\n";
-$config->readConfigFile("user2.conf");
-dump_config($config, "user");
-$config->mergeConfigFile("merge.conf", true);
-dump_config($config, "user");
-$config->readConfigFile("user2.conf");
-$config->mergeConfigFile("merge.conf", false);
-dump_config($config, "user");
-$config->readConfigFile("user.conf");
-dump_config($config, "user");
-$config->mergeConfigFile("merge.conf", true, "xyzzy");
-
-print "#5 testing: config file version detection\n";
-$config->readConfigFile("user.conf", "user");
-$config->readConfigFile("toonew.conf", "user");
-
-print "#6 testing: get/set/remove\n";
-var_dump($config->get("verbose"));
-$config->set("verbose", 100, "system");
-var_dump($config->get("verbose"));
-$config->set("verbose", 2, "user");
-var_dump($config->get("verbose"));
-$config->set("verbose", 2, "system");
-$config->set("verbose", 50, "user");
-var_dump($config->get("verbose"));
-$config->remove("verbose", "user");
-var_dump($config->get("verbose"));
-$config->remove("verbose", "system");
-var_dump($config->get("verbose"));
-
-print "#7 testing: getType\n";
-var_dump($config->getType("__unknown__"));
-var_dump($config->getType("verbose"));
-var_dump($config->getType("master_server"));
-var_dump($config->getType("ext_dir"));
-
-print "#8 testing: getDocs\n";
-print "master_server: " . $config->getDocs("master_server") . "\n";
-
-print "#9 testing: getKeys\n";
-$keys = $config->getKeys();
-sort($keys);
-print implode(" ", $keys) . "\n";
-
-print "#10 testing: definedBy\n";
-var_dump($config->definedBy("verbose"));
-$config->set("verbose", 6, "system");
-$config->set("verbose", 3, "user");
-var_dump($config->definedBy("verbose"));
-$config->remove("verbose", "system");
-var_dump($config->definedBy("verbose"));
-$config->set("verbose", 6, "system");
-$config->remove("verbose", "user");
-var_dump($config->definedBy("verbose"));
-$config->remove("verbose", "system");
-var_dump($config->definedBy("verbose"));
-
-print "#11 testing: isDefined\n";
-var_dump($config->isDefined("php_dir"));
-var_dump($config->isDefined("verbose"));
-var_dump($config->isDefined("HTTP_GET_VARS"));
-var_dump($config->isDefined("query"));
-
-/*
-print "setting user values\n";
-var_dump($config->set("master_server", "pear.localdomain"));
-var_dump($config->writeConfigFile(null, "user"));
-dumpall();
-
-print "going back to defaults\n";
-$config->remove("master_server", "user");
-$config->writeConfigFile(null, "user");
-dumpall();
-*/
-
-//
-
-print "done\n";
-
-unlink("user.conf");
-unlink("user2.conf");
-unlink("system.conf");
-unlink("merge.conf");
-
-// ------------------------------------------------------------------------- //
-
-function dump_file($file)
-{
- print "..$file:";
- $data = PEAR_Config::_readConfigDataFrom($file);
- if (empty($data)) {
- print " <empty>\n";
- return;
- }
- foreach ($data as $k => $v) {
- print " $k=\"$v\"";
- }
- print "\n";
-}
-
-function dump_files() {
- dump_file("system.conf");
- dump_file("user.conf");
-}
-
-function dump_array($name, $arr) {
- print "$name:";
- if (empty($arr)) {
- print " <empty>";
- } else {
- foreach ($arr as $k => $v) {
- print " $k=\"$v\"";
- }
- }
- print "\n";
-}
-
-function dump_config(&$obj, $layer = null) {
- if ($layer !== null) {
- dump_array($layer, $obj->configuration[$layer]);
- return;
- }
- foreach ($obj->configuration as $layer => $data) {
- if ($layer == "default") {
- continue;
- }
- dump_array($layer, $data);
- }
-}
-
-?>
---EXPECT--
-#0 starting up
-..system.conf: master_server="pear.php.net"
-..user.conf: <empty>
-#1 testing: constructor
-files: system="system.conf" user="user.conf"
-#2 testing: singleton
-string(4) "blah"
-string(4) "blah"
-#3 testing: readConfigFile
-user: verbose="2"
-system: master_server="pear.php.net"
-user: <empty>
-system: master_server="pear.php.net"
-#4 testing: mergeConfigFile
-user: verbose="2"
-user: verbose="100"
-user: verbose="2"
-user: <empty>
-unknown config file type `xyzzy'
-#5 testing: config file version detection
-toonew.conf: unknown version `2.0'
-#6 testing: get/set/remove
-int(1)
-int(100)
-int(2)
-int(50)
-int(2)
-int(1)
-#7 testing: getType
-bool(false)
-string(7) "integer"
-string(6) "string"
-string(9) "directory"
-#8 testing: getDocs
-master_server: name of the main PEAR server
-#9 testing: getKeys
-bin_dir data_dir doc_dir ext_dir http_proxy master_server password php_dir preferred_state test_dir umask username verbose
-#10 testing: definedBy
-string(7) "default"
-string(4) "user"
-string(4) "user"
-string(6) "system"
-string(7) "default"
-#11 testing: isDefined
-bool(true)
-bool(true)
-bool(false)
-bool(false)
-done
diff --git a/pear/tests/pear_error.phpt b/pear/tests/pear_error.phpt
deleted file mode 100644
index e602aa2887..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
-
-include dirname(__FILE__)."/../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 XXX\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 XXX
-[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 XXX
-[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 XXX
-[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 XXX
-[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 XXX
-[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 476374cba4..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
-
-include dirname(__FILE__)."/../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 fb26c9a2b0..0000000000
--- a/pear/tests/pear_error3.phpt
+++ /dev/null
@@ -1,52 +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
-
-include dirname(__FILE__)."/../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";
- }
-}
-
-// Test 1
-PEAR::setErrorHandling(PEAR_ERROR_PRINT, "OOPS: %s\n");
-$tmp = new PEAR;
-$tmp->raiseError("error happens");
-
-// Return PEAR to its original state
-$GLOBALS['_PEAR_default_error_mode'] = PEAR_ERROR_RETURN;
-$GLOBALS['_PEAR_default_error_options'] = E_USER_NOTICE;
-$GLOBALS['_PEAR_default_error_callback'] = '';
-
-// Test 2
-$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");
-$obj->setErrorHandling(PEAR_ERROR_PRINT);
-$obj->raiseError("error 4\n");
-
-?>
---EXPECT--
-OOPS: error happens
-error 1
-errorhandler called with an error object.
-error message: error 3
-error 4 \ No newline at end of file
diff --git a/pear/tests/pear_error4.phpt b/pear/tests/pear_error4.phpt
deleted file mode 100644
index 5ceee5a8ad..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
-
-include dirname(__FILE__)."/../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 214ecbfe79..0000000000
--- a/pear/tests/pear_registry.phpt
+++ /dev/null
@@ -1,93 +0,0 @@
---TEST--
-PEAR_Registry
---FILE--
-<?php
-
-error_reporting(E_ALL);
-include dirname(__FILE__)."/../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) {
- if ($k == '_lastmodified') continue;
- 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/pear_system.phpt b/pear/tests/pear_system.phpt
deleted file mode 100644
index 3c8e3371b5..0000000000
--- a/pear/tests/pear_system.phpt
+++ /dev/null
@@ -1,95 +0,0 @@
---TEST--
-System commands tests
---SKIPIF--
---FILE--
-<?php
-error_reporting(E_ALL);
-require_once 'System.php';
-
-$sep = DIRECTORY_SEPARATOR;
-
-/*******************
- mkDir
-********************/
-
-// Multiple directory creation
-System::mkDir('dir1 dir2 dir3');
-if (!@is_dir('dir1') || !@is_dir('dir2') || !@is_dir('dir3')) {
- print "System::mkDir('dir1 dir2 dir3'); failed\n";
-}
-
-// Parent creation without "-p" fail
-if (@System::mkDir("dir4{$sep}dir3")) {
- print "System::mkDir(\"dir4{$sep}dir3\") did not failed\n";
-}
-
-// Create a directory which is a file already fail
-touch('file4');
-$res = @System::mkDir('file4 dir5');
-if ($res) {
- print "System::mkDir('file4 dir5') did not failed\n";
-}
-if (!@is_dir('dir5')) {
- print "System::mkDir('file4 dir5') failed\n";
-}
-
-// Parent directory creation
-System::mkDir("-p dir2{$sep}dir21 dir6{$sep}dir61{$sep}dir611");
-if (!@is_dir("dir2{$sep}dir21") || !@is_dir("dir6{$sep}dir61{$sep}dir611")) {
- print "System::mkDir(\"-p dir2{$sep}dir21 dir6{$sep}dir61{$sep}dir611\")); failed\n";
-}
-
-/*******************
- mkTemp
-********************/
-
-// Create a temporal file with "tst" as filename prefix
-$tmpfile = System::mkTemp('tst');
-$tmpenv = System::tmpDir();
-if (!@is_file($tmpfile) || !ereg("^$tmpenv{$sep}tst", $tmpfile)) {
- print "System::mkTemp('tst') failed\n";
-}
-
-// Create a temporal dir in "dir1" with default prefix "tmp"
-$tmpdir = System::mkTemp('-d -t dir1');
-if (!@is_dir($tmpdir) || !ereg("^dir1{$sep}tmp", $tmpdir)) {
- print "System::mkTemp('-d -t dir1') failed\n";
-}
-
-/*******************
- rm
-********************/
-
-// Try to delete a dir without "-r" option
-if (@System::rm('dir1')) {
- print "System::rm('dir1') did not fail\n";
-}
-
-// Multiple and recursive delete
-$del = "dir1 dir2 dir3 file4 dir5 dir6";
-if (!@System::rm("-r $del")) {
- print "System::rm(\"-r $del\") failed\n";
-}
-
-/*******************
- type
-********************/
-
-if (OS_UNIX) {
- if (System::type('ls') != '/bin/ls') {
- print "System::type('ls') failed\n";
- }
- if (System::type('i_am_not_a_command')) {
- print "System::type('i_am_not_a_command') did not failed\n";
- }
-} // XXX Windows test
-
-/*******************
- cat
-********************/
-// Missing tests yet
-
-print "end\n";
-?>
---EXPECT--
-end
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/toonew.conf b/pear/tests/toonew.conf
deleted file mode 100644
index 6f0c72fe4b..0000000000
--- a/pear/tests/toonew.conf
+++ /dev/null
@@ -1,2 +0,0 @@
-#PEAR_Config 2.0
-master_server = pear.php.net
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
diff --git a/pear/tests/user2.input b/pear/tests/user2.input
deleted file mode 100644
index ac9a8afc0d..0000000000
--- a/pear/tests/user2.input
+++ /dev/null
@@ -1 +0,0 @@
-a:1:{s:7:"verbose";i:2;} \ No newline at end of file