]> git.sur5r.net Git - bacula/bacula/commitdiff
baculum: Fix sqlite db support
authorMarcin Haba <marcin.haba@bacula.pl>
Sat, 5 Aug 2017 18:04:35 +0000 (20:04 +0200)
committerMarcin Haba <marcin.haba@bacula.pl>
Sun, 6 Aug 2017 08:40:33 +0000 (10:40 +0200)
gui/baculum/protected/API/Class/APIDbModule.php

index 9440c6b08d046f23b139db871b202f8f8e3e1602..2d71139b1d2867c2472e354994aa40d58fc23404 100644 (file)
@@ -87,7 +87,12 @@ class APIDbModule extends TActiveRecord {
                $db_connection = null;
                if ((array_key_exists('enabled', $db_params) && $db_params['enabled'] === '1') || $force === true) {
                        $dsn = self::getDsn($db_params);
-                       $db_connection = new TDbConnection($dsn, $db_params['login'], $db_params['password']);
+                       $db_connection = null;
+                       if (array_key_exists('login', $db_params) && array_key_exists('password', $db_params)) {
+                               $db_connection = new TDbConnection($dsn, $db_params['login'], $db_params['password']);
+                       } else {
+                               $db_connection = new TDbConnection($dsn);
+                       }
                        $db_connection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
                        $db_connection->setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER);
                } else {