cvs: pear-core /PEAR/Command Registry.php
| From: | Greg Beaver | Date: | Mon, 21 Feb 2005 06:54:00 +0000 |
| Subject: | cvs: pear-core /PEAR/Command Registry.php | ||
| Groups: | php.pear.cvs php.pear.core | ||
| Request: | Send a blank email to pear-cvs+get-29605@lists.php.net to get a copy of this message | ||
cellog Mon Feb 21 01:54:00 2005 EDT
Modified files:
/pear-core/PEAR/Command Registry.php
Log:
try a lighter memory usage for pear list
http://cvs.php.net/diff.php/pear-core/PEAR/Command/Registry.php?r1=1.59&r2=1.60&ty=u
Index: pear-core/PEAR/Command/Registry.php
diff -u pear-core/PEAR/Command/Registry.php:1.59 pear-core/PEAR/Command/Registry.php:1.60
--- pear-core/PEAR/Command/Registry.php:1.59 Sun Feb 20 11:40:51 2005
+++ pear-core/PEAR/Command/Registry.php Mon Feb 21 01:53:59 2005
@@ -17,7 +17,7 @@
// | |
// +----------------------------------------------------------------------+
//
-// $Id: Registry.php,v 1.59 2005/02/20 16:40:51 cellog Exp $
+// $Id: Registry.php,v 1.60 2005/02/21 06:53:59 cellog Exp $
require_once 'PEAR/Command/Common.php';
require_once 'PEAR/Registry.php';
@@ -99,13 +99,6 @@
// {{{ doList()
- function _sortinfo($a, $b)
- {
- $apackage = isset($a['package']) ? $a['package'] :
$a['name'];
- $bpackage = isset($b['package']) ? $b['package'] :
$b['name'];
- return strcmp($apackage, $bpackage);
- }
-
function doList($command, $options, $params)
{
if (isset($options['allchannels'])) {
@@ -124,21 +117,22 @@
} else {
$channel = $this->config->get('default_channel');
}
- $installed = $reg->packageInfo(null, null, $channel);
- usort($installed, array(&$this, '_sortinfo'));
+ $names = $reg->listPackages($channel);
+ usort($names, 'strnatcmp');
+ $installed = array();
+ foreach ($names as $name) {
+ $installed[] = array('package' => $name,
+ 'version' => $reg->packageInfo($name, 'version',
$channel),
+ 'state' => $reg->packageInfo($name, 'state', $channel));
+ }
$i = $j = 0;
$data = array(
'caption' => 'Installed packages, channel ' .
$channel . ':',
'border' => true,
- 'headline' => array('Package', 'Version',
'State')
+ 'headline' => array('Package', 'Version',
'State'),
+ 'data' => $installed
);
- foreach ($installed as $package) {
- $pobj = $reg->getPackage(isset($package['package']) ?
- $package['package'] : $package['name'],
$channel);
- $data['data'][] = array($pobj->getPackage(), $pobj->getVersion(),
- $pobj->getState() ? $pobj->getState() : null);
- }
if (count($installed)==0) {
$data = '(no packages installed from channel ' . $channel . ')';
}