-
Notifications
You must be signed in to change notification settings - Fork 5
/
setup.php
55 lines (42 loc) · 1.33 KB
/
setup.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Limonade Blog Example Setup</title>
<meta name="generator" content="TextMate http://macromates.com/">
<meta name="author" content="Fabrice Luraine">
<!-- Date: 2009-06-26 -->
</head>
<body>
<h1>Limonade Blog Example Setup</h1>
<?php
function exceptions_error_handler($severity, $message, $filename, $lineno)
{
if (error_reporting() == 0) return;
if (error_reporting() & $severity)
throw new ErrorException($message, 0, $severity, $filename, $lineno);
}
set_error_handler('exceptions_error_handler');
$localhost = preg_match('/^localhost(\:\d+)?/', $_SERVER['HTTP_HOST']);
$db_file_name = $localhost ? 'dev.db' : 'prod.db';
$dsn = "sqlite:db/$db_file_name";
try
{
$db = new PDO($dsn);
$db->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING );
$db->exec(file_get_contents('db/schema.sql'));
$db->exec(file_get_contents('db/fixtures.sql'));
?>
<p>Setup succesful. <a href="index.php">Let's go !</a></p>
<?php
}
catch(Exception $e)
{
?>
<p><strong>Setup failed:</strong> <code><?php echo e?></code>
<?php
}
?>
</body>
</html>