mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-04 22:19:38 +00:00
configDB: add support for FUUID
git-svn-id: https://svn.fhem.de/fhem/trunk@18302 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
4380191603
commit
8753163f0e
@ -142,6 +142,8 @@
|
|||||||
#
|
#
|
||||||
# 2018-09-08 - change remove base64 migration functions
|
# 2018-09-08 - change remove base64 migration functions
|
||||||
#
|
#
|
||||||
|
# 2019-01-17 - added support for device specific uuid (setuuid)
|
||||||
|
#
|
||||||
##############################################################################
|
##############################################################################
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
@ -202,19 +204,27 @@ sub _cfgDB_dump($);
|
|||||||
# Read configuration file for DB connection
|
# Read configuration file for DB connection
|
||||||
#
|
#
|
||||||
|
|
||||||
if(!open(CONFIG, 'configDB.conf')) {
|
|
||||||
Log3('configDB', 1, 'Cannot open database configuration file configDB.conf');
|
my ($err,@c) = FileRead({FileName => 'configDB.conf',
|
||||||
return 0;
|
ForceType => "file"});
|
||||||
}
|
return 0 if ($err);
|
||||||
|
|
||||||
my @config;
|
my @config;
|
||||||
while (<CONFIG>){
|
|
||||||
my $line = $_;
|
foreach my $line (@c) {
|
||||||
$line =~ s/^\s+|\s+$//g; # remove whitespaces etc.
|
$line =~ s/^\s+|\s+$//g; # remove whitespaces etc.
|
||||||
$line =~ s/;$/;;/; # duplicate ; at end-of-line
|
$line =~ s/;$/;;/; # duplicate ; at end-of-line
|
||||||
push (@config,$line) if($line !~ m/^#/ && length($line) > 0);
|
push (@config,$line) if($line !~ m/^#/ && length($line) > 0);
|
||||||
}
|
}
|
||||||
close CONFIG;
|
|
||||||
|
|
||||||
|
#while (<CONFIG>){
|
||||||
|
# my $line = $_;
|
||||||
|
# $line =~ s/^\s+|\s+$//g; # remove whitespaces etc.
|
||||||
|
# $line =~ s/;$/;;/; # duplicate ; at end-of-line
|
||||||
|
# push (@config,$line) if($line !~ m/^#/ && length($line) > 0);
|
||||||
|
#}
|
||||||
|
#close CONFIG;
|
||||||
|
|
||||||
use vars qw(%configDB);
|
use vars qw(%configDB);
|
||||||
|
|
||||||
@ -461,6 +471,7 @@ sub cfgDB_SaveCfg(;$) {
|
|||||||
$def = "";
|
$def = "";
|
||||||
}
|
}
|
||||||
push @rowList, "define $d $defs{$d}{TYPE} $def";
|
push @rowList, "define $d $defs{$d}{TYPE} $def";
|
||||||
|
push @rowList, "setuuid $d $defs{$d}{FUUID}" if (defined($defs{$d}{FUUID}) && $defs{$d}{FUUID});
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach my $a (sort {
|
foreach my $a (sort {
|
||||||
@ -1029,7 +1040,8 @@ sub _cfgDB_Search($$;$) {
|
|||||||
push @result, "--------------------------------------------------------------------------------";
|
push @result, "--------------------------------------------------------------------------------";
|
||||||
while (@line = $sth->fetchrow_array()) {
|
while (@line = $sth->fetchrow_array()) {
|
||||||
$row = "$line[0] $line[1] $line[2] $line[3]";
|
$row = "$line[0] $line[1] $line[2] $line[3]";
|
||||||
push @result, "$row";
|
Log 5,"configDB: $row";
|
||||||
|
push @result, "$row" unless ($line[0] eq 'setuuid');
|
||||||
}
|
}
|
||||||
$fhem_dbh->disconnect();
|
$fhem_dbh->disconnect();
|
||||||
$ret = join("\n", @result);
|
$ret = join("\n", @result);
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user