cvs: php4(NEW_UI_API) /pear/PEAR Config.php Installer.php /pear/PEAR/Command Config.php Remote.php /pear/PEAR/Frontend CLI.php

From: Date: Sat, 01 Jun 2002 18:39:36 +0000
Subject: cvs: php4(NEW_UI_API) /pear/PEAR Config.php Installer.php /pear/PEAR/Command Config.php Remote.php /pear/PEAR/Frontend CLI.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-4338@lists.php.net to get a copy of this message
dickmann Sat Jun 1 14:39:36 2002 EDT Modified files: (Branch: NEW_UI_API) /php4/pear/PEAR Config.php Installer.php /php4/pear/PEAR/Command Config.php Remote.php /php4/pear/PEAR/Frontend CLI.php Log: add 'pear search'. introduce type 'mask' to config.

Index: php4/pear/PEAR/Config.php diff -u php4/pear/PEAR/Config.php:1.28.2.2 php4/pear/PEAR/Config.php:1.28.2.3 --- php4/pear/PEAR/Config.php:1.28.2.2 Thu May 30 05:01:32 2002 +++ php4/pear/PEAR/Config.php Sat Jun 1 14:39:36 2002 @@ -16,7 +16,7 @@ // | Author: Stig Bakken <ssb@fast.no> | // +----------------------------------------------------------------------+ // -// $Id: Config.php,v 1.28.2.2 2002/05/30 09:01:32 ssb Exp $ +// $Id: Config.php,v 1.28.2.3 2002/06/01 18:39:36 dickmann Exp $ require_once 'PEAR.php'; @@ -188,7 +188,7 @@ 'group' => 'Advanced', ), 'umask' => array( - 'type' => 'int', + 'type' => 'mask', 'default' => PEAR_DEFAULT_UMASK, 'doc' => 'umask used when creating files (Unix-like systems only)', 'prompt' => 'Unix file mask', @@ -485,6 +485,10 @@ $data[$key] = base64_encode($data[$key]); break; } + case 'mask': { + $data[$key] = octdec($data[$key]); + break; + } } } return true; @@ -519,6 +523,10 @@ $data[$key] = base64_decode($data[$key]); break; } + case 'mask': { + $data[$key] = decoct($data[$key]); + break; + } } } return true; @@ -577,10 +585,9 @@ } extract($this->configuration_info[$key]); switch ($type) { - case 'integer': { + case 'integer': $value = (int)$value; break; - } case 'set': { // If a valid_set is specified, require the value to // be in the set. If there is no valid_set, accept Index: php4/pear/PEAR/Installer.php diff -u php4/pear/PEAR/Installer.php:1.64.2.1 php4/pear/PEAR/Installer.php:1.64.2.2 --- php4/pear/PEAR/Installer.php:1.64.2.1 Wed May 29 08:59:12 2002 +++ php4/pear/PEAR/Installer.php Sat Jun 1 14:39:36 2002 @@ -17,7 +17,7 @@ // | Tomas V.V.Cox <cox@idecnet.com> | // +----------------------------------------------------------------------+ // -// $Id: Installer.php,v 1.64.2.1 2002/05/29 12:59:12 dickmann Exp $ +// $Id: Installer.php,v 1.64.2.2 2002/06/01 18:39:36 dickmann Exp $ require_once 'PEAR/Common.php'; require_once 'PEAR/Registry.php'; @@ -243,10 +243,10 @@ } if (!OS_WINDOWS) { if ($atts['role'] == 'script') { - $mode = 0777 & ~$this->config->get('umask'); + $mode = 0777 & ~(int)octdec($this->config->get('umask')); $this->log(3, "+ chmod +x $dest_file"); } else { - $mode = 0666 & ~$this->config->get('umask'); + $mode = 0666 & ~(int)octdec($this->config->get('umask')); } if (!@chmod($dest_file, $mode)) { $this->log(0, "failed to change mode of $dest_file"); Index: php4/pear/PEAR/Command/Config.php diff -u php4/pear/PEAR/Command/Config.php:1.15.2.2 php4/pear/PEAR/Command/Config.php:1.15.2.3 --- php4/pear/PEAR/Command/Config.php:1.15.2.2 Thu May 30 06:14:57 2002 +++ php4/pear/PEAR/Command/Config.php Sat Jun 1 14:39:36 2002 @@ -18,7 +18,7 @@ // | | // +----------------------------------------------------------------------+ // -// $Id: Config.php,v 1.15.2.2 2002/05/30 10:14:57 dickmann Exp $ +// $Id: Config.php,v 1.15.2.3 2002/06/01 18:39:36 dickmann Exp $ require_once "PEAR/Command/Common.php"; require_once "PEAR/Config.php"; @@ -94,12 +94,8 @@ $value = $this->config->get($key, @$params[0]); if ($type == 'password' && $value) { $value = '********'; - } elseif ($key == 'umask') { - $value = sprintf("%03o", $value); } - if ($value === null || $value === '') { - $value = '<not set>'; - } elseif ($value === false) { + if ($value === false) { $value = 'false'; } elseif ($value === true) { $value = 'true'; @@ -137,11 +133,11 @@ $failmsg = ''; if (sizeof($params) < 2 || sizeof($params) > 3) { $failmsg .= "config-set expects 2 or 3 parameters"; - break; + return PEAR::raiseError($failmsg); } if ($error = $this->_checkLayer(@$params[2])) { $failmsg .= $error; - break; + return PEAR::raiseError($failmsg); } if (!call_user_func_array(array(&$this->config, 'set'), $params)) { Index: php4/pear/PEAR/Command/Remote.php diff -u php4/pear/PEAR/Command/Remote.php:1.12.2.2 php4/pear/PEAR/Command/Remote.php:1.12.2.3 --- php4/pear/PEAR/Command/Remote.php:1.12.2.2 Thu May 30 06:14:57 2002 +++ php4/pear/PEAR/Command/Remote.php Sat Jun 1 14:39:36 2002 @@ -17,7 +17,7 @@ // | | // +----------------------------------------------------------------------+ // -// $Id: Remote.php,v 1.12.2.2 2002/05/30 10:14:57 dickmann Exp $ +// $Id: Remote.php,v 1.12.2.3 2002/06/01 18:39:36 dickmann Exp $ require_once 'PEAR/Command/Common.php'; require_once 'PEAR/Common.php'; @@ -55,6 +55,15 @@ Lists the packages available on the configured server along with the latest stable release of each package.', ), + 'search' => array( + 'summary' => 'Search Packagesdatabase', + 'function' => 'doSearch', + 'shortcut' => 'sp', + 'options' => array(), + 'doc' => ' +Lists all packages which match the search paramteres (first param +is package name, second package info)', + ), 'list-all' => array( 'summary' => 'List All Packages', 'function' => 'doListAll', @@ -100,7 +109,9 @@ function doRemoteInfo($command, $options, $params) { +/* return false; // coming soon + var_dump($params[0]); $r = new PEAR_Remote($this->config); $info = $r->call('package.info', $params[0]); @@ -109,6 +120,20 @@ } var_dump($info); +*/ + $r = new PEAR_Remote($this->config); + $available = $r->call('package.listAll', true); + if (PEAR::isError($available)) { + return $this->raiseError($available); + } + $info = $available[$params[0]]; + $info["name"] = $params[0]; + + $reg = new PEAR_Registry($this->config->get('php_dir')); + $installed = $reg->packageInfo($info['name']); + $info['installed'] = $installed['version']; + + $this->ui->outputData($info, $command); return false; // coming soon } @@ -169,6 +194,57 @@ $desc, ); } + $this->ui->outputData($data, $command); + return true; + } + + // }}} + // {{{ search + + function doSearch($command, $options, $params) + { + if ((!isset($params[0]) || empty($params[0])) + && (!isset($params[1]) || empty($params[1]))) + { + return $this->raiseError('no valid search string suppliedy<'); + }; + + $r = new PEAR_Remote($this->config); + $reg = new PEAR_Registry($this->config->get('php_dir')); + $available = $r->call('package.listAll', true); + if (PEAR::isError($available)) { + return $this->raiseError($available); + } + $data = array( + 'caption' => 'Matched packages:', + 'border' => true, + 'headline' => array('Package', 'Latest', 'Local'), + ); + + foreach ($available as $name => $info) { + $found = (!empty($params[0]) && stristr($name, $params[0]) !== false); + if (!$found && !(isset($params[1]) && !empty($params[1]) + && (stristr($info['summary'], $params[1]) !== false + || stristr($info['description'], $params[1]) !== false))) + { + continue; + }; + + $installed = $reg->packageInfo($name); + $desc = $info['summary']; + if (isset($params[$name])) + $desc .= "\n\n".$info['description']; + + $data['data'][$info['category']][] = array( + $name, + $info['stable'], + $installed['version'], + $desc, + ); + } + if (!isset($data['data'])) { + return $this->raiseError('no packages found'); + }; $this->ui->outputData($data, $command); return true; } Index: php4/pear/PEAR/Frontend/CLI.php diff -u php4/pear/PEAR/Frontend/CLI.php:1.12.2.6 php4/pear/PEAR/Frontend/CLI.php:1.12.2.7 --- php4/pear/PEAR/Frontend/CLI.php:1.12.2.6 Fri May 31 19:09:03 2002 +++ php4/pear/PEAR/Frontend/CLI.php Sat Jun 1 14:39:36 2002 @@ -16,7 +16,7 @@ | Author: Stig Sæther Bakken <ssb@fast.no> | +----------------------------------------------------------------------+ - $Id: CLI.php,v 1.12.2.6 2002/05/31 23:09:03 ssb Exp $ + $Id: CLI.php,v 1.12.2.7 2002/06/01 18:39:36 dickmann Exp $ */ require_once "PEAR.php"; @@ -385,6 +385,9 @@ foreach($data['data'] as $group) { foreach($group as $value) { + if ($value === null || $value === '') { + $value = "<not set>"; + }; $this->_tableRow($value, null, array(1 => array('wrap' => 55))); } };
« previous php.pear.cvs (#4338) next »