Source for file Registry.php
Documentation is available at Registry.php
// /* vim: set expandtab tabstop=4 shiftwidth=4: */
// +----------------------------------------------------------------------+
// +----------------------------------------------------------------------+
// | Copyright (c) 1997-2004 The PHP Group |
// +----------------------------------------------------------------------+
// | This source file is subject to version 3.0 of the PHP license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available through the world-wide-web at the following url: |
// | http://www.php.net/license/3_0.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@php.net> |
// +----------------------------------------------------------------------+
// $Id: Registry.php,v 1.36 2004/01/08 17:33:13 sniper Exp $
require_once 'PEAR/Command/Common.php';
require_once 'PEAR/Registry.php';
require_once 'PEAR/Config.php';
class PEAR_Command_Registry extends PEAR_Command_Common
'summary' => 'List Installed Packages',
If invoked without parameters, this command lists the PEAR packages
installed in your php_dir ({config php_dir)). With a parameter, it
lists the files in that package.
'summary' => 'Shell Script Test',
'function' => 'doShellTest',
'doc' => '<package> [[relation] version]
Tests if a package is installed in the system. Will exit(1) if it is not.
<relation> The version comparison operator. One of:
<, lt, <=, le, >, gt, >=, ge, ==, =, eq, !=, <>, ne
<version> The version to compare with
'summary' => 'Display information about a package',
Displays information about a package. The package argument may be a
local package file, an URL to a package file, or the name of an
* PEAR_Command_Registry constructor.
function PEAR_Command_Registry (&$ui, &$config)
parent ::PEAR_Command_Common ($ui, $config);
function _sortinfo ($a, $b)
return strcmp($a['package'], $b['package']);
function doList ($command, $options, $params)
$reg = new PEAR_Registry ($this->config->get ('php_dir'));
$installed = $reg->packageInfo ();
usort($installed, array (&$this, '_sortinfo'));
'caption' => 'Installed packages:',
'headline' => array ('Package', 'Version', 'State')
foreach ($installed as $package) {
$data['data'][] = array ($package['package'],
@$package['release_state']);
if (count($installed)==0 ) {
$data = '(no packages installed)';
$this->ui->outputData ($data, $command);
include_once "PEAR/Common.php";
$info = $obj->infoFromAny ($params[0 ]);
$headings = array ('Package File', 'Install Path');
$info = $reg->packageInfo ($params[0 ]);
$headings = array ('Type', 'Install Path');
if (PEAR ::isError ($info)) {
return $this->raiseError ($info);
return $this->raiseError (" `$params[0]' not installed" );
$list = $info['filelist'];
$caption = 'Installed Files For ' . $params[0 ];
$caption = 'Contents of ' . basename($params[0 ]);
'headline' => $headings);
foreach ($list as $file => $att) {
if (empty ($att['installed_as'])) {
$data['data'][] = array ($att['role'], $att['installed_as']);
if (isset ($att['baseinstalldir'])) {
$dest = $att['baseinstalldir'] . DIRECTORY_SEPARATOR .
$dest = '-- will not be installed --';
$dest = $this->config->get ('doc_dir') . DIRECTORY_SEPARATOR .
$dest = $this->config->get ('php_dir') . DIRECTORY_SEPARATOR .
$data['data'][] = array ($file, $dest);
$this->ui->outputData ($data, $command);
function doShellTest ($command, $options, $params)
$reg = &new PEAR_Registry ($this->config->get ('php_dir'));
if (!$reg->packageExists ($params[0 ])) {
// "pear shell-test Foo 1.0"
} elseif (sizeof($params) == 2 ) {
$v = $reg->packageInfo ($params[0 ], 'version');
// "pear shell-test Foo ge 1.0"
} elseif (sizeof($params) == 3 ) {
$v = $reg->packageInfo ($params[0 ], 'version');
$this->popErrorHandling ();
$this->raiseError (" $command: expects 1 to 3 parameters" );
function doInfo ($command, $options, $params)
// $params[0] The package for showing info
return $this->raiseError ("This command only accepts one param: ".
"the package you want information");
$obj = &new PEAR_Common ();
$info = $obj->infoFromAny ($params[0 ]);
$reg = &new PEAR_Registry ($this->config->get ('php_dir'));
$info = $reg->packageInfo ($params[0 ]);
if (PEAR ::isError ($info)) {
$this->raiseError (" Nothing found for `$params[0]'" );
unset ($info['filelist']);
unset ($info['changelog']);
$longtext = array ('description', 'summary');
foreach ($keys as $key) {
foreach ($info[$key] as $m) {
$mstr .= $m['name'] . " <";
if (isset ($m['email'])) {
$mstr .= $m['handle'] . '@php.net';
foreach ($info[$key] as $d) {
if (isset ($this->_deps_rel_trans[$d['rel']])) {
$rel = $this->_deps_rel_trans[$d['rel']];
if (isset ($this->_deps_type_trans[$d['type']])) {
$type = ucfirst($this->_deps_type_trans[$d['type']]);
$name = $d['name'] . ' ';
if (isset ($d['version'])) {
$version = $d['version'] . ' ';
$dstr .= " $type $name$rel $version\n";
$debug = $this->config->get ('verbose');
foreach ($info[$key] as $p) {
if ($debug < 2 && $p['type'] != "class") {
// Only print classes when verbosity mode is < 2
$pstr .= ucfirst($p['type']) . " " . $p['name'];
if (isset ($p['explicit']) && $p['explicit'] == 1 ) {
$info[$key] = implode(", ", $info[$key]);
if ($key == '_lastmodified') {
$hdate = date('Y-m-d', $info[$key]);
$info['Last Modified'] = $hdate;
$info[$key] = trim($info[$key]);
$caption = 'About ' . $info['package'] . '-' . $info['version'];
foreach ($info as $key => $value) {
$data['data'][] = array ($key, $value);
$this->ui->outputData ($data, 'package-info');
Documentation generated on Mon, 11 Mar 2019 14:24:00 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|