I have been looking into the user guide which came with CodeIgniter. I became very interested with the dbutil() method. Particularly the following line of code:
I am extremely new to CodeIgniter but I succeeded to do this backup. Try this, it will work successfully and is very easy to implement. Write the code in your controller and call the function from your view page which use for backup. Get set, go and you are done.
function dbbackup()
{
$this->load->dbutil();
$backup =& $this->dbutil->backup();
$this->load->helper('file');
write_file('/downloads', $backup);
$this->load->helper('download');
force_download('mybackup.gz', $backup);
}
For your full application backup, do the same procedure with the following code:
function backup()
{
$this->load->helper('download');
$this->load->library('zip');
$time = time();
$this->zip->read_dir('D:xampp/htdocs/wms/');
$this->zip->download('my_backup.'.$time.'.zip');
}
Here you can use any path of your choice.