mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-06-25 12:21:26 +02:00
improve db_backup/restore
This commit is contained in:
parent
ba7bfb3628
commit
577ce3e8df
@ -337,7 +337,7 @@ class db_backup
|
|||||||
* @param resource $f file opened with fopen for reading
|
* @param resource $f file opened with fopen for reading
|
||||||
* @param boolean $convert_to_system_charset=false convert the restored data to the selected system-charset
|
* @param boolean $convert_to_system_charset=false convert the restored data to the selected system-charset
|
||||||
*/
|
*/
|
||||||
function restore($f,$convert_to_system_charset=false,$filename)
|
function restore($f,$convert_to_system_charset=false,$filename='')
|
||||||
{
|
{
|
||||||
@set_time_limit(0);
|
@set_time_limit(0);
|
||||||
ini_set('auto_detect_line_endings',true);
|
ini_set('auto_detect_line_endings',true);
|
||||||
@ -632,7 +632,7 @@ class db_backup
|
|||||||
rmdir($dir.'/database_backup');
|
rmdir($dir.'/database_backup');
|
||||||
}
|
}
|
||||||
|
|
||||||
$file_list = $this->get_file_list($dir);
|
$file_list = array();
|
||||||
$name = $this->backup_dir.'/db_backup-'.date('YmdHi');
|
$name = $this->backup_dir.'/db_backup-'.date('YmdHi');
|
||||||
$filename = $name.'.zip';
|
$filename = $name.'.zip';
|
||||||
$zippresent = false;
|
$zippresent = false;
|
||||||
@ -649,6 +649,7 @@ class db_backup
|
|||||||
//echo ' -> !$res<br>'; // !
|
//echo ' -> !$res<br>'; // !
|
||||||
return "Cant open '$filename'<br>";
|
return "Cant open '$filename'<br>";
|
||||||
}
|
}
|
||||||
|
$file_list = $this->get_file_list($dir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fwrite($f,"eGroupWare backup from ".date('Y-m-d H:i:s')."\n\n");
|
fwrite($f,"eGroupWare backup from ".date('Y-m-d H:i:s')."\n\n");
|
||||||
@ -691,14 +692,14 @@ class db_backup
|
|||||||
fwrite($f,implode(',',$row)."\n");
|
fwrite($f,implode(',',$row)."\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// save files
|
if(!$zippresent) // save without files
|
||||||
if(!$zippresent) // save without files (why ever it works only right without '!'...)
|
|
||||||
{
|
{
|
||||||
if ($this->backup_files) echo '<center>'."No file backup, needs ZipArchive or disabled<br>".'</center>';
|
if ($this->backup_files) echo '<center>'."No file backup, needs ZipArchive or disabled<br>".'</center>';
|
||||||
fclose($f);
|
fclose($f);
|
||||||
if (file_exists($name)) unlink($name);
|
if (file_exists($name)) unlink($name);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
// save files ....
|
||||||
//echo $name.'<br>';
|
//echo $name.'<br>';
|
||||||
$zip->addFile($name, 'database_backup/'.basename($name));
|
$zip->addFile($name, 'database_backup/'.basename($name));
|
||||||
$count = 1;
|
$count = 1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user