mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-04 22:19:38 +00:00
configDB - code improvement
git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@5672 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
ca9ebcd3b8
commit
7e9e9eb23a
20
configDB.pm
20
configDB.pm
@ -69,6 +69,7 @@
|
||||
# 2014-04-23 - added command fileshow, filemove
|
||||
#
|
||||
# 2014-04-26 - added migration to generic file handling
|
||||
# fixed problem on migration of multiline DEFs
|
||||
#
|
||||
##############################################################################
|
||||
#
|
||||
@ -192,16 +193,18 @@ sub cfgDB_AttrRead($) {
|
||||
$sth->execute();
|
||||
while (@line = $sth->fetchrow_array()) {
|
||||
$row = "$line[1],$line[2],$line[3]";
|
||||
if($line[1] eq 'configdb') {
|
||||
$attr{configdb}{$line[2]} = $line[3];
|
||||
} else {
|
||||
push @rets, $row;
|
||||
}
|
||||
}
|
||||
$fhem_dbh->disconnect();
|
||||
return @rets;
|
||||
}
|
||||
|
||||
### work in process ###################
|
||||
# create generice read and write function
|
||||
# for filehandling to be used from fhem.pl
|
||||
# and other fhem modules
|
||||
# functions for filehandling to be called
|
||||
# from fhem.pl and other fhem modules
|
||||
|
||||
sub cfgDB_FileRead($) {
|
||||
my ($filename) = @_;
|
||||
@ -244,11 +247,9 @@ sub cfgDB_FileUpdate($) {
|
||||
return "";
|
||||
}
|
||||
|
||||
#
|
||||
#######################################
|
||||
|
||||
# read and execute all commands from
|
||||
# fhemconfig and fhemstate
|
||||
|
||||
sub cfgDB_ReadAll($){
|
||||
my ($cl) = @_;
|
||||
my $ret;
|
||||
@ -264,6 +265,7 @@ sub cfgDB_ReadAll($){
|
||||
|
||||
# rotate all older versions to versionnumber+1
|
||||
# save running configuration to version 0
|
||||
|
||||
sub cfgDB_SaveCfg {
|
||||
my (%devByNr, @rowList);
|
||||
|
||||
@ -291,6 +293,7 @@ sub cfgDB_SaveCfg {
|
||||
my $def = $defs{$d}{DEF};
|
||||
if(defined($def)) {
|
||||
$def =~ s/;/;;/g;
|
||||
$def =~ s/\n/\n /g;
|
||||
} else {
|
||||
$dev = "";
|
||||
}
|
||||
@ -383,6 +386,7 @@ sub cfgDB_svnId {
|
||||
return "# ".'$Id$'
|
||||
}
|
||||
|
||||
# return filelist depending on directory and regexp
|
||||
sub cfgDB_FW_fileList(@$) {
|
||||
my ($dir,$re,@ret) = @_;
|
||||
my @files = split(/\n/, _cfgDB_Filelist('notitle'));
|
||||
@ -411,7 +415,7 @@ sub cfgDB_Read99() {
|
||||
return $ret;
|
||||
}
|
||||
|
||||
# find SVN Id
|
||||
# return SVN Id from file stored in database
|
||||
sub cfgDB_Fileversion($$) {
|
||||
my ($file,$ret) = @_;
|
||||
my $fhem_dbh = _cfgDB_Connect;
|
||||
|
Loading…
x
Reference in New Issue
Block a user