Fix for installer failing with new DSN define.

This commit is contained in:
green-ponies (jgen) 2012-01-31 00:35:20 -05:00
parent 55447d1aa8
commit 5a63ad05b5

View File

@ -119,6 +119,7 @@ if(is_readable("config.php")) {
exit; exit;
} }
require_once "core/compat.inc.php"; require_once "core/compat.inc.php";
require_once "core/util.inc.php";
require_once "core/database.class.php"; require_once "core/database.class.php";
do_install(); do_install();
@ -160,6 +161,7 @@ function do_install() { // {{{
if(isset($_POST['database_type']) && isset($_POST['database_host']) && isset($_POST['database_user']) && isset($_POST['database_name'])) { if(isset($_POST['database_type']) && isset($_POST['database_host']) && isset($_POST['database_user']) && isset($_POST['database_name'])) {
global $database_dsn; global $database_dsn;
$database_dsn = "{$_POST['database_type']}:user={$_POST['database_user']};password={$_POST['database_password']};host={$_POST['database_host']};dbname={$_POST['database_name']}"; $database_dsn = "{$_POST['database_type']}:user={$_POST['database_user']};password={$_POST['database_password']};host={$_POST['database_host']};dbname={$_POST['database_name']}";
define('DATABASE_DSN', $database_dsn);
install_process(); install_process();
} }
else if(file_exists("auto_install.conf")) { else if(file_exists("auto_install.conf")) {
@ -362,9 +364,10 @@ function build_dirs() { // {{{
} // }}} } // }}}
function write_config() { // {{{ function write_config() { // {{{
global $database_dsn; global $database_dsn;
$file_content = "<"+"?php\n"+
"define('DATABASE_DSN', '$database_dsn');\n"+ $file_content = '<' . '?php' . "\n" .
"?"+">"; "define('DATABASE_DSN', '$database_dsn');\n" .
'?' . '>';
if(is_writable("./") && file_put_contents("config.php", $file_content)) { if(is_writable("./") && file_put_contents("config.php", $file_content)) {
assert(file_exists("config.php")); assert(file_exists("config.php"));