From: SVN Migration Date: Tue, 9 Apr 2002 17:15:18 +0000 (+0000) Subject: This commit was manufactured by cvs2svn to create branch 'PHP_4_2_0'. X-Git-Tag: php-4.2.0RC3~29 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=618fe005e6cc4ceeee95afd0d82950eb1f87dfac;p=php This commit was manufactured by cvs2svn to create branch 'PHP_4_2_0'. --- diff --git a/pear/Makefile.frag b/pear/Makefile.frag new file mode 100644 index 0000000000..1395913117 --- /dev/null +++ b/pear/Makefile.frag @@ -0,0 +1,191 @@ +# -*- 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/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 \ + +PEAR_PACKAGES=\ + Net_Socket-1.0.tgz + + +install-pear: + @if $(mkinstalldirs) $(INSTALL_ROOT)$(peardir); then \ + for i in $(PEAR_SUBDIRS); do \ + $(mkinstalldirs) $(INSTALL_ROOT)$(peardir)/$$i; \ + done; \ + for dir in PEAR/CommandUI; do \ + test -d $(INSTALL_ROOT)$(peardir)/$$dir && rm -rf $(INSTALL_ROOT)$(peardir)/$$dir; \ + done; \ + for i in $(PEAR_FILES); do \ + echo "Installing $$i"; \ + dir=`echo $$i|sed 's%[^/][^/]*$$%%'`; \ + $(INSTALL_DATA) $(srcdir)/$$i $(INSTALL_ROOT)$(peardir)/$$dir; \ + done; \ + rm -f $(INSTALL_ROOT)$(peardir)/PEAR/Command/Login.php; \ + rm -f $(INSTALL_ROOT)$(peardir)/PEAR/CommandUI/CLI.php; \ + rm -f $(INSTALL_ROOT)$(peardir)/PEAR/CommandResponse.php; \ + rm -f $(INSTALL_ROOT)$(peardir)/PEAR/Uploader.php; \ + 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/PEAR/Command/Package.php b/pear/PEAR/Command/Package.php new file mode 100644 index 0000000000..eb2d9771b2 --- /dev/null +++ b/pear/PEAR/Command/Package.php @@ -0,0 +1,389 @@ + | +// +----------------------------------------------------------------------+ +// +// $Id$ + +require_once 'PEAR/Command/Common.php'; +require_once 'PEAR/Packager.php'; +require_once 'PEAR/Common.php'; + +class PEAR_Command_Package extends PEAR_Command_Common +{ + // {{{ constructor + + /** + * PEAR_Command_Package constructor. + * + * @access public + */ + function PEAR_Command_Package(&$ui, &$config) + { + parent::PEAR_Command_Common($ui, $config); + } + + // }}} + + // {{{ _displayValidationResults() + + function _displayValidationResults($err, $warn, $strict = false) + { + foreach ($err as $e) { + $this->ui->displayLine("Error: $e"); + } + foreach ($warn as $w) { + $this->ui->displayLine("Warning: $w"); + } + $this->ui->displayLine(sprintf('Validation: %d error(s), %d warning(s)', + sizeof($err), sizeof($warn))); + if ($strict && sizeof($err) > 0) { + $this->ui->displayLine("Fix these errors and try again."); + return false; + } + return true; + } + + // }}} + // {{{ getCommands() + + /** + * Return a list of all the commands defined by this class. + * @return array list of commands + * @access public + */ + function getCommands() + { + return array('package', + 'package-info', + 'package-list', + 'package-validate', + 'cvstag'); + } + + // }}} + // {{{ getOptions() + + function getOptions() + { + return array('Z', 'n' /*, 'f', 'd', 'q', 'Q'*/); + } + + // }}} + // {{{ getHelp() + + function getHelp($command) + { + switch ($command) { + case 'package': + return array('[]', + 'Creates a PEAR package from its description file (usually '. + 'named as package.xml)'); + case 'package-list': + return array('', + 'List the contents of a PEAR package'); + case 'packge-info': + return array('', + 'Shows information about a PEAR package'); + case 'package-validate': + return array('', + 'Verifies a package or description file'); + case 'cvstag': + return array('', + 'Runs "cvs tag" on files contained in a release'); + } + } + + // }}} + // {{{ run() + + /** + * Execute the command. + * + * @param string command name + * + * @param array option_name => value + * + * @param array list of additional parameters + * + * @return bool TRUE on success, FALSE for unknown commands, or + * a PEAR error on failure + * + * @access public + */ + function run($command, $options, $params) + { + $failmsg = ''; + switch ($command) { + // {{{ package + + case 'package': { + $pkginfofile = isset($params[0]) ? $params[0] : 'package.xml'; + ob_start(); + $packager =& new PEAR_Packager($this->config->get('php_dir'), + $this->config->get('ext_dir'), + $this->config->get('doc_dir')); + $packager->debug = $this->config->get('verbose'); + $err = $warn = array(); + $packager->validatePackageInfo($pkginfofile, $err, $warn); + if (!$this->_displayValidationResults($err, $warn, true)) { + break; + } + $compress = empty($options['Z']) ? true : false; + $result = $packager->Package($pkginfofile, $compress); + $output = ob_get_contents(); + ob_end_clean(); + $lines = explode("\n", $output); + foreach ($lines as $line) { + $this->ui->displayLine($line); + } + if (PEAR::isError($result)) { + $this->ui->displayLine("Package failed: ".$result->getMessage()); + } + break; + } + + // }}} + // {{{ package-list + + case 'package-list': { + // $params[0] -> the PEAR package to list its contents + if (sizeof($params) != 1) { + $failmsg = "Command package-list requires a valid PEAR package filename ". + " as the first argument. Try the command \"help package-list\""; + break; + } + $obj = new PEAR_Common(); + + if (PEAR::isError($info = $obj->infoFromTgzFile($params[0]))) { + return $info; + } + $list =$info['filelist']; + $caption = 'Contents of ' . basename($params[0]); + $this->ui->startTable(array('caption' => $caption, + 'border' => true)); + $this->ui->tableRow(array('Package Files', 'Install Destination'), + array('bold' => true)); + foreach ($list as $file => $att) { + if (isset($att['baseinstalldir'])) { + $dest = $att['baseinstalldir'] . DIRECTORY_SEPARATOR . + $file; + } else { + $dest = $file; + } + switch ($att['role']) { + case 'test': + $dest = '-- will not be installed --'; break; + case 'doc': + $dest = $this->config->get('doc_dir') . DIRECTORY_SEPARATOR . + $dest; + break; + case 'php': + default: + $dest = $this->config->get('php_dir') . DIRECTORY_SEPARATOR . + $dest; + } + $dest = preg_replace('!/+!', '/', $dest); + $file = preg_replace('!/+!', '/', $file); + $opts = array(0 => array('wrap' => 23), + 1 => array('wrap' => 45) + ); + $this->ui->tableRow(array($file, $dest), null, $opts); + } + $this->ui->endTable(); + break; + } + + // }}} + // {{{ package-info + + case 'package-info': { + $obj = new PEAR_Common(); + if (PEAR::isError($info = $obj->infoFromTgzFile($params[0]))) { + return $info; + } + unset($info['filelist']); + unset($info['changelog']); + $keys = array_keys($info); + $longtext = array('description', 'summary'); + foreach ($keys as $key) { + if (is_array($info[$key])) { + switch ($key) { + case 'maintainers': { + $i = 0; + $mstr = ''; + foreach ($info[$key] as $m) { + if ($i++ > 0) { + $mstr .= "\n"; + } + $mstr .= $m['name'] . " <"; + if (isset($m['email'])) { + $mstr .= $m['email']; + } else { + $mstr .= $m['handle'] . '@php.net'; + } + $mstr .= "> ($m[role])"; + } + $info[$key] = $mstr; + break; + } + case 'release_deps': { + static $rel_trans = array( + 'lt' => '<', + 'le' => '<=', + 'eq' => '=', + 'ne' => '!=', + 'gt' => '>', + 'ge' => '>=', + ); + $i = 0; + $dstr = ''; + foreach ($info[$key] as $d) { + if ($i++ > 0) { + $dstr .= ", "; + } + if (isset($rel_trans[$d['rel']])) { + $d['rel'] = $rel_trans[$d['rel']]; + } + $dstr .= "$d[type] $d[rel]"; + if (isset($d['version'])) { + $dstr .= " $d[version]"; + } + } + $info[$key] = $dstr; + break; + } + default: { + $info[$key] = implode(", ", $info[$key]); + break; + } + } + } + $info[$key] = trim($info[$key]); + if (in_array($key, $longtext)) { + $info[$key] = preg_replace('/ +/', ' ', $info[$key]); + } + } + $caption = 'About ' . basename($params[0]); + $this->ui->startTable(array('caption' => $caption, + 'border' => true)); + foreach ($info as $key => $value) { + $key = ucwords(str_replace('_', ' ', $key)); + $this->ui->tableRow(array($key, $value), null, array(1 => array('wrap' => 55))); + } + $this->ui->endTable(); + break; + } + + // }}} + // {{{ package-validate + + case 'package-validate': { + if (sizeof($params) < 1) { + $params[0] = "package.xml"; + } + $obj = new PEAR_Common; + $info = null; + if (file_exists($params[0])) { + $fp = fopen($params[0], "r"); + $test = fread($fp, 5); + fclose($fp); + if ($test == "infoFromDescriptionFile($params[0]); + } + } + if (empty($info)) { + $info = $obj->infoFromTgzFile($params[0]); + } + if (PEAR::isError($info)) { + return $this->raiseError($info); + } + $obj->validatePackageInfo($info, $err, $warn); + $this->_displayValidationResults($err, $warn); + break; + } + + // }}} + // {{{ cvstag + + case 'cvstag': { + if (sizeof($params) < 1) { + $help = $this->getHelp($command); + return $this->raiseError("$command: missing parameter: $help[0]"); + } + $obj = new PEAR_Common; + $info = $obj->infoFromDescriptionFile($params[0]); + if (PEAR::isError($info)) { + return $this->raiseError($info); + } + $err = $warn = array(); + $obj->validatePackageInfo($info, $err, $warn); + if (!$this->_displayValidationResults($err, $warn, true)) { + break; + } + $version = $info['version']; + $cvsversion = preg_replace('/[^a-z0-9]/i', '_', $version); + $cvstag = "RELEASE_$cvsversion"; + $files = array_keys($info['filelist']); + $command = "cvs"; + /* until the getopt bug is fixed, these won't work: + if (isset($options['q'])) { + $command .= ' -q'; + } + if (isset($options['Q'])) { + $command .= ' -Q'; + } + */ + $command .= ' tag'; + if (isset($options['f'])) { + $command .= ' -f'; + } + /* neither will this one: + if (isset($options['d'])) { + $command .= ' -d'; + } + */ + $command .= ' ' . $cvstag . ' ' . escapeshellarg($params[0]); + foreach ($files as $file) { + $command .= ' ' . escapeshellarg($file); + } + $this->ui->displayLine("+ $command"); + if (empty($options['n'])) { + $fp = popen($command, "r"); + while ($line = fgets($fp, 1024)) { + $this->ui->displayLine(rtrim($line)); + } + pclose($fp); + } + break; + } + + // }}} + default: { + return false; + } + } + if ($failmsg) { + return $this->raiseError($failmsg); + } + return true; + } + + // }}} + +} + +?> \ No newline at end of file diff --git a/pear/package-db.xml b/pear/package-db.xml new file mode 100644 index 0000000000..61be3f47d8 --- /dev/null +++ b/pear/package-db.xml @@ -0,0 +1,152 @@ + + + + DB + Database Abstraction Layer + +DB is a database abstraction layer providing: +* an OO-style query API +* a DSN (data source name) format for specifying database servers +* prepare/execute (bind) emulation for databases that don't support it natively +* a result object for each query response +* portable error codes +* sequence emulation +* sequential and non sequential row fetching as well as bulk fetching +* ordered array, associative array and object formats supported for the fetched rows +* row limit support +* transactions support +* table information interface +* DocBook and PHPDoc API documentation + +DB layers itself on top of PHP's existing database extensions. The +currently supported extensions are: dbase, fbsql, interbase, informix, +msql, mssql, mysql, oci8, odbc, pgsql and sybase (a DB style interface +to LDAP servers is also avaible from a separate package). + + PHP License + + + ssb + lead + Stig Sæther Bakken + stig@php.net + + + cox + developer + Tomas V.V.Cox + cox@idecnet.com + + + + 2.0 + stable + 2002-04-07 + First packaged release. + + DB.php + + common.php + dbase.php + fbsql.php + ibase.php + ifx.php + msql.php + mssql.php + mysql.php + oci8.php + odbc.php + pgsql.php + sybase.php + storage.php + IDEAS + MAINTAINERS + STATUS + TESTERS + + db_error.phpt + db_parsedsn.phpt + db_factory.phpt + db_ismanip.phpt + db_error2.phpt + + 06prepexec.phpt + 08affectedrows.phpt + 09numrows.phpt + 13limit.phpt + 05sequences.phpt + 07errornative.phpt + 01connect.phpt + 10errormap.phpt + 04numcols.phpt + 03simplequery.phpt + 02fetch.phpt + + + 06prepexec.phpt + 09numrows.phpt + 07errornative.phpt + 01connect.phpt + 10errormap.phpt + 04numcols.phpt + 03simplequery.phpt + 02fetch.phpt + + + 06prepexec.phpt + 05sequences.phpt + 01connect.phpt + 10errormap.phpt + 04numcols.phpt + 03simplequery.phpt + 02fetch.phpt + + + 06prepexec.phpt + 08affectedrows.phpt + 09numrows.phpt + 13limit.phpt + 05sequences.phpt + 07errornative.phpt + 12tableinfo.phpt + 01connect.phpt + 10errormap.phpt + 04numcols.phpt + 03simplequery.phpt + 14fetchmode_object.phpt + 02fetch.phpt + + + 06prepexec.phpt + 11transact.phpt + 08affectedrows.phpt + 09numrows.phpt + 13limit.phpt + 05sequences.phpt + 07errornative.phpt + 01connect.phpt + 10errormap.phpt + 04numcols.phpt + 03simplequery.phpt + 14fetchmode_object.phpt + 02fetch.phpt + + + 06prepexec.phpt + 08affectedrows.phpt + 09numrows.phpt + 13limit.phpt + 05sequences.phpt + 15quote.phpt + 01connect.phpt + 10errormap.phpt + 04numcols.phpt + 03simplequery.phpt + 14fetchmode_object.phpt + 02fetch.phpt + + + + + +