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

From: Date: Tue, 08 Jul 2008 22:50:10 +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-7617@lists.php.net to get a copy of this message
dufuz Tue Jul 8 22:50:10 2008 UTC Modified files: /pear-core/PEAR/Command Install.php Log: Cosmetics http://cvs.php.net/viewvc.cgi/pear-core/PEAR/Command/Install.php?r1=1.142&r2=1.143&diff_format=u Index: pear-core/PEAR/Command/Install.php diff -u pear-core/PEAR/Command/Install.php:1.142 pear-core/PEAR/Command/Install.php:1.143 --- pear-core/PEAR/Command/Install.php:1.142 Tue Jul 8 20:31:44 2008 +++ pear-core/PEAR/Command/Install.php Tue Jul 8 22:50:10 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.142 2008/07/08 20:31:44 dufuz Exp $ + * @version CVS: $Id: Install.php,v 1.143 2008/07/08 22:50:10 dufuz Exp $ * @link http://pear.php.net/package/PEAR * @since File available since Release 0.1 */ @@ -548,10 +548,10 @@ } $abstractpackages = array(); - $otherpackages = array(); + $otherpackages = array(); // parse params PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); - foreach($params as $param) { + foreach ($params as $param) { if (strpos($param, 'http://') === 0) { $otherpackages[] = $param; continue; @@ -570,11 +570,10 @@ continue; } - if ($reg->packageExists($pf->getPackage(), $pf->getChannel()) && - version_compare($pf->getVersion(), - $reg->packageInfo($pf->getPackage(), 'version', $pf->getChannel()), - '<=')) { - + $exists = $reg->packageExists($pf->getPackage(), $pf->getChannel()); + $pversion = $reg->packageInfo($pf->getPackage(), 'version', $pf->getChannel()); + $version_compare = version_compare($pf->getVersion(), $pversion, '<='); + if ($exists && $version_compare) { if ($this->config->get('verbose')) { $this->ui->outputData('Ignoring installed package ' . $reg->parsedPackageNameToString( @@ -601,14 +600,14 @@ if (count($abstractpackages) && !isset($options['force'])) { // when not being forced, only do necessary upgrades/installs if (isset($options['upgrade'])) { - $abstractpackages = $this->_filterUptodatePackages($abstractpackages, - $command); + $abstractpackages = $this->_filterUptodatePackages($abstractpackages, $command); } else { foreach ($abstractpackages as $i => $package) { if (isset($package['group'])) { // do not filter out install groups continue; } + if ($instreg->packageExists($package['package'], $package['channel'])) { if ($this->config->get('verbose')) { $this->ui->outputData('Ignoring installed package ' . @@ -691,7 +690,7 @@ // we just installed a different package than requested, // let's change the param and info so that the rest of this works $param = $info[0]; - $info = $info[1]; + $info = $info[1]; } } @@ -1138,24 +1137,26 @@ $latestReleases = array(); $ret = array(); - foreach($packages as $package) { + foreach ($packages as $package) { if (isset($package['group'])) { $ret[] = $package; continue; } - $channel = $package['channel']; - $name = $package['package']; + $channel = $package['channel']; + $name = $package['package']; if (!$reg->packageExists($name, $channel)) { $ret[] = $package; continue; } + if (!isset($latestReleases[$channel])) { // fill in cache for this channel $chan = &$reg->getChannel($channel); if (PEAR::isError($chan)) { return $this->raiseError($chan); } + if ($chan->supportsREST($this->config->get('preferred_mirror', null, $channel)) && $base = $chan->getBaseURL('REST1.0', @@ -1167,6 +1168,7 @@ $dorest = false; $remote = &$this->config->getRemote($this->config); } + PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); if ($dorest) { $rest = &$this->config->getREST('1.0', array()); @@ -1175,10 +1177,11 @@ $this->config->get('preferred_state', null, $channel), $installed, $channel, $reg); } else { - $latest = $remote->call("package.listLatestReleases", + $latest = $remote->call('package.listLatestReleases', $this->config->get('preferred_state', null, $channel)); unset($remote); } + PEAR::staticPopErrorHandling(); if (PEAR::isError($latest)) { $this->ui->outputData('Error getting channel info from ' . $channel . @@ -1194,10 +1197,11 @@ // if not set, up to date $inst_version = $reg->packageInfo($name, 'version', $channel); $channel_version = $latestReleases[$channel][strtolower($name)]['version']; - if (version_compare($channel_version, $inst_version, "le")) { + if (version_compare($channel_version, $inst_version, 'le')) { // installed version is up-to-date continue; } + // maintain BC if ($command == 'upgrade-all') { $this->ui->outputData(array('data' => 'Will upgrade ' . @@ -1210,5 +1214,4 @@ return $ret; } -} -?> +} \ No newline at end of file

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