Welcome Guest, Not a member yet? Register   Sign In
Export backup database in gzip file format
#1

[eluser]Vadorequest[/eluser]
Hi,

I'm reading http://ellislab.com/codeigniter/user-gui...tml#backup for backup my database.

Now, I have this script:

Code:
$this->load->dbutil();
        $this->load->helper('file');
        
        $repertoire_sauvegardes = 'saves_database/' ;
        
        $prefs = array(
                'tables'      => array(),  // Array of tables to backup.
                'ignore'      => array('vado_log'),           // List of tables to omit from the backup
                'format'      => 'txt',             // gzip, zip, txt
                'filename'    => $this->db->database.'_backup_'.date('Y-m-d_H-i-s').'.sql',    // File name - NEEDED ONLY WITH ZIP FILES
                'add_drop'    => TRUE,              // Whether to add DROP TABLE statements to backup file
                'add_insert'  => TRUE,              // Whether to add INSERT data to backup file
                'newline'     => "\n"               // Newline character used in backup file
              );

        $content = $this->dbutil->backup($prefs);
        
        if( is_dir ($repertoire_sauvegardes) === FALSE ) {

            if(mkdir ($repertoire_sauvegardes, 0700) === FALSE ) {
                exit('Impossible de créer le répertoire pour la sauvegarde de la mysql');
            }
        }
        
        file_put_contents($repertoire_sauvegardes.$prefs['filename'], $content);

But I want use gzip file format, not txt format for the write are more speedly.

How I can do this ?

Thanks for your help.


Messages In This Thread
Export backup database in gzip file format - by El Forum - 01-02-2013, 07:04 AM
Export backup database in gzip file format - by El Forum - 01-02-2013, 08:31 AM
Export backup database in gzip file format - by El Forum - 01-02-2013, 11:38 AM
Export backup database in gzip file format - by El Forum - 01-02-2013, 12:47 PM
Export backup database in gzip file format - by El Forum - 01-02-2013, 01:17 PM



Theme © iAndrew 2016 - Forum software by © MyBB