2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-13 11:16:36 +00:00

configDB - added number of stored files into configdb info

git-svn-id: https://svn.fhem.de/fhem/trunk@5593 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
betateilchen 2014-04-21 12:24:31 +00:00
parent 8e88412f73
commit 5b1d73687d

View File

@ -63,6 +63,8 @@
# to show files in "Edit files" and use them # to show files in "Edit files" and use them
# with CommandReload() mechanism # with CommandReload() mechanism
# #
# modified _cfgDB_Info to show number of files in db
#
############################################################################## ##############################################################################
# #
@ -478,7 +480,7 @@ sub _cfgDB_Migrate {
# show database statistics # show database statistics
sub _cfgDB_Info { sub _cfgDB_Info {
my ($l, @r); my ($l, @r, @row_ary, $f);
for my $i (1..65){ $l .= '-';} for my $i (1..65){ $l .= '-';}
# $l .= "\n"; # $l .= "\n";
push @r, $l; push @r, $l;
@ -518,16 +520,25 @@ sub _cfgDB_Info {
# read state table statistics # read state table statistics
$count = $fhem_dbh->selectrow_array('SELECT count(*) FROM fhemstate'); $count = $fhem_dbh->selectrow_array('SELECT count(*) FROM fhemstate');
$f = ($count>1) ? "s" : "";
# read state table creation time # read state table creation time
$sth = $fhem_dbh->prepare( "SELECT * FROM fhemstate WHERE STATESTRING like '#%'" ); $sth = $fhem_dbh->prepare( "SELECT * FROM fhemstate WHERE STATESTRING like '#%'" );
$sth->execute(); $sth->execute();
while ($row = $sth->fetchrow_array()) { while ($row = $sth->fetchrow_array()) {
(undef,$row) = split(/#/,$row); (undef,$row) = split(/#/,$row);
$row = " fhemstate: $count entries saved: $row"; $row = " fhemstate: $count entrie$f saved: $row";
push @r, $row; push @r, $row;
} }
push @r, $l; push @r, $l;
# count files stored in database
$row = $fhem_dbh->selectall_arrayref("SELECT filename from fhemfilesave group by filename");
$count = @$row;
$f = ($count>1) ? "s" : "";
$row = " fhemfilesave: $count file$f stored in database";
push @r, $row;
push @r, $l;
$fhem_dbh->disconnect(); $fhem_dbh->disconnect();
return join("\n", @r); return join("\n", @r);