mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-04 22:19:38 +00:00
98_configdb.pm: code cleanup; commandref updated
git-svn-id: https://svn.fhem.de/fhem/trunk@16477 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
595d837fc5
commit
5111eb646b
@ -62,62 +62,6 @@ sub CommandConfigdb($$) {
|
|||||||
return _cfgDB_dump($param1);
|
return _cfgDB_dump($param1);
|
||||||
}
|
}
|
||||||
|
|
||||||
# my ($dbconn,$dbuser,$dbpass,$dbtype) = _cfgDB_readConfig();
|
|
||||||
# my ($dbname,$dbhostname,$dbport,$gzip,$mp,$ret,$size,$source,$target,$ts);
|
|
||||||
# $ts = strftime('%Y-%m-%d_%H-%M-%S',localtime);
|
|
||||||
# $mp = $configDB{attr}{'dumpPath'};
|
|
||||||
# $mp //= AttrVal('global','modpath','.').'/log';
|
|
||||||
# $target = "$mp/configDB_$ts.dump";
|
|
||||||
#
|
|
||||||
# if (lc($param1) eq 'unzipped') {
|
|
||||||
# $gzip = '';
|
|
||||||
# } else {
|
|
||||||
# $gzip = '| gzip -c';
|
|
||||||
# $target .= '.gz';
|
|
||||||
# }
|
|
||||||
#
|
|
||||||
# if ($dbtype eq 'SQLITE') {
|
|
||||||
# (undef,$source) = split (/=/, $dbconn);
|
|
||||||
# my $dumpcmd = "echo '.dump fhem%' | sqlite3 $source $gzip > $target";
|
|
||||||
# Log 4,"configDB: $dumpcmd";
|
|
||||||
# $ret = qx($dumpcmd);
|
|
||||||
# return $ret if $ret; # return error message if available
|
|
||||||
#
|
|
||||||
# } elsif ($dbtype eq 'MYSQL') {
|
|
||||||
# ($dbname,$dbhostname,$dbport) = split (/;/,$dbconn);
|
|
||||||
# $dbport //= '=3306';
|
|
||||||
# (undef,$dbname) = split (/=/,$dbname);
|
|
||||||
# (undef,$dbhostname) = split (/=/,$dbhostname);
|
|
||||||
# (undef,$dbport) = split (/=/,$dbport);
|
|
||||||
# my $dbtables = "fhemversions fhemconfig fhemstate fhemb64filesave";
|
|
||||||
# my $dumpcmd = "mysqldump --user=$dbuser --password=$dbpass --host=$dbhostname --port=$dbport -Q $dbname $dbtables $gzip > $target";
|
|
||||||
# Log 4,"configDB: $dumpcmd";
|
|
||||||
# $ret = qx($dumpcmd);
|
|
||||||
# return $ret if $ret;
|
|
||||||
# $source = $dbname;
|
|
||||||
#
|
|
||||||
# } elsif ($dbtype eq 'POSTGRESQL') {
|
|
||||||
# ($dbname,$dbhostname,$dbport) = split (/;/,$dbconn);
|
|
||||||
# $dbport //= '=5432';
|
|
||||||
# (undef,$dbname) = split (/=/,$dbname);
|
|
||||||
# (undef,$dbhostname) = split (/=/,$dbhostname);
|
|
||||||
# (undef,$dbport) = split (/=/,$dbport);
|
|
||||||
# my $dbtables = "-t fhemversions -t fhemconfig -t fhemstate -t fhemb64filesave";
|
|
||||||
# my $dumpcmd = "PGPASSWORD=$dbpass pg_dump -U $dbuser -h $dbhostname -p $dbport $dbname $dbtables $gzip > $target";
|
|
||||||
# Log 4,"configDB: $dumpcmd";
|
|
||||||
# $ret = qx($dumpcmd);
|
|
||||||
# return $ret if $ret;
|
|
||||||
# $source = $dbname;
|
|
||||||
#
|
|
||||||
# } else {
|
|
||||||
# return "configdb dump not supported for $dbtype!";
|
|
||||||
# }
|
|
||||||
#
|
|
||||||
# $size = -s $target;
|
|
||||||
# $size //= 0;
|
|
||||||
# $ret = "configDB dumped $size bytes\nfrom: $source\n to: $target";
|
|
||||||
# return $ret;
|
|
||||||
# }
|
|
||||||
|
|
||||||
when ('diff') {
|
when ('diff') {
|
||||||
return "\n Syntax: configdb diff <device> <version>" if @a != 3;
|
return "\n Syntax: configdb diff <device> <version>" if @a != 3;
|
||||||
@ -486,8 +430,7 @@ sub _cfgDB_readConfig() {
|
|||||||
<ul><b>deleteimported</b> if set to 1 files will always be deleted from filesystem after import to database.<br/></ul><br/>
|
<ul><b>deleteimported</b> if set to 1 files will always be deleted from filesystem after import to database.<br/></ul><br/>
|
||||||
<ul><b>maxversions</b> set the maximum number of configurations stored in database. <br/>
|
<ul><b>maxversions</b> set the maximum number of configurations stored in database. <br/>
|
||||||
The oldest version will be dropped in a "save config" if it would exceed this number.</ul><br/>
|
The oldest version will be dropped in a "save config" if it would exceed this number.</ul><br/>
|
||||||
<ul><b>private</b> if set to 1 the user and password info will not be shown in 'configdb info' output.</ul><br/>
|
<ul><b>private</b> if set to 0 the database user and password info will be shown in 'configdb info' output.</ul><br/>
|
||||||
<ul><b>useCache</b> (experimental!) if set to 1 fileread from database will be cached.</ul><br/>
|
|
||||||
<br/>
|
<br/>
|
||||||
|
|
||||||
<li><code>configdb diff <device> <version></code></li><br/>
|
<li><code>configdb diff <device> <version></code></li><br/>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user