4,19 → 4,12 |
* |
* PHP versions 4 and 5 |
* |
* LICENSE: This source file is subject to version 3.0 of the PHP license |
* that is available through the world-wide-web at the following URI: |
* 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 web, please |
* send a note to license@php.net so we can mail you a copy immediately. |
* |
* @category pear |
* @package PEAR |
* @author Stig Bakken <ssb@php.net> |
* @author Greg Beaver <cellog@php.net> |
* @copyright 1997-2006 The PHP Group |
* @license http://www.php.net/license/3_0.txt PHP License 3.0 |
* @version CVS: $Id: Registry.php,v 1.75 2006/11/19 23:50:09 cellog Exp $ |
* @copyright 1997-2009 The Authors |
* @license http://opensource.org/licenses/bsd-license.php New BSD License |
* @link http://pear.php.net/package/PEAR |
* @since File available since Release 0.1 |
*/ |
33,16 → 26,14 |
* @package PEAR |
* @author Stig Bakken <ssb@php.net> |
* @author Greg Beaver <cellog@php.net> |
* @copyright 1997-2006 The PHP Group |
* @license http://www.php.net/license/3_0.txt PHP License 3.0 |
* @version Release: 1.5.1 |
* @copyright 1997-2009 The Authors |
* @license http://opensource.org/licenses/bsd-license.php New BSD License |
* @version Release: 1.10.1 |
* @link http://pear.php.net/package/PEAR |
* @since Class available since Release 0.1 |
*/ |
class PEAR_Command_Registry extends PEAR_Command_Common |
{ |
// {{{ properties |
|
var $commands = array( |
'list' => array( |
'summary' => 'List Installed Packages In The Default Channel', |
58,6 → 49,10 |
'shortopt' => 'a', |
'doc' => 'list installed packages from all channels', |
), |
'channelinfo' => array( |
'shortopt' => 'i', |
'doc' => 'output fully channel-aware data, even on failure', |
), |
), |
'doc' => '<package> |
If invoked without parameters, this command lists the PEAR packages |
97,23 → 92,16 |
) |
); |
|
// }}} |
// {{{ constructor |
|
/** |
* PEAR_Command_Registry constructor. |
* |
* @access public |
*/ |
function PEAR_Command_Registry(&$ui, &$config) |
function __construct(&$ui, &$config) |
{ |
parent::PEAR_Command_Common($ui, $config); |
parent::__construct($ui, $config); |
} |
|
// }}} |
|
// {{{ doList() |
|
function _sortinfo($a, $b) |
{ |
$apackage = isset($a['package']) ? $a['package'] : $a['name']; |
123,67 → 111,131 |
|
function doList($command, $options, $params) |
{ |
if (isset($options['allchannels'])) { |
$reg = &$this->config->getRegistry(); |
$channelinfo = isset($options['channelinfo']); |
if (isset($options['allchannels']) && !$channelinfo) { |
return $this->doListAll($command, array(), $params); |
} |
$reg = &$this->config->getRegistry(); |
if (count($params) == 1) { |
|
if (isset($options['allchannels']) && $channelinfo) { |
// allchannels with $channelinfo |
unset($options['allchannels']); |
$channels = $reg->getChannels(); |
$errors = array(); |
PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); |
foreach ($channels as $channel) { |
$options['channel'] = $channel->getName(); |
$ret = $this->doList($command, $options, $params); |
|
if (PEAR::isError($ret)) { |
$errors[] = $ret; |
} |
} |
|
PEAR::staticPopErrorHandling(); |
if (count($errors)) { |
// for now, only give first error |
return PEAR::raiseError($errors[0]); |
} |
|
return true; |
} |
|
if (count($params) === 1) { |
return $this->doFileList($command, $options, $params); |
} |
|
if (isset($options['channel'])) { |
if ($reg->channelExists($options['channel'])) { |
$channel = $reg->channelName($options['channel']); |
} else { |
if (!$reg->channelExists($options['channel'])) { |
return $this->raiseError('Channel "' . $options['channel'] .'" does not exist'); |
} |
|
$channel = $reg->channelName($options['channel']); |
} else { |
$channel = $this->config->get('default_channel'); |
} |
|
$installed = $reg->packageInfo(null, null, $channel); |
usort($installed, array(&$this, '_sortinfo')); |
$i = $j = 0; |
|
$data = array( |
'caption' => 'Installed packages, channel ' . |
$channel . ':', |
'border' => true, |
'headline' => array('Package', 'Version', 'State') |
'headline' => array('Package', 'Version', 'State'), |
'channel' => $channel, |
); |
if ($channelinfo) { |
$data['headline'] = array('Channel', 'Package', 'Version', 'State'); |
} |
|
if (count($installed) && !isset($data['data'])) { |
$data['data'] = array(); |
} |
|
foreach ($installed as $package) { |
$pobj = $reg->getPackage(isset($package['package']) ? |
$package['package'] : $package['name'], $channel); |
$data['data'][] = array($pobj->getPackage(), $pobj->getVersion(), |
if ($channelinfo) { |
$packageinfo = array($pobj->getChannel(), $pobj->getPackage(), $pobj->getVersion(), |
$pobj->getState() ? $pobj->getState() : null); |
} else { |
$packageinfo = array($pobj->getPackage(), $pobj->getVersion(), |
$pobj->getState() ? $pobj->getState() : null); |
} |
$data['data'][] = $packageinfo; |
} |
if (count($installed)==0) { |
$data = '(no packages installed from channel ' . $channel . ')'; |
|
if (count($installed) === 0) { |
if (!$channelinfo) { |
$data = '(no packages installed from channel ' . $channel . ')'; |
} else { |
$data = array( |
'caption' => 'Installed packages, channel ' . |
$channel . ':', |
'border' => true, |
'channel' => $channel, |
'data' => array(array('(no packages installed)')), |
); |
} |
} |
|
$this->ui->outputData($data, $command); |
return true; |
} |
|
|
function doListAll($command, $options, $params) |
{ |
// This duplicate code is deprecated over |
// list --channelinfo, which gives identical |
// output for list and list --allchannels. |
$reg = &$this->config->getRegistry(); |
$installed = $reg->packageInfo(null, null, null); |
foreach ($installed as $channel => $packages) { |
usort($packages, array($this, '_sortinfo')); |
$i = $j = 0; |
$data = array( |
'caption' => 'Installed packages, channel ' . $channel . ':', |
'border' => true, |
'headline' => array('Package', 'Version', 'State') |
); |
'caption' => 'Installed packages, channel ' . $channel . ':', |
'border' => true, |
'headline' => array('Package', 'Version', 'State'), |
'channel' => $channel |
); |
|
foreach ($packages as $package) { |
$pobj = $reg->getPackage(isset($package['package']) ? |
$package['package'] : $package['name'], $channel); |
$p = isset($package['package']) ? $package['package'] : $package['name']; |
$pobj = $reg->getPackage($p, $channel); |
$data['data'][] = array($pobj->getPackage(), $pobj->getVersion(), |
$pobj->getState() ? $pobj->getState() : null); |
} |
if (count($packages)==0) { |
|
// Adds a blank line after each section |
$data['data'][] = array(); |
|
if (count($packages) === 0) { |
$data = array( |
'caption' => 'Installed packages, channel ' . $channel . ':', |
'border' => true, |
'data' => array(array('(no packages installed)')), |
'data' => array(array('(no packages installed)'), array()), |
'channel' => $channel |
); |
} |
$this->ui->outputData($data, $command); |
190,23 → 242,25 |
} |
return true; |
} |
|
|
function doFileList($command, $options, $params) |
{ |
if (count($params) != 1) { |
if (count($params) !== 1) { |
return $this->raiseError('list-files expects 1 parameter'); |
} |
|
$reg = &$this->config->getRegistry(); |
$fp = false; |
if (!is_dir($params[0]) && (file_exists($params[0]) || $fp = @fopen($params[0], |
'r'))) { |
if (!is_dir($params[0]) && (file_exists($params[0]) || $fp = @fopen($params[0], 'r'))) { |
if ($fp) { |
fclose($fp); |
} |
|
if (!class_exists('PEAR_PackageFile')) { |
require_once 'PEAR/PackageFile.php'; |
} |
$pkg = &new PEAR_PackageFile($this->config, $this->_debug); |
|
$pkg = new PEAR_PackageFile($this->config, $this->_debug); |
PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); |
$info = &$pkg->fromAnyFile($params[0], PEAR_VALIDATE_NORMAL); |
PEAR::staticPopErrorHandling(); |
219,16 → 273,20 |
if (PEAR::isError($parsed)) { |
return $this->raiseError($parsed); |
} |
|
$info = &$reg->getPackage($parsed['package'], $parsed['channel']); |
$headings = array('Type', 'Install Path'); |
$installed = true; |
} |
|
if (PEAR::isError($info)) { |
return $this->raiseError($info); |
} |
|
if ($info === null) { |
return $this->raiseError("`$params[0]' not installed"); |
} |
|
$list = ($info->getPackagexmlVersion() == '1.0' || $installed) ? |
$info->getFilelist() : $info->getContents(); |
if ($installed) { |
236,6 → 294,7 |
} else { |
$caption = 'Contents of ' . basename($params[0]); |
} |
|
$data = array( |
'caption' => $caption, |
'border' => true, |
285,6 → 344,7 |
if (!isset($list['dir']['file'][0])) { |
$list['dir']['file'] = array($list['dir']['file']); |
} |
|
foreach ($list['dir']['file'] as $att) { |
$att = $att['attribs']; |
$file = $att['name']; |
303,18 → 363,17 |
$data['data'][] = array($file, $dest); |
} |
} |
|
$this->ui->outputData($data, $command); |
return true; |
} |
|
// }}} |
// {{{ doShellTest() |
|
function doShellTest($command, $options, $params) |
{ |
if (count($params) < 1) { |
return PEAR::raiseError('ERROR, usage: pear shell-test packagename [[relation] version]'); |
} |
|
PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); |
$reg = &$this->config->getRegistry(); |
$info = $reg->parsePackageName($params[0], $this->config->get('default_channel')); |
321,6 → 380,7 |
if (PEAR::isError($info)) { |
exit(1); // invalid package name |
} |
|
$package = $info['package']; |
$channel = $info['channel']; |
// "pear shell-test Foo" |
331,18 → 391,19 |
} |
} |
} |
if (sizeof($params) == 1) { |
|
if (count($params) === 1) { |
if (!$reg->packageExists($package, $channel)) { |
exit(1); |
} |
// "pear shell-test Foo 1.0" |
} elseif (sizeof($params) == 2) { |
} elseif (count($params) === 2) { |
$v = $reg->packageInfo($package, 'version', $channel); |
if (!$v || !version_compare("$v", "{$params[1]}", "ge")) { |
exit(1); |
} |
// "pear shell-test Foo ge 1.0" |
} elseif (sizeof($params) == 3) { |
} elseif (count($params) === 3) { |
$v = $reg->packageInfo($package, 'version', $channel); |
if (!$v || !version_compare("$v", "{$params[2]}", $params[1])) { |
exit(1); |
354,24 → 415,26 |
} |
} |
|
// }}} |
// {{{ doInfo |
|
function doInfo($command, $options, $params) |
{ |
if (count($params) != 1) { |
if (count($params) !== 1) { |
return $this->raiseError('pear info expects 1 parameter'); |
} |
|
$info = $fp = false; |
$reg = &$this->config->getRegistry(); |
if ((file_exists($params[0]) && is_file($params[0]) && !is_dir($params[0])) || $fp = @fopen($params[0], 'r')) { |
if (is_file($params[0]) && !is_dir($params[0]) && |
(file_exists($params[0]) || $fp = @fopen($params[0], 'r')) |
) { |
if ($fp) { |
fclose($fp); |
} |
|
if (!class_exists('PEAR_PackageFile')) { |
require_once 'PEAR/PackageFile.php'; |
} |
$pkg = &new PEAR_PackageFile($this->config, $this->_debug); |
|
$pkg = new PEAR_PackageFile($this->config, $this->_debug); |
PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); |
$obj = &$pkg->fromAnyFile($params[0], PEAR_VALIDATE_NORMAL); |
PEAR::staticPopErrorHandling(); |
385,18 → 448,21 |
$this->ui->outputData($message); |
} |
} |
|
return $this->raiseError($obj); |
} |
if ($obj->getPackagexmlVersion() == '1.0') { |
$info = $obj->toArray(); |
} else { |
|
if ($obj->getPackagexmlVersion() != '1.0') { |
return $this->_doInfo2($command, $options, $params, $obj, false); |
} |
|
$info = $obj->toArray(); |
} else { |
$parsed = $reg->parsePackageName($params[0], $this->config->get('default_channel')); |
if (PEAR::isError($parsed)) { |
return $this->raiseError($parsed); |
} |
|
$package = $parsed['package']; |
$channel = $parsed['channel']; |
$info = $reg->packageInfo($package, null, $channel); |
405,13 → 471,16 |
return $this->_doInfo2($command, $options, $params, $obj, true); |
} |
} |
|
if (PEAR::isError($info)) { |
return $info; |
} |
|
if (empty($info)) { |
$this->raiseError("No information found for `$params[0]'"); |
return; |
} |
|
unset($info['filelist']); |
unset($info['dirtree']); |
unset($info['changelog']); |
419,10 → 488,12 |
$info['package.xml version'] = $info['xsdversion']; |
unset($info['xsdversion']); |
} |
|
if (isset($info['packagerversion'])) { |
$info['packaged with PEAR version'] = $info['packagerversion']; |
unset($info['packagerversion']); |
} |
|
$keys = array_keys($info); |
$longtext = array('description', 'summary'); |
foreach ($keys as $key) { |
527,6 → 598,7 |
} |
} |
} |
|
if ($key == '_lastmodified') { |
$hdate = date('Y-m-d', $info[$key]); |
unset($info[$key]); |
541,6 → 613,7 |
} |
} |
} |
|
$caption = 'About ' . $info['package'] . '-' . $info['version']; |
$data = array( |
'caption' => $caption, |
554,8 → 627,6 |
$this->ui->outputData($data, 'package-info'); |
} |
|
// }}} |
|
/** |
* @access private |
*/ |
593,6 → 664,7 |
if ($src = $obj->getSourcePackage()) { |
$extends .= ' (source package ' . $src['channel'] . '/' . $src['package'] . ')'; |
} |
|
$info = array( |
'Release Type' => $release, |
'Name' => $extends, |
606,21 → 678,27 |
if (!$leads) { |
continue; |
} |
|
if (isset($leads['active'])) { |
$leads = array($leads); |
} |
|
foreach ($leads as $lead) { |
if (!empty($info['Maintainers'])) { |
$info['Maintainers'] .= "\n"; |
} |
|
$active = $lead['active'] == 'no' ? ', inactive' : ''; |
$info['Maintainers'] .= $lead['name'] . ' <'; |
$info['Maintainers'] .= $lead['email'] . "> ($role)"; |
$info['Maintainers'] .= $lead['email'] . "> ($role$active)"; |
} |
} |
|
$info['Release Date'] = $obj->getDate(); |
if ($time = $obj->getTime()) { |
$info['Release Date'] .= ' ' . $time; |
} |
|
$info['Release Version'] = $obj->getVersion() . ' (' . $obj->getState() . ')'; |
$info['API Version'] = $obj->getVersion('api') . ' (' . $obj->getState('api') . ')'; |
$info['License'] = $obj->getLicense(); |
635,16 → 713,22 |
} |
} |
} |
|
$info['Release Notes'] = $obj->getNotes(); |
if ($compat = $obj->getCompatible()) { |
if (!isset($compat[0])) { |
$compat = array($compat); |
} |
|
$info['Compatible with'] = ''; |
foreach ($compat as $package) { |
$info['Compatible with'] .= $package['channel'] . '/' . $package['package'] . |
$info['Compatible with'] .= $package['channel'] . '/' . $package['name'] . |
"\nVersions >= " . $package['min'] . ', <= ' . $package['max']; |
if (isset($package['exclude'])) { |
if (is_array($package['exclude'])) { |
$package['exclude'] = implode(', ', $package['exclude']); |
} |
|
if (!isset($info['Not Compatible with'])) { |
$info['Not Compatible with'] = ''; |
} else { |
651,15 → 735,17 |
$info['Not Compatible with'] .= "\n"; |
} |
$info['Not Compatible with'] .= $package['channel'] . '/' . |
$package['package'] . "\nVersions " . $package['exclude']; |
$package['name'] . "\nVersions " . $package['exclude']; |
} |
} |
} |
|
$usesrole = $obj->getUsesrole(); |
if ($usesrole) { |
if (!isset($usesrole[0])) { |
$usesrole = array($usesrole); |
} |
|
foreach ($usesrole as $roledata) { |
if (isset($info['Uses Custom Roles'])) { |
$info['Uses Custom Roles'] .= "\n"; |
666,6 → 752,7 |
} else { |
$info['Uses Custom Roles'] = ''; |
} |
|
if (isset($roledata['package'])) { |
$rolepackage = $reg->parsedPackageNameToString($roledata, true); |
} else { |
674,11 → 761,13 |
$info['Uses Custom Roles'] .= $roledata['role'] . ' (' . $rolepackage . ')'; |
} |
} |
|
$usestask = $obj->getUsestask(); |
if ($usestask) { |
if (!isset($usestask[0])) { |
$usestask = array($usestask); |
} |
|
foreach ($usestask as $taskdata) { |
if (isset($info['Uses Custom Tasks'])) { |
$info['Uses Custom Tasks'] .= "\n"; |
685,6 → 774,7 |
} else { |
$info['Uses Custom Tasks'] = ''; |
} |
|
if (isset($taskdata['package'])) { |
$taskpackage = $reg->parsedPackageNameToString($taskdata, true); |
} else { |
693,6 → 783,7 |
$info['Uses Custom Tasks'] .= $taskdata['task'] . ' (' . $taskpackage . ')'; |
} |
} |
|
$deps = $obj->getDependencies(); |
$info['Required Dependencies'] = 'PHP version ' . $deps['required']['php']['min']; |
if (isset($deps['required']['php']['max'])) { |
700,6 → 791,7 |
} else { |
$info['Required Dependencies'] .= "\n"; |
} |
|
if (isset($deps['required']['php']['exclude'])) { |
if (!isset($info['Not Compatible with'])) { |
$info['Not Compatible with'] = ''; |
706,6 → 798,7 |
} else { |
$info['Not Compatible with'] .= "\n"; |
} |
|
if (is_array($deps['required']['php']['exclude'])) { |
$deps['required']['php']['exclude'] = |
implode(', ', $deps['required']['php']['exclude']); |
713,6 → 806,7 |
$info['Not Compatible with'] .= "PHP versions\n " . |
$deps['required']['php']['exclude']; |
} |
|
$info['Required Dependencies'] .= 'PEAR installer version'; |
if (isset($deps['required']['pearinstaller']['max'])) { |
$info['Required Dependencies'] .= 's ' . |
722,6 → 816,7 |
$info['Required Dependencies'] .= ' ' . |
$deps['required']['pearinstaller']['min'] . ' or newer'; |
} |
|
if (isset($deps['required']['pearinstaller']['exclude'])) { |
if (!isset($info['Not Compatible with'])) { |
$info['Not Compatible with'] = ''; |
728,6 → 823,7 |
} else { |
$info['Not Compatible with'] .= "\n"; |
} |
|
if (is_array($deps['required']['pearinstaller']['exclude'])) { |
$deps['required']['pearinstaller']['exclude'] = |
implode(', ', $deps['required']['pearinstaller']['exclude']); |
735,6 → 831,7 |
$info['Not Compatible with'] .= "PEAR installer\n Versions " . |
$deps['required']['pearinstaller']['exclude']; |
} |
|
foreach (array('Package', 'Extension') as $type) { |
$index = strtolower($type); |
if (isset($deps['required'][$index])) { |
741,6 → 838,7 |
if (isset($deps['required'][$index]['name'])) { |
$deps['required'][$index] = array($deps['required'][$index]); |
} |
|
foreach ($deps['required'][$index] as $package) { |
if (isset($package['conflicts'])) { |
$infoindex = 'Not Compatible with'; |
753,6 → 851,7 |
$infoindex = 'Required Dependencies'; |
$info[$infoindex] .= "\n"; |
} |
|
if ($index == 'extension') { |
$name = $package['name']; |
} else { |
762,11 → 861,13 |
$name = '__uri/' . $package['name'] . ' (static URI)'; |
} |
} |
|
$info[$infoindex] .= "$type $name"; |
if (isset($package['uri'])) { |
$info[$infoindex] .= "\n Download URI: $package[uri]"; |
continue; |
} |
|
if (isset($package['max']) && isset($package['min'])) { |
$info[$infoindex] .= " \n Versions " . |
$package['min'] . '-' . $package['max']; |
777,9 → 878,11 |
$info[$infoindex] .= " \n Version " . |
$package['max'] . ' or older'; |
} |
|
if (isset($package['recommended'])) { |
$info[$infoindex] .= "\n Recommended version: $package[recommended]"; |
} |
|
if (isset($package['exclude'])) { |
if (!isset($info['Not Compatible with'])) { |
$info['Not Compatible with'] = ''; |
786,9 → 889,11 |
} else { |
$info['Not Compatible with'] .= "\n"; |
} |
|
if (is_array($package['exclude'])) { |
$package['exclude'] = implode(', ', $package['exclude']); |
} |
|
$package['package'] = $package['name']; // for parsedPackageNameToString |
if (isset($package['conflicts'])) { |
$info['Not Compatible with'] .= '=> except '; |
800,10 → 905,12 |
} |
} |
} |
|
if (isset($deps['required']['os'])) { |
if (isset($deps['required']['os']['name'])) { |
$dep['required']['os']['name'] = array($dep['required']['os']['name']); |
} |
|
foreach ($dep['required']['os'] as $os) { |
if (isset($os['conflicts']) && $os['conflicts'] == 'yes') { |
if (!isset($info['Not Compatible with'])) { |
818,10 → 925,12 |
} |
} |
} |
|
if (isset($deps['required']['arch'])) { |
if (isset($deps['required']['arch']['pattern'])) { |
$dep['required']['arch']['pattern'] = array($dep['required']['os']['pattern']); |
} |
|
foreach ($dep['required']['arch'] as $os) { |
if (isset($os['conflicts']) && $os['conflicts'] == 'yes') { |
if (!isset($info['Not Compatible with'])) { |
836,6 → 945,7 |
} |
} |
} |
|
if (isset($deps['optional'])) { |
foreach (array('Package', 'Extension') as $type) { |
$index = strtolower($type); |
843,6 → 953,7 |
if (isset($deps['optional'][$index]['name'])) { |
$deps['optional'][$index] = array($deps['optional'][$index]); |
} |
|
foreach ($deps['optional'][$index] as $package) { |
if (isset($package['conflicts']) && $package['conflicts'] == 'yes') { |
$infoindex = 'Not Compatible with'; |
859,6 → 970,7 |
$info['Optional Dependencies'] .= "\n"; |
} |
} |
|
if ($index == 'extension') { |
$name = $package['name']; |
} else { |
868,15 → 980,18 |
$name = '__uri/' . $package['name'] . ' (static URI)'; |
} |
} |
|
$info[$infoindex] .= "$type $name"; |
if (isset($package['uri'])) { |
$info[$infoindex] .= "\n Download URI: $package[uri]"; |
continue; |
} |
|
if ($infoindex == 'Not Compatible with') { |
// conflicts is only used to say that all versions conflict |
continue; |
} |
|
if (isset($package['max']) && isset($package['min'])) { |
$info[$infoindex] .= " \n Versions " . |
$package['min'] . '-' . $package['max']; |
887,9 → 1002,11 |
$info[$infoindex] .= " \n Version " . |
$package['min'] . ' or older'; |
} |
|
if (isset($package['recommended'])) { |
$info[$infoindex] .= "\n Recommended version: $package[recommended]"; |
} |
|
if (isset($package['exclude'])) { |
if (!isset($info['Not Compatible with'])) { |
$info['Not Compatible with'] = ''; |
896,9 → 1013,11 |
} else { |
$info['Not Compatible with'] .= "\n"; |
} |
|
if (is_array($package['exclude'])) { |
$package['exclude'] = implode(', ', $package['exclude']); |
} |
|
$info['Not Compatible with'] .= "Package $package\n Versions " . |
$package['exclude']; |
} |
906,10 → 1025,12 |
} |
} |
} |
|
if (isset($deps['group'])) { |
if (!isset($deps['group'][0])) { |
$deps['group'] = array($deps['group']); |
} |
|
foreach ($deps['group'] as $group) { |
$info['Dependency Group ' . $group['attribs']['name']] = $group['attribs']['hint']; |
$groupindex = $group['attribs']['name'] . ' Contents'; |
920,10 → 1041,12 |
if (isset($group[$index]['name'])) { |
$group[$index] = array($group[$index]); |
} |
|
foreach ($group[$index] as $package) { |
if (!empty($info[$groupindex])) { |
$info[$groupindex] .= "\n"; |
} |
|
if ($index == 'extension') { |
$name = $package['name']; |
} else { |
933,6 → 1056,7 |
$name = '__uri/' . $package['name'] . ' (static URI)'; |
} |
} |
|
if (isset($package['uri'])) { |
if (isset($package['conflicts']) && $package['conflicts'] == 'yes') { |
$info[$groupindex] .= "Not Compatible with $type $name"; |
939,13 → 1063,16 |
} else { |
$info[$groupindex] .= "$type $name"; |
} |
|
$info[$groupindex] .= "\n Download URI: $package[uri]"; |
continue; |
} |
|
if (isset($package['conflicts']) && $package['conflicts'] == 'yes') { |
$info[$groupindex] .= "Not Compatible with $type $name"; |
continue; |
} |
|
$info[$groupindex] .= "$type $name"; |
if (isset($package['max']) && isset($package['min'])) { |
$info[$groupindex] .= " \n Versions " . |
957,9 → 1084,11 |
$info[$groupindex] .= " \n Version " . |
$package['min'] . ' or older'; |
} |
|
if (isset($package['recommended'])) { |
$info[$groupindex] .= "\n Recommended version: $package[recommended]"; |
} |
|
if (isset($package['exclude'])) { |
if (!isset($info['Not Compatible with'])) { |
$info['Not Compatible with'] = ''; |
966,6 → 1095,7 |
} else { |
$info[$groupindex] .= "Not Compatible with\n"; |
} |
|
if (is_array($package['exclude'])) { |
$package['exclude'] = implode(', ', $package['exclude']); |
} |
977,6 → 1107,7 |
} |
} |
} |
|
if ($obj->getPackageType() == 'bundle') { |
$info['Bundled Packages'] = ''; |
foreach ($obj->getBundledPackages() as $package) { |
983,6 → 1114,7 |
if (!empty($info['Bundled Packages'])) { |
$info['Bundled Packages'] .= "\n"; |
} |
|
if (isset($package['uri'])) { |
$info['Bundled Packages'] .= '__uri/' . $package['name']; |
$info['Bundled Packages'] .= "\n (URI: $package[uri]"; |
991,21 → 1123,22 |
} |
} |
} |
|
$info['package.xml version'] = '2.0'; |
if ($installed) { |
if ($obj->getLastModified()) { |
$info['Last Modified'] = date('Y-m-d H:i', $obj->getLastModified()); |
} |
|
$v = $obj->getLastInstalledVersion(); |
$info['Previous Installed Version'] = $v ? $v : '- None -'; |
} |
|
foreach ($info as $key => $value) { |
$data['data'][] = array($key, $value); |
} |
|
$data['raw'] = $obj->getArray(); // no validation needed |
|
$this->ui->outputData($data, 'package-info'); |
} |
} |
|
?> |