]> granicus.if.org Git - php/commitdiff
* support "pear-get install XML_RPC"
authorStig Bakken <ssb@php.net>
Wed, 2 Jan 2002 17:12:26 +0000 (17:12 +0000)
committerStig Bakken <ssb@php.net>
Wed, 2 Jan 2002 17:12:26 +0000 (17:12 +0000)
pear/PEAR/Installer.php

index dab993219097dd8535f885ace81f3e6884e8da3a..39fe746a24ca3c42ed180911df27205e96192678 100644 (file)
@@ -167,7 +167,7 @@ class PEAR_Installer extends PEAR_Common
      * @return bool true if successful, false if not
      */
 
-    function install($pkgfile, $options = array())
+    function install($pkgfile, $options = array(), $config = null)
     {
         // recognized options:
         // - register_only : update registry but don't install files
@@ -181,6 +181,16 @@ class PEAR_Installer extends PEAR_Common
         if (preg_match('#^(http|ftp)://#', $pkgfile)) {
             $need_download = true;
         } elseif (!@is_file($pkgfile)) {
+            if (preg_match('/^[A-Z][A-Za-z0-9_]+$/', $pkgfile)) {
+                // valid package name
+                if ($config === null) {
+                    $pkgfile = "http://pear.php.net/get/$pkgfile";
+                } else {
+                    $pkgfile = "http://" . $config->get('master_server') .
+                         "/get/$pkgfile";
+                }
+                $need_download = true;
+            }
             return $this->raiseError("could not open the package file: $pkgfile");
         }
 
@@ -328,6 +338,7 @@ class PEAR_Installer extends PEAR_Common
     }
 
     // }}}
+    // {{{ checkDeps()
 
     function checkDeps(&$pkginfo)
     {
@@ -345,6 +356,8 @@ class PEAR_Installer extends PEAR_Common
         }
         return false;
     }
+
+    // }}}
 }
 
 ?>
\ No newline at end of file