]> git.sur5r.net Git - bacula/bacula/commitdiff
ebl clean internal brestore table in batch mode
authorEric Bollengier <eric@eb.homelinux.org>
Fri, 13 Jul 2007 14:07:00 +0000 (14:07 +0000)
committerEric Bollengier <eric@eb.homelinux.org>
Fri, 13 Jul 2007 14:07:00 +0000 (14:07 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@5171 91ce42f0-d328-0410-95d8-f526ca767f89

gui/brestore/ReleaseNotes
gui/brestore/brestore.pl

index 8a1b5b09431f602df07bc6d288fd8e98e0cdd22a..3cffa8e235e84b56f5a4e9da641d79d20be491dc 100644 (file)
@@ -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
index 2aa6c08e7c9c4b73755c58c4343f6a09b8524bf9..31359ab54206c26370b8ed54a09bbec9f131cd68 100755 (executable)
@@ -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