[eluser]Miroslav Vitanov[/eluser]
Hello all,
I've just completed a backup module for my site. Under Windows (win7) there are no problems, but when I uploaded it to my server (linux) I encountered the following problem: when I'm zipping only the SQL file everything is OK and I can open the file, but when I use
Code:
$this->zip->read_dir('uploads/');
the file opens but there is nothing in it.
Here is my function for creating the backup:
Code:
function doBackup($backup_dir = 'backups')
{
if($this->session->userdata('is_logged') == TRUE && $this->users_model->hasAccess('backup'))
{
// Зареждане на библиотеката за създаване на архиви
$this->load->library('zip');
// Зареждане на класа за архивиране на БД
$this->load->dbutil();
// Опции за архива с базата данни
$config = array(
'format' => 'zip',
'filename' => 'sql_backup.sql'
);
// Създаване на бекъпа
$backup =& $this->dbutil->backup($config);
// Задаване на бекъпа към архива
$this->zip->add_data($backup);
// Задаване на папки за архивиране, в случая папката uploads
$this->zip->read_dir('uploads/');
// Създаване на архива и връщане на стойност TRUE/FALSE за потребителя
return $this->zip->archive($backup_dir.'/fullbackup_'.date('d-m-Y').'.zip');
}
return FALSE;
}
Thank you for your help in advance!