summaryrefslogtreecommitdiff
path: root/pear
diff options
context:
space:
mode:
authorStig Bakken <ssb@php.net>2002-07-28 08:52:55 +0000
committerStig Bakken <ssb@php.net>2002-07-28 08:52:55 +0000
commitcbbc47a1991b0b4e54a06989ea72d2491adb4ff6 (patch)
tree232658616495a40d6055542e800b8c33618a4ed2 /pear
parent2b4f112d026069388ba36cfb82fa72023e786f1f (diff)
downloadphp-git-cbbc47a1991b0b4e54a06989ea72d2491adb4ff6.tar.gz
* added "upgrade-all" command
Diffstat (limited to 'pear')
-rw-r--r--pear/PEAR/Command/Install.php58
1 files changed, 58 insertions, 0 deletions
diff --git a/pear/PEAR/Command/Install.php b/pear/PEAR/Command/Install.php
index 36c0b80cd3..a7b590e140 100644
--- a/pear/PEAR/Command/Install.php
+++ b/pear/PEAR/Command/Install.php
@@ -118,6 +118,34 @@ upgrade anyway).
More than one package may be specified at once.
'),
+ 'upgrade-all' => array(
+ 'summary' => 'Upgrade All Packages',
+ 'function' => 'doInstall',
+ 'shortcut' => 'ua',
+ 'options' => array(
+ 'nodeps' => array(
+ 'shortopt' => 'n',
+ 'doc' => 'ignore dependencies, upgrade anyway',
+ ),
+ 'register-only' => array(
+ 'shortopt' => 'r',
+ 'doc' => 'do not install files, only register the package as upgraded',
+ ),
+ 'nobuild' => array(
+ 'shortopt' => 'B',
+ 'doc' => 'don\'t build C extensions',
+ ),
+ 'nocompress' => array(
+ 'shortopt' => 'Z',
+ 'doc' => 'request uncompressed files when downloading',
+ ),
+ ),
+ 'doc' => '
+Upgrades all packages that have a newer release available. Upgrades are
+done only if there is a release available of the state specified in
+"preferred_state" (currently {config preferred_state}), or a state considered
+more stable.
+'),
'uninstall' => array(
'summary' => 'Un-install Package',
'function' => 'doUninstall',
@@ -162,6 +190,36 @@ specified at once.
if ($command == 'upgrade') {
$options[$command] = true;
}
+ if ($command == 'upgrade-all') {
+ include_once "PEAR/Remote.php";
+ $options['upgrade'] = true;
+ $remote = new PEAR_Remote($this->config);
+ $state = $this->config->get('preferred_state');
+ if (empty($state) || $state == 'any') {
+ $latest = $remote->call("package.listLatestReleases");
+ } else {
+ $latest = $remote->call("package.listLatestReleases", $state);
+ }
+ if (PEAR::isError($latest)) {
+ return $latest;
+ }
+ $reg = new PEAR_Registry($this->config->get('php_dir'));
+ $installed = array_flip($reg->listPackages());
+ $params = array();
+ foreach ($latest as $package => $info) {
+ if (!isset($installed[$package])) {
+ // skip packages we don't have installed
+ continue;
+ }
+ $inst_version = $reg->packageInfo($package, 'version');
+ if (version_compare("$info[version]", "$inst_version", "le")) {
+ // installed version is up-to-date
+ continue;
+ }
+ $params[] = $package;
+ $this->ui->outputData("will upgrade $package", $command);
+ }
+ }
foreach ($params as $pkg) {
$bn = basename($pkg);
$info = $this->installer->install($pkg, $options, $this->config);