From d094772f587b54f61e9f01386a932c73654a4c2e Mon Sep 17 00:00:00 2001 From: Eric Bollengier Date: Fri, 13 Jul 2007 14:07:00 +0000 Subject: [PATCH] ebl clean internal brestore table in batch mode git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@5171 91ce42f0-d328-0410-95d8-f526ca767f89 --- gui/brestore/ReleaseNotes | 5 ++++- gui/brestore/brestore.pl | 21 +++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/gui/brestore/ReleaseNotes b/gui/brestore/ReleaseNotes index 8a1b5b0943..3cffa8e235 100644 --- a/gui/brestore/ReleaseNotes +++ b/gui/brestore/ReleaseNotes @@ -1,4 +1,7 @@ - Release Notes for brestore 2.0.3 + Release Notes for brestore 2.2.0 + +Version 2.2.0: + - -b now clean brestore internal tables Version 2.0.3-4: - -b console mode can now create brestore table diff --git a/gui/brestore/brestore.pl b/gui/brestore/brestore.pl index 2aa6c08e7c..31359ab542 100755 --- a/gui/brestore/brestore.pl +++ b/gui/brestore/brestore.pl @@ -2388,12 +2388,33 @@ sub update_cache { my ($self) = @_; + $self->{conf}->{dbh}->begin_work(); + my $query = " SELECT JobId from Job WHERE JobId NOT IN (SELECT JobId FROM brestore_knownjobid) ORDER BY JobId"; my $jobs = $self->dbh_selectall_arrayref($query); $self->update_brestore_table(map { $_->[0] } @$jobs); + + print STDERR "Cleaning path visibility\n"; + + my $nb = $self->dbh_do(" + DELETE FROM brestore_pathvisibility + WHERE NOT EXISTS + (SELECT 1 FROM Job WHERE JobId=brestore_pathvisibility.JobId)"); + + print STDERR "$nb rows affected\n"; + print STDERR "Cleaning known jobid\n"; + + $nb = $self->dbh_do(" + DELETE FROM brestore_knownjobid + WHERE NOT EXISTS + (SELECT 1 FROM Job WHERE JobId=brestore_knownjobid.JobId)"); + + print STDERR "$nb rows affected\n"; + + $self->{conf}->{dbh}->commit(); } sub get_root -- 2.39.5