Large domain backups to browser

Discussion in 'Developers' Forum' started by pat, Jun 11, 2009.

  1. pat

    pat New Member

    Here are a couple of suggestions to changes to the backup routine. The first one is a pure cosmetical change and makes sure the hostname is part of the resulting filename. The second one is a little more interesting and makes sure we are not limited by available RAM when choosing output to browser rather than via FTP.

    Cheers,
    Pat


    Code:
    --- backup.php.orig     2009-05-20 19:33:53.000000000 +0200
    +++ backup.php  2009-05-20 19:33:45.000000000 +0200
    @@ -58,7 +58,7 @@
     if(strlen($ftp_user) < 1 and $transfer == 'ftp') $go_api->errorMessage($go_api->lng("Sie haben keinen FTP Benutzernamen angegeben."));
    
     // Erstelle Namen für Backup Datei
    -$backup_file_name = "backup_".date("Y_m_d",time()).".zip";
    +$backup_file_name = exec("hostname") . "-backup_".date("Y_m_d",time()).".zip";
    
     // bestimme Web-Pfad
     $server = $go_api->db->queryOneRecord("SELECT * from isp_server");
    @@ -154,7 +154,7 @@
                     header("Content-Length: ".filesize($tgz_name));
    
             // gebe Daten aus
    -        echo file_get_contents($tgz_name);
    +        readfile($tgz_name);
    
             // lösche temp Verzeichnis
             if($tmp_dir != "" and stristr($tmp_dir,"/home/admispconfig/ispconfig/temp") and !stristr($tmp_dir,"../")) exec("rm -rf $tmp_dir");
    
    
     
  2. hairydog2

    hairydog2 New Member

    Which backup.php is this?There seem to be three files of that name.
     
  3. falko

    falko Super Moderator Howtoforge Staff Moderator HowtoForge Supporter ISPConfig Developer

    I've just implemented this. :)
     

Share This Page