From: Tomas V.V.Cox Date: Thu, 21 Mar 2002 22:29:03 +0000 (+0000) Subject: - Make the rellocation of packages work as expected if the target X-Git-Tag: php-4.3.0dev-ZendEngine2-Preview1~1138 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9772468d37096ea7c5b551b78491c5a597ffdd25;p=php - Make the rellocation of packages work as expected if the target dir doesn't exist - The "install -f" now replaces the info in the registry --- diff --git a/pear/PEAR/Command/Install.php b/pear/PEAR/Command/Install.php index 6cfd8e65cc..e858adf5e0 100644 --- a/pear/PEAR/Command/Install.php +++ b/pear/PEAR/Command/Install.php @@ -77,7 +77,7 @@ class PEAR_Command_Install extends PEAR_Command_Common if (isset($options['f'])) { $opts['force'] = true; } - // The ['force'] and ['nodeps'] options are still missing + // XXX The ['nodeps'] option is still missing if ($installer->install(@$params[0], $opts, $this->config)) { $this->ui->displayLine("install ok"); } else { diff --git a/pear/PEAR/Installer.php b/pear/PEAR/Installer.php index 260e3e817e..0e9dbdaf19 100644 --- a/pear/PEAR/Installer.php +++ b/pear/PEAR/Installer.php @@ -347,6 +347,10 @@ class PEAR_Installer extends PEAR_Common // Register that the package is installed ----------------------- if (empty($options['upgrade'])) { + // if 'force' is used, replace the info in registry + if (!empty($options['force']) && $this->registry->packageExists($pkgname)) { + $this->registry->deletePackage($pkgname); + } $ret = $this->registry->addPackage($pkgname, $this->pkginfo); } else { $ret = $this->registry->updatePackage($pkgname, $this->pkginfo, false); diff --git a/pear/PEAR/Registry.php b/pear/PEAR/Registry.php index 7bb9b9b47d..9257aa84cb 100644 --- a/pear/PEAR/Registry.php +++ b/pear/PEAR/Registry.php @@ -198,6 +198,10 @@ class PEAR_Registry extends PEAR // XXX does not check type of lock (LOCK_SH/LOCK_EX) return true; } + $php_dir = dirname($this->lockfile); + if (!@is_dir($php_dir) && !System::mkDir("-p $php_dir")) { + return false; + } $this->lock_fp = @fopen($this->lockfile, "w"); if (!is_resource($this->lock_fp)) { return null; diff --git a/pear/scripts/pear.in b/pear/scripts/pear.in index 85368cce73..f7a7d0d548 100644 --- a/pear/scripts/pear.in +++ b/pear/scripts/pear.in @@ -63,7 +63,7 @@ $verbose = $config->get("verbose"); $cmdopts = array(); foreach ($opts as $opt) { - $param = !empty($opt[1]) ? $opt[1] : null; + $param = !empty($opt[1]) ? $opt[1] : true; switch ($opt[0]) { case 'd': list($key, $value) = explode('=', $param);