2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-22 02:10:32 +00:00

configDB.pm: add attribute shortinfo for use with configdb info

git-svn-id: https://svn.fhem.de/fhem/trunk@26291 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
betateilchen 2022-08-06 12:44:38 +00:00
parent eeb25045b5
commit 04b67d0444

View File

@ -482,6 +482,7 @@ sub cfgDB_SaveCfg { ## prototype used in fhem.pl
$internal = defined($internal) ? $internal : 0;
my $c = "configdb";
my @dontSave = qw(configdb:rescue configdb:nostate configdb:loadversion
configdb:shortinfo
global:configfile global:statefile global:version);
my (%devByNr, @rowList, %comments, $t, $out);
@ -946,6 +947,9 @@ sub _cfgDB_Info {
my ($sql, $sth, @line, $row);
# read versions table statistics
$configDB{attr}{shortinfo} //= 0;
if ($configDB{attr}{shortinfo} == 0) {
my $maxVersions = $configDB{attr}{maxversions};
$maxVersions = ($maxVersions) ? $maxVersions : 0;
push @r, " max Versions: $maxVersions" if($maxVersions);
@ -955,7 +959,7 @@ sub _cfgDB_Info {
push @r, " config: $count entries";
push @r, "";
# read versions creation time
# read versions creation time
$sql = "SELECT * FROM fhemconfig as c join fhemversions as v on v.versionuuid=c.versionuuid ".
"WHERE COMMAND like '#created%' ORDER by v.VERSION";
$sth = $fhem_dbh->prepare( $sql );
@ -969,21 +973,15 @@ sub _cfgDB_Info {
$row .= " tag: ".$line[8] if $line[8];
push @r, $row;
}
} else {
my $count;
$count = $fhem_dbh->selectrow_array('SELECT count(*) FROM fhemversions');
push @r, " versions: $count";
$count = $fhem_dbh->selectrow_array('SELECT count(*) FROM fhemconfig');
push @r, " config: $count entries";
}
push @r, $l;
## read state table statistics
# $count = $fhem_dbh->selectrow_array('SELECT count(*) FROM fhemstate');
# $f = ($count>1) ? "s" : "";
## read state table creation time
# $sth = $fhem_dbh->prepare( "SELECT * FROM fhemstate WHERE STATESTRING like '#%'" );
# $sth->execute();
# while ($row = $sth->fetchrow_array()) {
# (undef,$row) = split(/#/,$row);
# $row = " state: $count entrie$f saved: $row";
# push @r, $row;
# }
# push @r, $l;
$row = $fhem_dbh->selectall_arrayref("SELECT filename from fhemb64filesave group by filename");
$count = @$row;
$count = ($count)?$count:'No';
@ -1268,16 +1266,18 @@ sub _cfgDB_knownAttr {
"(0|1) delete file from filesystem after import";
$configDB{knownAttr}{dumpPath} =
"(valid path) define path for database dump";
# $configDB{knownAttr}{loadversion}=
# "for internal use only";
$configDB{knownAttr}{maxversions}=
"(number) define maximum number of configurations stored in database";
$configDB{knownAttr}{mysqldump}=
"(valid parameter string) define additional parameters used for dump in mysql environment";
# $configDB{knownAttr}{nostate}=
# "for internal use only";
$configDB{knownAttr}{private}=
"(0|1) show or supress userdata in info output";
$configDB{knownAttr}{shortinfo}=
"(0|1) show detailed or short result in info output";
# $configDB{knownAttr}{loadversion}=
# "for internal use only";
# $configDB{knownAttr}{nostate}=
# "for internal use only";
# $configDB{knownAttr}{rescue}=
# "for internal use only";
}