From: Steve W. <wai...@us...> - 2001-01-20 21:52:12
|
Update of /cvsroot/phpwiki/phpwiki/lib In directory usw-pr-cvs1:/tmp/cvs-serv20825 Modified Files: config.php Log Message: Added a new database configuration selection, 'default'. There is an if/else that determines whether the user is running PHP3 or PHP4 and sets $WhichDatabase to either 'dbm' or 'dba', and then the corresponding library file (dbmlib.php or dbalib.php) is loaded. Index: config.php =================================================================== RCS file: /cvsroot/phpwiki/phpwiki/lib/config.php,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -r1.20 -r1.21 *** config.php 2001/01/19 22:20:30 1.20 --- config.php 2001/01/20 21:52:21 1.21 *************** *** 39,48 **** // For PHP 4.0.4 and later you must use "dba" if you are using // DBM files for storage. "dbm" uses the older deprecated interface. ! $WhichDatabase = 'dbm'; // use one of "dbm", "dba", "mysql", ! // "pgsql", "msql", or "file" ! ! // DBM (default) and DBA settings ! if ($WhichDatabase == 'dbm' or 'dba') { $DBMdir = "/tmp"; $WikiPageStore = "wiki"; --- 39,52 ---- // For PHP 4.0.4 and later you must use "dba" if you are using // DBM files for storage. "dbm" uses the older deprecated interface. + // The option 'default' will choose either dbm or dba, depending on + // the version of PHP you are running. + ///////////////////////////////////////////////////////////////////// ! $WhichDatabase = 'default'; // use one of "dbm", "dba", "mysql", ! // "pgsql", "msql", or "file" ! ! ! // DBM and DBA settings (default) ! if ($WhichDatabase == 'dbm' or 'dba' or 'default') { $DBMdir = "/tmp"; $WikiPageStore = "wiki"; *************** *** 55,58 **** --- 59,70 ---- // try this many times if the dbm is unavailable define("MAX_DBM_ATTEMPTS", 20); + + // for PHP3 use dbmlib, else use dbalib for PHP4 + if (($WhichDatabase == 'default') and (floor(phpversion())) == 3) { + $WhichDatabase = 'dbm'; + } else { + $WhichDatabase = 'dba'; + } + if ($WhichDatabase == 'dbm') { include "lib/dbmlib.php"; |