diff options
| author | Stig Bakken <ssb@php.net> | 2000-03-09 21:57:14 +0000 |
|---|---|---|
| committer | Stig Bakken <ssb@php.net> | 2000-03-09 21:57:14 +0000 |
| commit | 81ff62c2713b690434514d3bc1cac59f7af22bae (patch) | |
| tree | 29c03e75423856648959223c3156c002e98a8174 /pear | |
| parent | e8cf4a40d4f814c3bca12016e347a2b956b35a6e (diff) | |
| download | php-git-81ff62c2713b690434514d3bc1cac59f7af22bae.tar.gz | |
PEAR now uses "use" instead of "include".
Diffstat (limited to 'pear')
| -rw-r--r-- | pear/DB.php | 35 | ||||
| -rw-r--r-- | pear/Makefile.in | 3 |
2 files changed, 7 insertions, 31 deletions
diff --git a/pear/DB.php b/pear/DB.php index dc8853539c..2b76a790cf 100644 --- a/pear/DB.php +++ b/pear/DB.php @@ -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", diff --git a/pear/Makefile.in b/pear/Makefile.in index 6c8f7cc5d9..5b3dee222f 100644 --- a/pear/Makefile.in +++ b/pear/Makefile.in @@ -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 |
