svn: /pear/pear-core/trunk/PEAR/ Command/Remote.php Frontend/CLI.php

[email protected] (Helgi Þormar Þorbjörnsson) Sun, 01 Aug 2010 17:46:53 +0000
Newsgroups php.pear.cvs,php.pear.core
Message-ID <[email protected]>
dufuz                                    Sun, 01 Aug 2010 17:46:53 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=301766

Log:
Improved the fix for Bug #17641, made it CLI specific so we don't mess with other legacy UIs

Bug: http://pear.php.net/bugs/17641 (unknown) 
      
Changed paths:
    U   pear/pear-core/trunk/PEAR/Command/Remote.php
    U   pear/pear-core/trunk/PEAR/Frontend/CLI.php

Modified: pear/pear-core/trunk/PEAR/Command/Remote.php
===================================================================
--- pear/pear-core/trunk/PEAR/Command/Remote.php	2010-08-01 17:34:09 UTC (rev 301765)
+++ pear/pear-core/trunk/PEAR/Command/Remote.php	2010-08-01 17:46:53 UTC (rev 301766)
@@ -286,10 +286,7 @@
         if (count($available) == 0) {
             $data = '(no packages available yet)';
         } else {
-            $packages = array_keys($available);
-            natcasesort($packages);
-            foreach ($packages as $name) {
-                $info = $available[$name];
+            foreach ($available as $name => $info) {
                 $version = (isset($info['stable']) && $info['stable']) ? $info['stable'] : '-n/a-';
                 $data['data'][] = array($name, $version);
             }
@@ -353,10 +350,7 @@
         }
         $local_pkgs = $reg->listPackages($channel);

-        $packages = array_keys($available);
-        natcasesort($packages);
-        foreach ($packages as $name) {
-            $info = $available[$name];
+        foreach ($available as $name => $info) {
             $installed = $reg->packageInfo($name, null, $channel);
             if (is_array($installed['version'])) {
                 $installed['version'] = $installed['version']['release'];
@@ -540,10 +534,7 @@
             $available = array();
         }

-        $packages = array_keys($available);
-        natcasesort($packages);
-        foreach ($packages as $name) {
-            $info = $available[$name];
+        foreach ($available as $name => $info) {
             $installed = $reg->packageInfo($name, null, $channel);
             $desc = $info['summary'];
             if (isset($params[$name]))
@@ -577,7 +568,7 @@
                     $desc,
                 );
             }
-            $data['data']['all'][] = $packageinfo;
+            $data['data'][$info['category']][] = $packageinfo;
         }

         $this->ui->outputData($data, $command);

Modified: pear/pear-core/trunk/PEAR/Frontend/CLI.php
===================================================================
--- pear/pear-core/trunk/PEAR/Frontend/CLI.php	2010-08-01 17:34:09 UTC (rev 301765)
+++ pear/pear-core/trunk/PEAR/Frontend/CLI.php	2010-08-01 17:46:53 UTC (rev 301766)
@@ -415,12 +415,19 @@
                     $this->_tableRow($data['headline'], array('bold' => true), array(1 => array('wrap' => 55)));
                 }

+                $packages = array();
                 foreach($data['data'] as $category) {
-                    foreach($category as $pkg) {
-                        $this->_tableRow($pkg, null, array(1 => array('wrap' => 55)));
+                    foreach($category as $name => $pkg) {
+                        $packages[$pkg[0]] = $pkg;
                     }
                 }

+                $p = array_keys($packages);
+                natcasesort($p);
+                foreach ($p as $name) {
+                    $this->_tableRow($packages[$name], null, array(1 => array('wrap' => 55)));
+                }
+
                 $this->_endTable();
                 break;
             case 'list-all':
@@ -434,13 +441,21 @@
                     $this->_tableRow($data['headline'], array('bold' => true), array(1 => array('wrap' => 55)));
                 }

+                $packages = array();
                 foreach($data['data'] as $category) {
-                    foreach($category as $pkg) {
-                        unset($pkg[4], $pkg[5]);
-                        $this->_tableRow($pkg, null, array(1 => array('wrap' => 55)));
+                    foreach($category as $name => $pkg) {
+                        $packages[$pkg[0]] = $pkg;
                     }
                 }

+                $p = array_keys($packages);
+                natcasesort($p);
+                foreach ($p as $name) {
+                    $pkg = $packages[$name];
+                    unset($pkg[4], $pkg[5]);
+                    $this->_tableRow($pkg, null, array(1 => array('wrap' => 55)));
+                }
+
                 $this->_endTable();
                 break;
             case 'config-show':