Fixed dns building for non-absolute paths
This commit is contained in:
Sergio Brighenti 2020-04-06 12:54:34 +02:00
parent 63c332a697
commit 1c674e5e67

View file

@ -469,8 +469,13 @@ if (!function_exists('dsnFromConfig')) {
function dsnFromConfig(array $config): string
{
$dsn = $config['db']['dsn'];
if ($config['db']['connection'] === 'sqlite' && file_exists($config['db']['dsn'])) {
$dsn = realpath($config['db']['dsn']);
if ($config['db']['connection'] === 'sqlite') {
if (getcwd() !== BASE_DIR) { // if in installer, change the working dir to the app dir
chdir(BASE_DIR);
}
if (file_exists($config['db']['dsn'])) {
$dsn = realpath($config['db']['dsn']);
}
}
return $config['db']['connection'].':'.$dsn;