From: moodler Date: Sat, 7 Dec 2002 07:27:58 +0000 (+0000) Subject: If the database doesn't work then just die before anything else X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=a8a71844e45ce3112d8b246bc41bc34d90b9e0f8;p=moodle.git If the database doesn't work then just die before anything else --- diff --git a/lib/setup.php b/lib/setup.php index dfa2af0ef1..488ee0fc46 100644 --- a/lib/setup.php +++ b/lib/setup.php @@ -13,18 +13,22 @@ /// If there are any errors in the standard libraries we want to know! error_reporting(15); // use 0=none 7=normal 15=all +/// Connect to the database using adodb + + require("$CFG->libdir/adodb/adodb.inc.php"); // Database access functions + ADOLoadCode($CFG->dbtype); + $db = &ADONewConnection(); + if (! $db->PConnect($CFG->dbhost,$CFG->dbuser,$CFG->dbpass,$CFG->dbname)) { + echo "

The database details specified in config.php are not correct, or the database is down.

"; + die; + } + + /// Load up standard libraries require("$CFG->libdir/weblib.php"); // Standard web page functions - require("$CFG->libdir/adodb/adodb.inc.php"); // Database access functions - require("$CFG->libdir/adodb/tohtml.inc.php");// Database display functions require("$CFG->libdir/moodlelib.php"); // Various Moodle functions -/// Connect to the database using adodb - - ADOLoadCode($CFG->dbtype); - $db = &ADONewConnection(); - $db->PConnect($CFG->dbhost,$CFG->dbuser,$CFG->dbpass,$CFG->dbname); /// Set error reporting back to normal error_reporting(7);