aboutsummaryrefslogtreecommitdiff
path: root/app/install.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2016-10-24 23:32:58 +0200
committerGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2016-10-24 23:32:58 +0200
commit811145863237cfdd0d2d453a27143625ba5b617c (patch)
tree98a0c7e3bd5e048c894e0343448285d3672f0444 /app/install.php
parentc8e5292ab7a4670ff67e587f18d7973eee2f00e6 (diff)
Fix bugs in install
Diffstat (limited to 'app/install.php')
-rw-r--r--app/install.php15
1 files changed, 8 insertions, 7 deletions
diff --git a/app/install.php b/app/install.php
index 0daa02b1b..dbc2a8908 100644
--- a/app/install.php
+++ b/app/install.php
@@ -220,6 +220,7 @@ function saveStep3() {
file_put_contents(join_path(DATA_PATH, 'config.php'), "<?php\n return " . var_export($config_array, true) . ";\n");
$config_array['db']['default_user'] = $config_array['default_user'];
+ $config_array['db']['prefix_user'] = $_SESSION['bd_prefix_user'];
$ok = checkDb($config_array['db']) && checkDbUser($config_array['db']);
if (!$ok) {
@unlink(join_path(DATA_PATH, 'config.php'));
@@ -229,7 +230,7 @@ function saveStep3() {
$_SESSION['bd_error'] = '';
header('Location: index.php?step=4');
} else {
- $_SESSION['bd_error'] = empty(config_array['db']['bd_error']) ? 'Unknown error!' : config_array['db']['bd_error'];
+ $_SESSION['bd_error'] = empty($config_array['db']['bd_error']) ? 'Unknown error!' : $config_array['db']['bd_error'];
}
}
invalidateHttpCache();
@@ -337,13 +338,13 @@ function checkStep3() {
function checkDbUser(&$dbOptions) {
$ok = false;
- $str = $dbOptions['bd_dsn'];
- $driver_options = $dbOptions['bd_options'];
+ $str = $dbOptions['dsn'];
+ $driver_options = $dbOptions['options'];
try {
$c = new PDO($str, $dbOptions['bd_user'], $dbOptions['bd_password'], $driver_options);
if (defined('SQL_CREATE_TABLES')) {
- $sql = sprintf(SQL_CREATE_TABLES, $dbOptions['bd_prefix_user'], _t('gen.short.default_category'));
+ $sql = sprintf(SQL_CREATE_TABLES, $dbOptions['prefix_user'], _t('gen.short.default_category'));
$stm = $c->prepare($sql);
$ok = $stm->execute();
} else {
@@ -351,7 +352,7 @@ function checkDbUser(&$dbOptions) {
if (is_array($SQL_CREATE_TABLES)) {
$ok = true;
foreach ($SQL_CREATE_TABLES as $instruction) {
- $sql = sprintf($instruction, $dbOptions['bd_prefix_user'], _t('gen.short.default_category'));
+ $sql = sprintf($instruction, $dbOptions['prefix_user'], _t('gen.short.default_category'));
$stm = $c->prepare($sql);
$ok &= $stm->execute();
}
@@ -359,14 +360,14 @@ function checkDbUser(&$dbOptions) {
}
if (defined('SQL_INSERT_FEEDS')) {
- $sql = sprintf(SQL_INSERT_FEEDS, $dbOptions['bd_prefix_user']);
+ $sql = sprintf(SQL_INSERT_FEEDS, $dbOptions['prefix_user']);
$stm = $c->prepare($sql);
$ok &= $stm->execute();
} else {
global $SQL_INSERT_FEEDS;
if (is_array($SQL_INSERT_FEEDS)) {
foreach ($SQL_INSERT_FEEDS as $instruction) {
- $sql = sprintf($instruction, $dbOptions['bd_prefix_user']);
+ $sql = sprintf($instruction, $dbOptions['prefix_user']);
$stm = $c->prepare($sql);
$ok &= $stm->execute();
}