cvs: php4 /pear/PEAR Installer.php /pear/PEAR/Command Install.php
| From: | Stig Bakken | Date: | Tue, 02 Apr 2002 09:21:48 +0000 |
| Subject: | cvs: php4 /pear/PEAR Installer.php /pear/PEAR/Command Install.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-2979@lists.php.net to get a copy of this message | ||
ssb Tue Apr 2 04:21:48 2002 EDT
Modified files:
/php4/pear/PEAR Installer.php
/php4/pear/PEAR/Command Install.php
Log:
* Added "-s" (soft update) option to install/upgrade. Will make installs
fail silently.
Index: php4/pear/PEAR/Installer.php
diff -u php4/pear/PEAR/Installer.php:1.41 php4/pear/PEAR/Installer.php:1.42
--- php4/pear/PEAR/Installer.php:1.41 Sat Mar 23 00:29:09 2002
+++ php4/pear/PEAR/Installer.php Tue Apr 2 04:21:48 2002
@@ -17,7 +17,7 @@
// | Tomas V.V.Cox <cox@idecnet.com> |
// +----------------------------------------------------------------------+
//
-// $Id: Installer.php,v 1.41 2002/03/23 05:29:09 imajes Exp $
+// $Id: Installer.php,v 1.42 2002/04/02 09:21:48 ssb Exp $
require_once 'PEAR/Common.php';
require_once 'PEAR/Registry.php';
@@ -171,6 +171,7 @@
// 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 @@
} 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 @@
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');
}
}
Index: php4/pear/PEAR/Command/Install.php
diff -u php4/pear/PEAR/Command/Install.php:1.13 php4/pear/PEAR/Command/Install.php:1.14
--- php4/pear/PEAR/Command/Install.php:1.13 Mon Apr 1 14:17:59 2002
+++ php4/pear/PEAR/Command/Install.php Tue Apr 2 04:21:48 2002
@@ -16,7 +16,7 @@
// | Author: Stig Bakken <ssb@fast.no> |
// +----------------------------------------------------------------------+
//
-// $Id: Install.php,v 1.13 2002/04/01 19:17:59 cox Exp $
+// $Id: Install.php,v 1.14 2002/04/02 09:21:48 ssb Exp $
require_once "PEAR/Command/Common.php";
require_once "PEAR/Installer.php";
@@ -77,11 +77,20 @@
$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 @@
$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 @@
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 @@
}
// }}}
-
- function getOptions()
- {
- return array('f', 'n');
- }
}
?>