Skip to content

Commit

Permalink
[UPC#320] remove domain from listing if gone
Browse files Browse the repository at this point in the history
  • Loading branch information
frankiejol committed Nov 20, 2017
1 parent f1e6c0e commit 91a32f9
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/Ravada/Front.pm
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,10 @@ sub list_domains {
while ( my $row = $sth->fetchrow_hashref) {
my $domain ;
eval { $domain = $self->search_domain($row->{name}) };
next if $row->{is_volatile} && !$domain;
if ( $row->{is_volatile} && !$domain ) {
$self->_remove_domain_db($row->{id});
next;
}
$row->{has_clones} = 0 if !exists $row->{has_clones};
$row->{is_locked} = 0 if !exists $row->{is_locked};
if ( $domain ) {
Expand All @@ -224,6 +227,12 @@ sub list_domains {
return \@domains;
}

sub _remove_domain_db($self, $id) {
my $sth = $CONNECTOR->dbh->prepare("DELETE FROM domains WHERE id=?");
$sth->execute($id);
$sth->finish;
}

=head2 domain_info
Returns information of a domain
Expand Down

0 comments on commit 91a32f9

Please sign in to comment.