]> granicus.if.org Git - php/commitdiff
PEAR now uses "use" instead of "include".
authorStig Bakken <ssb@php.net>
Thu, 9 Mar 2000 21:57:14 +0000 (21:57 +0000)
committerStig Bakken <ssb@php.net>
Thu, 9 Mar 2000 21:57:14 +0000 (21:57 +0000)
pear/DB.php
pear/Makefile.in

index dc8853539c762f42c842abb46ea2a57f897f3948..2b76a790cfce6bd187554de6a6a730b10ddde16a 100644 (file)
@@ -22,9 +22,6 @@
 // Database independent query interface.
 //
 
-if (!empty($GLOBALS['USED_PACKAGES']['DB'])) return;
-$GLOBALS['USED_PACKAGES']['DB'] = true;
-
 // {{{ Database independent error codes.
 
 /*
@@ -164,15 +161,8 @@ class DB {
         * error
         */
     function &factory($type) {
-               global $USED_PACKAGES;
-               // "include" should be replaced with "import" once PHP gets it
-               $pkgname = 'DB/' . $type;
-               if (!is_array($USED_PACKAGES) || !$USED_PACKAGES[$pkgname]) {
-                       if (!@include("${pkgname}.php")) {
-                               return DB_ERROR_NOT_FOUND;
-                       } else {
-                               $USED_PACKAGES[$pkgname] = true;
-                       }
+               if (!@import("DB/${type}.php")) {
+                       return DB_ERROR_NOT_FOUND;
                }
                $classname = 'DB_' . $type;
                $obj = new $classname;
@@ -200,23 +190,8 @@ class DB {
 
                $dsninfo = DB::parseDSN($dsn);
                $type = $dsninfo['phptype'];
-               // "include" should be replaced with "import" once PHP gets it
-               $pkgname = 'DB/' . $type;
-               if (!is_array($USED_PACKAGES) || !$USED_PACKAGES[$pkgname]) {
-                       $file = "${pkgname}.php";
-                       include($file);
-/*
-
-   This suddenly stopped working.  I thought include() was supposed to
-   return a boolean? [ssb 20000218]
-
-                       if (!include($file)) {
-                               print "'$file' not found<br>\n";
-                               return DB_ERROR_NOT_FOUND;
-                       } else {
-                               $USED_PACKAGES[$pkgname] = true;
-                       }
-*/
+               if (!@import("DB/${type}.php")) {
+                       return DB_ERROR_NOT_FOUND;
                }
                $classname = 'DB_' . $type;
                $obj = new $classname;
@@ -281,7 +256,7 @@ class DB {
         * not recognized
         */
        function errorMessage($code) {
-               if (!is_array($errorMessages)) {
+               if (!isset($errorMessages)) {
                        $errorMessages = array(
                                DB_OK                   => "no error",
                                DB_ERROR                => "unknown error",
index 6c8f7cc5d9cbb90247dccf0aa60ba51326a265ec..5b3dee222f81262e6327029531b96cc5b821f040 100644 (file)
@@ -18,7 +18,8 @@ install-data-local:
        $(INSTALL_DATA) $(srcdir)/DB/odbc.php $(pear_DBdir) && \
        $(INSTALL_DATA) $(srcdir)/DB/mysql.php $(pear_DBdir) && \
        $(INSTALL_DATA) $(srcdir)/DB/pgsql.php $(pear_DBdir) && \
-       $(INSTALL_DATA) $(srcdir)/DB/storage.php $(pear_DBdir)
+       $(INSTALL_DATA) $(srcdir)/DB/storage.php $(pear_DBdir) && \
+       $(INSTALL_DATA) $(srcdir)/HTTP.php $(peardir)
 
 phpincludedir = $(includedir)/php
 builddir = $(prefix)/lib/php/build