forked from extern/egroupware
* Setup: skip files backup on update even if configured
It might takes the server down for hours and updates usually dont affect the files
This commit is contained in:
parent
5ca7452613
commit
691fb06de5
@ -858,9 +858,10 @@ class Backup
|
|||||||
* @param resource $f file opened with fopen for writing
|
* @param resource $f file opened with fopen for writing
|
||||||
* @param boolean $lock_table =null true: allways, false: never, null: if no primary key
|
* @param boolean $lock_table =null true: allways, false: never, null: if no primary key
|
||||||
* default of null limits memory usage if there is no primary key, by locking table and use ROW_CHUCK
|
* default of null limits memory usage if there is no primary key, by locking table and use ROW_CHUCK
|
||||||
|
* @param bool $skip_files_backup =false true: do not backup files, even if config / $this->backup_files is set (used by upgrade)
|
||||||
* @todo use https://github.com/maennchen/ZipStream-PHP to not assemble all files in memmory
|
* @todo use https://github.com/maennchen/ZipStream-PHP to not assemble all files in memmory
|
||||||
*/
|
*/
|
||||||
function backup($f, $lock_table=null)
|
function backup($f, $lock_table=null, bool $skip_files_backup=false)
|
||||||
{
|
{
|
||||||
//echo "function backup($f)<br>"; // !
|
//echo "function backup($f)<br>"; // !
|
||||||
@set_time_limit(0);
|
@set_time_limit(0);
|
||||||
@ -876,7 +877,7 @@ class Backup
|
|||||||
$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;
|
||||||
if(class_exists('ZipArchive') && $this->backup_files)
|
if(class_exists('ZipArchive') && $this->backup_files && !$skip_files_backup)
|
||||||
{
|
{
|
||||||
$zip = new ZipArchive;
|
$zip = new ZipArchive;
|
||||||
if(is_object($zip))
|
if(is_object($zip))
|
||||||
@ -952,7 +953,7 @@ class Backup
|
|||||||
|
|
||||||
if(!$zippresent) // save without files
|
if(!$zippresent) // save without files
|
||||||
{
|
{
|
||||||
if ($this->backup_files)
|
if ($this->backup_files && !$skip_files_backup)
|
||||||
{
|
{
|
||||||
echo '<center>'.lang("Cant open %1, needs ZipArchive", $name)."<br>\n".'</center>';
|
echo '<center>'.lang("Cant open %1, needs ZipArchive", $name)."<br>\n".'</center>';
|
||||||
}
|
}
|
||||||
|
@ -257,7 +257,7 @@ function do_backup($arg,$quite_check=false)
|
|||||||
if (is_resource($f = $db_backup->fopen_backup($backup)))
|
if (is_resource($f = $db_backup->fopen_backup($backup)))
|
||||||
{
|
{
|
||||||
echo lang('Backup started, this might take a few minutes ...')."\n";
|
echo lang('Backup started, this might take a few minutes ...')."\n";
|
||||||
$db_backup->backup($f);
|
$db_backup->backup($f, null, true); // true: skip (configured) files backup
|
||||||
echo lang('Backup finished')."\n";
|
echo lang('Backup finished')."\n";
|
||||||
}
|
}
|
||||||
else // backup failed ==> dont start the upgrade
|
else // backup failed ==> dont start the upgrade
|
||||||
|
Loading…
Reference in New Issue
Block a user