This repository has been archived by the owner on Sep 14, 2022. It is now read-only.
/
index.php
96 lines (85 loc) · 2.72 KB
/
index.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<?php
// if there is a settings file skip installation
if(!is_file("bundt.settings.php")) {
require_once "bundt.util.install.php";
$bundt_installer = new Install();
// check if CouchDB is installed and running
$bundt_installer->step(array(
"title" => "Install CouchDB",
"failure" => "You don't have the correct version of CouchDB installed. Please upgrade to the latest version. It can be downloaded from <a href=\"http://couchdb.apache.org/\">http://couchdb.apache.org/</a>",
"prompt" => array(
array(
"type" => "url",
"text" => "Or maybe we can't find it. Where's it located? We'll check again.",
"value" => "http://localhost:5984/",
"name" => "COUCH_LOCATION",
"filter" => FILTER_SANITIZE_URL
)
),
"test" => function() {
global $couch;
$info = $couch->relax()->response();
return $info && (version_compare($info["version"], "0.10.0", ">="));
}
));
// create the database structure
$bundt_installer->step(array(
"title" => "Create Database Structure",
"failure" => "The database could not be initialized. Please check that CouchDB has been setup properly.",
"test" => function () {
global $couch;
$users = $couch("bundt-users")->get()->response();
$fonts = $couch("bundt-fonts")->get()->response();
return !isset($users["error"]) && !isset($fonts["error"]);
},
"automatic" => function () {
global $couch;
$couch("bundt-users")->create();
$couch("bundt-users")->import("database/bundt-users.json");
$couch("bundt-fonts")->create();
$couch("bundt-fonts")->import("database/bundt-fonts.json");
}
));
$bundt_installer->step(array(
"title" => "Create Your Account",
"failure" => " <a href=\"/signup/\">Please create your account »</a>",
"test" => function() {
global $couch;
return $couch("users", "_design/user", "bundt-users")->count() > 0;
}
));
$bundt_installer->step(array(
"title" => "Assign Administrator Privileges",
"failure" => "Failed to assign administrator privileges to a user. You may need to do this manually.
<ol>
<li>Go to your CouchDB Futon installation</li>
<li>In the <code>bundt-users</code> database, find the user whom you wish grant administrative privileges</li>
<li>Change the <code>role</code> property to <code>8</code></li>
</ol>",
"test" => function () {
return false;
},
"automatic" => function () {
return false;
}
));
/*$bundt_installer->step(array(
"title" => "Choose some fonts"
));*/
?>
<html>
<head>
<title>Bundt Installation Awesomeness</title>
</head>
<body><?php
// process any new config
$bundt_installer->process_settings();
require_once "bundt.util.couch.php";
$bundt_installer->run();
?>
</body>
</html>
<?php
} else {
include "bundt.views.editor.xhtml";
}