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

From: Date: Thu, 10 Jul 2008 20:16:26 +0000
Subject: cvs: pear-core /PEAR/Command Install.php
Groups: php.pear.cvs php.pear.core 
Request: Send a blank email to pear-core+get-7619@lists.php.net to get a copy of this message
dufuz Thu Jul 10 20:16:26 2008 UTC Modified files: /pear-core/PEAR/Command Install.php Log: Request #14324 Make the pear install command behave similar to apt-get Request #14325 make pear upgrade with no params behave like pear upgrade-all http://cvs.php.net/viewvc.cgi/pear-core/PEAR/Command/Install.php?r1=1.143&r2=1.144&diff_format=u Index: pear-core/PEAR/Command/Install.php diff -u pear-core/PEAR/Command/Install.php:1.143 pear-core/PEAR/Command/Install.php:1.144 --- pear-core/PEAR/Command/Install.php:1.143 Tue Jul 8 22:50:10 2008 +++ pear-core/PEAR/Command/Install.php Thu Jul 10 20:16:26 2008 @@ -16,7 +16,7 @@ * @author Greg Beaver <cellog@php.net> * @copyright 1997-2008 The PHP Group * @license http://www.php.net/license/3_0.txt PHP License 3.0 - * @version CVS: $Id: Install.php,v 1.143 2008/07/08 22:50:10 dufuz Exp $ + * @version CVS: $Id: Install.php,v 1.144 2008/07/10 20:16:26 dufuz Exp $ * @link http://pear.php.net/package/PEAR * @since File available since Release 0.1 */ @@ -525,6 +525,10 @@ } if ($command == 'upgrade' || $command == 'upgrade-all') { + // If people run the upgrade command but pass nothing, emulate a upgrade-all + if ($command == 'upgrade' && empty($params)) { + $this->doUpgradeAll($command, $options, $params); + } $options['upgrade'] = true; } else { $packages = $params; @@ -602,6 +606,7 @@ if (isset($options['upgrade'])) { $abstractpackages = $this->_filterUptodatePackages($abstractpackages, $command); } else { + $count = count($abstractpackages); foreach ($abstractpackages as $i => $package) { if (isset($package['group'])) { // do not filter out install groups @@ -609,11 +614,16 @@ } if ($instreg->packageExists($package['package'], $package['channel'])) { - if ($this->config->get('verbose')) { - $this->ui->outputData('Ignoring installed package ' . - $reg->parsedPackageNameToString($package, true)); + if ($count > 1) { + if ($this->config->get('verbose')) { + $this->ui->outputData('Ignoring installed package ' . + $reg->parsedPackageNameToString($package, true)); + } + unset($abstractpackages[$i]); + } elseif ($count === 1) { + // Lets try to upgrade it since it's already installed + $options['upgrade'] = true; } - unset($abstractpackages[$i]); } } }

« previous php.pear.core (#7619) next »