summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStig Bakken <ssb@php.net>2002-04-02 09:21:48 +0000
committerStig Bakken <ssb@php.net>2002-04-02 09:21:48 +0000
commitd4dfead250bbb6b9718fa9f3021f1510019f2424 (patch)
tree4d385ee695317aa21e9a4bc01a7755b7435393ef
parentf8fc50b922704dd12737efd56eb6a8b42d04a37d (diff)
downloadphp-git-d4dfead250bbb6b9718fa9f3021f1510019f2424.tar.gz
* Added "-s" (soft update) option to install/upgrade. Will make installs
fail silently.
-rw-r--r--pear/PEAR/Command/Install.php20
-rw-r--r--pear/PEAR/Installer.php8
2 files changed, 21 insertions, 7 deletions
diff --git a/pear/PEAR/Command/Install.php b/pear/PEAR/Command/Install.php
index cb75a30592..2bb4f167e3 100644
--- a/pear/PEAR/Command/Install.php
+++ b/pear/PEAR/Command/Install.php
@@ -77,11 +77,20 @@ class PEAR_Command_Install extends PEAR_Command_Common
$ret[1] = "{$ret[1]}\n" .
" -f forces the installation of the package\n".
" when it is already installed\n".
- " -n do not take care of package dependencies";
+ " -n do not take care of package dependencies\n".
+ " -s soft update: install or upgrade only if needed";
return $ret;
}
// }}}
+ // {{{ getOptions()
+
+ function getOptions()
+ {
+ return array('f', 'n', 's');
+ }
+
+ // }}}
// {{{ run()
function run($command, $options, $params)
@@ -89,6 +98,7 @@ class PEAR_Command_Install extends PEAR_Command_Common
$installer = &new PEAR_Installer($this->config->get('php_dir'),
$this->config->get('ext_dir'),
$this->config->get('doc_dir'));
+ $installer->setFrontend($this->ui);
$installer->debug = $this->config->get('verbose');
$failmsg = '';
@@ -99,6 +109,9 @@ class PEAR_Command_Install extends PEAR_Command_Common
if (isset($options['n'])) {
$opts['nodeps'] = true;
}
+ if (isset($options['s'])) {
+ $opts['soft'] = true;
+ }
switch ($command) {
case 'upgrade':
$opts['upgrade'] = true;
@@ -130,11 +143,6 @@ class PEAR_Command_Install extends PEAR_Command_Common
}
// }}}
-
- function getOptions()
- {
- return array('f', 'n');
- }
}
?> \ No newline at end of file
diff --git a/pear/PEAR/Installer.php b/pear/PEAR/Installer.php
index 0e9dbdaf19..d632449a9a 100644
--- a/pear/PEAR/Installer.php
+++ b/pear/PEAR/Installer.php
@@ -171,6 +171,7 @@ class PEAR_Installer extends PEAR_Common
// recognized options:
// - register_only : update registry but don't install files
// - upgrade : upgrade existing install
+ // - soft : fail silently
//
if (empty($this->registry)) {
$this->registry = new PEAR_Registry($this->phpdir);
@@ -182,6 +183,9 @@ class PEAR_Installer extends PEAR_Common
} elseif (!@is_file($pkgfile)) {
if (preg_match('/^[A-Z][A-Za-z0-9_]+$/', $pkgfile)) {
// valid package name
+ if ($this->registry->packageExists($pkgfile)) {
+ return $this->raiseError("$pkgfile already installed");
+ }
if ($config === null) {
$pkgfile = "http://pear.php.net/get/$pkgfile";
} else {
@@ -291,7 +295,9 @@ class PEAR_Installer extends PEAR_Common
if (isset($pkginfo['release_deps']) && !isset($options['nodeps'])) {
$error = $this->checkDeps($pkginfo);
if ($error) {
- $this->log(0, $error);
+ if (empty($options['soft'])) {
+ $this->log(0, $error);
+ }
return $this->raiseError('Dependencies failed');
}
}