[slbackup-commit] CVS update: slbackup-php/src index.php
finnarne-guest at alioth.debian.org
finnarne-guest at alioth.debian.org
Fri Apr 20 06:24:49 UTC 2007
User: finnarne-guest
Date: 07/04/20 06:24:49
Modified: src index.php
Log:
Now it's possible to browse through deleted folders, and at list show, but not recover, deleted files
Revision Changes Path
1.32 +56 -8 slbackup-php/src/index.php
Index: index.php
===================================================================
RCS file: /cvsroot/slbackup/slbackup-php/src/index.php,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- index.php 18 Apr 2007 12:00:29 -0000 1.31
+++ index.php 20 Apr 2007 06:24:48 -0000 1.32
@@ -159,9 +159,6 @@
'sub' => trim ($parent)) ;
}
- $cmd = sprintf ("ssh %s %s@%s 'find %s%s/%s -maxdepth 1 -mindepth 1 -type d'",
- $ssh_options, $backupuser,
- $backuphost, $clientdir, $location, $sub ) ;
$desc[0] = array ("pipe", "r") ;
$desc[1] = array ("pipe", "w") ;
@@ -169,6 +166,9 @@
$env = array ('SSH_ASKPASS' => $ssh_askpass,
'DISPLAY' => ':nowhere') ;
+ $cmd = sprintf ("ssh %s %s@%s 'find %s%s/%s -maxdepth 1 -mindepth 1 -type d'",
+ $ssh_options, $backupuser,
+ $backuphost, $clientdir, $location, $sub ) ;
$proc = proc_open ($cmd, $desc, $pipes, '/tmp', $env) ;
if (is_resource ($proc)) {
fprintf ($pipes[0], "%s\n", $passwd) ;
@@ -182,6 +182,29 @@
fclose ($pipes[1]) ;
proc_close ($proc) ;
}
+ $cmd = sprintf ("ssh %s %s@%s 'find %s/rdiff-backup-data/increments%s/%s -maxdepth 1 -mindepth 1 -type d'",
+ $ssh_options, $backupuser,
+ $backuphost, $clientdir, $location, $sub ) ;
+ $proc = proc_open ($cmd, $desc, $pipes, '/tmp', $env) ;
+ if (is_resource ($proc)) {
+ fprintf ($pipes[0], "%s\n", $passwd) ;
+ fclose ($pipes[0]) ;
+ while ($line = fgets ($pipes[1], 1024)) {
+ $found=false ;
+ foreach ($loc as $key => $value)
+ if ($value["type"] == "dir" and
+ $value["name"] == basename(trim ($line)))
+ $found = true ;
+
+ if (!$found)
+ $loc[] = array ('type' => 'deldir',
+ 'name' => basename (trim($line)),
+ 'sub' => substr (trim ($line), strlen ($clientdir) + strlen ($location) + 30)) ;
+
+ }
+ fclose ($pipes[1]) ;
+ proc_close ($proc) ;
+ }
$cmd = sprintf ("ssh %s %s@%s 'find %s%s/%s -maxdepth 1 -mindepth 1 -type f'",
$ssh_options, $backupuser,
$backuphost, $clientdir, $location, $sub ) ;
@@ -190,11 +213,36 @@
if (is_resource ($proc)) {
fprintf ($pipes[0], "%s\n", $passwd) ;
fclose ($pipes[0]) ;
- while ($line = fgets ($pipes[1], 1024))
+ while ($line = fgets ($pipes[1], 1024)) {
+ $base = basename (trim($line)) ;
$loc[] = array ('type' => 'file',
- 'name' => basename (trim($line)),
- 'sub' => substr (trim ($line), strlen ($clientdir) + strlen ($location) + 1)) ;
-
+ 'name' => $base,
+ 'sub' => sprintf ("%s/%s", $sub, $base)) ;
+ }
+ fclose ($pipes[1]) ;
+ proc_close ($proc) ;
+ }
+ $cmd = sprintf ("ssh %s %s@%s 'find %s/rdiff-backup-data/increments%s/%s -maxdepth 1 -mindepth 1 -type f -name \"*.snapshot.gz\"'",
+ $ssh_options, $backupuser,
+ $backuphost, $clientdir, $location, $sub ) ;
+ $proc = proc_open ($cmd, $desc, $pipes, '/tmp', $env) ;
+ if (is_resource ($proc)) {
+ fprintf ($pipes[0], "%s\n", $passwd) ;
+ fclose ($pipes[0]) ;
+ while ($line = fgets ($pipes[1], 1024)) {
+ $found=false ;
+ $base = basename (trim($line)) ;
+ $base = substr($base, 0, strlen($base) - 38) ;
+ foreach ($loc as $key => $value)
+ if ($value["type"] == "file" and
+ $value["name"] == $base)
+ $found = true ;
+
+ if (!$found)
+ $loc[] = array ('type' => 'delfile',
+ 'name' => $base,
+ 'sub' => sprintf ("%s/%s", $sub, $base)) ;
+ }
fclose ($pipes[1]) ;
proc_close ($proc) ;
}
@@ -637,7 +685,7 @@
$loc = listloc ($passwd,
sprintf ("%s/%s", $config["server_destdir"], $client),
$newconf["location"]) ;
- else
+ else
$loc = listloc ($passwd,
sprintf ("%s/%s", $config["server_destdir"], $client),
$newconf["location"], $newconf["sub"]) ;
More information about the slbackup-commit
mailing list