diff --git a/html/svc/backup.php b/html/svc/backup.php
index 94c4bbd..53b503f 100755
--- a/html/svc/backup.php
+++ b/html/svc/backup.php
@@ -169,6 +169,15 @@
$fn_e = getFilename_out( $buid, $bu_test, true );
exec("echo 'ID: $buid' > $g_data_dir/$fn_e");
+ $dest_file = "$bu_dest/$fn_o";
+ $dest_file_zip = "$bu_dest/$fn_o.gz";
+ $dest_file_old_zip = "$dest_file.old.gz";
+ if( file_exists($dest_file_old_zip) ) unlink($dest_file_old_zip);
+ if( file_exists($dest_file_zip) ){
+ //save a copy of the zip file
+ rename( $dest_file_zip, $dest_file_old_zip );
+ }
+
// set the bash command
if($bu_res_usr!=''){
$command = "mysqldump -u$bu_res_usr -p$bu_res_pwd $bu_src 2>> $g_data_dir/$fn_e 1>> $bu_dest/$fn_o";
@@ -192,14 +201,20 @@
if($pos===FALSE){
$pos = strpos($str_errs, 'failed' );
}
- if($pos===FALSE){
- unlink("$g_data_dir/$fn_e");
+ if($pos!==FALSE){
+ //place the error in the database
+ rpc( 'f:set_bu_error', $buid, $str_errs );
return;
}
-
- //place it in the database
- rpc( 'f:set_bu_error', $buid, $str_errs );
-
+
+ unlink("$g_data_dir/$fn_e");
+
+ //zip the file
+ $zipCmd = "gzip $dest_file";
+ if( exec( $zipCmd, $output, $result_code )===FALSE){
+ return "gzip of $dest_file failed";
+ }
+
}
diff --git a/html/svc/db-writes.php b/html/svc/db-writes.php
index b045d0d..595b715 100755
--- a/html/svc/db-writes.php
+++ b/html/svc/db-writes.php
@@ -34,7 +34,7 @@
if( $postVars['new_bu_is_dbType'] ){
// Database backup
if($bu_id==0){
- $db_st = $db->prepare('INSERT INTO BULIST ( BUName, Dir_Src, Dir_Dest, BuType ) values( :bun, :bus, :bud, 1, :buusr, :bupwd )');
+ $db_st = $db->prepare('INSERT INTO BULIST ( BUName, Dir_Src, Dir_Dest, BuType, Res_User, Res_Pwd ) values( :bun, :bus, :bud, 1, :buusr, :bupwd )');
}else{
$db_st = $db->prepare('update BULIST set BUName=:bun, Dir_Src=:bus, Dir_Dest=:bud, Res_User=:buusr, Res_Pwd=:bupwd where BUID=:buid');
}