Browse Source

3.1.RC1
Fixed dns building for non-absolute paths

Sergio Brighenti 5 years ago
parent
commit
1c674e5e67
1 changed files with 7 additions and 2 deletions
  1. 7 2
      app/helpers.php

+ 7 - 2
app/helpers.php

@@ -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;