cvs: pear-core /PEAR/Command Registry.php

From: Date: Mon, 21 Feb 2005 07:11:51 +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-29604@lists.php.net to get a copy of this message
cellog Mon Feb 21 02:11:51 2005 EDT Modified files: /pear-core/PEAR/Command Registry.php Log: revert terrible non-lightweight code http://cvs.php.net/diff.php/pear-core/PEAR/Command/Registry.php?r1=1.60&r2=1.61&ty=u Index: pear-core/PEAR/Command/Registry.php diff -u pear-core/PEAR/Command/Registry.php:1.60 pear-core/PEAR/Command/Registry.php:1.61 --- pear-core/PEAR/Command/Registry.php:1.60 Mon Feb 21 01:53:59 2005 +++ pear-core/PEAR/Command/Registry.php Mon Feb 21 02:11:50 2005 @@ -17,7 +17,7 @@ // | | // +----------------------------------------------------------------------+ // -// $Id: Registry.php,v 1.60 2005/02/21 06:53:59 cellog Exp $ +// $Id: Registry.php,v 1.61 2005/02/21 07:11:50 cellog Exp $ require_once 'PEAR/Command/Common.php'; require_once 'PEAR/Registry.php'; @@ -99,6 +99,13 @@ // {{{ 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'])) { @@ -117,22 +124,21 @@ } else { $channel = $this->config->get('default_channel'); } - $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)); - } + $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'), - 'data' => $installed + 'headline' => array('Package', 'Version', 'State') ); + 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 . ')'; }

« previous php.pear.cvs (#29604) next »