simplified install logic
This commit is contained in:
parent
cd6015203e
commit
e9cabb30b3
35
install.php
35
install.php
@ -224,19 +224,7 @@ function install_process($database_dsn) { // {{{
|
|||||||
header("Location: index.php");
|
header("Location: index.php");
|
||||||
} // }}}
|
} // }}}
|
||||||
function create_tables($dsn) { // {{{
|
function create_tables($dsn) { // {{{
|
||||||
if(substr($dsn, 0, 5) == "mysql") {
|
$engine = select_db_engine($dsn);
|
||||||
$engine = new MySQL();
|
|
||||||
}
|
|
||||||
else if(substr($dsn, 0, 5) == "pgsql") {
|
|
||||||
$engine = new PostgreSQL();
|
|
||||||
}
|
|
||||||
else if(substr($dsn, 0, 6) == "sqlite") {
|
|
||||||
$engine = new SQLite();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
die("Unknown database engine; Shimmie currently officially supports MySQL
|
|
||||||
(mysql://), with hacks for Postgres (pgsql://) and SQLite (sqlite://)");
|
|
||||||
}
|
|
||||||
|
|
||||||
$db = NewADOConnection($dsn);
|
$db = NewADOConnection($dsn);
|
||||||
if(!$db) {
|
if(!$db) {
|
||||||
@ -304,19 +292,7 @@ function insert_defaults($dsn) { // {{{
|
|||||||
die("Couldn't connect to \"$dsn\"");
|
die("Couldn't connect to \"$dsn\"");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(substr($dsn, 0, 5) == "mysql") {
|
$engine = select_db_engine($dsn);
|
||||||
$engine = new MySQL();
|
|
||||||
}
|
|
||||||
else if(substr($dsn, 0, 5) == "pgsql") {
|
|
||||||
$engine = new PostgreSQL();
|
|
||||||
}
|
|
||||||
else if(substr($dsn, 0, 6) == "sqlite") {
|
|
||||||
$engine = new SQLite();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
die("Unknown database engine; Shimmie currently officially supports MySQL
|
|
||||||
(mysql://), with hacks for Postgres (pgsql://) and SQLite (sqlite://)");
|
|
||||||
}
|
|
||||||
$engine->init($db);
|
$engine->init($db);
|
||||||
|
|
||||||
$config_insert = $db->Prepare("INSERT INTO config(name, value) VALUES(?, ?)");
|
$config_insert = $db->Prepare("INSERT INTO config(name, value) VALUES(?, ?)");
|
||||||
@ -332,6 +308,13 @@ function insert_defaults($dsn) { // {{{
|
|||||||
$db->Close();
|
$db->Close();
|
||||||
}
|
}
|
||||||
} // }}}
|
} // }}}
|
||||||
|
function select_db_engine($dsn) { // {{{
|
||||||
|
if(substr($dsn, 0, 5) == "mysql") return new MySQL();
|
||||||
|
if(substr($dsn, 0, 5) == "pgsql") return new PostgreSQL();
|
||||||
|
if(substr($dsn, 0, 6) == "sqlite") return new SQLite();
|
||||||
|
die("Unknown database engine; Shimmie currently officially supports MySQL
|
||||||
|
(mysql://), with hacks for Postgres (pgsql://) and SQLite (sqlite://)");
|
||||||
|
} // }}}
|
||||||
function build_dirs() { // {{{
|
function build_dirs() { // {{{
|
||||||
// *try* and make default dirs. Ignore any errors --
|
// *try* and make default dirs. Ignore any errors --
|
||||||
// if something is amiss, we'll tell the user later
|
// if something is amiss, we'll tell the user later
|
||||||
|
Loading…
x
Reference in New Issue
Block a user