]> granicus.if.org Git - php/commitdiff
- Make the rellocation of packages work as expected if the target
authorTomas V.V.Cox <cox@php.net>
Thu, 21 Mar 2002 22:29:03 +0000 (22:29 +0000)
committerTomas V.V.Cox <cox@php.net>
Thu, 21 Mar 2002 22:29:03 +0000 (22:29 +0000)
  dir doesn't exist
- The "install -f" now replaces the info in the registry

pear/PEAR/Command/Install.php
pear/PEAR/Installer.php
pear/PEAR/Registry.php
pear/scripts/pear.in

index 6cfd8e65cc08cddbcf158e9c8483fbbc25c4263f..e858adf5e079d88d8f4dfa23200f69ea1ee77a4b 100644 (file)
@@ -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 {
index 260e3e817efee8ab8d78732120420bdecbab4494..0e9dbdaf191e03021ced5316d2eb7653ef7e918e 100644 (file)
@@ -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);
index 7bb9b9b47d08f2cbc9567fc013fa32146acccade..9257aa84cb1686658214c56fd1aebd23a731592e 100644 (file)
@@ -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;
index 85368cce73f7f126c3d205e9c0f7f3407ee9edf0..f7a7d0d5481209ed7b87a869e2023d41817029c7 100644 (file)
@@ -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);