From: kink Date: Sun, 16 Dec 2007 16:34:55 +0000 (+0000) Subject: optionally make use of dynamic mysql extension loading done by PEAR. X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=commitdiff_plain;h=d053c206a77e37162af9e889d8cd6d822292bc14 optionally make use of dynamic mysql extension loading done by PEAR. Thanks Walter Huijbers. (#1833123) git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@12826 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- diff --git a/src/configtest.php b/src/configtest.php index 431904bc..967ac11a 100644 --- a/src/configtest.php +++ b/src/configtest.php @@ -275,7 +275,14 @@ if(count($diff)) { do_err('Required PHP extensions missing: '.implode(', ',$diff) ); } -echo $IND . "PHP extensions OK.
\n"; +echo $IND . "PHP extensions OK. Dynamic loading is "; + +if (!(bool)ini_get('enable_dl') || (bool)ini_get('safe_mode')) { + echo "disabled.
\n"; +} else { + echo "enabled.
\n"; +} + /* dangerous php settings */ /** @@ -866,22 +873,28 @@ if($addrbook_dsn || $prefs_dsn || $addrbook_global_dsn) { foreach($dsns as $type => $dsn) { $aDsn = explode(':', $dsn); $dbtype = array_shift($aDsn); + if(isset($db_functions[$dbtype]) && function_exists($db_functions[$dbtype])) { echo "$IND$dbtype database support present.
\n"; + } elseif(!(bool)ini_get('enable_dl') || (bool)ini_get('safe_mode')) { + do_err($dbtype.' database support not present!'); + } else { + // Non-fatal error + do_err($dbtype.' database support not present or not configured! + Trying to dynamically load '.$dbtype.' extension. + Please note that it is advisable to not rely on dynamic loading of extensions.', FALSE); + } - // now, test this interface: - $dbh = DB::connect($dsn, true); - if (DB::isError($dbh)) { - do_err('Database error: '. htmlspecialchars(DB::errorMessage($dbh)) . - ' in ' .$type .' DSN.'); - } - $dbh->disconnect(); - echo "$IND$type database connect successful.
\n"; + // now, test this interface: - } else { - do_err($dbtype.' database support not present!'); + $dbh = DB::connect($dsn, true); + if (DB::isError($dbh)) { + do_err('Database error: '. htmlspecialchars(DB::errorMessage($dbh)) . + ' in ' .$type .' DSN.'); } + $dbh->disconnect(); + echo "$IND$type database connect successful.
\n"; } } else { $db_error='Required PHP PEAR DB support is not available.'