mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-01 20:20:10 +00:00
configDB.pm: corrections for statefile handling with postgresql
git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@25847 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
ad842fb5fc
commit
67ce378a7a
19
configDB.pm
19
configDB.pm
@ -930,6 +930,7 @@ sub _cfgDB_Info {
|
|||||||
push @r, " dbsize: $size";
|
push @r, " dbsize: $size";
|
||||||
}
|
}
|
||||||
push @r, $l;
|
push @r, $l;
|
||||||
|
push @r, " loaded: ".$configDB{loaded};
|
||||||
my $fhem_dbh = _cfgDB_Connect;
|
my $fhem_dbh = _cfgDB_Connect;
|
||||||
my ($sql, $sth, @line, $row);
|
my ($sql, $sth, @line, $row);
|
||||||
|
|
||||||
@ -1285,22 +1286,26 @@ sub _cfgDB_deleteRF {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub _cfgDB_deleteStatefiles {
|
sub _cfgDB_deleteStatefiles {
|
||||||
|
|
||||||
if ($configDB{type} eq "POSTGRESQL") {
|
|
||||||
Log 1, "configDB: deletion of statefiles currently not supported for postgresql!";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
my $filename;
|
my $filename;
|
||||||
my $fhem_dbh = _cfgDB_Connect;
|
my $fhem_dbh = _cfgDB_Connect;
|
||||||
my $sth = $fhem_dbh->prepare( "SELECT filename FROM fhemb64filesave where filename like '%.fhem.save'" );
|
my $sth = $fhem_dbh->prepare( "SELECT filename FROM fhemb64filesave where filename like '%.fhem.save'" );
|
||||||
$sth->execute();
|
$sth->execute();
|
||||||
while ($filename = $sth->fetchrow_array()) {
|
while ($filename = $sth->fetchrow_array()) {
|
||||||
|
Log 5, "configDB: statefile filename >$filename<";
|
||||||
|
if (length($filename) > 42) { # malformed filename from postgresql
|
||||||
|
Log 5, "configDB: statefile del1 >$filename<";
|
||||||
|
$fhem_dbh->do("delete from fhemb64filesave where filename = '$filename'");
|
||||||
|
next;
|
||||||
|
}
|
||||||
my $uuid = "";
|
my $uuid = "";
|
||||||
$uuid = substr($filename,0,32);
|
$uuid = substr($filename,0,32);
|
||||||
|
Log 5, "configDB: statefile uuid: >$uuid<";
|
||||||
my $found = $fhem_dbh->selectrow_array("SELECT versionuuid FROM fhemversions WHERE versionuuid = '$uuid'");
|
my $found = $fhem_dbh->selectrow_array("SELECT versionuuid FROM fhemversions WHERE versionuuid = '$uuid'");
|
||||||
$found //= -1; # to prevent perl warning
|
$found //= 'notfound'; # to prevent perl warning
|
||||||
|
$found = substr($found,0,32);
|
||||||
|
Log 5, "configDB: statefile found: >$found<";
|
||||||
unless ($uuid eq $found) {
|
unless ($uuid eq $found) {
|
||||||
|
Log 5, "configDB: statefile del2 >$filename<";
|
||||||
$fhem_dbh->do("delete from fhemb64filesave where filename = '$filename'");
|
$fhem_dbh->do("delete from fhemb64filesave where filename = '$filename'");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user