mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-21 20:06:18 +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:
parent
eeb25045b5
commit
04b67d0444
@ -481,7 +481,8 @@ sub cfgDB_SaveCfg { ## prototype used in fhem.pl
|
|||||||
my ($internal) = shift;
|
my ($internal) = shift;
|
||||||
$internal = defined($internal) ? $internal : 0;
|
$internal = defined($internal) ? $internal : 0;
|
||||||
my $c = "configdb";
|
my $c = "configdb";
|
||||||
my @dontSave = qw(configdb:rescue configdb:nostate configdb:loadversion
|
my @dontSave = qw(configdb:rescue configdb:nostate configdb:loadversion
|
||||||
|
configdb:shortinfo
|
||||||
global:configfile global:statefile global:version);
|
global:configfile global:statefile global:version);
|
||||||
my (%devByNr, @rowList, %comments, $t, $out);
|
my (%devByNr, @rowList, %comments, $t, $out);
|
||||||
|
|
||||||
@ -946,44 +947,41 @@ sub _cfgDB_Info {
|
|||||||
my ($sql, $sth, @line, $row);
|
my ($sql, $sth, @line, $row);
|
||||||
|
|
||||||
# read versions table statistics
|
# read versions table statistics
|
||||||
my $maxVersions = $configDB{attr}{maxversions};
|
|
||||||
$maxVersions = ($maxVersions) ? $maxVersions : 0;
|
|
||||||
push @r, " max Versions: $maxVersions" if($maxVersions);
|
|
||||||
push @r, " lastReorg: ".$configDB{attr}{'lastReorg'};
|
|
||||||
my $count;
|
|
||||||
$count = $fhem_dbh->selectrow_array('SELECT count(*) FROM fhemconfig');
|
|
||||||
push @r, " config: $count entries";
|
|
||||||
push @r, "";
|
|
||||||
|
|
||||||
# read versions creation time
|
$configDB{attr}{shortinfo} //= 0;
|
||||||
$sql = "SELECT * FROM fhemconfig as c join fhemversions as v on v.versionuuid=c.versionuuid ".
|
if ($configDB{attr}{shortinfo} == 0) {
|
||||||
"WHERE COMMAND like '#created%' ORDER by v.VERSION";
|
my $maxVersions = $configDB{attr}{maxversions};
|
||||||
$sth = $fhem_dbh->prepare( $sql );
|
$maxVersions = ($maxVersions) ? $maxVersions : 0;
|
||||||
$sth->execute();
|
push @r, " max Versions: $maxVersions" if($maxVersions);
|
||||||
while (@line = $sth->fetchrow_array()) {
|
push @r, " lastReorg: ".$configDB{attr}{'lastReorg'};
|
||||||
$line[3] = "" unless defined $line[3];
|
my $count;
|
||||||
$row = " Ver $line[6] saved: $line[1] $line[2] $line[3] def: ".
|
$count = $fhem_dbh->selectrow_array('SELECT count(*) FROM fhemconfig');
|
||||||
$fhem_dbh->selectrow_array("SELECT COUNT(*) from fhemconfig where COMMAND = 'define' and VERSIONUUID = '$line[5]'");
|
push @r, " config: $count entries";
|
||||||
$row .= " attr: ".
|
push @r, "";
|
||||||
$fhem_dbh->selectrow_array("SELECT COUNT(*) from fhemconfig where COMMAND = 'attr' and VERSIONUUID = '$line[5]'");
|
|
||||||
$row .= " tag: ".$line[8] if $line[8];
|
# read versions creation time
|
||||||
push @r, $row;
|
$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 );
|
||||||
|
$sth->execute();
|
||||||
|
while (@line = $sth->fetchrow_array()) {
|
||||||
|
$line[3] = "" unless defined $line[3];
|
||||||
|
$row = " Ver $line[6] saved: $line[1] $line[2] $line[3] def: ".
|
||||||
|
$fhem_dbh->selectrow_array("SELECT COUNT(*) from fhemconfig where COMMAND = 'define' and VERSIONUUID = '$line[5]'");
|
||||||
|
$row .= " attr: ".
|
||||||
|
$fhem_dbh->selectrow_array("SELECT COUNT(*) from fhemconfig where COMMAND = 'attr' and VERSIONUUID = '$line[5]'");
|
||||||
|
$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;
|
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");
|
$row = $fhem_dbh->selectall_arrayref("SELECT filename from fhemb64filesave group by filename");
|
||||||
$count = @$row;
|
$count = @$row;
|
||||||
$count = ($count)?$count:'No';
|
$count = ($count)?$count:'No';
|
||||||
@ -1268,16 +1266,18 @@ sub _cfgDB_knownAttr {
|
|||||||
"(0|1) delete file from filesystem after import";
|
"(0|1) delete file from filesystem after import";
|
||||||
$configDB{knownAttr}{dumpPath} =
|
$configDB{knownAttr}{dumpPath} =
|
||||||
"(valid path) define path for database dump";
|
"(valid path) define path for database dump";
|
||||||
# $configDB{knownAttr}{loadversion}=
|
|
||||||
# "for internal use only";
|
|
||||||
$configDB{knownAttr}{maxversions}=
|
$configDB{knownAttr}{maxversions}=
|
||||||
"(number) define maximum number of configurations stored in database";
|
"(number) define maximum number of configurations stored in database";
|
||||||
$configDB{knownAttr}{mysqldump}=
|
$configDB{knownAttr}{mysqldump}=
|
||||||
"(valid parameter string) define additional parameters used for dump in mysql environment";
|
"(valid parameter string) define additional parameters used for dump in mysql environment";
|
||||||
# $configDB{knownAttr}{nostate}=
|
|
||||||
# "for internal use only";
|
|
||||||
$configDB{knownAttr}{private}=
|
$configDB{knownAttr}{private}=
|
||||||
"(0|1) show or supress userdata in info output";
|
"(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}=
|
# $configDB{knownAttr}{rescue}=
|
||||||
# "for internal use only";
|
# "for internal use only";
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user