From 7116e42a03729993e828ea3fc96e8db0c4e9a7f9 Mon Sep 17 00:00:00 2001 From: betateilchen Date: Mon, 21 Apr 2014 15:09:27 +0000 Subject: [PATCH] configdb - fixed: minor typos in output git-svn-id: https://svn.fhem.de/fhem/trunk@5594 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/98_configdb.pm | 2 +- fhem/configDB.pm | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/fhem/FHEM/98_configdb.pm b/fhem/FHEM/98_configdb.pm index a083028a5..87ff51fe3 100644 --- a/fhem/FHEM/98_configdb.pm +++ b/fhem/FHEM/98_configdb.pm @@ -151,7 +151,7 @@ sub CommandConfigdb($$) { my $val = $attr{configdb}{$c}; $val =~ s/;/;;/g; $val =~ s/\n/\\\n/g; - $ret .= "attr configdb $c $val"; + $ret .= "attr configdb $c $val\n"; } } elsif($param2 eq "") { # delete attribute diff --git a/fhem/configDB.pm b/fhem/configDB.pm index ad5505ac6..78efdd362 100644 --- a/fhem/configDB.pm +++ b/fhem/configDB.pm @@ -534,7 +534,8 @@ sub _cfgDB_Info { # count files stored in database $row = $fhem_dbh->selectall_arrayref("SELECT filename from fhemfilesave group by filename"); $count = @$row; - $f = ($count>1) ? "s" : ""; + $count = ($count)?$count:'No'; + $f = ("$count" ne '1') ? "s" : ""; $row = " fhemfilesave: $count file$f stored in database"; push @r, $row; push @r, $l; @@ -687,8 +688,9 @@ sub _cfgDB_Fileexport($) { } # import file from filesystem into database -sub _cfgDB_Fileimport($) { - my ($filename) = @_; +sub _cfgDB_Fileimport($;$) { + my ($filename,$doDelete) = @_; + $doDelete = (defined($doDelete)) ? 1 : 0; my $counter = 0; my $fhem_dbh = _cfgDB_Connect; $fhem_dbh->do("delete from fhemfilesave where filename = '$filename'"); @@ -703,6 +705,7 @@ sub _cfgDB_Fileimport($) { $sth->finish(); $fhem_dbh->commit(); $fhem_dbh->disconnect(); + unlink($filename) if($attr{configdb}{deleteimported} || $doDelete ); return "$counter lines written from file $filename to database"; }