a somewhat nicer error message for can't connect to DB

git-svn-id: file:///home/shish/svn/shimmie2/trunk@390 7f39781d-f577-437e-ae19-be835c7a54ca
This commit is contained in:
shish 2007-07-28 14:15:03 +00:00
parent 86561be3ec
commit 619d18c8f3

View File

@ -32,10 +32,26 @@ class Database {
public function Database() {
if(is_readable("config.php")) {
require_once "config.php";
$this->db = NewADOConnection($database_dsn);
$this->db->SetFetchMode(ADODB_FETCH_ASSOC);
$this->db->Execute("SET NAMES utf8"); // FIXME: mysql specific :|
$this->extensions = $this->db->GetAssoc("SELECT name, version FROM extensions");
$this->db = @NewADOConnection($database_dsn);
if($this->db) {
$this->db->SetFetchMode(ADODB_FETCH_ASSOC);
$this->db->Execute("SET NAMES utf8"); // FIXME: mysql specific :|
$this->extensions = $this->db->GetAssoc("SELECT name, version FROM extensions");
}
else {
$version = VERSION;
print "
<html>
<head>
<title>Internal error - Shimmie-$version</title>
</head>
<body>
Internal error: Could not connect to database
</body>
</html>
";
exit;
}
}
else {
header("Location: install.php");