]> git.sur5r.net Git - bacula/bacula/commitdiff
bacula-web: Fixed bug in DSN construction for SQLite database support
authorDavide Franco <bacula-dev@dflc.ch>
Fri, 15 Jul 2011 13:29:53 +0000 (15:29 +0200)
committerKern Sibbald <kern@sibbald.com>
Sat, 20 Apr 2013 12:49:24 +0000 (14:49 +0200)
gui/bacula-web/config/config.php.sample
gui/bacula-web/includes/cfg/config.class.php

index ddddd521b33aac309216f76dad1f6b0c9c0c6a7d..8c0d7754bc6a62be9fb1c552b992c2e1934bcdb1 100644 (file)
@@ -35,7 +35,7 @@
  
  // SQLite bacula catalog
  $config[0]['label'] = 'Dev backup server';
- $config[0]['db_path'] = '/path/to/database/db.sdb';
+ $config[0]['db_name'] = '/path/to/database/db.sdb';
 
  If you want to configure more than one catalog in Bacula-Web, just copy the first parameters and increment by one the index
 
index 070fd2cdb998cea7ceb3757220c4860c21f79802..76f3e976c4e6b9498f959a9c1746043c6b18d35d 100644 (file)
                $dsn['phptype']  = $this->catalogs[$catalog_id]["db_type"];
                return $dsn;
        }
+       
+       public function getDSN( $catalog_id ) 
+       {
+               $dsn = '';
+               
+               switch( $this->catalogs[$catalog_id]['db_type'] )
+               {
+                       case 'mysql':
+                       case 'pgsql':
+                               $dsn  = $this->catalogs[$catalog_id]['db_type'] . ':';
+                               $dsn .= 'dbname=' . $this->catalogs[$catalog_id]['db_name'] . ';';
+                               $dsn .= 'host=' . $this->catalogs[$catalog_id]['host'];
+                       break;
+                       case 'sqlite':
+                               $dsn  = $this->catalogs[$catalog_id]['db_type'] . ':' . $this->catalogs[$catalog_id]['db_name'];
+                       break;
+               }
+               
+               return $dsn;            
+       }
                
        function __destruct()
        {