소스 검색

3.1.RC1
Fixed dns building for non-absolute paths

Sergio Brighenti 5 년 전
부모
커밋
1c674e5e67
1개의 변경된 파일7개의 추가작업 그리고 2개의 파일을 삭제
  1. 7 2
      app/helpers.php

+ 7 - 2
app/helpers.php

@@ -469,8 +469,13 @@ if (!function_exists('dsnFromConfig')) {
     function dsnFromConfig(array $config): string
     function dsnFromConfig(array $config): string
     {
     {
         $dsn = $config['db']['dsn'];
         $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;
         return $config['db']['connection'].':'.$dsn;