From 26a74527c535f028dde40c1112b3e8868d78e013 Mon Sep 17 00:00:00 2001 From: wainstead Date: Sat, 20 Jan 2001 21:52:21 +0000 Subject: [PATCH] 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. git-svn-id: svn://svn.code.sf.net/p/phpwiki/code/trunk@374 96ab9672-09ca-45d6-a79d-3d69d39ca109 --- lib/config.php | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/lib/config.php b/lib/config.php index 7b5528b1e..7c1ba792a 100644 --- a/lib/config.php +++ b/lib/config.php @@ -10,7 +10,7 @@ if (!function_exists('rcs_id')) { function rcs_id($id) { echo "\n"; }; } - rcs_id('$Id: config.php,v 1.20 2001-01-19 22:20:30 wainstead Exp $'); + rcs_id('$Id: config.php,v 1.21 2001-01-20 21:52:21 wainstead Exp $'); // end essential internal stuff @@ -38,12 +38,16 @@ // set your database here and edit the according section below. // 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" - $WhichDatabase = 'dbm'; // use one of "dbm", "dba", "mysql", - // "pgsql", "msql", or "file" - - // DBM (default) and DBA settings - if ($WhichDatabase == 'dbm' or 'dba') { + + // DBM and DBA settings (default) + if ($WhichDatabase == 'dbm' or 'dba' or 'default') { $DBMdir = "/tmp"; $WikiPageStore = "wiki"; $ArchivePageStore = "archive"; @@ -54,6 +58,14 @@ $WikiDB['hitcount'] = "$DBMdir/wikihitcountdb"; // 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"; } else { -- 2.45.0