Continue working on new install
This commit is contained in:
parent
a3819f9e16
commit
0cdb25029f
|
@ -25,10 +25,11 @@ class InstallModule
|
|||
$istart = microtime(true); // time the database setup
|
||||
if (!isset($_POST['mode'])) redirect('/install'); // redirect if no mode
|
||||
$complete = $_POST['mode'] == 'complete'; // complete or partial setup
|
||||
$resFmt = '%s <span class="extra-data">(%fs)</span><br />';
|
||||
|
||||
$results = '';
|
||||
|
||||
// create Settings table
|
||||
// @Settings
|
||||
App::$db->q("CREATE TABLE IF NOT EXISTS settings (
|
||||
id INTEGER PRIMARY KEY,
|
||||
game_name TEXT DEFAULT 'Dragon Knight',
|
||||
|
@ -46,14 +47,14 @@ class InstallModule
|
|||
show_babble INT DEFAULT 1
|
||||
);");
|
||||
|
||||
$results .= 'Settings table created. ('. stopwatch($istart) .'s)<br />';
|
||||
$results .= sprintf($resFmt, 'Settings table created', stopwatch($istart));
|
||||
|
||||
// insert default settings
|
||||
App::$db->q("INSERT INTO settings DEFAULT VALUES;");
|
||||
|
||||
$results .= 'Default settings inserted. ('. stopwatch($istart) .'s)<br />';
|
||||
$results .= sprintf($resFmt, 'Default settings inserted', stopwatch($istart));
|
||||
|
||||
// create Classes table
|
||||
// @Classes
|
||||
App::$db->q("CREATE TABLE IF NOT EXISTS classes (
|
||||
id INTEGER PRIMARY KEY,
|
||||
name TEXT DEFAULT '',
|
||||
|
@ -72,7 +73,7 @@ class InstallModule
|
|||
spells TEXT DEFAULT '',
|
||||
);");
|
||||
|
||||
$results .= 'Classes table created. ('. stopwatch($istart) .'s)<br />';
|
||||
$results .= sprintf($resFmt, 'Classes table created', stopwatch($istart));
|
||||
|
||||
if ($complete) {
|
||||
// add default classes if complete install
|
||||
|
@ -85,8 +86,16 @@ class InstallModule
|
|||
App::$db->q("INSERT INTO classes (name) VALUES ('Adventurer');");
|
||||
}
|
||||
|
||||
$results .= 'Default classes inserted. ('. stopwatch($istart) .'s)<br />';
|
||||
$results .= sprintf($resFmt, 'Default classes inserted', stopwatch($istart));
|
||||
|
||||
echo $results;
|
||||
// @Babble
|
||||
App::$db->q("CREATE TABLE IF NOT EXISTS babble (
|
||||
id INTEGER PRIMARY KEY,
|
||||
author INTEGER NOT NULL,
|
||||
babble TEXT NOT NULL,
|
||||
posted DATETIME DEFAULT CURRENT_TIMESTAMP
|
||||
);");
|
||||
|
||||
$results .= sprintf($resFmt, 'Babble table created', stopwatch($istart));
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user