aboutsummaryrefslogtreecommitdiff
path: root/app/install.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2016-08-23 00:02:54 +0200
committerGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2016-08-23 00:02:54 +0200
commitc25fdbcc0990b637e305665a456e52e1aa3dec0a (patch)
treec5c7582833eaf82d6afc608312c3420a83914e8f /app/install.php
parent2af3abc89e56af75c38caf5e8071b3cd09bedba8 (diff)
More PostgreSQL
Diffstat (limited to 'app/install.php')
-rw-r--r--app/install.php26
1 files changed, 5 insertions, 21 deletions
diff --git a/app/install.php b/app/install.php
index 6e902485c..db16ca6b1 100644
--- a/app/install.php
+++ b/app/install.php
@@ -200,6 +200,9 @@ function saveStep3() {
$_SESSION['bd_prefix'] = substr($_POST['prefix'], 0, 16);
$_SESSION['bd_prefix_user'] = $_SESSION['bd_prefix'] . (empty($_SESSION['default_user']) ? '' : ($_SESSION['default_user'] . '_'));
}
+ if ($_SESSION['bd_type'] === 'pgsql') {
+ $_SESSION['bd_base'] = strtolower($_SESSION['bd_base']);
+ }
// We use dirname to remove the /i part
$base_url = dirname(Minz_Request::guessBaseUrl());
@@ -236,26 +239,6 @@ function saveStep3() {
invalidateHttpCache();
}
-function newPdo() {
- switch ($_SESSION['bd_type']) {
- case 'mysql':
- $str = 'mysql:host=' . $_SESSION['bd_host'] . ';dbname=' . $_SESSION['bd_base'];
- $driver_options = array(
- PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8mb4',
- );
- break;
- case 'sqlite':
- $str = 'sqlite:' . join_path(USERS_PATH, $_SESSION['default_user'], 'db.sqlite');
- $driver_options = array(
- PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
- );
- break;
- default:
- return false;
- }
- return new PDO($str, $_SESSION['bd_user'], $_SESSION['bd_password'], $driver_options);
-}
-
function deleteInstall() {
$res = unlink(join_path(DATA_PATH, 'do-install.txt'));
@@ -444,11 +427,12 @@ function checkBD() {
);
try { // on ouvre une connexion juste pour créer la base si elle n'existe pas
- $str = 'pgsql:host=' . $_SESSION['bd_host'] . ';';
+ $str = 'pgsql:host=' . $_SESSION['bd_host'] . ';dbname=postgres';
$c = new PDO($str, $_SESSION['bd_user'], $_SESSION['bd_password'], $driver_options);
$sql = sprintf(SQL_CREATE_DB, $_SESSION['bd_base']);
$res = $c->query($sql);
} catch (PDOException $e) {
+ syslog(LOG_DEBUG, 'pgsql ' . $e->getMessage());
}
// on écrase la précédente connexion en sélectionnant la nouvelle BDD