2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-03 23:06:37 +00:00

98_configdb.pm: add fileexport all

git-svn-id: https://svn.fhem.de/fhem/trunk@13380 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
betateilchen 2017-02-10 20:03:09 +00:00
parent 9f92772f80
commit 7614143c17

View File

@ -134,6 +134,7 @@ sub CommandConfigdb($$) {
when ('fileexport') { when ('fileexport') {
return "\n Syntax: configdb fileexport <pathToFile>" if @a != 2; return "\n Syntax: configdb fileexport <pathToFile>" if @a != 2;
if ($param1 ne 'all') {
my $filename; my $filename;
if($param1 =~ m,^[./],) { if($param1 =~ m,^[./],) {
$filename = $param1; $filename = $param1;
@ -142,6 +143,19 @@ sub CommandConfigdb($$) {
$filename .= "/$param1"; $filename .= "/$param1";
} }
$ret = _cfgDB_Fileexport $filename; $ret = _cfgDB_Fileexport $filename;
} else { # start export all
my $flist = _cfgDB_Filelist(1);
my @filelist = split(/\n/,$flist);
undef $flist;
foreach my $f (@filelist) {
Log3 (4,undef,"configDB: exporting $f");
my ($path,$file) = $f =~ m|^(.*[/\\])([^/\\]+?)$|;
$path = "/tmp/$path";
eval qx(mkdir -p $path) unless (-e "$path");
$ret .= _cfgDB_Fileexport $f;
$ret .= "\n";
}
} # end export all
} }
when ('fileimport') { when ('fileimport') {
@ -498,7 +512,7 @@ compare device: telnetPort in current version 0 (left) to version: 1 (right)
<br/> <br/>
<br/> <br/>
<li><code>configdb fileexport &lt;targetFilename&gt;</code></li><br/> <li><code>configdb fileexport &lt;targetFilename&gt;|all</code></li><br/>
Exports specified fhem file from database into filesystem.<br/> Exports specified fhem file from database into filesystem.<br/>
Example:<br/> Example:<br/>
<br/> <br/>